This paper uses Oracle 11g Dataguard broker Switchover Test
1. Using Dataguard Broker Test switchover
1 Main Library situation
Sql> select Open_mode,database_role,db_unique_name from V$database;
Open_mode Database_role Db_unique_name
-------------------- ---------------- ------------------------------
READ WRITE PRIMARY ORCL
Sql>
Sql> Conn ABC/ABC
is connected.
Sql> SELECT * FROM ABC;
ID NAME
---------- ----------
3 DDD
4 eee
2 CCC
0 AAA
1 BBB
Sql>
2) Standby conditions
Sql> select Open_mode,database_role,db_unique_name from V$database;
Open_mode Database_role Db_unique_name
-------------------- ---------------- ------------------------------
Mounted physical STANDBY Slave
Sql>
2. The main reserve Library switch test
$ DGMGRL sys/oracle
DGMGRL for Linux:version 11.2.0.3.0-64bit Production
Copyright (c), 2009, Oracle. All rights reserved.
Welcome to the DGMGRL, for information, type Help.
is connected.
Dgmgrl> show configuration;
Configuration-Dgorcldb
Protection mode: Maxperformance
Database:
ORCL-Primary Database
Slave-Physical Standby database
Quick Start Failover: DISABLED
Configuration Status:
SUCCESS
# Main Reserve Cut
Dgmgrl> switchover to Slave;
Please wait while the switch is performed ...
The new primary database "Slave" is opening ...
Operation requires the instance "master" to be closed (on the database "master")
Closing instance "MASTER" ...
The ORACLE routine has been closed.
Operation requires startup instance "master" (on Database "master")
Starting instance "MASTER" ...
The ORACLE routine has started.
Database loading complete.
Switch succeeded, the new primary database is "slave"
Dgmgrl> Show Configuration
Configuration-Dgorcldb
Protection mode: Maxperformance
Database:
Slave-Primary Database
ORCL-Physical Standby database
Quick Start Failover: DISABLED
Configuration Status:
SUCCESS
Dgmgrl>
3. Main Standby test
# on the main library, the main standby has switched to the standby.
Sql> Conn/as sysdba;
is connected.
Sql> select Open_mode,database_role,db_unique_name from V$database;
Open_mode Database_role Db_unique_name
-------------------- ---------------- ------------------------------
Mounted physical STANDBY ORCL
Sql>
On standby, the repository has been switched to the main library.
Sql> Conn/as sysdba;
is connected.
Sql> select Open_mode,database_role,db_unique_name from V$database;
Open_mode Database_role Db_unique_name
-------------------- ---------------- ------------------------------
READ WRITE PRIMARY Slave
Sql>
Sql> Conn ABC/ABC
is connected.
Sql> SELECT * FROM ABC;
ID NAME
---------- ----------
3 DDD
4 eee
2 CCC
0 AAA
1 BBB
# Insert a new record on the main library after you switch.
Sql> INSERT INTO ABC values (5, ' new ');
1 lines have been created.
Sql> commit;
Submit completed.
Sql> SELECT * FROM ABC;
ID NAME
---------- ----------
3 DDD
4 eee
5 new
2 CCC
0 AAA
1 BBB
6 rows have been selected.
Sql>
4. Prepare the library and then cut to the main library (cut back)
# The Standby is cut to the main library
Dgmgrl> switchover to ORCL;
Please wait while the switch is performed ...
The new primary database "Master" is opening ...
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/
Operation requires the instance "SLAVE" to be closed (on the database "SLAVE")
Closing instance "SLAVE" ...
The ORACLE routine has been closed.
Operation requires starting the instance "SLAVE" (On the Database "SLAVE")
Starting instance "SLAVE" ...
The ORACLE routine has started.
Database loading complete.
Switch succeeded, the new primary database is "master"
Dgmgrl> Show Configuration
Configuration-Dgorcldb
Protection mode: Maxperformance
Database:
ORCL-Primary Database
Slave-Physical Standby database
Quick Start Failover: DISABLED
Configuration Status:
SUCCESS
# The main library on the SQL view, the main standby has been switched
Sql> Conn/as sysdba;
is connected.
Sql> select Open_mode,database_role,db_unique_name from V$database;
Open_mode Database_role Db_unique_name
-------------------- ---------------- ------------------------------
READ WRITE PRIMARY ORCL
Sql>
Sql> Conn ABC/ABC
is connected.
Sql> SELECT * FROM ABC;
ID NAME
---------- ----------
3 DDD
4 eee
5 new
2 CCC
0 AAA
1 BBB
6 rows have been selected.
Sql>
The records inserted on the main library are also available, which enables lossless data switching.
Standby SQL view, the standby has been cut back.
Sql> Conn/as sysdba;
is connected.
Sql> Conn/as sysdba;
is connected.
Sql> select Open_mode,database_role,db_unique_name from V$database;
Open_mode Database_role Db_unique_name
-------------------- ---------------- ------------------------------
Mounted physical STANDBY Slave
Sql>
This article is from "Koumm Linux Technology blog" blog, please be sure to keep this source http://koumm.blog.51cto.com/703525/1275717