How to delete expired archive log files using rman?

时间:2023-03-09 04:00:46
How to delete expired archive log files using rman?

he following commands will helpful to delete the expired archive log files using Oracle Recovery Manager(RMAN).Connect to the Rman prompt and try the bellow commands.

RMAN>list expired archivelog all;

RMAN>crosscheck archivelog all;
RMAN>delete noprompt expired archivelog all;
RMAN>list expired archivelog all;

Sample Ouptut:

RMAN> list expired archivelog all;
specification does not match any archived log in the repository
RMAN>

In my develop environment , sometime the archive destination folder is full, caused the database hang. So I will use below command to disable it.

Disable Archive log mode

startup mount

alter database noarchivelog;

alter database open;

方法一:
rman target/
或rman target/@orcl
在命令窗口里面执行
delete noprompt archivelog until time 'sysdate-7'; //删除七天前的归档,果使用了闪回功能,也会删除闪回的数据。 
DELETE ARCHIVELOG FROM TIME 'SYSDATE-7'; //删除七天到现在的归档

方法二:(rman登不进去)

执行find /archive/ -name "*.dbf"|wc –l查看有多少归档日志
删除7天之前的所有归档文件
find /archive/ -name "*.dbf" -mtime +7  -exec rm -f {} ;

将归档日志信息进行更新

asm 就得用asmcmd交互界面rm了
RMAN> crosscheck archivelog all;
RMAN> delete noprompt expired archivelog all; 
RMAN> exit