接上文,由于通过手动的switchover对应的服务并未按照预期启动或停止,下文通过dgbroker进行切换,查看对应的服务状态。
下面通过添加dg到dgbroker中进行dg切换查看service是否会自动切换?
查看当前主库的信息
当前备库信息
服务运行状态
同时当前svc运行正常,gadb rw运行正常
gadbstd zd服务运行正常
执行切换
切换后的预期状态如下图。
DGMGRL> validate database gadbstd Database Role: Physical standby database Primary Database: gadb Ready for Switchover: Yes Ready for Failover: Yes (Primary Running) Flashback Database Status: gadb : Off gadbstd: Off Managed by Clusterware: gadb : YES gadbstd: YES DGMGRL> switchover to gadbstd;Performing switchover NOW, please wait...Operation requires a connection to database "gadbstd"Connecting ...Connected to "gadbstd"Connected as SYSDBA.New primary database "gadbstd" is opening...Oracle Clusterware is restarting database "gadb" ...Connected to "gadb"Connected to "gadb"Switchover succeeded, new primary is "gadbstd"DGMGRL> show configurationConfiguration - gadbcfg Protection Mode: MaxPerformance Members: gadbstd - Primary database gadb - Physical standby database Fast-Start Failover: DisabledConfiguration Status:SUCCESS (status updated 35 seconds ago)
再次查看svc状态,新备库启动到readonly状态,并且zd服务正常启动。
同时新主库正常启动并且rw服务正常启动
查看ocr配置 新主库的role变为了primary
新备库从primary也变为了physical standby
回切数据库
回切后的预期状态如下图。
dgmgrl sys/rxxxsdd@gadbDGMGRL for Linux: Release 19.0.0.0.0 - Production on Fri Oct 28 17:01:13 2022Version 19.10.1.0.0Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.Welcome to DGMGRL, type "help" for information.Connected to "gadb"Connected as SYSDBA.DGMGRL> show configurationConfiguration - gadbcfg Protection Mode: MaxPerformance Members: gadbstd - Primary database gadb - Physical standby database Fast-Start Failover: DisabledConfiguration Status:SUCCESS (status updated 32 seconds ago)DGMGRL> validate database gadb Database Role: Physical standby database Primary Database: gadbstd Ready for Switchover: Yes Ready for Failover: Yes (Primary Running) Flashback Database Status: gadbstd: Off gadb : Off Managed by Clusterware: gadbstd: YES gadb : YES DGMGRL> DGMGRL> switchover to gadb;Performing switchover NOW, please wait...New primary database "gadb" is opening...Oracle Clusterware is restarting database "gadbstd" ...Connected to "gadbstd"Connected to "gadbstd"Switchover succeeded, new primary is "gadb"
备库状态服务按预期正常启动
主库状态,服务按预期正常启动
通过如上操作测试,发现通过dgbroker进行dg的切换服务的启动和停止是符合预期的。关键点就是通过dgbroker进行切换会更新ocr的数据库角色信息,当切换后集群crs会根据ocr里面的信息决定哪个服务是启动还是停止。
切换测试模拟业务连接
当执行完毕切换后连接zd和rw的服务均可以正常恢复。满足了预期的效果。
版权声明:内容来源于互联网和用户投稿 如有侵权请联系删除