-
-
1、备库中mrp是否在运行
-
select process from v$managed_standby where process like 'mrp%';
-
如果没有则启动
-
alter database recover managed standby database cancel;
-
alter database recover managed standby database using current logfile disconnect;
-
-
2、检查备库redo状态
-
select distinct l.group# from v$log l, v$logfile lf
-
where l.group# = lf.group#
-
and l.status not in ('unused', 'clearing','clearing_current');
-
如果有结果,则停止mrp后
-
alter database recover managed standby database cancel;
-
清理redo
-
alter database clear logfile group <orl group# from the query above>;
-
-
3、确认主备库同步gap
-
主库:select thread#, sequence# from v$thread;
-
备库:select thread#, max(sequence#) from v$archived_log
-
where applied = 'yes'
-
and resetlogs_change# = (select resetlogs_change#
-
from v$database_incarnation where status = 'current')
-
group by thread#;
-
如果超过3个,需要手工处理
-
-
4、验证临时文件个数相同
-
select tmp.name filename, bytes, ts.name tablespace
-
from v$tempfile tmp, v$tablespace ts where tmp.ts#=ts.ts#;
-
-
5、没有offline文件
-
select name from v$datafile where status='offline';
-
-
6、没有后台作业在运行
-
select * from dba_jobs_running;
-
select owner, job_name, start_date, end_date, enabled from
-
dba_scheduler_jobs where enabled='true' and owner <> 'sys';
-
-
7、创建还原点
-
备库:
-
alter database recover managed standby database cancel;
-
create restore point switchover_start_grp guarantee flashback database;
-
alter database recover managed standby database using current logfile disconnect;
-
-
主库:
-
create restore point switchover_start_grp guarantee flashback database;
-
-
-----------------
-
开始切换
-
-
1、主切到备
-
备库此时mrp应该保持启动
-
recover managed standby database disconnect;
-
-
主库状态
-
select switchover_status from v$database;
-
应该是to standby 或 sessions active
-
-
alter database commit to switchover to standby with session shutdown;
-
-
2、备切到主
-
备库状态
-
select switchover_status from v$database;
-
应该是to primary 或 sessions active
-
-
alter database commit to switchover to primary with session shutdown;
-
alter database open;
-
-
3、原主库切换到备用状态
-
shu immediate
-
startup mount
-
alter database recover managed standby database using current logfile disconnect;
-
-
4、清理还原点
-
主备库上 drop restore point switchover_start_grp;
参考:
使用 sql*plus 的 data guard 物理备用切换{banned}最佳佳实践(文档 id 1304939.1)
阅读(1123) | 评论(0) | 转发(0) |