1、使用这个脚本无法不清理过期的归档
[oracle@r7901:/home/oracle]\$ cat /home/oracle/scripts/del_arch.sh
#!/bin/bash
source ~/.bash_profile
deltime=`date +"20%y%m%d%H%M%S"`
rman target / nocatalog msglog /home/oracle/scripts/del_arch_\${deltime}.log<<EOF
crosscheck archivelog all;
#delete noprompt archivelog until time 'sysdate-7';
delete noprompt force archivelog until time 'sysdate-10';
EOF
2、告警: 都无法匹配到归档
RMAN> delete noprompt expired archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=3685 device type=DISK
specification does not match any archived log in the repository
RMAN> delete noprompt force archivelog until time 'sysdate-18';
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=3685 device type=DISK
specification does not match any archived log in the repository
RMAN> delete noprompt force archivelog until time 'sysdate-18';
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=3404 device type=DISK
specification does not match any archived log in the repository
检查正常
RMAN> crosscheck archivelog all;
validation succeeded for archived log
archived log file name=/oracle/arch/1_70201_1171883401.dbf RECID=12487 STAMP=1216509023
validation succeeded for archived log
archived log file name=/oracle/arch/1_70202_1171883401.dbf RECID=12489 STAMP=1216509184
validation succeeded for archived log
archived log file name=/oracle/arch/1_70203_1171883401.dbf RECID=12491 STAMP=1216509191
validation succeeded for archived log
archived log file name=/oracle/arch/1_70204_1171883401.dbf RECID=12493 STAMP=1216509197
validation succeeded for archived log
archived log file name=/oracle/arch/1_70205_1171883401.dbf RECID=12495 STAMP=1216509206
...
LIST无法匹配
RMAN> list expired archivelog all;
specification does not match any archived log in the repository
3、解决
--操作系统层面检查归档日志目录
ls -l /oracle/arch/
--如果物理文件存在但RMAN不认识,可能需要重新catalog
RMAN> catalog start with '/oracle/arch';
rman target /
delete noprompt force archivelog until time 'sysdate-18';
删除成功。
4、原因
数据库在安装之后修改了归档路径,没有进行过归档清理导致归档过大,需要将归档重新catalog