在DataGuard環境中使用Broker-模式切換

來源:互聯網
上載者:User

一、環境介紹
 
Data Guard環境:
 
Primary資料庫:Oracle10.2.0.5.0
作業系統:RedHat 4.4
主機名稱:source
IP地址:192.168.10.101
資料庫SID:source
DB_UNIQUE_NAME:source_pr
 
Standby資料庫:oracle10.2.0.5.0
作業系統:redhat 4.4
主機名稱:target
IP地址:192.168.10.102
資料庫SID:source
DB_UNIQUE_NAME:source_st
 
 
二、dataguard啟停
 
 
注意Data Guard啟動順序:
 
啟動順序:先standby ,後primary;
關閉順序:先primary後standby;
 
在備庫將執行個體啟動到mount狀態:
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database recover managed standby database disconnect from session;
如果要取消恢複:alter database recover managed standby database cancel;
 
在備庫啟動監聽:
$lsnrctl start
 
在主庫啟動執行個體:
SQL> startup;
 
在主庫啟動監聽:
$lsnrctl start
 
在主庫驗證歸檔目錄是否有效:
 
SQL> select dest_name,status,error from v$archive_dest;
 
如果有錯誤,要排查原因。
 
SQL> alter system switch logfile;
SQL> select max(sequence#) from v$archived_log;
 
查看資料庫模式
SQL>select dest_name,status,database_mode,recovery_mode,protection_mode from v$archive_dest_status;
SQL>select status,database_mode from v$archive_dest_status;
SQL>select OPEN_MODE, PROTECTION_MODE, ACTIVATION#,DATABASE_ROLE, SWITCHOVER# ,SWITCHOVER_STATUS from v$database;
 
 
三、保護模式切換體驗 
 
我最初配置的DG的保護模式是最大效能模式(MAXIMUM PERFORMANCE),在下面的體驗中我分別完成如下模式的切換    最大效能-->最大保護 
最大保護-->最大可用 
最大可用-->最大保護 
最大保護-->最大效能
最大效能-->最大可用
 
當保護模式更改順序:
maximize protection ---> maximize availability ----> maximize performance
當在把dataguard的保護層級按這上面的順序減低的時候,不需要primary庫在mount狀態,否則primary必須在mount狀態。
如果是升級保護模式,比如從最高效能模式升級到最高可用模式,則需要先關閉資料庫,然後mount資料庫,如果是降級保護模式則直接
 
data guard資料保護模式                                        最大保護         最高可用           最高效能
REDO寫進程                     LGWR            LGWR           LGWR或ARCH
網路傳輸模式                       SYNC            SYNC            LGWR進程時SYNC或ASYNC,ARCH進程時YNC
磁碟寫操作                        AFFIRM       AFFIRM         AFFIRM或NOAFFIRM
是否需要standby redologs    YES             YES            可沒有但推薦有
 
 
1、最大效能-->最大保護的切換 
 
DGMGRL> edit database source_pr set property LogXptMode ='SYNC';  --為什麼改為SYNC大家很清楚吧
Property "logxptmode" updated
 
DGMGRL> edit database source_st set property LogXptMode ='SYNC';
Property "logxptmode" updated
 
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXPROTECTION;  --這個restart的過程是自動的
Operation requires shutdown of instance "source" on database "source_pr"
Shutting down instance "source"...
Database closed.
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "source" on database "source_pr"
Starting instance "source"...
ORACLE instance started.
Database mounted.
 
2、最大保護-->最大可用的切換
 
這個動作比較簡單,不需要改參數。
 
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;
Succeeded.
3、最大可用-->最大保護的切換
 
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXPROTECTION;
Operation requires shutdown of instance "source" on database "source_pr"
Shutting down instance "source"...
Database closed.
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "source" on database "source_pr"
Starting instance "source"...
ORACLE instance started.
Database mounted.
DGMGRL>
4、最大保護-->最大效能的切換
 
 
DGMGRL> edit database source_pr set property LogXptMode ='ASYNC';
Property "logxptmode" updated
 
DGMGRL> edit database source_st set property LogXptMode ='ASYNC';
Error: ORA-16805: change of LogXptMode property violates overall protection mode
 
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXPERFORMANCE;
Succeeded.
 
DGMGRL> edit database source_st set property LogXptMode ='ASYNC';
Property "logxptmode" updated
5、最大效能-->最大可用性的切換
 
DGMGRL> edit database source_pr set property LogXptMode ='SYNC';  --為什麼改為SYNC大家很清楚吧
Property "logxptmode" updated
 
DGMGRL> edit database source_st set property LogXptMode ='SYNC';
Property "logxptmode" updated
 
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;
Succeeded.

更多Oracle相關資訊見Oracle 專題頁面 http://www.bkjia.com/topicnews.aspx?tid=12

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.