單機Linux平臺Oracle 11g DataGuard Physical Standby 搭建例項(4)

cow977發表於2011-12-04

單機Linux平臺Oracle 11g DataGuard Physical Standby 搭建例項(1)http://space.itpub.net/81227/viewspace-713012

單機Linux平臺Oracle 11g DataGuard Physical Standby 搭建例項(2)http://space.itpub.net/81227/viewspace-713013

單機Linux平臺Oracle 11g DataGuard Physical Standby 搭建例項(3)http://space.itpub.net/81227/viewspace-713014

 

 

. 啟用real-time apply,試驗real-time query

1. 建立standby logfile。否則在執行“ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;”時,會報“ORA-38500: USING CURRENT LOGFILE option not available without stand”錯誤。

SQL> alter database add standby logfile group 11 '…/redo11.log' size 50M;

Database altered.

SQL> alter database add standby logfile group 12 '…/redo12.log' size 50M;

Database altered.

duplicate結束後,備庫沒有新增standby redo log file。但是主庫採用的是:lgwr async傳送的日誌。當備庫的RFS程式接收到日誌後,發現備庫沒有standby redo log的時候,備庫會自動用ARCH將其寫入歸檔檔案。

在主庫也新增一下standby redo log,以備切換。

2. 啟用real-time apply,從而實現real-time query

SQL> alter database recover managed standby database cancel;

SQL> ALTER DATABASE OPEN;

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

3. 測試real-time apply real-time query

Primary

SQL> create table rt(id number,name varchar2(20));

SQL> insert into rt values(1,'tianlesoftware');

SQL> commit;

SQL> alter system switch logfile;

 

Standby

SQL> select open_mode from v$database;

OPEN_MODE

--------------------

READ ONLY WITH APPLY

SQL> desc rt

 Name                Null?    Type

 ------------------- -------- ----------------------------

 ID                           NUMBER

 NAME                         VARCHAR2(30)

 

SQL> select * from rt;

        ID NAME

---------- ------------------------------

         1 tianlesoftware

 

注意:如果在主庫執行 alter database clear unarchived logfilealter database open resetlogs ,dataguard要重建。

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/81227/viewspace-713017/,如需轉載,請註明出處,否則將追究法律責任。

相關文章