ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RMAN 备份异机恢复流程总结

RMAN 备份异机恢复流程总结

原创 Linux操作系统 作者:herry1689 时间:2011-12-17 16:45:10 0 删除 编辑

RMAN 备份异机恢复流程总结

 

测试环境信息:

源服务器:

IP地址:10.130.160.200

OSRedHat as 5.5

Oracle10.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 *.* oracle@10.130.171.29:/backup

 

目的服务器做好恢复的相关准备工作:

--创建存储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/7922095/viewspace-713493/,如需转载,请注明出处,否则将追究法律责任。

下一篇: CPU负载的分析
请登录后发表评论 登录
全部评论

注册时间:2011-10-25

  • 博文量
    37
  • 访问量
    117304