sitemap

RSS地图

收藏本站

设为首页

Oracle研究中心

当前位置:Oracle研究中心 > 产品DBA > Oracle DG >

案例:Oracle DG系统 Data Gurad switchover切换(Physical Stand

时间:2016-05-16 21:45   来源:Oracle研究中心   作者:惜分飞   点击:

天萃荷净 Oralce Data Gurad系统主备库switchover切换(Physical Standby Databases)

一、主库
查看当前数据库状态
select database_role,switchover_status from v$database;

当switchover_status为SESSIONS ACTIVE时
alter database commit to switchover to physical standby with session shutdown;
否则执行
alter database commit to switchover to physical standby;

切换成功关闭数据库
shutdown immediate;

startup mount;
note:11g 可以直接置于 read only 使用命令startup

开启实时应用
alter database recover managed standby database using current logfile disconnect from session;

恢复备库未利用日志
alter database recover managed standby database disconnect from session;

二、备库
查看当前数据库状态
select database_role,switchover_status from v$database;

如果是switchover_status为recovery needed或switchover latent 恢复数据库
alter database recover managed standby database disconnect from session;

切换数据库
alter database commit to switchover to primary with session shutdown;

开启数据库
startup

–查询除自己进程外的其他进程,并kill掉

SELECT 'kill -9 '||p.spid,'alter system kill session '''||v.sid||','||v.SERIAL#||''''
FROM V$SESSION v ,v$process p  
WHERE v.TYPE = 'USER' 
AND v.SID <> (SELECT DISTINCT SID FROM V$MYSTAT) 
AND v.paddr=p.addr;

三、补充11g官方文档处理顺序和操作语句
1、主库切换
SELECT SWITCHOVER_STATUS FROM V$DATABASE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
SHUTDOWN ABORT;
STARTUP MOUNT;

2、备库切换
SELECT SWITCHOVER_STATUS FROM V$DATABASE;
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;
ALTER DATABASE OPEN;

3、开启应用(新备库–原主库)
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
 

-----------------温馨提示--------------------
操作有风险,动手需谨慎
Oracle研究中心
http://www.oracleplus.net
本文由大师惜分飞原创分享,转载请尽量保留本站网址

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之案例:Oracle DG系统 Data Gurad switchover切换(Physical Stand

本文由大师惜分飞原创分享,网址:http://www.oracleplus.net/arch/192.html

Oracle研究中心

关键词:

Oracle DG系统

Data Gurad switchover切换

Physical Standby Databases switchover切换