adg切换(RAC TO SINGLE)
adg切换步骤:
1、关闭两节点监听和清理外部链接:
su - grid
srvctl stop listener
ps -ef|grep LOCAL=NO|awk '{print $2}'|xargs kill -9
2、生产2号节点关闭数据库:
su - oracle
sqlplus / as sysdba
shutdown immediate;
exit;
3、生产1号节点执行主切备,并开启日志应用
su - oracle
sqlplus / as sysdba
alter system checkpoint;
alter database commit to switchover to physical standby with session shutdown ;
(执行主切备)
shutdown immediate;
startup
set linesize 300;
select dbid,name,open_mode,current_scn,protection_mode,database_role,force_logging,switchover_status from gv$database;
(检查主库状态)
alter database recover managed standby database using current logfile disconnect from session;
(开启日志应用)
4、启动2号节点
su - oracle
sqlplus / as sysdba
startup
select dbid,name,open_mode,current_scn,protection_mode,database_role,force_logging,switchover_status from gv$database;(检查数据库状态--正确应为physical standby)
5、启动资金两节点监听:
su - grid
srvctl start listener
6、备库停监听和杀外部链接:
su - oracle
lsnrctl stop
su - root
ps -ef|grep LOCAL=NO|awk '{print $2}'|xargs kill -9
7、备库转换为主库:
su - oracle
sqlplus / as sysdba
select dbid,name,open_mode,current_scn,protection_mode,database_role,
force_logging,switchover_status from v$database;(检查数据库状态)
alter database recover managed standby database cancel; (取消日志应用)
alter database commit to switchover to primary with session shutdown;
(备转主,转换过程包括自动重启操作)
alter database open;
8、备库启动监听:
lsnrctl start