RMAN備份異機恢復流程總結

shilei1發表於2011-12-19

 

測試環境資訊:

源:

IP地址:10.130.160.200

OSRedHat as 5.5

10.2.0.4 x64

ORACLE_SID=orcl

 

目的伺服器:

IP地址:10.130.171.29

OS: CentOS 5.4

Oracle10.2.0.4 x64

ORACLE_SID=orcl

 

 

源伺服器RMAN備份:(包括資料檔案、歸檔日誌檔案、控制檔案和引數檔案)

--建立備份目錄:

[root@dba1 ~]# mkdir /backup

[root@dba1 ~]# chmod 775 /backup

[root@dba1 ~]# chown oracle.oinstall /backup

--生成pfile

[root@dba1 ~]# su – oracle

[oracle@dba1 ~]$sqlplus / as sysdba

SQL> create pfile=’/backup/pfile_orcl_2116.ora’ from spfile;

--Rman全備

[oracle@dba1 ~]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Sat Dec 17 15:58:07 2011

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

connected to target database: ORCL (DBID=1156269023)

RMAN> run{

allocate channel c1 device type disk;

backup as compressed backupset

format ' /backup/db_full_%d_%I_%u.bak'

tag '2011-12-16-full'

database plus archivelog;

release channel c1;

backup current controlfile format ' /backup/control_20111216.bak';

backup spfile format ' /backup/spfile_20111216.bak';

}

--使用SCP傳送到目的伺服器:10.130.171.29

[oracle@dba1 backup]$ scp *.*

 

目的伺服器做好恢復的相關準備工作:

--建立儲存Rman備份的目錄:

[root@dba2 ~]# mkdir /backup

[root@dba2 ~]# chmod 775 /backup

[root@dba2 ~]# chown oracle.oinstall /backup

 

--建立例項ORCL的相關目錄:

mkdir -p /oracle/admin/orcl/{adump,bdump,cdump,dpdump,pfile,udump}

mkdir -p $ORACLE_BASE/flash_recovery_area/

mkdir -p $ORACLE_BASE/oradata/orcl

 

--建立口令檔案:

[oracle@dba1]$ orapwd file=$ORACLE_HOME/dbs/orapworcl password= entries=5

[oracle@dba1]$ strings $ORACLE_HOME/dbs/orapworcl

 

--生產引數檔案

[oracle@dba1]$ export ORACLE_SID=orcl

[oracle@dba1]$ sqlplus / as sysdba

SQL> create spfile from pfile=’ /backup/pfile_orcl_2116.ora’

 

--RMAN恢復

[oracle@dba1]$ export ORACLE_SID=orcl

[oracle@dba1]$ rman target/

Recovery Manager: Release 10.2.0.4.0 - Production on Sat Dec 17 15:58:07 2011

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

connected to target database: ORCL (not started)

RMAN> set dbid=1156269023;   //指定DBID,需要和源伺服器的DBID一致

RMAN> starup nomount;

RMAN> restore controlfile from '/backup/control_20111216.bak';    --恢復控制檔案

RMAN> restore database;     --還原資料庫檔案 

RMAN> recover database;     --恢復資料庫檔案,這裡將報錯

Starting recover at 17-DEC-11

using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=5661

channel ORA_DISK_1: reading from backup piece / backup/db_full_orcl_1156269023_8umubkf5.bak

channel ORA_DISK_1: restored backup piece 1

piece handle=/ backup/db_full_orcl_1156269023_8umubkf5.bak tag=2011-12-16-FULL

channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

archive log filename=/oracle/oraarch/1_5661_764212959.dbf thread=1 sequence=5661

unable to find archive log

archive log thread=1 sequence=5662

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 12/17/2011 20:08:56

RMAN-06054: media recovery requesting unknown log: thread 1 seq 5662 lowscn 68375127548

 --sqlplus中對資料庫進行until cancel操作後以resetlogs open

[oracle@dba1 ~]$ sqlplus sys@orcl as sysdba           

SQL> recover database using backup controlfile until cancel;

ORA-00279: change 68375127548 generated at 12/16/2011 10:56:37 needed for

thread 1

ORA-00289: suggestion : /oracle/oraarch/1_5662_764212959.dbf

ORA-00280: change 68375127548 for thread 1 is in sequence #5662

 Specify log: {=suggested | filename | AUTO | CANCEL}

cancel

Media recovery cancelled.

SQL> alter database open resetlogs;

Database altered.

SQL> select status from v$instance;

STATUS

------------

OPEN

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/196700/viewspace-713555/,如需轉載,請註明出處,否則將追究法律責任。

相關文章