rman异机恢复
注意事项:
1.源数据库与目标数据库的目录结构相同
2.目标数据库只需要安装ORACLE软件(但是参数文件中指定的目录要创建)
3.要将源数据库的数据文件,参数文件,控制文件,密码文件,归档日志统统备份
1.源数据库备份
参数文件与控制文件自动备份
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/rmanback/level_cont_spfile_%F';
备份数据库及归档日志
backup incremental level 0 database format '/home/oracle/rmanback/level0_%d_%s_%p_%u.bak'
plus archivelog format '/home/oracle/rmanback/level0arclog_%d_%s_%p_%u.bak' delete all input;
2.拷贝备份的文件到目标数据库的相同路径下
scp level* 192.170.100.12:/home/oracle/rmanback
3.启动数据库到nomount状态下
[oracle@server8 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jan 7 13:53:54 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/home/u01/app/oracle/product/11.2.0/db_1/dbs/initghsjdb.ora'
starting Oracle instance without parameter file for retrieva l of spfile
Oracle instance started
Total System Global Area 158662656 bytes
Fixed Size 2226456 bytes
Variable Size 130025192 bytes
Database Buffers 20971520 bytes
Redo Buffers 5439488 bytes
4.恢复参数文件
RMAN> restore spfile to pfile '/home/u01/app/oracle/product/11.2.0/db_1/dbs/initghsjdb.ora' from '/home/oracle/rmanback/level_cont_spfile_c-1442539879-20150107-00'
2> ;
RMAN> sql 'create spfile from pfile';
sql statement: create spfile from pfile
5.创建参数文件中指定的路径
mkdir -p admin/ghsjdb/adump
mkdir -p oradata/ghsjdb
mkdir -p fast_recovery_area/ghsjdb
mkdir archivelog
6.重启到nomount
RMAN> startup force nomount;
Oracle instance started
Total System Global Area 11858636800 bytes
Fixed Size 2239176 bytes
Variable Size 7818183992 bytes
Database Buffers 3758096384 bytes
Redo Buffers 280117248 bytes
7.恢复控制文件
RMAN> restore controlfile from '/home/oracle/rmanback/level_cont_spfile_c-1442539879-20150107-00';
Starting restore at 07-JAN-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1141 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/home/u01/app/oracle/oradata/ghsjdb/control01.ctl
output file name=/home/u01/app/oracle/fast_recovery_area/ghsjdb/control02.ctl
Finished restore at 07-JAN-15
8.启动数据库到mount状态
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
9.由于目标数据库与源数据库的备份路径相同所以不需要重新在控制文件中注册
RMAN> catalog start with '/home/oracle/rmanback';
10.restore database;
RMAN> restore database;
Starting restore at 07-JAN-15
Starting implicit crosscheck backup at 07-JAN-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1141 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=7 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=574 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=1142 device type=DISK
Crosschecked 7 objects
Crosschecked 2 objects
Finished implicit crosscheck backup at 07-JAN-15
Starting implicit crosscheck copy at 07-JAN-15
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
Finished implicit crosscheck copy at 07-J