Oracle RMAN 11g Backup and Recovery (139 page)

BOOK: Oracle RMAN 11g Backup and Recovery
8.3Mb size Format: txt, pdf, ePub

Chapter 16: Maintaining RMAN
413

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

deleted backup piece

backup piece

handle /oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf annnn TAG20090908T025101 5bd9od5x .bkp RECID 16 STAMP 697002060

deleted backup piece

backup piece

handle /oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf annnn TAG20090908T025101 5bd6qplq .bkp RECID 1 STAMP 696999062

deleted backup piece

backup piece

handle /oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf annnn TAG20090908T025101 5bd9ohdb .bkp RECID 17 STAMP 697002063

deleted backup piece

backup piece

handle /oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf annnn TAG20090908T025101 5bd6qydw .bkp RECID 2 STAMP 696999070

deleted backup piece

backup piece

handle /oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf nnndf TAG20090908T025112 5bd9ojln .bkp RECID 18 STAMP 697002064

deleted backup piece

backup piece

handle /oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf nnndf TAG20090908T025112 5bd6r0mz .bkp RECID 3 STAMP 696999072

deleted backup piece

backup piece

handle /oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf ncsnf TAG20090908T025112 5bd6vpb1 .bkp RECID 4 STAMP 696999190

deleted backup piece

backup piece

handle /oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf ncsnf TAG20090908T025112 5bd9ozwy .bkp RECID 19 STAMP 697002079

Deleted 8 objects

In this example, backup sets 56, 57, 58, and 59, as well as all the associated backup pieces, will be removed. Here are some additional examples of other options for the
change
command that will result in the removal of backup set pieces:

change backuppiece 1304 delete;

change archivelog until logseq 544 delete;

Finally, you can use the
change backuppiece uncatalog
command to remove backup set pieces from the catalog. If the
change backuppiece uncatalog
command removes the last remaining backup set piece, then it will also remove the backup set record. Here is an example of using the
change backuppiece uncatalog
command:

RMAN> Change backuppiece

'/u01/oracle/RMAN/mydb/mydb user01 01.bak' uncatalog;

414
Part III: Using RMAN Effectively

RMAN Workshop:
Using the change Command

Workshop Notes

This workshop assumes that you have a functional Oracle database running in ARCHIVELOG

mode, that you are backing up your database to disk, that you have a tablespace called USERS

in your database, and that one datafile is associated with the USERS tablespace.

Step 1.
Using RMAN, back up the USERS tablespace:

RMAN> backup tablespace users;

Starting backup at 08 SEP 09

using channel ORA DISK 1

channel ORA DISK 1: starting full datafile backup set

channel ORA DISK 1: specifying datafile(s) in backup set

input datafile file number 00004 name /ora01/oracle/rob1/rob1/users01.dbf channel ORA DISK 1: starting piece 1 at 08 SEP 09

channel ORA DISK 1: finished piece 1 at 08 SEP 09

piece handle=/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf nnndf TAG20090908T051140 5bdgzfc9 .bkp tag=TAG20090908T051140 comment=NONE

channel ORA DISK 1: backup set complete, elapsed time: 00:00:01

Finished backup at 08 SEP 09

Step 2.
Look at the output of the backup, and determine the backup set piece that has just been created. The backup set piece is highlighted in the output in Step 1.

Step 3.
Use the
list backup of tablespace users
command to determine the backup key of the backup set piece that you need to mark as DELETED in the control file or recovery catalog. Note in the following output that we have highlighted the backup set key and the related backup set piece:

RMAN> list backup of tablespace users;

List of Backup Sets

BS Key Type LV Size

68 Full 1.03M

List of Datafiles in backup set 68

File LV Type Ckp SCN Ckp Time Name

4 Full 637442 08 SEP 09 /ora01/oracle/rob1/rob1/users01.dbf

Backup Set Copy #2 of backup set 68

Device Type Elapsed Time Completion Time Compressed Tag

DISK 00:00:01 08 SEP 09 NO TAG20090908T032815

List of Backup Pieces for backup set 68 Copy #2

BP Key Pc# Status Piece Name

96
1 AVAILABLE

/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf nnndf TAG20090908T032815 5bd9pon1 .bkp

Chapter 16: Maintaining RMAN
415

Backup Set Copy #1 of backup set 68

Device Type Elapsed Time Completion Time Compressed Tag

