Welcome 微信登录

首页 / 数据库 / MySQL / RMAN指定备份集恢复

今天在做数据库恢复的时候遇到一个问题,就是有两个目录下面的备份集,想指定备份集来恢复,回来查了下资料,下面做个简单的实验记录: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=DISKallocated channel: a2
channel a2: sid=148 devtype=DISKStarting 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-11released channel: a1released channel: a2 在这个时候我在scott用户下删除了2条记录,表空间是users,用于恢复比较用~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=DISKallocated channel: a2
channel a2: sid=143 devtype=DISKStarting 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-11released channel: a1released channel: a2
RMAN> list backup of database;using target database control file instead of recovery catalogList 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  --第一次备份集的目录
  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.dbfBS 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.dbfBS 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      --第二次备份集的目录
  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.dbfBS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
208     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.dbfRMAN> run{
2>   set until scn=1645604;  --执行不完全恢复
3>   restore database from tag="TAG20110702T231137";   --指定备份集的tag值,在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=DISKchannel 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   --第一次的备份集中读取
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-11Starting recover at 03-JUL-11
using channel ORA_DISK_1starting media recoveryarchive log thread 1 sequence 96 is already on disk as file /home/oracle/app/oracle/flash_recovery_area/ZWH/archivelog/2011_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-11Oracle字符集问题总结在Java + Oracle环境下对于CLOB类型的数据的插入相关资讯      Oracle教程 
  • Oracle中纯数字的varchar2类型和  (07/29/2015 07:20:43)
  • Oracle教程:Oracle中查看DBLink密  (07/29/2015 07:16:55)
  • [Oracle] SQL*Loader 详细使用教程  (08/11/2013 21:30:36)
  • Oracle教程:Oracle中kill死锁进程  (07/29/2015 07:18:28)
  • Oracle教程:ORA-25153 临时表空间  (07/29/2015 07:13:37)
  • Oracle教程之管理安全和资源  (04/08/2013 11:39:32)
本文评论 查看全部评论 (0)
表情: 姓名: 字数