Oracle Dataguard基本操作語句

牛平發表於2017-11-18
## 啟動備庫

STARTUP MOUNT;

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

或,如果使用實時同步,則執行以下

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE;


## 關閉備庫操作


檢視是否正在應用redo data,如果存在MRP0或者MRP

SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;

關閉redo apply

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

關閉備庫

SHUTDOWN IMMEDIATE;


## 狀態查詢

主庫:
動態效能檢視:
v$archive_dest_status

RECOVERY_MODE 列表示是否是實時Redo Data同步。


## 啟動同步

前臺

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE;

後臺
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

實時

LTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE

## 停止同步

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;


## 監控Redo同步

主庫或備庫執行

SELECT DATABASE_ROLE, DB_UNIQUE_NAME INSTANCE, OPEN_MODE,PROTECTION_MODE, PROTECTION_LEVEL, SWITCHOVER_STATUS FROM V$DATABASE;

檢視fast-start failover

SELECT FS_FAILOVER_STATUS FSFO_STATUS, FS_FAILOVER_CURRENT_TARGET TARGET_STANDBY, FS_FAILOVER_THRESHOLD THRESHOLD, FS_FAILOVER_OBSERVER_PRESENT OBS_PRES FROM V$DATABASE;


備庫上執行,檢視Redo apply和redo transport service 活動

SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;

備庫執行,透過檢視ARCHIVED_SEQ#和APPLIED_SEQ#對比備庫和主庫差距。


SELECT ARCHIVED_THREAD#, ARCHIVED_SEQ#, APPLIED_THREAD#, APPLIED_SEQ# FROM V$ARCHIVE_DEST_STATUS;
備庫上執行,是實時同步還是普通同步

SELECT RECOVERY_MODE FROM V$ARCHIVE_DEST_STATUS WHERE DEST_ID=2 ;

備庫上執行,用於檢視收到的redo log file情況

SELECT REGISTRAR, CREATOR, THREAD#, SEQUENCE#, FIRST_CHANGE#, NEXT_CHANGE# FROM V$ARCHIVED_LOG;

備庫上執行,檢視已經被應用的archive log file.

SELECT THREAD#, SEQUENCE#, FIRST_CHANGE#, NEXT_CHANGE# FROM V$LOG_HISTORY;

主庫上執行,檢視DG相關的警報日誌。

SELECT MESSAGE FROM V$DATAGUARD_STATUS;




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

相關文章