【DATAGUARD】DG系列之邏輯備庫非實時更新小問題處理

xysoul_雲龍發表於2014-10-15

DG系列之邏輯備庫非實時更新小問題處理

一、         概述
    dg
越來越成為資料庫中災備和分擔壓力的重要工具,作為傳說中的DBA來說,你要下得了廚房、上得了廳堂。扯遠了,看看這個小問題吧,弱爆了。

二、               處理過程:
   
這裡所說非實時,並不是人為延遲資料傳輸、更新,主要問題在於當主庫更新表資料後備庫無法及時更新過來,在主庫手動歸檔後資料才傳輸過來。也就是當主庫操作後備庫備庫並沒有接收該事務(日誌),主庫切換歸檔後備庫讀取歸檔日誌資料才提取完成。下圖為DG傳輸流程


檢視主庫、備庫相關引數配置,並無異常,也曾參照該dg配置搭建了一套測試的dg環境,而該測試環境資料則是實時更新的。在檢視dg配置文件時,發現測試環境啟動日誌應用語句中多一個immediate; 此前並無檢視官方及相關文件,只是認為多一個它是立即啟動日誌應用。通過檢視官方文件,得知,immediate的意思是立即應用日誌。說明如下:

To start SQL Apply, start the logical standby database and issue the following statement:

SQL>  ALTER DATABASE START LOGICAL STANDBY APPLY;

To start real-time apply on the logical standby database to immediately apply redo data from the standby redo log files on the logical standby database, include the IMMEDIATE keyword as shown in the following statement:

SQL>  ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;

 

 

If the real-time apply feature is enabled, log apply services can apply redo data as it is received, without waiting for the current standby redo log file to be archived. This results in faster switchover and failover times because the standby redo log files have been applied already to the standby database by the time the failover or switchover begins.

Use the ALTER DATABASE statement to enable the real-time apply feature, as follows:

·         For physical standby databases, issue the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE statement.

·         For logical standby databases, issue the ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE statement.

Standby redo log files are required to use real-time apply

 

停止日誌應用,再次啟動(當然這次加了IMMEDIATE),檢視錶資料,當然資料為實時更新。

三、         總結
這個其實沒啥可總結的,基礎知識不牢固,還沒認真檢視相關文件,不多說了。

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

相關文章