Oracle 19C Data Guard基礎運維-02 Switchovers(物理)

chenoracle發表於2020-04-16

Oracle 19C Data Guard 基礎運維 -02  S witchover s( 物理 )

原主庫

原備庫

 

Switchovers

新主庫

新備庫

192.168.31.90

192.168.31.100

192.168.31.100

192.168.31.90

cjcdb

chendb

chendb

cjcdb

原理:

https://docs.oracle.com/en/database/oracle/oracle-database/19/sbydb/data-guard-concepts-and-administration.pdf

Figure 9-1 Oracle Data Guard Configuration Before Switchover 

Figure 9-2 Standby Databases Before Switchover to the New Primary Database 

Figure 9-3 Oracle Data Guard Environment After Switchover 

Performing a Switchover to a Physical Standby Database

31.90 主庫

SQL> select database_role,protection_level,protection_mode from v$database;  

DATABASE_ROLE  PROTECTION_LEVEL     PROTECTION_MODE

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

PRIMARY  MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

31.100 備庫

SQL> select database_role,protection_level,protection_mode from v$database;

DATABASE_ROLE  PROTECTION_LEVEL     PROTECTION_MODE

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

PHYSICAL STANDBY MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

1. 驗證目標備用資料庫是否已準備好進行切換。

Verify that the target standby database is ready for switchover.

31.90 主庫

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS

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

TO STANDBY

SQL> alter database switchover to chendb verify;

Database altered

2. 在主資料庫 CJCDB 上啟動切換,方法是發出以下命令

Initiate the switchover on the primary database, CJCDB , by issuing the following

31.90 主庫

SQL> alter database switchover to chendb;

Database altered.

3. 在新的主資料庫 chendb 上發出以下 SQL 語句以開啟它。

Issue the following SQL statement on the new primary database, CHICAGO , to open

it.

SQL> alter database open;  

4. 發出以下 SQL 語句以裝載新的物理備用資料庫 CJCDB

Issue the following SQL statement to mount the new physical standby database,

BOSTON :

SQL>startup mount;

或者,如果 CJCDB Oracle Active Data Guard物理備用資料庫,則發出以下SQL語句以只讀方式開啟它:

Or, if BOSTON  is an Oracle Active Data Guard physical standby database, then

issue the following SQL statement to open it read only:

SQL> STARTUP;

5 . 在新的物理備用資料庫 CJCDB 上啟動Redo Apply 。例如:

Start Redo Apply on the new physical standby database. For example:

3.90 新備庫

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

SQL> select database_role,protection_level,protection_mode from v$database;

DATABASE_ROLE  PROTECTION_LEVEL     PROTECTION_MODE

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

PHYSICAL STANDBY MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

3.100 新主庫

SQL> select database_role,protection_level,protection_mode from v$database;

DATABASE_ROLE  PROTECTION_LEVEL     PROTECTION_MODE

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

PRIMARY  MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

同步測試:

新主庫chendb:

SQL> create table test2 as select level as id from dual connect by level <=3;

新備庫cjcpdb:

SQL> select * from test2;

ID

----------

 1

 2

 3

歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!

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

相關文章