物理DG常用维护



----查看备库恢复的最后日志
select THREAD#,max(SEQUENCE#),to_char(max(first_time), 'yyyy-mm-dd hh24:mi:ss') from V$ARCHIVED_LOG where APPLIED='YES' group by THREAD#;






alter database recover managed standby database using current logfile disconnect;


alter database recover managed standby database  disconnect;


alter database recover managed standby database cancel;




SYS@bss> select process,status,sequence# from v$managed_standby;


PROCESS   STATUS SEQUENCE#
--------- ------------ ----------
ARCH  CONNECTED 0
ARCH  CLOSING       24
ARCH  CONNECTED 0
ARCH  CLOSING       23
RFS  IDLE       25
RFS  IDLE 0
MRP0  WAIT_FOR_LOG       25










-----激活物理DG


alter database activate standby database;








1.停止Standby
select process, status,SEQUENCE# from v$managed_standby; --查看备库是否在应用日志进行恢复
alter database recover managed standby database cancel;
shutdown immediate;
 
2.切换到只读模式
-----由shutdown模式切换到只读模式-------
startup nomount;
alter database mount standby database;
alter database open read only;
-----由应用日志模式切换到只读模式-------
alter database recover managed standby database cancel; -- 取消日志应用
alter database open read only;
 
3.切换回管理恢复模式
startup nomount;
alter database mount standby database;
alter database recover managed standby database disconnect from session; -- 启动日志应用
alter database recover managed standby database using current logfile disconnect from session;
 
4.主库和备库之间角色切换
4.1 主库切换为备库
alter database commit to switchover to physical standby;
alter database commit to switchover to physical standby with session shutdown;-- 主库有会话连接的时候
shutdown immediate
startup nomount;
alter database mount standby database;
alter database recover managed standby database disconnect from session;
 
4.2 从库切换为主库
alter database commit to switchover to primary;
shutdown immediate;
startup
alter system switch logfile;
 
5.备库自动使用主库传过来的日志进行恢复
alter database recover automatic standby database;
 
6.更改保护模式
alter database set standby database to maximize protection;
alter database set standby database to maximize availability;
alter database set standby database to maximize performancen;
 
7.取消自动恢复模式
alter database recover managed standby database cancel;
alter database recover managed standby database finish;
alter database recover managed standby database finish force;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值