nohup dgmgrl sys/oracle@db1 'start observer' &
后台挂起进程
switchover 切换测试
1:把主库dg1
[oracle@dg1 ~]$ dgmgrl sys/manager
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg1 - Primary database
dg2 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
主库切换到备库
DGMGRL> switchover to 'dg2';
Performing switchover NOW, please wait...
Operation requires a connection to instance "orcl" on database "dg2"
Connecting to instance "orcl"...
Connected.
New primary database "dg2" is opening...
Operation requires startup of instance "orcl" on database "dg1"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "dg2"
DGMGRL> show configuration;
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg2 - Primary database
dg1 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
Note:切换成功
DGMGRL> switchover to 'dg2';
Performing switchover NOW, please wait...
Error: ORA-16558: database specified for switchover is not a standby database
Failed.
Unable to switchover, primary database is still "dg2"
将新主库切换为备库
DGMGRL> exit
[oracle@dg1 ~]$ dgmgrl sys/manager@dg2
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg2 - Primary database
dg1 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
DGMGRL> switchover to 'dg1';
Performing switchover NOW, please wait...
Operation requires a connection to instance "orcl" on database "dg1"
Connecting to instance "orcl"...
Connected.
New primary database "dg1" is opening...
Operation requires startup of instance "orcl" on database "dg2"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "dg1"
DGMGRL>
Note切换成功
测试failover
主库
SQL> shutdown abort
ORACLE instance shut down.
DGMGRL> start observer
Observer started
18:10:41.98 Tuesday, July 25, 2017
Initiating Fast-Start Failover to database "dg2"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "dg2"
18:10:44.46 Tuesday, July 25, 2017
新主库
SQL> select open_mode,database_role,log_mode,flashback_on from v$database;
OPEN_MODE DATABASE_ROLE LOG_MODE FLASHBACK_ON
-------------------- ---------------- ------------ ------------------
READ WRITE PRIMARY ARCHIVELOG YES
[oracle@dg1 ~]$ dgmgrl sys/manager@dg2
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg2 - Primary database
Warning: ORA-16817: unsynchronized fast-start failover configuration
dg1 - (*) Physical standby database (disabled)
ORA-16661: the standby database needs to be reinstated
Fast-Start Failover: ENABLED
Configuration Status:
WARNING
启动
DGMGRL> connect sys/manager@dg1
Connected.
DGMGRL> startup
ORACLE instance started.
Database mounted.
ORA-16649: possible failover to another database prevents this database from being opened
DGMGRL> start observer
Observer started
18:10:41.98 Tuesday, July 25, 2017
Initiating Fast-Start Failover to database "dg2"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "dg2"
18:10:44.46 Tuesday, July 25, 2017
18:14:41.93 Tuesday, July 25, 2017
Initiating reinstatement for database "dg1"...
Reinstating database "dg1", please wait...
Operation requires shutdown of instance "orcl" on database "dg1"
Shutting down instance "orcl"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "orcl" on database "dg1"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Continuing to reinstate database "dg1" ...
Reinstatement of database "dg1" succeeded
18:15:44.57 Tuesday, July 25, 2017
[oracle@dg1 ~]$ dgmgrl sys/manager@dg1
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg2 - Primary database
dg1 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
后台挂起进程
switchover 切换测试
1:把主库dg1
[oracle@dg1 ~]$ dgmgrl sys/manager
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg1 - Primary database
dg2 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
主库切换到备库
DGMGRL> switchover to 'dg2';
Performing switchover NOW, please wait...
Operation requires a connection to instance "orcl" on database "dg2"
Connecting to instance "orcl"...
Connected.
New primary database "dg2" is opening...
Operation requires startup of instance "orcl" on database "dg1"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "dg2"
DGMGRL> show configuration;
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg2 - Primary database
dg1 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
Note:切换成功
DGMGRL> switchover to 'dg2';
Performing switchover NOW, please wait...
Error: ORA-16558: database specified for switchover is not a standby database
Failed.
Unable to switchover, primary database is still "dg2"
将新主库切换为备库
DGMGRL> exit
[oracle@dg1 ~]$ dgmgrl sys/manager@dg2
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg2 - Primary database
dg1 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
DGMGRL> switchover to 'dg1';
Performing switchover NOW, please wait...
Operation requires a connection to instance "orcl" on database "dg1"
Connecting to instance "orcl"...
Connected.
New primary database "dg1" is opening...
Operation requires startup of instance "orcl" on database "dg2"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "dg1"
DGMGRL>
Note切换成功
测试failover
主库
SQL> shutdown abort
ORACLE instance shut down.
DGMGRL> start observer
Observer started
18:10:41.98 Tuesday, July 25, 2017
Initiating Fast-Start Failover to database "dg2"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "dg2"
18:10:44.46 Tuesday, July 25, 2017
新主库
SQL> select open_mode,database_role,log_mode,flashback_on from v$database;
OPEN_MODE DATABASE_ROLE LOG_MODE FLASHBACK_ON
-------------------- ---------------- ------------ ------------------
READ WRITE PRIMARY ARCHIVELOG YES
[oracle@dg1 ~]$ dgmgrl sys/manager@dg2
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg2 - Primary database
Warning: ORA-16817: unsynchronized fast-start failover configuration
dg1 - (*) Physical standby database (disabled)
ORA-16661: the standby database needs to be reinstated
Fast-Start Failover: ENABLED
Configuration Status:
WARNING
启动
DGMGRL> connect sys/manager@dg1
Connected.
DGMGRL> startup
ORACLE instance started.
Database mounted.
ORA-16649: possible failover to another database prevents this database from being opened
DGMGRL> start observer
Observer started
18:10:41.98 Tuesday, July 25, 2017
Initiating Fast-Start Failover to database "dg2"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "dg2"
18:10:44.46 Tuesday, July 25, 2017
18:14:41.93 Tuesday, July 25, 2017
Initiating reinstatement for database "dg1"...
Reinstating database "dg1", please wait...
Operation requires shutdown of instance "orcl" on database "dg1"
Shutting down instance "orcl"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "orcl" on database "dg1"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Continuing to reinstate database "dg1" ...
Reinstatement of database "dg1" succeeded
18:15:44.57 Tuesday, July 25, 2017
[oracle@dg1 ~]$ dgmgrl sys/manager@dg1
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg2 - Primary database
dg1 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS