Today, a friend asked me how to delete archive logs in Oracle10g and answered the following question:
Archiving logs in Oracle cannot be directly deleted by operating system (OS) commands, because some information of archiving logs is recorded in the control file, in addition, the information in the control file will not change after the OS-level command is directly deleted, and the information in the related system view will not change. The Oracle system still considers archive logs to exist.
How can I delete archive logs correctly?
You can use the following methods:
You can use RMAN to delete archivelog. follow these steps:
1. Use OS-level commands to physically Delete archivelog
2. Enter RMAN
3. crosscheck archivelog all;
4. delete expried archivelog all;
In this way, the corresponding archivelog records cannot be found in some Oracle records.
Ii. directly use RMAN to delete archivelog
In fact, in RMAN, you can use the command to directly Delete ARCHIVELOG. The command is as follows:
RMAN> delete archivelog all completed before 'sysdate-7 ';
This command deletes all archivelog seven days ago. However, the disadvantage of this command is that archivelog cannot be divided in detail.
Iii. Use RMAN to back up aechivelog and delete it
This is the most secure method. Use RMAN to back up archivelog and delete all backups.
Backup format'/u01/arch _ % T _ % s _ % U' archivelog all delete input;
Or
Backup database plus archivelog;