Thursday, March 28, 2013

Delete backupset irregardless of deletion policy

1. files before delettion

orarac2poc:TTS:/u01/app/oracle/product/11.2.0/db_2/dbs> ls -l 01o536r8_1_1
-rw-r----- 1 oracle asmadmin 200278016 Mar 21 13:50 01o536r8_1_1
orarac2poc:TTS:/u01/app/oracle/product/11.2.0/db_2/dbs> ls -l c-1769654909-20130326-00
-rw-r----- 1 oracle asmadmin 9830400 Mar 26 15:05 c-1769654909-20130326-00

2. list backup sets

RMAN> report obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
no obsolete backups found

RMAN> list backup ;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    190.99M    DISK        00:01:11     21-MAR-13
        BP Key: 1   Status: AVAILABLE  Compressed: YES  Tag: TAG20130321T134928
        Piece Name: /u01/app/oracle/product/11.2.0/db_2/dbs/01o536r8_1_1
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 721426     21-MAR-13 /u02/oradata/TTS/system01.dbf
  2       Full 721426     21-MAR-13 /u02/oradata/TTS/sysaux01.dbf
  3       Full 721426     21-MAR-13 /u02/oradata/TTS/undotbs01.dbf
  4       Full 721426     21-MAR-13 /u02/oradata/TTS/users01.dbf
  5       Full 714646     21-MAR-13 /u02/oradata/TTS/tts1_01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    9.36M      DISK        00:00:02     26-MAR-13
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20130326T150504
        Piece Name: /u01/app/oracle/product/11.2.0/db_2/dbs/c-1769654909-20130326-00
  SPFILE Included: Modification time: 26-MAR-13
  SPFILE db_unique_name: TTS
  Control File Included: Ckp SCN: 976753       Ckp time: 26-MAR-13

3. Delete and verification
RMAN> delete backupset;

using channel ORA_DISK_1

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1       1       1   1   AVAILABLE   DISK        /u01/app/oracle/product/11.2.0/db_2/dbs/01o536r8_1_1
2       2       1   1   AVAILABLE   DISK        /u01/app/oracle/product/11.2.0/db_2/dbs/c-1769654909-20130326-00

Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u01/app/oracle/product/11.2.0/db_2/dbs/01o536r8_1_1 RECID=1 STAMP=810654568
deleted backup piece
backup piece handle=/u01/app/oracle/product/11.2.0/db_2/dbs/c-1769654909-20130326-00 RECID=2 STAMP=811091105
Deleted 2 objects


RMAN> list backup;

specification does not match any backup in the repository



orarac2poc:TTS:/u01/app/oracle/product/11.2.0/db_2/dbs> ls -l c-1769654909-20130326-00
ls: c-1769654909-20130326-00: No such file or directory
orarac2poc:TTS:/u01/app/oracle/product/11.2.0/db_2/dbs> ls -l 01o536r8_1_1
ls: 01o536r8_1_1: No such file or directory