DATAGUARD手工注冊歸檔日志(轉(zhuǎn)載)

從9i以后,一般都不需要手工處理確實的日志,F(xiàn)AL自動會幫我們處理這些問題。?
但是,并非我們就完全不用手工處理了,比如,你的磁盤空間爆滿,歸檔日志在傳到備庫前被轉(zhuǎn)移到其他地方,這種情況下FAL是不能解決問題的,需要手工處理一下。?
下面就簡單說說手工處理日志GAP的步驟:?
1、在備庫檢查是否有日志缺失?
SQL> 0select * from V$ARCHIVE_GAP.?
THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#?
---------- ------------- --------------?
1 99 109?
從上面的信息可以看出,備庫中缺失了99到109的日志。?
2、在主庫中查詢?nèi)笔У娜罩镜乃诼窂胶兔Q?
SQL> SELECT NAME FROM V$ARCHIVED_LOG WHERE THREAD#=1 AND DEST_ID=1 AND SEQUENCE# BETWEEN 99 AND 109.?
NAME?
--------------------------------------------------------------------------------?
/u01/archivelog/1_99_626106231.arc?
/u01/archivelog/1_100_626106231.arc?
/u01/archivelog/1_101_626106231.arc?
/u01/archivelog/1_102_626106231.arc?
/u01/archivelog/1_103_626106231.arc?
/u01/archivelog/1_104_626106231.arc?
/u01/archivelog/1_105_626106231.arc?
/u01/archivelog/1_106_626106231.arc?
/u01/archivelog/1_107_626106231.arc?
/u01/archivelog/1_108_626106231.arc?
/u01/archivelog/1_109_626106231.arc?
如果把日志移動到其他路徑,則把日志所在路徑換成當(dāng)前實際所在路徑。?
3、把日志拷貝到備庫上?
sftp> get 1_99_626106231.arc?
Fetching /u01/archivelog/archive/1_99_626106231.arc to 1_99_626106231.arc?
/u01/archivelog/archive/1_99_626106231.arc 100% 17KB 17.0KB/s 00:00?
sftp> mget 1_10*?
Fetching /u01/archivelog/archive/1_100_626106231.arc to 1_100_626106231.arc?
/u01/archivelog/archive/1_100_626106231.arc 100% 4962KB 2.4MB/s 00:02?
......?
Fetching /u01/archivelog/archive/1_10_626106231.dbf to 1_10_626106231.dbf?
/u01/archivelog/archive/1_10_626106231.dbf 100% 40KB 40.0KB/s 00:00?
4、在備庫上手工注冊上一步中從主庫拷貝來的日志?
SQL> ALTER DATABASE REGISTER LOGFILE /u01/archivelog/1_99_626106231.arc.?
Database altered.?
......?
SQL> ALTER DATABASE REGISTER LOGFILE /u01/archivelog/1_109_626106231.arc.?
Database altered.?
5、稍等片刻,觀察備庫的alert日志信息?
Sun Aug 12 20:38:47 2007?
Media Recovery Log /u01/archivelog/1_99_626106231.arc?
Media Recovery Log /u01/archivelog/1_100_626106231.arc?
Media Recovery Log /u01/archivelog/1_101_626106231.arc?
Media Recovery Log /u01/archivelog/1_102_626106231.arc?
......?
從以上信息,可以看出之前注冊的日志已經(jīng)被正常應(yīng)用。?
6、檢查備庫是否還有日志GAP?
SQL> 0select * from V$ARCHIVE_GAP.?
no rows 0selected?
如果有行返回,則重復(fù)2-5步,直到查詢結(jié)果是"no rows 0selected"。?
如果日志只是臨時移動到其他地方,過后會再移回原路徑,則不用這么大費(fèi)周折手工去手工處理了,把日志拷回原處后FAL會自動處理GAP。
了解更多相關(guān)內(nèi)容歡迎關(guān)注http://www.vecloud.com/