未设置归档删除策略时,
rman target /
delete archivelog all;
可以直接删除归档。
如果设置了归档删除策略,delete archivelog all; 不能删除。如果加上 force 关键字可以删除。
RMAN> configure archivelog deletion policy to backed up 1 times to disk;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DISK;
new RMAN configuration parameters are successfully stored
RMAN> list archivelog all;
List of Archived Log Copies for database with db_unique_name CDB1
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
237 1 366 A 28-APR-24
Name: /home/oracle/arch/1_366_1163583990.dbf
238 1 367 A 28-APR-24
Name: /home/oracle/arch/1_367_1163583990.dbf
RMAN> delete archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=278 device type=DISK
RMAN-08138: warning: archived log not deleted - must create more backups
archived log file name=/home/oracle/arch/1_366_1163583990.dbf thread=1 sequence=366
RMAN-08138: warning: archived log not deleted - must create more backups
archived log file name=/home/oracle/arch/1_367_1163583990.dbf thread=1 sequence=367
RMAN> delete noprompt archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=278 device type=DISK
RMAN-08138: warning: archived log not deleted - must create more backups
archived log file name=/home/oracle/arch/1_366_1163583990.dbf thread=1 sequence=366
RMAN-08138: warning: archived log not deleted - must create more backups
archived log file name=/home/oracle/arch/1_367_1163583990.dbf thread=1 sequence=367
RMAN> delete force noprompt archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=278 device type=DISK
List of Archived Log Copies for database with db_unique_name CDB1
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
237 1 366 A 28-APR-24
Name: /home/oracle/arch/1_366_1163583990.dbf
238 1 367 A 28-APR-24
Name: /home/oracle/arch/1_367_1163583990.dbf
deleted archived log
archived log file name=/home/oracle/arch/1_366_1163583990.dbf RECID=237 STAMP=1167479060
deleted archived log
archived log file name=/home/oracle/arch/1_367_1163583990.dbf RECID=238 STAMP=1167479061
Deleted 2 objects
RMAN> list archivelog all;
specification does not match any archived log in the repository
RMAN>