归档模式下的Rman备份集在异机恢复(原库和目的库的路径不一致)(一)

2014-11-24 18:48:03 · 作者: · 浏览: 0

Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jun 29 06:51:54 2012


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


connected to target database (not started)


RMAN>set dbid 1820932955 -- 这里的dbid需要跟原库保持一致


RMAN> startup nomount


startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0/db_1/dbs/initoracl.ora'


starting Oracle instance without parameter file for retrival of spfile
Oracle instance started


Total System Global Area 159383552 bytes


Fixed Size 1218268 bytes
Variable Size 54528292 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes


RMAN> restore spfile to pfile '/u01/app/oracle/product/10.2.0/db_1/dbs/initoracl.ora' from '/u02/ftp/full_backup_20120628_37';


Starting restore at 29-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK


channel ORA_DISK_1: autobackup found: /u02/ftp/full_backup_20120628_37
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 29-JUN-12



备份集full_backup_20120628_3里7包含了参数文件,我们在备份数据的时候会默认备份参数文件,可以在原库使用list backup查看,list backup输出部分内容如下:


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
35 Full 80.00K DISK 00:00:01 28-JUN-12
BP Key: 35 Status: AVAILABLE Compressed: NO Tag: TAG20120628T184555
Piece Name: /u02/rman_backup/full_backup/full_backup_20120628_37
SPFILE Included: Modification time: 28-JUN-12


恢复了参数文件initoracl.ora后,因为原库和目的库各文件保存的路径不一致,这个时候需要修改参数文件,修改的地方如下,各文件路径指向新目录:


*.audit_file_dest='/u02/mydb/oracl/adump'
*.background_dump_dest='/u02/mydb/oracl/bdump'
*.control_files='/u02/mydb/oradata/oracl/control01.ctl','/u02/mydb/oradata/oracl/control02.ctl','/u02/mydb/oradata/oracl/control03.ctl'
*.core_dump_dest='/u02/mydb/oracl/cdump'
*.db_recovery_file_dest='/u02/mydb/flash_recovery_area'
*.user_dump_dest='/u02/mydb/oracl/udump'


7.使用编辑好的参数文件启动数据库到nomount状态并恢复控制文件


SQL> startup nomount pfile=/u01/app/oracle/product/10.2.0/db_1/dbs/initoracl.ora
ORACLE instance started.


Total System Global Area 1048576000 bytes
Fixed Size 1223368 bytes
Variable Size 310379832 bytes
Database Buffers 734003200 bytes
Redo Buffers 2969600 bytes
SQL>


恢复控制文件
RMAN> restore controlfile from '/u02/ftp/full_backup_20120628_36';


Starting restore at 29-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK


channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
output filename=/u02/mydb/oradata/oracl/control01.ctl
output filename=/u02/mydb/oradata/oracl/control02.ctl
output filename=/u02/mydb/oradata/oracl/control03.ctl
Finished restore at 29-JUN-12


跟参数文件一样,在备份数据的时候会默认备份了控制文件,备份集full_backup_20120628_36中包含了控制文件,同样可以在原库使用list backup查看,list backup输出部分内容如下:


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
34 Full 6.98M DISK 00