fbpx

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.

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.

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

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 the 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/

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.

2 thoughts on “How to Delete old archives using ASMCMD?”

Leave a Comment