首页 > 代码库 > rman异机恢复
rman异机恢复
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 retrieval 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-JAN-15
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
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 00003 to /home/u01/app/oracle/oradata/ghsjdb/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /home/u01/app/oracle/oradata/ghsjdb/users01.dbf
channel ORA_DISK_1: restoring datafile 00009 to /home/u01/app/oracle/oradata/ghsjdb/shine_fm.dbf
channel ORA_DISK_1: restoring datafile 00017 to /home/u01/app/oracle/oradata/ghsjdb/tbs_ogg.dbf
channel ORA_DISK_1: restoring datafile 00018 to /home/u01/app/oracle/oradata/ghsjdb/ghsj_pwjc.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/rmanback/level0_GHSJDB_14625_1_91ps538h.bak
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00001 to /home/u01/app/oracle/oradata/ghsjdb/system01.dbf
channel ORA_DISK_2: restoring datafile 00008 to /home/u01/app/oracle/oradata/ghsjdb/sde.dbf
channel ORA_DISK_2: restoring datafile 00012 to /home/u01/app/oracle/oradata/ghsjdb/ts_platform_index.dbf
channel ORA_DISK_2: restoring datafile 00016 to /home/u01/app/oracle/oradata/ghsjdb/index_assess.dbf
channel ORA_DISK_2: reading from backup piece /home/oracle/rmanback/level0_GHSJDB_14626_1_92ps538h.bak
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00006 to /home/u01/app/oracle/oradata/ghsjdb/GHSJ_JCSJ.dbf
channel ORA_DISK_3: restoring datafile 00010 to /home/u01/app/oracle/oradata/ghsjdb/shine_fm_index.dbf
channel ORA_DISK_3: restoring datafile 00011 to /home/u01/app/oracle/oradata/ghsjdb/ts_platform.dbf
channel ORA_DISK_3: restoring datafile 00013 to /home/u01/app/oracle/oradata/ghsjdb/GHSJ_pwgl.dbf
channel ORA_DISK_3: reading from backup piece /home/oracle/rmanback/level0_GHSJDB_14627_1_93ps538h.bak
channel ORA_DISK_4: starting datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_DISK_4: restoring datafile 00002 to /home/u01/app/oracle/oradata/ghsjdb/sysaux01.dbf
channel ORA_DISK_4: restoring datafile 00005 to /home/u01/app/oracle/oradata/ghsjdb/ghsj_xm.dbf
channel ORA_DISK_4: restoring datafile 00007 to /home/u01/app/oracle/oradata/ghsjdb/ghsj_index.dbf
channel ORA_DISK_4: restoring datafile 00014 to /home/u01/app/oracle/oradata/ghsjdb/ghsj_psdb.dbf
channel ORA_DISK_4: restoring datafile 00015 to /home/u01/app/oracle/oradata/ghsjdb/dgh.dbf
channel ORA_DISK_4: reading from backup piece /home/oracle/rmanback/level0_GHSJDB_14628_1_94ps538h.bak
channel ORA_DISK_1: piece handle=/home/oracle/rmanback/level0_GHSJDB_14625_1_91ps538h.bak tag=TAG20150107T185510
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:06:36
channel ORA_DISK_2: piece handle=/home/oracle/rmanback/level0_GHSJDB_14626_1_92ps538h.bak tag=TAG20150107T185510
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:08:36
channel ORA_DISK_3: piece handle=/home/oracle/rmanback/level0_GHSJDB_14627_1_93ps538h.bak tag=TAG20150107T185510
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:11:56
channel ORA_DISK_4: piece handle=/home/oracle/rmanback/level0_GHSJDB_14628_1_94ps538h.bak tag=TAG20150107T185510
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:12:06
Finished restore at 07-JAN-15
11.recover database
RMAN> recover database;
Starting recover at 07-JAN-15
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
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=991
channel ORA_DISK_1: reading from backup piece /home/oracle/rmanback/level0arclog_GHSJDB_14631_1_97ps540p.bak
channel ORA_DISK_1: piece handle=/home/oracle/rmanback/level0arclog_GHSJDB_14631_1_97ps540p.bak tag=TAG20150107T190808
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archived log file name=/home/u01/app/oracle/archivelog/1_991_854121688.dbf thread=1 sequence=991
unable to find archived log
archived log thread=1 sequence=992
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/07/2015 14:47:41
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 992 and starting SCN of 1836854473
RMAN> recover database until scn 1836854473;
Starting recover at 07-JAN-15
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 07-JAN-15
12 .打开数据库
RMAN> alter database open resetlogs;
database opened
结束了,查看库里面的信息是否正确
rman异机恢复