Oracle 如何删除归档日志文件 |
发布时间: 2012/9/18 17:39:53 |
Oracle的OEM管理器中有可视化的日志展现出,当我们手工清除archive目录下的文件后,这些记录并没有被我们从controlfile中清除掉,也就是oracle并不知道这些文件已经不存在了!这时候我们要做手工的清除的话,下面我经过实验,可以尝试这种方法: 1. 进入rman 4. delete expired archivelog all; Oracle正确删除归档并回收空间的方法 备份非常重要,不到万不得已不要删除归档日志。 UNIX/LINUX下也可以通过FIND找到7天前的归档数据,使用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 试着同步一下,看行不行,结果不行,crosscheck还是失败: 正在启动全部恢复目录的 resync RMAN> crosscheck archivelog all; 释放的通道: ORA_DISK_1 7 用list expired看看是否有失效的archive log,证明没有失效的archive log: 说明与恢复目录中的任何存档日志均不匹配 8 更改语言环境试试,结果再次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
本文出自:亿恩科技【www.enkj.com】 |