Friday, October 08, 2010

Delete archive log using RMAN

Caution : By deleting archive log file, you may not be able to perform point-in-time recovery of the database.

Summary
  1. connect to database using rman
  2. issue archive log delete command and confirm
  3. crosscheck archivelog all


step 1

Lnx101:demo1:/ora01/oracle $ rman target / nocatalog

Recovery Manager: Release 10.2.0.4.0 - Production on Fri Oct 8 14:11:02 2010
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: DEMO (DBID=2526927219)
using target database control file instead of recovery catalog


step 2

Execute  the following command to delete specific archive log file

RMAN> delete archivelog sequence 8407;
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=513 instance=demo1 devtype=DISK

List of Archived Log Copies
Key     Thrd Seq     S Low Time  Name
------- ---- ------- - --------- ----
6562    1    8407    A 07-OCT-10 +ORAFLASH001/demo/archivelog/2010_10_08/thread_1_seq_8407.1953.731809149

Do you really want to delete the above objects (enter YES or NO)? no



Execute the following command to delete all archivelog.

RMAN> delete archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=513 instance=demo1 devtype=DISK

List of Archived Log Copies
Key     Thrd Seq     S Low Time  Name
------- ---- ------- - --------- ----
6562    1    8407    A 07-OCT-10 +ORAFLASH001/demo/archivelog/2010_10_08/thread_1_seq_8407.1953.731809149

Do you really want to delete the above objects (enter YES or NO)? NO

Step 3

Crosscheck to sync the database dictionary, otherwise you will get error, when you take archive log backup of missing archive log

RMAN> crosscheck archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=513 instance=demo1 devtype=DISK
validation succeeded for archived log
archive log filename=+ORAFLASH001/demo/archivelog/2010_10_08/thread_1_seq_8407.1953.731809149 recid=6562 stamp=731809152
Crosschecked 1 objects
RMAN>

Hope this help. Regards Rupam