DataGuard 日常維護命令整理

dukewyh發表於2012-07-16
1.停止Standby
select process, status 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;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15592508/viewspace-735626/,如需轉載,請註明出處,否則將追究法律責任。

相關文章