RMAN specified backup set Recovery

Source: Internet
Author: User

Today, I encountered a problem when I was doing database restoration. I had two backup sets under the directory. I wanted to specify a backup set for restoration. I checked the information and made 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 current 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 two records under the scott user. The tablespace is users, which is used for recovery comparison ~

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 current 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.06 m disk 00:00:05 02-JUL-11
Back Propagation 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 Full164560402-JUL-11/home/oracle/app/oracle/oradata/zwh/users01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
-------------------------------------------------------------
204 Full 568.33 m 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.06 m disk 00:00:03 02-JUL-11
Back Propagation 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
-------------------------------------------------------------
208 Full 568.33 m disk 00:00:53 02-JUL-11
Back Propagation 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; -- the execution is not completely restored.
3> restore database from tag = 'tag20110702t231137 '; -- specify the tag value of the backup set, which can be found in 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 -- read from the first backup set
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 96 is already on disk as file/home/oracle/app/oracle/flash_recovery_area/ZWH/archivelog/201%07_02/o%mf_%96_70ygz9cv _. arc
Archive log filename =/home/oracle/app/oracle/flash_recovery_area/ZWH/archivelog/201%07_02/o%mf_%96_70ygz9cv _. arc thread = 1 sequence = 96
Media recovery complete, elapsed time: 00:00:04
Finished recover at 03-JUL-11

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.