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
原理:
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",共同学习,共同成长!!!