Oracle 如何刪除歸檔日志文件 |
發(fā)布時間: 2012/9/14 16:45:35 |
Oracle的OEM管理器中有可視化的日志展現(xiàn)出,當我們手工清除archive目錄下的文件后,這些記錄并沒有被我們從controlfile中清除掉,也就是oracle并不知道這些文件已經(jīng)不存在了!這時候我們要做手工的清除的話,下面我經(jīng)過實驗,可以嘗試這種方法: 1. 進入rman 4. delete expired archivelog all; Oracle正確刪除歸檔并回收空間的方法 備份非常重要,不到萬不得已不要刪除歸檔日志。 UNIX/LINUX下也可以通過FIND找到7天前的歸檔數(shù)據(jù),使用EXEC子操作刪除 find /oraarchive -xdev -mtime +7 -name "*.dbf" -exec rm -f {} ; 3.簡要介紹一下report obsolete命令 使用report obsolete命令報告過期備份 RMAN> report obsolete;RMAN retention policy will be applied to the commandRMAN retention policy is set to redundancy 1Report of obsolete backups and copiesType Key Completion Time Filename/Handle-------------------- ------ ------------------ --------------------Backup Set 125 01-NOV-04Backup Piece 125 01-NOV-04 /data1/Oracle/orabak/full_1_541045804Backup Set 131 04-NOV-04Backup Piece 131 04-NOV-04 /data1/oracle/orabak/full_AVATAR2_20041104_131....Backup Set 173 06-DEC-04Backup Piece 173 06-DEC-04 /data1/oracle/orabak/full_AVATAR2_20041206_173Backup Set 179 11-DEC-04Backup Piece 179 11-DEC-04 /data1/oracle/orabak/arch544588206.arc.....Backup Piece 189 17-DEC-04 /data1/oracle/orabak/arch545106606.arcBackup Set 190 17-DEC-04Backup Piece 190 17-DEC-04 /data1/oracle/orabak/arch545106665.arcBackup Set 191 20-DEC-04Backup Piece 191 20-DEC-04 /data1/oracle/orabak/arch_AVATAR2_20041220_194Archive Log 2973 20-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2985.dbfArchive Log 2971 20-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2984.dbf.....Archive Log 2705 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2717.dbfArchive Log 2704 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2716.dbfArchive Log 2703 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2715.dbfArchive Log 2702 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2714.dbf 4.使用delete obsolete命令刪除過期備份: RMAN> delete obsolete;RMAN retention policy will be applied to the commandRMAN retention policy is set to redundancy 1using channel ORA_DISK_1Deleting the following obsolete backups and copies:Type Key Completion Time Filename/Handle-------------------- ------ ------------------ --------------------Backup Set 125 01-NOV-04Backup Piece 125 01-NOV-04 /data1/Oracle/orabak/full_1_541045804....Archive Log 2704 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2716.dbfArchive Log 2703 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2715.dbfArchive Log 2702 17-DEC-04 /opt/oracle/oradata/avatar2/archive/1_2714.dbfDo you really want to delete the above objects (enter YES or NO)? yesdeleted backup piecebackup piece handle=/data1/oracle/orabak/full_AVATAR2_20041206_173 recid=173 stamp=544156241.....deleted archive logarchive log filename=/opt/oracle/oradata/avatar2/archive/1_2715.dbf recid=2703 stamp=545108268deleted archive logarchive log filename=/opt/oracle/oradata/avatar2/archive/1_2714.dbf recid=2702 stamp=545107659Deleted 286 objectsRMAN> crosscheck archivelog all;released channel: ORA_DISK_1allocated channel: ORA_DISK_1channel ORA_DISK_1: sid=19 devtype=DISKspecification does not match any archive log in the recovery catalog
釋放的通道: ORA_DISK_1 6 試著同步一下,看行不行,結(jié)果不行,crosscheck還是失敗: 正在啟動全部恢復目錄的 resync RMAN> crosscheck archivelog all; 釋放的通道: ORA_DISK_1 7 用list expired看看是否有失效的archive log,證明沒有失效的archive log: 說明與恢復目錄中的任何存檔日志均不匹配 8 更改語言環(huán)境試試,結(jié)果再次crosscheck,2個archive log 都成功了:
C:>set nls_lang=american_america.zhs16gbk C:>rman catalogrman/rman@safetarget / Recovery Manager: Release 9.2.0.1.0 - Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. connected to target database: TEST (DBID=1870953724) RMAN> crosscheck archivelog all; allocated channel: ORA_DISK_1
本文出自:億恩科技【mszdt.com】 服務(wù)器租用/服務(wù)器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM] |