dataguard 常規運維操作

張衝andy發表於2017-03-13

1.standby database 正常的開啟與關閉

1.1 針對 physical standby
開啟:
--開啟資料庫
SQL>startup; 
-- 開啟 mgr 程式 
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE disconnect from session; ( physical standby )

關閉:
-- 關閉 mgr 程式
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
-- 正常關閉資料庫
SQL> shutdown immediate;

1.2 針對 logical standby
-- 開啟 mgr 程式
SQL>ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE; 
-- 關閉 mgr 程式
SQL>ALTER DATABASE STOP LOGICAL STANDBY APPLY;

2. 檢視資料庫角色與保護模式

SQL> select protection_mode, protection_level, database_role role, switchover_status from v$database;

3.查詢每個standby 的狀態:
-- 主庫執行
SQL> SELECT DEST_ID, STATUS,APPLIED_SCN FROM V$ARCHIVE_DEST WHERE TARGET='STANDBY';

DEST_ID STATUS APPLIED_SCN
---------- --------- -----------
2 VALID 1818069

4. 檢查redo 傳送情況

-- 備庫檢視當前 log sequence 
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 41
Next log sequence to archive 0
Current log sequence 41
-- 主庫日誌切換
SQL> alter system switch logfile;
System altered.
-- 備庫檢視當前 log sequence ,如果 log sequence 有變化說明傳輸沒有問題。
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 41
Next log sequence to archive 0
Current log sequence 42

5. 檢查 mrp 應用情況
--備庫執行
SQL> SELECT THREAD#, SEQUENCE#, FIRST_CHANGE#,NEXT_CHANGE#,APPLIED FROM V$ARCHIVED_LOG;


THREAD# SEQUENCE# FIRST_CHANGE# NEXT_CHANGE# APPLIED
---------- ---------- ------------- ------------ ---------
1 24 1449716 1451135 YES
1 26 1476706 1481494 YES
1 25 1451135 1476706 YES
1 27 1481494 1491422 YES
1 29 1524315 1547524 YES

6. 查詢archived log 的歷史資訊:(主備都執行,對比是否相同)
SQL> SELECT THREAD#, SEQUENCE#, FIRST_CHANGE#, NEXT_CHANGE# FROM V$LOG_HISTORY;

7. 查詢DG的日誌資訊,這些日誌資訊可以寫入alert log 或者程式的trace 檔案
SQL> set pagesize 200
SQL> SELECT MESSAGE FROM V$DATAGUARD_STATUS;
MESSAGE
------------------------------------------
ARC0: Archival started
ARC1: Archival started
ARC2: Archival started
ARC2: Becoming the 'no FAL' ARCH
ARC1: Becoming the heartbeat ARCH
ARC1: Becoming the active heartbeat ARCH
ARC3: Archival started

 


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

相關文章