1. 采用Broker测试Switchover
1) 主库情况
SQL> select open_mode,database_role,db_unique_name from v$database;
OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME
-------------------- -------------------- --------------------
READ WRITE PRIMARY fxopt
2) 备库情况
SQL> select open_mode,database_role,db_unique_name from v$database;
OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME
-------------------- -------------------- --------------------
READ ONLY WITH APPLY PHYSICAL STANDBY fxopt_std
2. 主备切换
1) 查看Broker配置
$ dgmgrl sys/oracle
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dgfxoptdb
Protection Mode: MaxAvailability
Databases:
fxopt - Primary database
fxopt_std - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
2) 切换到备库
DGMGRL> switchover to fxopt_std;
Performing switchover NOW, please wait...
New primary database "fxopt_std" is opening...
Operation requires shutdown of instance "fxopt" on database "fxopt"
Shutting down instance "fxopt"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "fxopt" on database "fxopt"
Starting instance "fxopt"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "fxopt_std"
DGMGRL> show configuration
Configuration - dgfxoptdb
Protection Mode: MaxAvailability
Databases:
fxopt_std - Primary database
fxopt - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
3) 主库情况
SQL> select open_mode,database_role,db_unique_name from v$database;
OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME
-------------------- -------------------- --------------------
READ ONLY WITH APPLY PHYSICAL STANDBY fxopt
4) 备库情况
SQL> select open_mode,database_role,db_unique_name from v$database;
OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME
-------------------- -------------------- --------------------
READ WRITE PRIMARY fxopt_std
5) 切回主库
DGMGRL> switchover to fxopt
Performing switchover NOW, please wait...
New primary database "fxopt" is opening...
Operation requires shutdown of instance "fxopt" on database "fxopt_std"
Shutting down instance "fxopt"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "fxopt" on database "fxopt_std"
Starting instance "fxopt"...
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "fxopt"
6) 主库情况
SQL> select open_mode,database_role,db_unique_name from v$database;
OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME
-------------------- -------------------- --------------------
READ WRITE PRIMARY fxopt
7) 备库情况
SQL> select open_mode,database_role,db_unique_name from v$database;
OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME
-------------------- -------------------- --------------------
READ ONLY WITH APPLY PHYSICAL STANDBY fxopt_std