Read Oracle RMAN 11g Backup and Recovery Online
Authors: Robert Freeman
217 Incr 1 328.00K DISK 00:01:10 23-FEB-06
BP Key: 217 Status: AVAILABLE Compressed: YES
Tag: TAG20060223T144904
Piece Name:
C:\ORACLE\PRODUCT\10.2.0\FLASH RECOVERY AREA\ROB10R2\BACKUPSET\2006 02 23
\O1 MF NNND1 TAG20060223T144904 1ZW7Z98D .BKP
List of Datafiles in backup set 217
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 1 Incr 4472653 23-FEB-06
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\SYSTEM01.DBF
6 1 Incr 4472653 23-FEB-06
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\NEWTBS01.DBF
7 1 Incr 4472653 23-FEB-06
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\TEST RECOVER 01.DBF
8 1 Incr 4472653 23-FEB-06
C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\TEST RECOVER TWO 01.DBF
Chapter 14: RMAN Advanced Recovery Topics
369
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
300 1 23 A 23-FEB-06 C:\ARCHIVE\ROB10R2ARC00023 0582936761.001
Media recovery start SCN is 4472638
Recovery must be done beyond SCN 4472653 to clear data files fuzziness
Finished restore at 23-FEB-06
Some vendors support “recalling” media from a DR site to use for a local restore. The
restore
database preview recall
supports this functionality, allowing you to initiate a recall of the required backup files from a remote disaster recovery site in order to perform the restore preview.
Restoring with the validate and check logical Commands
The
restore
command comes with some great options that allow you to verify that your database is recoverable and that the backup itself is valid. First, you can use the
validate
parameter of the
backup
command to cause RMAN to check the backup sets and to make sure your database is recoverable. When you use the
validate
option, Oracle checks the most current backup set that will be needed to recover your database, ensuring that it is complete. This option also checks any datafile copies and archived redo log backup sets that will be required for recovery and ensures that they are all complete. Additionally, the
validate
option does a general validation of the backup sets to ensure that they are intact. Validation doesn’t take very long and is one way to ensure that your database is recoverable. Here is an example of a
validate
operation on our database:
RMAN> restore database validate;
Starting restore at 05-JUL-02
using channel ORA DISK 1
using channel ORA DISK 2
channel ORA DISK 1: starting validation of datafile backupset
channel ORA DISK 2: starting validation of datafile backupset
channel ORA DISK 1: restored backup piece 1
piece handle D:\BACKUP\RECOVER\BACKUP 4QDSM5IB 1 1
tag TAG20020703T221224 params NULL
channel ORA DISK 1: validation complete
channel ORA DISK 2: restored backup piece 1
piece handle D:\BACKUP\RECOVER\BACKUP 4RDSM5IC 1 1
tag TAG20020703T221224 params NULL
channel ORA DISK 2: validation complete
Finished restore at 05-JUL-02
Another, more complete check of the most current backup set is the
check logical
parameter of the
restore
command. This command causes RMAN to check the backups of the database, if they pass a physical corruption check, for logical corruption within the data and index segments backed up. If logical errors are found, Oracle responds in one of two ways:
■ If the
maxcorrupt
parameter has been set and this count is not exceeded during the restore check logical operation, RMAN populates the Oracle V$ table V$DATABASE_
BLOCK_CORRUPTION with a list of corrupted block ranges.
■ If
maxcorrupt
is exceeded during the operation, then the operation will terminate.
370
Part III: Using RMAN Effectively
By default,
maxcorrupt
is set to 0, so any logical corruption will cause the operation to fail.
The
maxcorrupt
parameter default is modified via the
set
command and can only be established within the confines of a
run
block. Additionally,
maxcorrupt
is set for each datafile individually, not collectively. The following is an example of setting
maxcorrupt
to allow for some corruption to appear, and then logically validating backups of our database. In this example, we have set
maxcorrupt
for all the datafiles in our database (1 through 5), and we not only are checking that the latest backup sets are present and recoverable, but also are looking for logical corruption within the backup sets.
RMAN> run {
2> set maxcorrupt for datafile 1,2,3,4,5,6 to 5;
3> restore database check logical validate;
4> }
executing command: SET MAX CORRUPT
Starting restore at 05-JUL-02
using channel ORA DISK 1
using channel ORA DISK 2
channel ORA DISK 1: starting validation of datafile backupset
channel ORA DISK 2: starting validation of datafile backupset
channel ORA DISK 1: restored backup piece 1
piece handle D:\BACKUP\RECOVER\BACKUP 4QDSM5IB 1 1
tag TAG20020703T221224 params NULL
channel ORA DISK 1: validation complete
channel ORA DISK 2: restored backup piece 1
piece handle D:\BACKUP\RECOVER\BACKUP 4RDSM5IC 1 1
tag TAG20020703T221224 params NULL
channel ORA DISK 2: validation complete
Finished restore at 05-JUL-02
Using the validate backupset Command
Using the
restore
command with the
validate
and/or
check logical
parameters only checks the most current backup set. There may well be times that you want to check a specific backup set.
To do this, you use the
validate backupset
command. To use this command, you first need to determine the backup set key that you want to back up. Each backup set, when it is made, is assigned a unique identifier called the
backup set key.
To determine the key assigned to the backup set you are interested in, you can use the
list backupset
command, as shown in the following example:
RMAN> list backupset;
List of Backup Sets
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
141 Full 320K DISK 00:02:09 03-JUL-02
BP Key: 141 Status: AVAILABLE Tag: TAG20020703T221224
Piece Name: D:\BACKUP\RECOVER\BACKUP 4QDSM5IB 1 1
List of Datafiles in backup set 141
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 Full 647435 03-JUL-02 D:\ORACLE\ORADATA\RECOVER\REVDATA.DBF
Chapter 14: RMAN Advanced Recovery Topics
371
4 Full 647435 03-JUL-02 D:\ORACLE\ORADATA\RECOVER\TOOLS01.DBF
6 Full 647435 03-JUL-02 D:\ORACLE\ORADATA\RECOVER\REVINDEX.DBF
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
142 Full 113M DISK 00:03:28 03-JUL-02
BP Key: 142 Status: AVAILABLE Tag: TAG20020703T221224
Piece Name: D:\BACKUP\RECOVER\BACKUP 4RDSM5IC 1 1
List of Datafiles in backup set 142
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 647439 03-JUL-02 D:\ORACLE\ORADATA\RECOVER\SYSTEM01.DBF
3 Full 647439 03-JUL-02 D:\ORACLE\ORADATA\RECOVER\INDX01.DBF
5 Full 647439 03-JUL-02 D:\ORACLE\ORADATA\RECOVER\USERS01.DBF
Here, we are interested in the report’s BS Key column, which lists the backup set key number.
Notice that the files in the backup set also are listed, as are the date and time of the backup. All of this information should make it easy to identify the backup set you wish to validate. Once you have determined the set you need to check, then validating the backup set is as easy as running the
validate backupset
command, as shown in the next two examples: RMAN> validate backupset 141;
using channel ORA DISK 1
using channel ORA DISK 2
channel ORA DISK 1: starting validation of datafile backupset
channel ORA DISK 1: restored backup piece 1
piece handle D:\BACKUP\RECOVER\BACKUP 4QDSM5IB 1 1
tag TAG20020703T221224 params NULL
channel ORA DISK 1: validation complete
RMAN> validate backupset 141 check logical;
using channel ORA DISK 1
using channel ORA DISK 2
channel ORA DISK 1: starting validation of datafile backupset
channel ORA DISK 1: restored backup piece 1
piece handle D:\BACKUP\RECOVER\BACKUP 4QDSM5IB 1 1
tag TAG20020703T221224 params NULL
channel ORA DISK 1: validation complete
Call the Movers! Cross-Platform Database
Movement and RMAN
Oracle Database supports manually moving databases across different platforms, even those of different
endian
formats. The endian formats relate to byte ordering, and there are two different formats, big endian and little endian. If you want to move a database between databases of different endian byte formats, then you have to do so manually, using the RMAN
convert datafile
or
convert tablespace
command along the way to convert the datafiles being transported to the correct endian format.
In this section, we quickly cover cross-platform transportable tablespaces. We then discuss the different endian byte-ordering formats. Next, we discuss converting tablespaces for transport