失效链接处理 |
Oracle数据库DG主备切换 PDF 下载
本站整理下载:
相关截图:
主要内容:
1、主库操作
1.1 关闭主库监听
su - oracle
lsnrctl stop(只在主库操作)
1.2 在主库端检查数据库可切换状态
sqlplus / as sysdba
SQL> select switchover_status from v$database;
如果SWITCHOVER_STATUS 的值为TO STANDBY 表示可以正常切换.
SQL> alter database commit to switchover to physical standby;
Database altered.
切换成功!
如果SWITCHOVER_STATUS 的值为SESSIONS ACTIVE表示当前有会话处于ACTIVE状态:
SQL> alter database commit to switchover to physical standby with session shutdown;
Database altered.
查看日志:
tail -f $ORACLE_BASE/admin/$ORACLE_SID/bdump/alert_$ORACLE_SID.log
1.3 重启主库
SQL> shutdown abort;
SQL> startup mount;
2、备库操作
2.1这时候到备份库 在备库验证可切换状态
sqlplu / as sysdba
SQL> select switchover_status from v$database;
到备库验证可切换状态SWITCHOVER_STATUS
2.2.将目标备库转换为主库
如果SWITCHOVER_STATUS 的值为TO PRIMARY 则:
SQL> alter database commit to switchover to primary;
Database altered.
如果SWITCHOVER_STATUS 的值为SESSIONS ACTIVE 则:
SQL> alter database commit to switchover to primary with session shutdown;
Database altered.
查询temp文件是否同步过来,主库创建临时表空间,备库自动创建临时文件,但无临时文件,需手工添加。
SQL> select FILE_NAME,TABLESPACE_NAME,status from dba_temp_files;
查看日志:
tail -f $ORACLE_BASE/admin/$ORACLE_SID/bdump/alert_$ORACLE_SID.log
2.3 打开目标备库
SQL> alter database open;
2.4 开始在目标备库应用日志
SQL> alter database recover managed standby database disconnect;
开启备库的实时日志应用:
SQL> alter database recover managed standby database using current logfile disconnect from session;
检查主备库角色状态:
SQL> select switchover_status,database_role from v$database;
3、修改新备库ip(原主库)
ping 10.100.0.201
修改IP地址
sed -i 's/10.100.0.9/10.100.0.201/g' /etc/sysconfig/network-scripts/ifcfg-bond0
cat /etc/sysconfig/network-scripts/ifcfg-bond0
|