oracle12c异机导出导入恢复,Oracle 11g RMAN 备份异机恢复并创建新DBID

7.restore数据库

7.1恢复目录不同的情况:

因为我们的路径不同,所以我们需要使用set命令转换一下路径。

到Target库查询一下:

SQL>select file_id,file_name from dba_data_files order by 1;

FILE_ID FILE_NAME

---------- --------------------------------------------------

1 /u01/app/Oracle/oradata/orcl/system01.dbf

2 /u01/app/oracle/oradata/orcl/sysaux01.dbf

3 /u01/app/oracle/oradata/orcl/undotbs01.dbf

4 /u01/app/oracle/oradata/orcl/users01.dbf

5 /u01/app/oracle/oradata/orcl/example01.dbf

NOTE:restore的时候不会对temp表空间进行restore。所以restore之后,我们需要手工创建temp表空间。

RMAN>RUN {

2>set newname for datafile 1 to '/u01/oradata/orcl/system01.dbf';

3>set newname for datafile 2 to '/u01/oradata/orcl/sysaux01.dbf';

4>set newname for datafile 3 to '/u01/oradata/orcl/undotbs01.dbf';

5>set newname for datafile 4 to '/u01/oradata/orcl/users01.dbf';

6>set newname for datafile 5 to '/u01/oradata/orcl/example01.dbf';

7>restore database;

8>switch datafile all;

9>}

对switch datafile all的说明:

--对于nocatalog模式下,rman备份的信息是保存在控制文件里的,包括文件的路径信息。 这里的switch datafile all的作用,就是更新控制文件里的信息。

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 11-APR-11

using channel ORA_DISK_1

datafile 1 is already restored to file /u01/oradata/orcl/system01.dbf

datafile 4 is already restored to file /u01/oradata/orcl/users01.dbf

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00002 to /u01/oradata/orcl/sysaux01.dbf

channel ORA_DISK_1: restoring datafile 00003 to /u01/oradata/orcl/undotbs01.dbf

channel ORA_DISK_1: restoring datafile 00005 to /u01/oradata/orcl/example01.dbf

channel ORA_DISK_1: reading from backup piece /u02/backup/orcl_lev0_0km9hi1b_1_1_20110411

channel ORA_DISK_1: piece handle=/u02/backup/orcl_lev0_0km9hi1b_1_1_20110411 tag=ORCL_LEV0

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

Finished restore at 11-APR-11

datafile 1 switched to datafile copy

input datafile copy RECID=8 STAMP=748214583 file name=/u01/oradata/orcl/system01.dbf

datafile 2 switched to datafile copy

input datafile copy RECID=9 STAMP=748214583 file name=/u01/oradata/orcl/sysaux01.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=10 STAMP=748214583 file name=/u01/oradata/orcl/undotbs01.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=11 STAMP=748214583 file name=/u01/oradata/orcl/users01.dbf

datafile 5 switched to datafile copy

input datafile copy RECID=12 STAMP=748214583 file name=/u01/oradata/orcl/example01.dbf

7.2恢复目录相同

这种情况比较简单,直接:

RMAN>restore database

8.recover DB

RMAN>recover database;

Starting recover at 11-APR-11

using channel ORA_DISK_1

channel ORA_DISK_1: starting incremental datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

destination for restore of datafile 00001: /u01/oradata/orcl/system01.dbf

destination for restore of datafile 00004: /u01/oradata/orcl/users01.dbf

channel ORA_DISK_1: reading from backup piece /u02/backup/orcl_lev1_0tm9hj59_1_1_20110411

channel ORA_DISK_1: piece handle=/u02/backup/orcl_lev1_0tm9hj59_1_1_20110411 tag=ORCL_LEV1

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

channel ORA_DISK_1: starting incremental datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

destination for restore of datafile 00002: /u01/oradata/orcl/sysaux01.dbf

destination for restore of datafile 00003: /u01/oradata/orcl/undotbs01.dbf

destination for restore of datafile 00005: /u01/oradata/orcl/example01.dbf

channel ORA_DISK_1: reading from backup piece /u02/backup/orcl_lev1_0sm9hj59_1_1_20110411

channel ORA_DISK_1: piece handle=/u02/backup/orcl_lev1_0sm9hj59_1_1_20110411 tag=ORCL_LEV1

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=14

channel ORA_DISK_1: reading from backup piece /u02/backup/arch_0vm9hj5b_1_1_20110411

channel ORA_DISK_1: piece handle=/u02/backup/arch_0vm9hj5b_1_1_20110411 tag=ARC_BAK

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_11/o1_mf_1_14_6t7g27t7_.arc thread=1 sequence=14

channel default: deleting archived log(s)

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_11/o1_mf_1_14_6t7g27t7_.arc RECID=11 STAMP=748214775

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=15

channel ORA_DISK_1: reading from backup piece /u02/backup/arch_10m9hj5b_1_1_20110411

channel ORA_DISK_1: piece handle=/u02/backup/arch_10m9hj5b_1_1_20110411 tag=ARC_BAK

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_11/o1_mf_1_15_6t7g2929_.arc thread=1 sequence=15

channel default: deleting archived log(s)

archived log file name=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_11/o1_mf_1_15_6t7g2929_.arc RECID=12 STAMP=748214777

unable to find archived log

archived log thread=1 sequence=16

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 04/11/2011 21:26:18

RMAN-06054:media recovery requesting unknown archived log for thread 1 with sequence 16 and starting SCN of 1109237

之后会报一个错误:

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 16 and starting SCN of 1109237

这里是提醒恢复到一个未知的scn号。在alter database mount之后,通过set until scn或者set until time命令设置恢复到的scn号或时间,就可以避免这个错误。0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值