Oracle Technologies Blog

By ASKM

Deleting RMAN “NO EXPIRE” BACKUPS FROM TAPE

Posted by Srikrishna Murthy Annam on November 3, 2011

The following steps are useful to delete the backups which are marked as NO-EXPIRE. No expire backup are the backups for which the retention policy will not apply and the backups remain till you manually and forcibly delete these backups.  The best example for No-expire backups are the backups kept for training purposes. After successfully creating any training environment, we will backup the database with NO-Expire option and these backups will be used to refresh the database every week.

The following commands show you how to delete these no-expire backups on tape from  RMAN CATALOG. This is useful in cases where if you made any changes to the databases and need to preseve these changes in the database forever, you will take new NO-EXPIRE backups and delete the old backups.

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
145913  B  0  A SBT_TAPE    25-APR-11       1       1       YES        NOEXPIRE
145914  B  0  A SBT_TAPE    25-APR-11       1       1       YES        NOEXPIRE
145915  B  0  A SBT_TAPE    25-APR-11       1       1       YES        NOEXPIRE
145916  B  0  A SBT_TAPE    25-APR-11       1       1       YES        NOEXPIRE
145917  B  0  A SBT_TAPE    25-APR-11       1       1       YES        NOEXPIRE
147274  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147275  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147276  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147277  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147278  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147498  B  F  A SBT_TAPE    29-APR-11       1       1       NO         NOEXPIRE

RMAN> DELETE BACKUPSET 145913,145914,145915,145916,145917;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=522 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 05/01/2011 01:20:25
RMAN-06160: no backup pieces found for backup set key: 145913

RMAN> ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;

released channel: ORA_DISK_1
allocated channel: ORA_MAINT_SBT_TAPE_1
channel ORA_MAINT_SBT_TAPE_1: sid=522 devtype=SBT_TAPE
channel ORA_MAINT_SBT_TAPE_1: Data Protection for Oracle: version 5.5.2.0

RMAN> ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;

allocated channel: ORA_MAINT_SBT_TAPE_2
channel ORA_MAINT_SBT_TAPE_2: sid=525 devtype=SBT_TAPE
channel ORA_MAINT_SBT_TAPE_2: Data Protection for Oracle: version 5.5.2.0

RMAN> DELETE BACKUPSET 145913,145914,145915,145916,145917;

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
145919  145913  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set9_piece1_copy1_20110425_09mal5t9_1_1
145920  145914  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set8_piece1_copy1_20110425_08mal5t9_1_1
145921  145915  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set11_piece1_copy1_20110425_0bmal6d9_1_1
145922  145916  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set7_piece1_copy1_20110425_07mal5t9_1_1
145923  145917  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set10_piece1_copy1_20110425_0amal6br_1_1

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

RMAN> delete noprompt BACKUPSET 145913,145914,145915,145916,145917;

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
145919  145913  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set9_piece1_copy1_20110425_09mal5t9_1_1
145920  145914  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set8_piece1_copy1_20110425_08mal5t9_1_1
145921  145915  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set11_piece1_copy1_20110425_0bmal6d9_1_1
145922  145916  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set7_piece1_copy1_20110425_07mal5t9_1_1
145923  145917  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set10_piece1_copy1_20110425_0amal6br_1_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of delete command on ORA_MAINT_SBT_TAPE_1 channel at 05/01/2011 01:27:05
ORA-27191: sbtinfo2 returned error
Additional information: 2

RMAN> delete noprompt force BACKUPSET 145913,145914,145915,145916,145917;

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
145919  145913  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set9_piece1_copy1_20110425_09mal5t9_1_1
145920  145914  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set8_piece1_copy1_20110425_08mal5t9_1_1
145921  145915  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set11_piece1_copy1_20110425_0bmal6d9_1_1
145922  145916  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set7_piece1_copy1_20110425_07mal5t9_1_1
145923  145917  1   1   AVAILABLE   SBT_TAPE    backup_CRTRNG_3679252776_set10_piece1_copy1_20110425_0amal6br_1_1
deleted backup piece
backup piece handle=backup_CRTRNG_3679252776_set9_piece1_copy1_20110425_09mal5t9_1_1 recid=7 stamp=749377449
deleted backup piece
backup piece handle=backup_CRTRNG_3679252776_set8_piece1_copy1_20110425_08mal5t9_1_1 recid=8 stamp=749377449
deleted backup piece
backup piece handle=backup_CRTRNG_3679252776_set11_piece1_copy1_20110425_0bmal6d9_1_1 recid=9 stamp=749377962
deleted backup piece
backup piece handle=backup_CRTRNG_3679252776_set7_piece1_copy1_20110425_07mal5t9_1_1 recid=10 stamp=749377449
deleted backup piece
backup piece handle=backup_CRTRNG_3679252776_set10_piece1_copy1_20110425_0amal6br_1_1 recid=11 stamp=749377916
Deleted 5 objects

RMAN> list backup summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
147274  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147275  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147276  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147277  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147278  B  0  A SBT_TAPE    29-APR-11       1       1       YES        NOEXPIRE
147498  B  F  A SBT_TAPE    29-APR-11       1       1       NO         NOEXPIRE

RMAN>

Hope it helps

SRI

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: