oracle data guard broker配置與使用(下)

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
發佈了64 篇原創文章 · 獲贊 51 · 訪問量 24萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章