Oracle 12C dg broker实现swithover后failover,也可以failover后再switchover

特别强调:在使用dg broker在执行failover to xxx需要确认一下 主备库是否开启flashback,如果没有开启,需要执行,否则会报错并且库基本上需要重新手工同步了。

alter database flashback on;  --开启数据库一级的flashback功能

 

[oracle@node1 ~]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

Copyright (c) 2000, 2013, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle@orcl
Connected as SYSDBA.
DGMGRL> show configuration

Configuration - dg

  Protection Mode: MaxPerformance
  Members:
  orcl  - Primary database
    orcl2 - Physical standby database (disabled)

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 43 seconds ago)

DGMGRL> w;
Unrecognized command "w", try "help"
DGMGRL> enable database orcl2
Enabled.
DGMGRL> show configuration

Configuration - dg

  Protection Mode: MaxPerformance
  Members:
  orcl  - Primary database
    orcl2 - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 4 seconds ago)

DGMGRL> failover to orcl2
Performing failover NOW, please wait...
Error: ORA-16600: not connected to target standby database for failover

Failed.
Unable to failover
DGMGRL> exit
[oracle@node1 ~]$ dgmgrl
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

Copyright (c) 2000, 2013, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle@orcl2
Connected as SYSDBA.
DGMGRL> failover to orcl2
Performing failover NOW, please wait...
Failover succeeded, new primary is "orcl2"
DGMGRL> show configuration

Configuration - dg

  Protection Mode: MaxPerformance
  Members:
  orcl2 - Primary database
    orcl  - Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 81 seconds ago)

DGMGRL> connect sys/oracle@orcl
Connected as SYSDBA.
DGMGRL> reinstate database orcl
ORA-16795: the standby database needs to be re-created

Configuration details cannot be determined by DGMGRL
DGMGRL> connect sys/oracle@orcl2
Connected as SYSDBA.
DGMGRL> reinstate database orcl
Reinstating database "orcl", please wait...
Operation requires shut down of instance "orcl" on database "orcl"
Shutting down instance "orcl"...
ORACLE instance shut down.
Operation requires start up of instance "orcl" on database "orcl"
Starting instance "orcl"...
ORACLE instance started.
Database mounted.
Continuing to reinstate database "orcl" ...
Reinstatement of database "orcl" succeeded
DGMGRL> show configuration

Configuration - dg

  Protection Mode: MaxPerformance
  Members:
  orcl2 - Primary database
    orcl  - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 20 seconds ago)
DGMGRL> switchover to orcl
Performing switchover NOW, please wait...
Operation requires a connection to instance "orcl" on database "orcl"
Connecting to instance "orcl"...
Connected as SYSDBA.
New primary database "orcl" is opening...
Operation requires start up of instance "orcl2" on database "orcl2"
Starting instance "orcl2"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "orcl"
DGMGRL> 
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Oracle 12c DG(Data Guard)是一种高可用性解决方案,它可以在主数据库和一个或多个备用数据库之间自动地传输数据,并确保数据在所有数据库中保持一致。下面是 Oracle 12c DG 部署的大致步骤: 1. 确保主数据库和备用数据库都已经安装了 Oracle 12c 数据库软件,并且主数据库和备用数据库的版本一致。 2. 配置主数据库的参数文件,启用归档模式,并配置归档日志的保存位置。 3. 在主数据库上创建一个备用数据库的连接,配置 tnsnames.ora 文件以便主数据库可以连接到备用数据库。 4. 在主数据库上创建一个备用数据库的控制文件备份。可以使用 RMAN 工具来创建备份。 5. 在备用数据库上安装 Oracle 12c 数据库软件,并创建一个与主数据库相同的实例。 6. 配置备用数据库的参数文件,启用归档模式,并配置归档日志的保存位置。 7. 在备用数据库上创建一个与主数据库相同的控制文件,以便备用数据库可以使用主数据库的归档日志。 8. 在备用数据库上创建一个与主数据库相同的监听器,并配置 tnsnames.ora 文件以便备用数据库可以连接到主数据库。 9. 在备用数据库上创建一个 DG 连接,指向主数据库并启动该连接。 10. 在主数据库上启用 DG 功能,并将主数据库的归档日志传输到备用数据库。 11. 确认 DG 部署成功。可以使用 DGMGRL 工具来检查主数据库和备用数据库之间的连接和数据传输状态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值