Data Guard維護管理三之處理archivelog gap

parknkjun發表於2015-01-01
1.When Is an Archive Gap Discovered?
An archive gap can occur whenever the primary database archives a log locally, but the log is not received at the standby site. Every minute, the primary database polls its standby databases to see if there are gaps in the sequence of archived redo log files.

每分鐘,prmary database都會檢測standby database看archived redo logfile是否發生開gap.

2.How Is a Gap Resolved?

Gap recovery is handled through the polling mechanism. For physical and logical standby databases, Oracle Change Data Capture, and Oracle Streams, Data Guard performs gap detection and resolution by automatically retrieving missing archived redo log files from the primary database. No extra configuration settings are required to poll the standby databases, to detect any gaps, or to resolve the gaps.

The important consideration here is that automatic gap recovery is contingent on the availability of the primary database. If the primary database is not available and you have a configuration with multiple physical standby databases, you can set up additional initialization parameters so that the Redo Apply can resolve archive gaps from another standby database


oracle會自動檢測和處理出現gap的archivelog,不需要dba手動處理,當然,前提是primary和standby狀態是avaliable,網路恢復正常。


3. Using the Fetch Archive Log (FAL) to Resolve Archive Gap

The fetch archive log (FAL) client and server resolve gaps detected in the range of archived redo log files generated at the primary database and received at the physical standby database.

  • The FAL client requests the transfer of archived redo log files automatically.-------FAL client端請求自動傳輸archived log

  • The FAL server services the FAL requests coming from the FAL client.--------------FAL server端響應來自FAL client端的請

The FAL mechanism handles the following types of archive gaps and problems:

  • When creating a physical or logical standby database, the FAL mechanism can automatically retrieve any archived redo log files generated during a hot backup of the primary database.
    FAL會自動檢索primary 熱備份產生的作何arcived redo logfile

  • When there are problems with archived redo log files that have already been received on the standby database, the FAL mechanism can automatically retrieve archived redo log files to resolve any of the following situations:

    • When the archived redo log file is deleted from disk before it is applied to the standby database.

    • When the archived redo log file cannot be applied because of a disk corruption.

    • When the archived redo log file is accidentally replaced by another file (for example, a text file) that is not an archived redo log file before the redo data has been applied to the standby database.

  • When you have multiple physical standby databases, the FAL mechanism can automatically retrieve missing archived redo log files from another physical standby database.

         如果有多個物理standby,FAL會自動從其他的standby上檢索丟失的archived log file.
4.Manually Determining and Resolving Archive Gaps
In some situations, automatic gap recovery may not take place and you will need to perform gap recovery manually. For example, you will need to perform gap recovery manually if you are using logical standby databases and the primary database is not available.
手動解決archive gap

首先確認一下發生gap的redo logfile sequence號
standby上執行:
SYS@jzh>select * from v$archive_gap;

  THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
         1            27             28
這裡顯示sequence#,27-28在standby 上丟失。
在primary上執行以下語句,檢視sequence# 27,28
SYS@jyp>select name from v$archived_log where thread#=1 and dest_id=1 and sequence# between 27 and 28;

NAME
--------------------------------------------------------------------------------
/u01/oracle/arch/1_27_867602649.arc
/u01/oracle/arch/1_28_867602649.arc

將以上兩個archivelog scp至standby並register.
SYS@jzh>alter database register logfile '/u01/oracle/arch/1_27_867602649.arc';
Database altered.
SYS@jzh>alter database register logfile '/u01/oracle/arch/1_28_867602649.arc';
Database altered.
register之後standby會自動recovery.檢視alert日誌:
alter database register logfile '/u01/oracle/arch/1_27_867602649.arc'
There are 1 logfiles specified.
ALTER DATABASE REGISTER [PHYSICAL] LOGFILE
Completed: alter database register logfile '/u01/oracle/arch/1_27_867602649.arc'
Thu Jan 01 10:04:33 2015
Media Recovery Log /u01/oracle/arch/1_27_867602649.arc
Media Recovery Waiting for thread 1 sequence 28
Fetching gap sequence in thread 1, gap sequence 28-28
Thu Jan 01 10:04:42 2015
alter database register logfile '/u01/oracle/arch/1_28_867602649.arc'
There are 1 logfiles specified.
ALTER DATABASE REGISTER [PHYSICAL] LOGFILE
Completed: alter database register logfile '/u01/oracle/arch/1_28_867602649.arc'
Thu Jan 01 10:04:43 2015
Media Recovery Log /u01/oracle/arch/1_27_867602649.arc
Media Recovery Log /u01/oracle/arch/1_28_867602649.arc
Media Recovery Waiting for thread 1 sequence 29 (in transit)

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

相關文章