rman異機恢複,rman恢複

來源:互聯網
上載者:User

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

 

結束了,查看庫裡面的資訊是否正確

 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.