DISK 00:00:01 08 SEP 09 NO TAG20090908T032815

List of Backup Pieces for backup set 68 Copy #1

BP Key Pc# Status Piece Name

84
1 AVAILABLE

/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf nnndf TAG20090908T032815 5bd8xhxm .bkp

BS Key Type LV Size Device Type Elapsed Time Completion Time

176 Full 5.07M DISK 00:00:01 08 SEP 09

BP Key: 179
Status: AVAILABLE Compressed: NO Tag: TAG20090908T040309

Piece Name: /oracle/backup/0hkomrbt 1 1

List of Datafiles in backup set 176

File LV Type Ckp SCN Ckp Time Name

4 Full 642222 08 SEP 09 /ora01/oracle/rob1/rob1/users01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time

421 Full 5.52M DISK 00:00:00 08 SEP 09

BP Key: 424
Status: AVAILABLE Compressed: NO Tag: TAG20090908T051140

Piece Name:

oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf nnndf TAG20090908T051140 5bdgzfc9 .bkp

List of Datafiles in backup set 421

File LV Type Ckp SCN Ckp Time Name

4 Full 644956 08 SEP 09 /ora01/oracle/rob1/rob1/users01.dbf

Step 4.
Exit to the operating system, and do a directory listing on the backup set piece. You should see it.

Step 5.
Use the
change backuppiece
command to change the status flag of this backup set piece from AVAILABLE to DELETED:

RMAN> change backuppiece 96 delete;

using channel ORA DISK 1

List of Backup Pieces

BP Key BS Key Pc# Cp# Status Device Type Piece Name

------- ------- --- --- ----------- ----------- ----------

96 68 1 2 AVAILABLE DISK

/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf nnndf TAG20090908T032815 5bd9pon1 .bkp

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

deleted backup piece

backup piece

handle /oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08

/o1 mf nnndf TAG20090908T032815 5bd9pon1 .bkp RECID 25 STAMP 697002101

Deleted 1 objects

416
Part III: Using RMAN Effectively

Step 6.
Use the
list backup of tablespace users
command to determine that the backup set piece is no longer available for use during a recovery:

RMAN> list backup of tablespace users;

Step 7.
Exit to the operating system, and do a directory listing on the backup set piece. You should no longer see the backup set piece. Oracle removed it, if it existed.

The delete Command

All good things must come to an end, and the same is true about the life of a given backup set.

With a retention policy, we can mark backups whose usefulness and lifetime are at an end. As we mentioned already, enforcement of a redundancy policy does not remove the backups from the catalog, but rather just marks the backups with a status of OBSOLETE. The same is true with the
crosscheck
command, which we discussed earlier in this chapter. The
crosscheck
command marks obsolete backups and copies as EXPIRED, but does not remove them.

Enter the
delete
command, the grim reaper of RMAN. It is the raven that swoops down and puts the kibosh on your backups and copies. With the
delete
command, you can remove any backups that have been made obsolete based on a retention criterion, and you can change the status of any expired backups in the recovery catalog or control file to a status of DELETED. Here are a couple of examples of the
delete
command in use:

delete expired;

delete obsolete;

When you issue a
delete
command, the associated RMAN backup records will be removed from the recovery catalog. You can see this by looking at the recovery catalog view WR_BACKUP_

PIECE. Records contained in the database control file will be kept in the control file until overwritten. These records will appear in the V$BACKUP_PIECE view with a status of D. These deleted records will not appear in RMAN command output, such as
list backup of database
summary
.

When you issue a
delete
command, RMAN will request that you confirm your instructions.

Once you have confirmed your instructions, RMAN will complete the
delete
operation. You can use the
noprompt
option of the
delete
command to avoid the requirement to verify the execution of the
delete
command. This is handy if you are writing scripts to work with RMAN. Here is an example of using the
delete
command with the
noprompt
option: delete noprompt obsolete;

NOTE

Once a backup has been marked with a DELETED status, you cannot

get it back. You can still recover the backup, if it’s physically available,
by using the
catalog
command to register the backup sets in the control
file/recovery catalog.

Other books

Bob of Small End by David Hockey
Exile by Denise Mina
A Wish Upon Jasmine by Laura Florand
Scrivener's Tale by Fiona McIntosh
Riley by Susan Hughes
Blood Purple by Ashley Nemer
The Witch's Market by Mingmei Yip