adg切换(RAC TO SINGLE)

广大2年前技术文章970

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



相关文章

MySQL排障实战(一)—— 连接异常中断

MySQL排障实战(一)—— 连接异常中断

问题背景数栈数据质量模块,接入客户的数据源后,一执行就报错。报错信息:{"logInfo": {{"jobid":"1a4ebbbd&quo...

MongoDB的索引(二)

四、Case Insesitive索引1、语法db.collection.createIndex(  { "key" : 1 }, { collation: {locale : <local...

企业级大数据安全架构(五)

企业级大数据安全架构(五)

本章节介绍安全架构里面一个重要组件Knox安装,我们是通过ambari安装,如果安装开源Knox可参考官网文档1 ambari页面add service2勾选Knox安装点击NEXT3选择安装knox...

Prometheus基于Alertmanager实现钉钉告警

Prometheus基于Alertmanager实现钉钉告警

一、安装prometheus-webhook-dingtalk插件wget https://github.com/timonwong/prometheus-webhook-dingtalk/relea...

win2016系统新增辅助网卡无法访问公网

win2016系统新增辅助网卡无法访问公网

问题现象:一台阿里云win2016系统服务器,在主网卡已绑定弹性公网ip之后,再新增了一块辅助网卡,无法访问公网。另外,使用NAT网关做了dnat到辅助网卡的映射。该台服务器网卡信息为:主网卡:172...

MySQL 有意思的权限报错

前言今天遇到了一个报错,觉得挺有意思的,在此记录下。SELECT command denied to user 'xxx'@'xxx' for table 'xxx'1. 报错原因这里是研发提了一条修...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。