rman恢复复到异机

将原库用rman做个全备份,将备份集 备份到目标数据库之后,进行恢复的试验。

 

[oracle@rhel133 dbs]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Fri Dec 14 16:26:17 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database (not started)

RMAN> set dbid 1230508166

executing command: SET DBID

 

我是将原库的pfile给复制到目标库了,也可以从rman中恢复过来:

restore spfile to pfile '/u01/app/...' from '/u03/....';

 

用复制过来的pfile启动:

RMAN> startup nomount

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 12/14/2012 16:27:55
RMAN-04014: startup failed: ORA-07446: sdnfy: bad value '/u01/app/oracle/admin/orcl/udump' for parameter user_dump_dest.

出错了,是因为udump目录没有准备好。

建好相当的目录(包手udump,cdump,bdump...)之后,再试一下:

 

RMAN> startup nomount

Segmentation fault
[oracle@rhel133 dbs]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Fri Dec 14 16:30:53 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database (not started)

RMAN> set dbid 1230508166

executing command: SET DBID

RMAN> startup nomount

Oracle instance started

Total System Global Area    1610612736 bytes

Fixed Size                     1267740 bytes
Variable Size                385877988 bytes
Database Buffers            1207959552 bytes
Redo Buffers                  15507456 bytes

RMAN> restore controlfile from '/u03/rman/c-1230508166-20130118-01';

Starting restore at 14-DEC-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=541 devtype=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output filename=/u01/oradata/orcl/control01.ctl
output filename=/u01/oradata/orcl/control02.ctl
output filename=/u01/oradata/orcl/control03.ctl
Finished restore at 14-DEC-12

RMAN> alter database mount
2> ;

database mounted
released channel: ORA_DISK_1


要注意/u01/backup/rman/03nvnnd4_1_1必须存在,之前我把03nvnnd4_1_1复制到了/u03的目录下,导致rman找不到备份集,将备份集备份过去或者

通过ln软link指定过去就ok了。(不要忘记用crosscheck backupset 来检验一下备份集)

RMAN> run {
2> SET NEWNAME FOR DATAFILE '/u01/oradata/orcl/system01.dbf' TO '/u02/oradata/orcl/system01.dbf';
3> SET NEWNAME FOR DATAFILE '/u01/oradata/orcl/undotbs01.dbf' TO '/u02/oradata/orcl/undotbs01.dbf';
4> SET NEWNAME FOR DATAFILE '/u01/oradata/orcl/sysaux01.dbf' TO '/u02/oradata/orcl/sysaux01.dbf';
5> SET NEWNAME FOR DATAFILE '/u01/oradata/orcl/DEALSPACE_002.dbf' TO '/u02/oradata/orcl/DEALSPACE_002.dbf';
6> SET NEWNAME FOR DATAFILE '/u01/oradata/orcl/DEALSPACE_001.dbf' TO '/u02/oradata/orcl/DEALSPACE_001.dbf';
7> SET NEWNAME FOR DATAFILE '/u01/oradata/orcl/l5mspace01.dbf' TO '/u02/oradata/orcl/l5mspace01.dbf';
8> SET NEWNAME FOR DATAFILE '/u01/oradata/orcl/RCFSPACE_002.dbf' TO '/u02/oradata/orcl/RCFSPACE_002.dbf';
9> SET NEWNAME FOR DATAFILE '/u01/oradata/orcl/RCFSPACE_001.dbf' TO '/u02/oradata/orcl/RCFSPACE_001.dbf';
10> SET NEWNAME FOR DATAFILE '/u01/oradata/orcl/DTSPACE_001.dbf' TO '/u02/oradata/orcl/DTSPACE_001.dbf';
11> restore database;
12> switch datafile all;
13> recover database;
14> }

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 14-DEC-12
using channel ORA_DISK_1

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=152
channel ORA_DISK_1: reading from backup piece /u01/backup/rman/04nvnp1g_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/backup/rman/04nvnp1g_1_1 tag=TAG20130118T132504
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_12_17/o1_mf_1_152_8dxcjqtj_.arc thread=1

sequence=152
channel default: deleting archive log(s)
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_12_17/o1_mf_1_152_8dxcjqtj_.arc recid=7

stamp=802272663
unable to find archive log
archive log thread=1 sequence=153
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 12/17/2012 13:31:07
RMAN-06054: media recovery requesting unknown log: thread 1 seq 153 lowscn 3521230100

RMAN>

报错了,但是没关系,并非严重错误,只是提醒你恢复到一个未知的scn号。如果要避免这个错误,可以在alter database mount之后,通过set

until scn或者set until time命令设置恢复到的scn号或时间。


RMAN> alter database open resetlogs;

database opened

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值