How do I delete old archive logs?
Hi, in this article we are going to learn how to delete old archives using asmcmd. ASMCMD will work only in the case of the ASM environment.
Subscribe to us on YouTube
So, before deleting the archives in the ASM environment we need to know the location of archive files.
How do I delete files from ASM Diskgroup?
Step 1. Login to your RDBMS instance to know the archive file location.
export ORACLE_SID=ocp sqlplus / as sysdba SQL> show parameter db_recovery
ARCHIVE LOG LIST OUTPUT
In my case, the archives file is available on +RECO mount point.
Step 2. Login with GRID user and connect with ASMCMD prompt.
$su - grid password ******
Now you are logged in with GRID user, after that connect with the asmcmd prompt.
ASMCMD> ls DATA1/ RECO/ ASMCMD> cd RECO/ ASMCMD> ls OCP/ ASMCMD> cd OCP/ ASMCMD> ls ARCHIVELOG/ CONTROLFILE/ FLASHBACK/ ONLINELOG/ ASMCMD> cd ARCHIVELOG/ ASMCMD> ls 2021_09_12/ 2021_09_13/
Delete old archives
Step 3. I'm going to delete archives under 2021_09_12, using the below steps.
ASMCMD> cd 2021_09_12/ ASMCMD>rm * You may delete multiple files and/or directories. Are you sure? (y/n) y
Always remember after deleting the archives, must perform a crosscheck by RMAN otherwise your next database backup will be failed.
I hope now you understand how to Delete old archives using ASMCMD, if yes please write your fillings in the comment box.