Wednesday, 6 June 2018

How to Check/Validate That RMAN Backups Are Good

I Want to restore and recover the database till time ‘9:00, 22-October-2012
Step 1: The below command just gives the report of backups that are used to do the  restore and recover :
RMAN> run
{
set until time "to_date('2012-22-10:9:00:00','yyyy-dd-mm:hh24:mi:ss')";
restore database preview;
}
2> 3> 4> 5>
executing command: SET until clause
using target database control file instead of recovery catalog
Starting restore at 22-OCT-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=4 devtype=DISK

List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3457 Full 3.41G DISK 00:11:40 22-OCT-12
 BP Key: 3457 Status: AVAILABLE Compressed: YES Tag: WHOLE_DATABASE_OPEN
 Piece Name: /u02/rman/db_797315408_3460_p1
 List of Datafiles in backup set 3457
 File LV Type Ckp SCN Ckp Time Name
 ---- -- ---- ---------- --------- ----
 1 Full 135540931 22-OCT-12 /u01/oracle/oradata/prod/system01.dbf
 2 Full 135540931 22-OCT-12 /u01/oracle/oradata/prod/undotbs01.dbf
 3 Full 135540931 22-OCT-12 /u01/oracle/oradata/prod/sysaux01.dbf
 4 Full 135540931 22-OCT-12 /u01/oracle/oradata/prod/users01.dbf
 5 Full 135540931 22-OCT-12 /u01/oracle/oradata/prod/prodtbs
 6 Full 135540931 22-OCT-12 /u01/oracle/oradata/prod/prod_data_space.dbf
using channel ORA_DISK_1

List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
48185 1 48301 A 22-OCT-12 /u02/arch/1_48301_738779061.dbf
48186 1 48302 A 22-OCT-12 /u02/arch/1_48302_738779061.dbf
48187 1 48303 A 22-OCT-12 /u02/arch/1_48303_738779061.dbf
48188 1 48304 A 22-OCT-12 /u02/arch/1_48304_738779061.dbf
48189 1 48305 A 22-OCT-12 /u02/arch/1_48305_738779061.dbf
48190 1 48306 A 22-OCT-12 /u02/arch/1_48306_738779061.dbf
48191 1 48307 A 22-OCT-12 /u02/arch/1_48307_738779061.dbf
48192 1 48308 A 22-OCT-12 /u02/arch/1_48308_738779061.dbf
48193 1 48309 A 22-OCT-12 /u02/arch/1_48309_738779061.dbf
48194 1 48310 A 22-OCT-12 /u02/arch/1_48310_738779061.dbf
48195 1 48311 A 22-OCT-12 /u02/arch/1_48311_738779061.dbf
48196 1 48312 A 22-OCT-12 /u02/arch/1_48312_738779061.dbf
48197 1 48313 A 22-OCT-12 /u02/arch/1_48313_738779061.dbf
48198 1 48314 A 22-OCT-12 /u02/arch/1_48314_738779061.dbf
48199 1 48315 A 22-OCT-12 /u02/arch/1_48315_738779061.dbf
48200 1 48316 A 22-OCT-12 /u02/arch/1_48316_738779061.dbf
48201 1 48317 A 22-OCT-12 /u02/arch/1_48317_738779061.dbf
Media recovery start SCN is 135540931
Recovery must be done beyond SCN 135540931 to clear data files fuzziness
Finished restore at 22-OCT-12
Step 2: Then run the below command to check the backup pieces are good :
The below command will read the backup pieces/Copies which has datafiles and if finds any error it will report at the RMAN prompt.
RMAN> run
{
allocate channel c1 type disk;
set until time "to_date('2012-22-10:9:00:00','yyyy-dd-mm:hh24:mi:ss')";
restore database validate;
} 2> 3> 4> 5> 6>
released channel: ORA_DISK_1
allocated channel: c1
channel c1: sid=4 devtype=DISK
executing command: SET until clause
Starting restore at 22-OCT-12
channel c1: starting validation of datafile backupset
channel c1: reading from backup piece /u02/rman/db_797315408_3460_p1

Step 3: Check the archivelogs needed for recovery
Replace the xxx, yyy with the start and end archivelog sequence reported by restore database preview command ran in the step 1.
RMAN> run
2> {
allocate channel c1 type disk;
restore archivelog from sequence 48301 until sequence 48317 validate;
}
3> 4> 5>
allocated channel: c1
channel c1: sid=4 devtype=DISK
Starting restore at 22-OCT-12
channel c1: scanning archive log /u02/arch/1_48301_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48302_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48303_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48304_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48305_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48306_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48307_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48308_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48309_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48310_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48311_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48312_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48313_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48314_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48315_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48316_738779061.dbf
channel c1: scanning archive log /u02/arch/1_48317_738779061.dbf
Finished restore at 22-OCT-12
released channel: c1
RMAN>

No comments:

Post a Comment