星期五, 5月 11, 2018

Oracle DataGuard停止同步步驟(10g+)

Oracle DataGuard停止同步操作步驟(10g+)

1.[Primary DB]停止 data guard apply
alter database recover managed standby database cancel;

2.[Standby DB] PRIMARY 暫時關閉傳送Archive log Standby
alter system set log_archive_dest_state_2 = 'defer';

3.[Primary DB]暫停清理archive log file機制/ rman backup archivelog cron job

4.[Standby DB]開啟 data guard apply
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

5.[Primary DB]開啟傳送Archive log Standby
alter system set log_archive_dest_state_2 = 'enable';

6.[Primary DB && Standby DB] 確認是否同步完成
select dest_id, sequence# , applied from v$archived_log
where dest_id = 2 and sequence# > (select max(sequence#) - 10 from v$archived_log)
order by sequence#
/
--*從Standby DB , Primary DB都下以下指令確保最後一個產生的archived log 在v$archived_log都有看到同樣的編號, 那麼就代表檔案在兩邊的archive log都有被註冊(register)到data dictionary裡面, 只要在Standby DB看到的applied status 大多都為YES, 只有一筆為NO or In-memory就代表是正常的狀態
select thread#, max(sequence#), applied from v$archived_log where thread# in (1,2) group by thread#, applied;

7.[Primary DB]清理expiredarchive log file(已經被standby applied archivelog)

RMAN>list expired archivelog all;
RMAN>crosscheck archivelog all;
RMAN>backup archivelog all not backed up;
RMAN>delete noprompt expired archivelog all;

8.[Primary DB]開啟清理archive log file機制/ rman backup archivelog cron job

--
ref
https://www.qualogy.com/techblog/oracle/deleting-archive-log-files-in-a-data-guard-environment
http://blog.itpub.net/29067253/viewspace-2056040/

沒有留言:

LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...