RMAN Specifies backup set recovery
Today in the database restore time encountered a problem, that is, there are two of directories below the backup set, to specify the backup set to restore, back to check the data, the following do a simple experiment record:
Rman> run{
2> allocate channel A1 type disk;
3> ALLOCATE channel A2 type disk;
4> Backup Database format= '/home/oracle/backup/db_arch_%u ';
5> release channel A1;
6> release channel A2;
7>}
Released Channel:ora_disk_1
Allocated CHANNEL:A1
Channel a1:sid=144 Devtype=disk
Allocated CHANNEL:A2
Channel a2:sid=148 Devtype=disk
Starting backup at 02-jul-11
Channel a1:starting full datafile backupset
Channel a1:specifying DataFile (s) in Backupset
Input datafile fno=00001 name=/home/oracle/app/oracle/oradata/zwh/system01.dbf
Input datafile fno=00003 name=/home/oracle/app/oracle/oradata/zwh/sysaux01.dbf
Channel a1:starting piece 1 at 02-jul-11
Channel a2:starting full datafile backupset
Channel a2:specifying DataFile (s) in Backupset
Input datafile fno=00002 name=/home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
Input datafile fno=00004 name=/home/oracle/app/oracle/oradata/zwh/users01.dbf
Channel a2:starting piece 1 at 02-jul-11
Channel a2:finished piece 1 at 02-jul-11
Piece Handle=/home/oracle/backup/db_arch_6kmgfc5a_1_1 tag=tag20110702t231137 comment=none
Channel A2:backup set complete, elapsed time:00:00:07
Channel a2:starting full datafile backupset
Channel a2:specifying DataFile (s) in Backupset
Including control file in Backupset
Channel a2:starting piece 1 at 02-jul-11
Channel a2:finished piece 1 at 02-jul-11
Piece Handle=/home/oracle/backup/db_arch_6lmgfc5i_1_1 tag=tag20110702t231137 comment=none
Channel A2:backup set complete, elapsed time:00:00:07
Channel a2:starting full datafile backupset
Channel a2:specifying DataFile (s) in Backupset
Including current SPFILE in Backupset
Channel a2:starting piece 1 at 02-jul-11
Channel a2:finished piece 1 at 02-jul-11
Piece Handle=/home/oracle/backup/db_arch_6mmgfc5q_1_1 tag=tag20110702t231137 comment=none
Channel A2:backup set complete, elapsed time:00:00:08
Channel a1:finished piece 1 at 02-jul-11
Piece Handle=/home/oracle/backup/db_arch_6jmgfc5a_1_1 tag=tag20110702t231137 comment=none
Channel A1:backup set complete, elapsed time:00:00:59
Finished backup at 02-jul-11
Released CHANNEL:A1
Released CHANNEL:A2
At this time I deleted 2 records under the Scott User, table space is users, used to restore comparison with ~
Rman> run{
2> allocate channel A1 type disk;
3> ALLOCATE channel A2 type disk;
4> Backup Database format= '/home/oracle/backup2/db2_arch_%u ';
5> release channel A1;
6> release channel A2;
7>}
Using target database control file instead of recovery catalog
Allocated CHANNEL:A1
Channel a1:sid=141 Devtype=disk
Allocated CHANNEL:A2
Channel a2:sid=143 Devtype=disk
Starting backup at 02-jul-11
Channel a1:starting full datafile backupset
Channel a1:specifying DataFile (s) in Backupset
Input datafile fno=00001 name=/home/oracle/app/oracle/oradata/zwh/system01.dbf
Input datafile fno=00003 name=/home/oracle/app/oracle/oradata/zwh/sysaux01.dbf
Channel a1:starting piece 1 at 02-jul-11
Channel a2:starting full datafile backupset
Channel a2:specifying DataFile (s) in Backupset
Input datafile fno=00002 name=/home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
Input datafile fno=00004 name=/home/oracle/app/oracle/oradata/zwh/users01.dbf
Channel a2:starting piece 1 at 02-jul-11
Channel a2:finished piece 1 at 02-jul-11
Piece Handle=/home/oracle/backup2/db2_arch_6omgfciq_1_1 tag=tag20110702t231850 comment=none
Channel A2:backup set complete, elapsed time:00:00:07
Channel a2:starting full datafile backupset
Channel a2:specifying DataFile (s) in Backupset
Including control file in Backupset
Channel a2:starting piece 1 at 02-jul-11
Channel a2:finished piece 1 at 02-jul-11
Piece Handle=/home/oracle/backup2/db2_arch_6pmgfcj3_1_1 tag=tag20110702t231850 comment=none
Channel A2:backup set complete, elapsed time:00:00:13
Channel a2:starting full datafile backupset
Channel a2:specifying DataFile (s) in Backupset
Including current SPFILE in Backupset
Channel a2:starting piece 1 at 02-jul-11
Channel a2:finished piece 1 at 02-jul-11
Piece Handle=/home/oracle/backup2/db2_arch_6qmgfcjj_1_1 tag=tag20110702t231850 comment=none
Channel A2:backup set complete, elapsed time:00:00:04
Channel a1:finished piece 1 at 02-jul-11
Piece Handle=/home/oracle/backup2/db2_arch_6nmgfciq_1_1 tag=tag20110702t231850 comment=none
Channel A1:backup set complete, elapsed time:00:00:54
Finished backup at 02-jul-11
Released CHANNEL:A1
Released CHANNEL:A2
Rman> list Backup of database;
Using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion time
------- ---- -- ---------- ----------- ------------ ---------------
201 Full 24.06M DISK 00:00:05 02-jul-11
BP key:201 status:available Compressed:no tag:tag20110702t231137
Piece Name:/home/oracle/backup/db_arch_6kmgfc5a_1_1--Directory of the first backup set
List of Datafiles in Backup set 201
File LV Type Ckp SCN Ckp time Name
---- -- ---- ---------- --------- ----
2 Full 1645604 02-jul-11/home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
4 Full 1645604 02-JUL-11/HOME/ORACLE/APP/ORACLE/ORADATA/ZWH/USERS01.DBF
BS Key Type LV Size Device Type Elapsed Time Completion time
------- ---- -- ---------- ----------- ------------ ---------------
204 Full 568.33M DISK 00:00:52 02-jul-11
BP key:204 status:available Compressed:no tag:tag20110702t231137
Piece Name:/home/oracle/backup/db_arch_6jmgfc5a_1_1
List of Datafiles in backup set 204
File LV Type Ckp SCN Ckp time Name
---- -- ---- ---------- --------- ----
1 Full 1645603 02-jul-11/home/oracle/app/oracle/oradata/zwh/system01.dbf
3 Full 1645603 02-JUL-11/HOME/ORACLE/APP/ORACLE/ORADATA/ZWH/SYSAUX01.DBF
BS Key Type LV Size Device Type Elapsed Time Completion time
------- ---- -- ---------- ----------- ------------ ---------------
205 Full 24.06M DISK 00:00:03 02-jul-11
BP key:205 status:available Compressed:no tag:tag20110702t231850
Piece Name:/home/oracle/backup2/db2_arch_6omgfciq_1_1--Directory of the second backup set
List of datafiles in Backup set 205
File LV Type Ckp SCN Ckp time Name
---- -- ---- ---------- --------- ----
2 Full 1645939 02-jul-11/home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
4 Full 1645939 02-JUL-11/HOME/ORACLE/APP/ORACLE/ORADATA/ZWH/USERS01.DBF
BS Key Type LV Size Device Type Elapsed Time Completion time
------- ---- -- ---------- ----------- ------------ ---------------
Full 568.33M DISK 00:00:53 02-jul-11
BP key:208 status:available Compressed:no tag:tag20110702t231850
Piece Name:/home/oracle/backup2/db2_arch_6nmgfciq_1_1
List of Datafiles in backup set 208
File LV Type Ckp SCN Ckp time Name
---- -- ---- ---------- --------- ----
1 Full 1645938 02-jul-11/home/oracle/app/oracle/oradata/zwh/system01.dbf
3 Full 1645938 02-JUL-11/HOME/ORACLE/APP/ORACLE/ORADATA/ZWH/SYSAUX01.DBF
Rman> run{
2> set until scn=1645604; --Perform incomplete restores
3> restore Database from tag= ' tag20110702t231137 '; --Specifies the tag value of the backup set, which can be found in the list backup of database
4> Recover database;
5> SQL ' ALTER DATABASE open resetlogs ';
6>}
Starting restore at 03-jul-11
Using target database control file instead of recovery catalog
Allocated Channel:ora_disk_1
Channel ora_disk_1:sid=157 Devtype=disk
Channel ora_disk_1:starting datafile backupset restore
Channel ora_disk_1:specifying DataFile (s) to restore from backup set
restoring DataFile 00002 to/home/oracle/app/oracle/oradata/zwh/undotbs01.dbf
restoring datafile 00004 to/home/oracle/app/oracle/oradata/zwh/users01.dbf
Channel ora_disk_1:reading from backup Piece/home/oracle/backup/db_arch_6kmgfc5a_1_1--first-time backup set read
Channel ora_disk_1:restored backup Piece 1
Piece Handle=/home/oracle/backup/db_arch_6kmgfc5a_1_1 tag=tag20110702t231137
Channel Ora_disk_1:restore complete, elapsed time:00:00:15
Channel ora_disk_1:starting datafile backupset restore
Channel ora_disk_1:specifying DataFile (s) to restore from backup set
restoring DataFile 00001 to/home/oracle/app/oracle/oradata/zwh/system01.dbf
restoring DataFile 00003 to/home/oracle/app/oracle/oradata/zwh/sysaux01.dbf
Channel ora_disk_1:reading from backup Piece/home/oracle/backup/db_arch_6jmgfc5a_1_1
Channel ora_disk_1:restored backup Piece 1
Piece Handle=/home/oracle/backup/db_arch_6jmgfc5a_1_1 tag=tag20110702t231137
Channel Ora_disk_1:restore complete, elapsed time:00:00:55
Finished restore at 03-jul-11
Starting recover at 03-jul-11
Using channel Ora_disk_1
Starting Media recovery
Archive log thread 1 sequence to already on disk as file/home/oracle/app/oracle/flash_recovery_area/zwh/archivelog/201 1_07_02/o1_mf_1_96_70ygz9cv_.arc
Archive log filename=/home/oracle/app/oracle/flash_recovery_area/zwh/archivelog/2011_07_02/o1_mf_1_96_70ygz9cv_. Arc thread=1 sequence=96
Media recovery complete, elapsed time:00:00:04
Finished recover at 03-jul-11