rman单机备份异机还原

源服务器和目的服务器的操作系统,oracle版本均一致
目的服务器只需要安装oracle软件即可,不需要建库操作


备份数据库
[oracle@yc ~]$ rman target /


Recovery Manager: Release 11.2.0.4.0 - Production on Wed Feb 24 09:24:15 2016


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ORCL (DBID=1429420386)


RMAN> backup database plus archivelog;




Starting backup at 24-FEB-16
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=52 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2 RECID=1 STAMP=901709137
input archived log thread=1 sequence=3 RECID=2 STAMP=901725989
input archived log thread=1 sequence=4 RECID=3 STAMP=904208184
input archived log thread=1 sequence=5 RECID=4 STAMP=904218606
input archived log thread=1 sequence=6 RECID=5 STAMP=904467293
input archived log thread=1 sequence=7 RECID=6 STAMP=904641434
input archived log thread=1 sequence=8 RECID=7 STAMP=904641888
channel ORA_DISK_1: starting piece 1 at 24-FEB-16
channel ORA_DISK_1: finished piece 1 at 24-FEB-16
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/01qunfb1_1_1 tag=TAG20160224T092448 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-FEB-16


Starting backup at 24-FEB-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/ORCL/datafile/o1_mf_system_c9yfl5xq_.dbf
input datafile file number=00002 name=/oradata/ORCL/datafile/o1_mf_sysaux_c9yfl63v_.dbf
input datafile file number=00003 name=/oradata/ORCL/datafile/o1_mf_undotbs1_c9yfl66x_.dbf
input datafile file number=00004 name=/oradata/ORCL/datafile/o1_mf_users_c9yfl6b8_.dbf
channel ORA_DISK_1: starting piece 1 at 24-FEB-16
channel ORA_DISK_1: finished piece 1 at 24-FEB-16
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/02qunfb2_1_1 tag=TAG20160224T092450 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 24-FEB-16
channel ORA_DISK_1: finished piece 1 at 24-FEB-16
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/03qunfc6_1_1 tag=TAG20160224T092450 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-FEB-16


Starting backup at 24-FEB-16
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=9 RECID=8 STAMP=904641928
channel ORA_DISK_1: starting piece 1 at 24-FEB-16
channel ORA_DISK_1: finished piece 1 at 24-FEB-16
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/04qunfc9_1_1 tag=TAG20160224T092529 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-FEB-16


RMAN> exit


Recovery Manager complete.


将备份的文件传到目标服务器相应目录下
在目标服务器下根据spfile创建相应路径
[oracle@dg2 ~]$ mkdir -p /u01/app/oracle/admin/orcl/{adump,bdump,cdump,dpdump,udump,pfile}
[oracle@dg2 ~]$ mkdir -p /oradata/ORCL/controlfile
确定好环境变量
[oracle@dg2 ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 
[oracle@dg2 ~]$ export ORACLE_SID=orcl -----SID要一样
[oracle@dg2 ~]$ export PATH=$ORACLE_HOME/bin:$PATH 
[oracle@dg2 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Feb 23 22:06:11 2016


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database (not started)


RMAN> startup nomount


Oracle instance started


Total System Global Area    1043886080 bytes


Fixed Size                     2259840 bytes
Variable Size                864027776 bytes
Database Buffers             171966464 bytes
Redo Buffers                   5632000 bytes


RMAN> restore controlfile from  '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/03qunfc6_1_1'; 


Starting restore at 23-FEB-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK


channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output file name=/oradata/ORCL/controlfile/o1_mf_c9yfq2tf_.ctl
Finished restore at 23-FEB-16


RMAN> alter database mount 
2> ;


database mounted
released channel: ORA_DISK_1


RMAN> run
2> {
3> set newname for datafile 1 to '/oradata/ORCL/datafile/o1_mf_system_c9yfl5xq_.dbf';
4> set newname for datafile 2 to '/oradata/ORCL/datafile/o1_mf_sysaux_c9yfl63v_.dbf';
5> set newname for datafile 3 to '/oradata/ORCL/datafile/o1_mf_undotbs1_c9yfl66x_.dbf';
6> set newname for datafile 4 to '/oradata/ORCL/datafile/o1_mf_users_c9yfl6b8_.dbf';
7> restore database;
8> switch datafile all;
9> recover database;
10> alter database open resetlogs;
11> }


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


Starting restore at 23-FEB-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK


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 00001 to /oradata/ORCL/datafile/o1_mf_system_c9yfl5xq_.dbf
channel ORA_DISK_1: restoring datafile 00002 to /oradata/ORCL/datafile/o1_mf_sysaux_c9yfl63v_.dbf
channel ORA_DISK_1: restoring datafile 00003 to /oradata/ORCL/datafile/o1_mf_undotbs1_c9yfl66x_.dbf
channel ORA_DISK_1: restoring datafile 00004 to /oradata/ORCL/datafile/o1_mf_users_c9yfl6b8_.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/02qunfb2_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/02qunfb2_1_1 tag=TAG20160224T092450
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:25
Finished restore at 23-FEB-16




Starting recover at 23-FEB-16
using channel ORA_DISK_1


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=9
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/04qunfc9_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/04qunfc9_1_1 tag=TAG20160224T092529
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/arch/1_9_901639655.dbf thread=1 sequence=9
unable to find archived log
archived log thread=1 sequence=10
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/23/2016 22:28:33
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 10 and starting SCN of 1099356


RMAN> exit




Recovery Manager complete.


[oracle@dg2 ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 23 22:29:36 2016


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




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> recover database using backup controlfile until cancel;
ORA-00279: change 1099356 generated at 02/24/2016 09:25:28 needed for thread 1
ORA-00289: suggestion : /arch/1_10_901639655.dbf
ORA-00280: change 1099356 for thread 1 is in sequence #10




Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.
SQL> alter database open resetlogs;                                      


Database altered.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值