這一篇介紹RMAN刪除歸檔日志時的驗證。
在11g以前的版本,Oracle的rman并沒有和其他日志應用系統緊密結合起來,因此,rman刪除歸檔日志的時候并不會判斷這個日志是否對其他系統仍然有用。
當rman刪除日志后,可能會發現其他的系統比如DATA GUARD、STREAMS等由于日志被刪除而無法正常工作。
從11g開始,rman在刪除時會首先判斷,這個日志是否其他系統仍然需要,當其他需要仍然需要這個日志時,rman會報警,且不會刪除這個日志。
先看看10g下的情況:
SQL> conn sys/test@testrac_standby as sysdba已連接。
SQL> select sequence# from v$managed_standby where status = 'WAIT_FOR_LOG';
SEQUENCE#
----------
577
SQL> shutdown immediate
ORA-01109: 數據庫未打開
已經卸載數據庫。
ORACLE 例程已經關閉。
SQL> exit從 Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options 斷開
$ rman target /
恢復管理器: Release 10.2.0.3.0 - Production on 星期四 9月 13 04:14:09 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
連接到目標數據庫: TESTRAC (DBID=4291216984)
RMAN> delete archivelog sequence 577;
使用目標數據庫控制文件替代恢復目錄分配的通道: ORA_DISK_1通道 ORA_DISK_1: sid=286 實例=testrac1 devtype=DISK分配的通道: ORA_DISK_2通道 ORA_DISK_2: sid=308 實例=testrac2 devtype=DISK
已存檔的日志副本列表關鍵字 Thrd Seq S 時間下限 名稱
------- ---- ------- - ---------- ----
1981 1 577 A 31-8月 -07 /data1/archivelog/1_577_626291662.dbf
是否確定要刪除以上對象 (輸入 YES 或 NO)? no
在10g中,rman不會檢查這個日志是否其他系統仍然需要,而在11g中,這個問題得到解決:
[oracle@yangtk ~]$ rman target / Recovery Manager: Release 11.1.0.6.0 - Production on Sun Oct 21 09:02:08 2007 Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: ORA11G (DBID=4026820313) RMAN> delete archivelog all; using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=128 device type=DISK RMAN-08137: WARNING: archived log not deleted as it is still needed archived log file name=/data/oracle/oradata/ora11g/archivelog/1_212_630620185.dbf thread=1 sequence=212 RMAN-08137: WARNING: archived log not deleted as it is still needed archived log file name=/data/oracle/oradata/ora11g/archivelog/1_213_630620185.dbf thread=1 sequence=213 |