Oracle 11g 删除归档日志

时间:2022-09-28 08:41:51

工作环境ORACLE 11g 归档日志满了,手动删除出现 ora 异常。

注:工作环境是linux redhat 5

执行命令如下:

1. 进入rman

Oracle 11g 删除归档日志

2. connect target /

Oracle 11g 删除归档日志

3. crosscheck archivelog all;

4. delete expired archivelog all;

Oracle 11g 删除归档日志

执行到最后一步出现异常

RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process

官方解释:

RMAN-08137 When deleting archivelogs even when Streams CAPTURE does not require them [ID 1079953.1]

RMAN is unable to delete archive logs from database even though they are not needed by CAPTURE process anymore.

如果想强制删除,执行命令

4. delete force expired archivelog all;

Oracle 11g 删除归档日志

RMAN常用命令

1.RMAN> connect target / nocatalog

连接到目标数据库(不使用恢复目录数据库)

2.RMAN> show all;

显示rman配置

3.RMAN> report schema;

报告目标数据库的物理结构

4.RMAN> report obsolete;

报告陈旧备份

5.RMAN> report unrecoverable;

报告不可恢复的数据文件

6.RMAN> list backup;

   RMAN> list backup of database;

 RMAN> list backup of tablespace table_name;

   RMAN> list backup of controlfile;

 RMAN> list backup of spfile;

 RMAN> list backupset id;

列出备份信息

7.RMAN> crosscheck backup;

 RMAN> crosscheck backup of database;

 RMAN> crosscheck backup of tablespace system;

 RMAN> crosscheck backup of controlfile;

 RMAN> crosscheck backup of spfile;

 RMAN> crosscheck backup of archivelog all;

校验备份

8.RMAN>crosscheck archivelog all;
 RMAN>delete noprompt expired archivelog all;

校验没有备份过的归档日志

8.RMAN> delete archivelog all; 

刪除所有的Archivelog files

9.RMAN> delete force archivelog until time 'sysdate -1';
 RMAN> delete noprompt  force archivelog until time 'sysdate -2';

強制刪除昨天以前的archivelog files

10.RMAN> delete expired archivelog all;

刪除所有过期的Archivelog files

11.RMAN> delete obsolete; -- 删除陈旧备份
 RMAN> delete noprompt obsolete;

删除备份

12.RMAN> delete expired backup;

删除所有expired的备份(包括归档日志、控制文件、备份聚)
 
13.RMAN> delete backup;

删除所有备份

14.RMAN> change backupset id unavailable;

 RMAN> change backupset id keep forever logs;

 RMAN> change backupset id keep until time 'sysdate+30' logs;

 RMAN> change backupset id nokeep;

改为长期备份

15.RMAN> configure retention policy to recovery window of 30 days;

改为基于时间的备份

16.RMAN> configure retention policy to redundancy  n ;

改为基于冗余数量的备份

17.RMAN> configure retention policy to none;

取消备份保留策略:

18.RMAN> set archivelog destination to 'e:\temp';

设置归档日志存放在其它位置

不过切记,ORACLE归档日志对于ORACLE的数据恢复和备份非常重要,不到万不得已不要删除归档日志。