Read Oracle RMAN 11g Backup and Recovery Online
Authors: Robert Freeman
Chapter 16: Maintaining RMAN
409
Once you have properly scolded the employee for fiddling around in your hardware area with a drink and have fixed the device, you can change the status of that backup set with the
change
command again so that it will take on an AVAILABLE status. You can also change a backup status to UNAVAILABLE, indicating that the backup is not currently available. This effectively disqualifies the backup from consideration during restore and recovery operations, but protects the backup record from being removed during the execution of the
delete expired
command. Here are some examples of the use of the
change
command: change backup of database tag 'GOLD' unavailable;
change backup of database like '%GOLD%' unavailable;
change backupset 33 unavailable;
change backupset 33 available;
change archivelog 'd:\oracle\mydb\arch\arch 001.arc' unavailable;
Using the
change
command, you can modify the status of archived redo log backups. For example, you can modify the status to UNAVAILABLE for all archived redo logs that have been backed up at least a given number of times. You can also change the status of all backups that occurred using a given device. Examples of these operations are shown next: change archivelog all backed up 5 times to device type disk unavailable; change backup of database device type disk unavailable;
You can also use the
change
command to delete backup sets (physically on the backup media and from the control file and recovery catalog). The
delete
parameter is used for this operation.
First, you need to identify the RMAN backup IDs of the backups that you wish to remove. Use either the
list backup
or
list copy
command (each of which is covered in detail in the next chapter) to perform this operation. Here is an example of how to get the backup ID using the
list backup
command (we have modified the output somewhat to save space):
RMAN> list backup;
List of Backup Sets
BS Key Size
------- ----------
56 18.88M
List of Archived Logs in backup set 56
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 69 593930 07-SEP-09 612201 07-SEP-09
1 70 612201 07-SEP-09 635114 08-SEP-09
1 71 635114 08-SEP-09 635383 08-SEP-09
Backup Set Copy #1 of backup set 56
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:00:05 08-SEP-09 YES TAG20090908T025101
List of Backup Pieces for backup set 56 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
72 1 AVAILABLE
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf annnn TAG20090908T025101 5bd6qplq .bkp
410
Part III: Using RMAN Effectively
Backup Set Copy #2 of backup set 56
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:00:05 08-SEP-09 YES TAG20090908T025101
List of Backup Pieces for backup set 56 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
87 1 AVAILABLE
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf annnn TAG20090908T025101 5bd9od5x .bkp
BS Key Size
------- ----------
57 57.50K
List of Archived Logs in backup set 57
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 1 635384 08-SEP-09 635574 08-SEP-09
Backup Set Copy #1 of backup set 57
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:00:00 08-SEP-09 YES TAG20090908T025101
List of Backup Pieces for backup set 57 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
73 1 AVAILABLE
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf annnn TAG20090908T025101 5bd6qydw .bkp
Backup Set Copy #2 of backup set 57
Device Type Elapsed Time Completion Time Compressed Tag
XX
----------- ------------ --------------- ---------- ---
DISK 00:00:00 08-SEP-09 YES TAG20090908T025101
List of Backup Pieces for backup set 57 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
88 1 AVAILABLE
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf annnn TAG20090908T025101 5bd9ohdb .bkp
BS Key Type LV Size
------- ---- -- ----------
58 Full 243.80M
List of Datafiles in backup set 58
Chapter 16: Maintaining RMAN
411
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 635590 08-SEP-09 /ora01/oracle/rob1/rob1/system01.dbf
2 Full 635590 08-SEP-09 /ora01/oracle/rob1/rob1/sysaux01.dbf
3 Full 635590 08-SEP-09 /ora01/oracle/rob1/rob1/undotbs01.dbf
4 Full 635590 08-SEP-09 /ora01/oracle/rob1/rob1/users01.dbf
Backup Set Copy #1 of backup set 58
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:01:53 08-SEP-09 YES TAG20090908T025112
List of Backup Pieces for backup set 58 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
74 1 AVAILABLE
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf nnndf TAG20090908T025112 5bd6r0mz .bkp
Backup Set Copy #2 of backup set 58
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:01:53 08-SEP-09 YES TAG20090908T025112
List of Backup Pieces for backup set 58 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
89 1 AVAILABLE
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf nnndf TAG20090908T025112 5bd9ojln .bkp
BS Key Type LV Size
------- ---- -- ----------
59 Full 1.03M
SPFILE Included: Modification time: 08-SEP-09
SPFILE db unique name: ROB1
Control File Included: Ckp SCN: 635636 Ckp time: 08-SEP-09
Backup Set Copy #1 of backup set 59
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:00:02 08-SEP-09 YES TAG20090908T025112
List of Backup Pieces for backup set 59 Copy #1
BP Key Pc# Status Piece Name
------- --- ----------- ----------
75 1 AVAILABLE
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf ncsnf TAG20090908T025112 5bd6vpb1 .bkp
Backup Set Copy #2 of backup set 59
412
Part III: Using RMAN Effectively
Device Type Elapsed Time Completion Time Compressed Tag
----------- ------------ --------------- ---------- ---
DISK 00:00:02 08-SEP-09 YES TAG20090908T025112
List of Backup Pieces for backup set 59 Copy #2
BP Key Pc# Status Piece Name
------- --- ----------- ----------
90 1 AVAILABLE
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf ncsnf TAG20090908T025112 5bd9ozwy .bkp
The results of this report provide us with a detailed list of all database backups and the backup piece identifiers. We can then remove either the entire backup set, by using the BS Key identifier, or individual backup pieces, by using the BP Key identifier. Let’s assume we want to remove both backup sets. The BP Key IDs for these sets are 117 and 118. Once we have this information, we simply need to use the
change
command with the
delete
parameter, and our backup will be gone. If you are not using the FRA, then the physical piece will be removed. If you are using an FRA, then the physical file will be removed as any other file in the FRA is removed.
Here is what we would do to remove these backup sets:
RMAN> change backupset 56, 57, 58, 59 delete;
using channel ORA DISK 1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
87 56 1 2 AVAILABLE DISK
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf annnn TAG20090908T025101 5bd9od5x .bkp
72 56 1 1 AVAILABLE DISK
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf annnn TAG20090908T025101 5bd6qplq .bkp
88 57 1 2 AVAILABLE DISK
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf annnn TAG20090908T025101 5bd9ohdb .bkp
73 57 1 1 AVAILABLE DISK
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf annnn TAG20090908T025101 5bd6qydw .bkp
89 58 1 2 AVAILABLE DISK
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf nnndf TAG20090908T025112 5bd9ojln .bkp
74 58 1 1 AVAILABLE DISK
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf nnndf TAG20090908T025112 5bd6r0mz .bkp
75 59 1 1 AVAILABLE DISK
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf ncsnf TAG20090908T025112 5bd6vpb1 .bkp
90 59 1 2 AVAILABLE DISK
/oracle/app/oracle/flash recovery area/ROB1/backupset/2009 09 08
/o1 mf ncsnf TAG20090908T025112 5bd9ozwy .bkp