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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值