在dataguard的配置當中,LOG_ARCHIVE_DEST_n參數的配置比較重要,故做下整理
以下是reference中的截圖
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiInBnauEjMwQDSVJ3UJlGcKFUQshzVEdmdfFmYZFTbvl2S39CXGVzLcRzNvwFMw00LcJDMzZWe39CXt92Yu8GdjFTNuMzcvw1LcpDc0RHaiojIsJye.jpg)
The LOG_ARCHIVE_DEST_n initializationparameter defines up to 31 (where n = 1, 2, 3, ... 31) destinations,each of which must specify either the LOCATION or the SERVICE attribute to specify where toarchive the redo data. All other attributes are optional. Note that whether youare specifying the LOCATIONattribute or the SERVICE attribute, it must be the firstattribute supplied in the list of attributes.
If you choosenot to enter any attributes, then you can specify a NULL string by entering thefollowing:
LOG_ARCHIVE_DEST_n='';
You set theattributes for the LOG_ARCHIVE_DEST_n initialization parameter to control differentaspects of how redo transport services transfer redo data from a production orprimary database destination to another (standby) database destination. You canquery the V$ARCHIVE_DEST view tosee the current attribute settings for each destination (n).
For every
LOG_ARCHIVE_DEST_n
initialization parameter that you define, you must specify acorresponding
LOG_ARCHIVE_DEST_STATE_n
parameter. The
LOG_ARCHIVE_DEST_STATE_n
(where
n
is an integer from 1 to 31) initialization parameter specifies whetherthe corresponding destination is currently enabled or disabled.
Destinations
LOG_ARCHIVE_DEST_11
through
LOG_ARCHIVE_DEST_31
do not support the
SYNC
,
ARCH
LOCATION
MANDATORY
, or
ALTERNATE
attributes, and cannot be specified as the target of the
ALTERNATE
attribute.
LOG_ARCHIVE_DEST_11
LOG_ARCHIVE_DEST_31
can only be used when the
COMPATIBLE
initialization parameter is set to
11.2.0
or higher.
參數解釋:
1.AFFIRM和NOAFFIRM
AFFIRM明确指定redo傳輸目的地在寫redo資料到standby redo日志之後告知傳送者接收到了redo資料
NOAFFIRM明确指定redo傳輸目的地在寫redo資料到standby redo日志之前告知傳送者接收到了redo資料
如果沒有明确指定,當sync屬性被指定時,預設是AFFIRM,當async屬性被指定,預設是NOAFFIRM
2.db_unique_name
這個參數在目的地指定資料庫唯一的名字,如果在DG中有多個standby資料庫,這個屬性有用,使用db_unique_name屬性能明确辨別主資料庫和standby資料庫之間的關系。db_unique_name指定的名字必須比對在DG_CONFIG清單中db_unique_name的其中一個值,db_unique_name屬性指定的名字還必須比對指定目的地資料庫初始化參數db_unique_name的值,如果不指定,連接配接會被拒絕。
3.delay
delay參數明确指定一個standby位置應用接收到的歸檔redo資料延遲的時間,delay是可選的,預設是沒有任何延遲,delay屬性的設定表明在standby目的地應用歸檔redo日志是不活動的,直到指定的時間間隔過期才會應用日志,在standby資料庫上,當redo資料庫成功傳輸和歸檔後開始計算時間,delay的時間間隔以分鐘為機關,可以用于保護standby資料庫免遭、來自主資料庫的使用者錯誤或者損壞帶來的影響,是一種折中方案,在failover過程中必然需要更多的時間來應用日志。Delay不影響redo時間傳送到standby目的地,如果啟動實時應用,設定的任何延遲都将被忽略。改變delay屬性設定會在下一次redo時間呗歸檔時起作用,正在歸檔的日志不受影響
4.location和service
每個目的地必須制定location或者service屬性,用來制定redo傳輸服務栓出redo資料到本地磁盤目錄或者遠端資料庫目的地。
log_archive_dest_1—log_archive_dest_10目的地能包括
location屬性或者service屬性
log_archive_dest_11—log_archive_dest_31目的地隻能包括
service屬性。
如果要為log_archive_dest_n初始化參數指定多個屬性,在屬性清單中首先指定location或者service屬性。確定資料庫本地歸檔redo日志目錄是可通路的使用location屬性至少指定一個本地磁盤目錄。通過指定location='use_db_recovery_file_dest'
可以指定檔案傳輸位置為閃回恢複區。對應資料庫初始化參數db_recovery_file_dest指定的目錄,oracle通過omf自動管理存儲在閃回恢複區中的檔案,在service屬性中必須使用Oracle net服務名
5.SYNC和ASYNC
指定使用同步sync傳輸或者異步async傳輸模式。
log_archive_dest_11—log_archive_dest_31不支援sync屬性,sync屬性表明通過食物生成的redo資料在食物送出之前必須被每個啟用的目的地接收,async屬性表明通過食物生成的redo資料在事務送出之前不需要被目的地接收,如果沒有指定,預設值是async
6.vaild_for
在DG中,Oracle基于資料庫角色和redo日志類型判斷log_archive_dest_n指定的目錄是否産生相應的歸檔redo日志,vaild_for屬性可選,Oracle推薦在DG配置中的每個資料庫為日志傳輸目的地指定vaild_for屬性,以至于主資料庫角色轉換到配置中的任何standby資料庫之後,redo傳輸都能繼續工作。
為每個log_archive_dest_n目的地配置valid_for參數
VALID_FOR=(redo_log_type,database_role)
redo_log_type關鍵字表明該目的地産生歸檔的redo日志類型
online_logfile:目的地隻歸檔聯機redo日志
standby_logfile:目的地隻歸檔standbyredo日志
all_logfiles:目的地既歸檔聯機redo日志,也歸檔standby redo日志
database_role表明該目的地産生歸檔的資料庫角色
primary_role:隻有資料庫是主,該目的地才會産生歸檔
standby_role:隻有資料庫是備,該目的地才會産生歸檔
all_role:當資料庫不論是主還是備,該目的地都會産生歸檔
如果目的地沒有指定valid_for屬性,預設情況下,不管資料庫是主還是備,目的地都會歸檔聯機redo和standby redo,預設的行為等于設定valid_for=(all_logfiles,all_roles)屬性值,在主資料庫和standby資料庫中可以使用相同的初始化參數設定啟用valid_for屬性
例子: