How to Delete old archives using ASMCMD?

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.

Read: How to create ASM diskgroup

Subscribe to us on YouTube

So, before deleting the archives in the ASM environment we need to know the location of archive files.

Step 1. Login in your RDBMS instance to knowing the archive file location.

export ORACLE_SID=ocp
sqlplus / as sysdba

SQL> show parameter db_recovery

OUTPUT:

Delete old archives using ASMCMD

ARCHIVE LOG LIST OUTPUT

Delete old archives using ASMCMD

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 asmcmd prompt.

$asmcmd
ASMCMD>
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/

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.

Leave a Comment

%d bloggers like this:
Enable Notifications    OK No thanks