rman异机增量备份恢复

实验环境
a:oraclelinux6.5
ip地址:192.168.6.245
oracle版本:11.2.0.3
建库




b:oraclelinux6.5
ip地址:192.168.6.200
oracle版本:11.2.0.3
只安装oracle的软件,不建库


a备份==>b恢复


在a服务器上操作:


首先在a服务器上做0级备份


RMAN> run {
2> backup incremental level 0 database include current controlfile;
3> sql 'alter system archive log current';
4> backup archivelog all delete input;
5> }


Starting backup at 06-JUL-16
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/clsp01.dbf
input datafile file number=00003 name=/u01/oracle/oradata/pu/undotbs01.dbf
input datafile file number=00004 name=/u01/oracle/oradata/pu/users01.dbf
channel ORA_DISK_1: starting piece 1 at 06-JUL-16
channel ORA_DISK_2: starting incremental level 0 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/oracle/oradata/pu/sysaux01.dbf
input datafile file number=00001 name=/u01/oracle/oradata/pu/system01.dbf
input datafile file number=00006 name=/u01/salary01.dbf
input datafile file number=00007 name=/u01/TEST01.DBF
channel ORA_DISK_2: starting piece 1 at 06-JUL-16
channel ORA_DISK_1: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrq9o_.bkp tag=TAG20160706T111222 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:27
channel ORA_DISK_1: starting incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 06-JUL-16
channel ORA_DISK_1: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_ncnn0_TAG20160706T111222_cqrxvpr1_.bkp tag=TAG20160706T111222 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:20
channel ORA_DISK_2: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrr22_.bkp tag=TAG20160706T111222 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:02:43
Finished backup at 06-JUL-16


Starting Control File and SPFILE Autobackup at 06-JUL-16
piece handle=/u01/rmanbackup/controlfile_c-2744947428-20160706-03 comment=NONE
Finished Control File and SPFILE Autobackup at 06-JUL-16


sql statement: alter system archive log current


Starting backup at 06-JUL-16
current log archived
using channel ORA_DISK_1
using channel ORA_DISK_2
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=412 RECID=365 STAMP=916485310
channel ORA_DISK_1: starting piece 1 at 06-JUL-16
channel ORA_DISK_2: starting archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=413 RECID=366 STAMP=916485311
channel ORA_DISK_2: starting piece 1 at 06-JUL-16
channel ORA_DISK_1: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy08q_.bkp tag=TAG20160706T111511 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_412_cqrxxyh8_.arc RECID=365 STAMP=916485310
channel ORA_DISK_2: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy0dx_.bkp tag=TAG20160706T111511 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_2: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_413_cqrxxzb3_.arc RECID=366 STAMP=916485311
Finished backup at 06-JUL-16


Starting Control File and SPFILE Autobackup at 06-JUL-16
piece handle=/u01/rmanbackup/controlfile_c-2744947428-20160706-04 comment=NONE
Finished Control File and SPFILE Autobackup at 06-JUL-16


RMAN> exit




Recovery Manager complete.


创建pfile文件


[oracle@oracle2 ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 6 11:20:55 2016


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




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


SQL> create pfile from spfile;


File created.


SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     412
Next log sequence to archive   414
Current log sequence           414












到备份目录下拷贝备份片和pfile文件到b服务器(记得全部拷贝)
[root@oracle2 2016_07_06]# scp * [email protected]:/u01
The authenticity of host '192.168.6.200 (192.168.6.200)' can't be established.
RSA key fingerprint is 1e:70:87:a4:a9:ac:58:97:e4:31:ac:f5:f5:2f:6d:70.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.6.200' (RSA) to the list of known hosts.
[email protected]'s password: 
o1_mf_annnn_TAG20160706T111511_cqrxy08q_.bkp                                                                                                                                                               100%   47KB  46.5KB/s   00:00    
o1_mf_annnn_TAG20160706T111511_cqrxy0dx_.bkp                                                                                                                                                               100% 2560     2.5KB/s   00:00    
o1_mf_ncnn0_TAG20160706T111222_cqrxvpr1_.bkp                                                                                                                                                               100% 9888KB   9.7MB/s   00:00    
o1_mf_nnnd0_TAG20160706T111222_cqrxrq9o_.bkp                                                                                                                                                               100%  613MB  25.6MB/s   00:24    
o1_mf_nnnd0_TAG20160706T111222_cqrxrr22_.bkp                                                                                                                                                               100% 1390MB  26.2MB/s   00:53    
[root@oracle2 2016_07_06]# cd /u01/11
11.bad  11g/    11.log  11.txt  
[root@oracle2 2016_07_06]# cd /u01/11
11.bad  11g/    11.log  11.txt  
[root@oracle2 2016_07_06]# cd /u01/11g/
apex/            clone/           cv/              dv/              install/         jdev/            md/              odbc/            ord/             precomp/         slax/            timingframework/ xdk/
assistants/      config/          dbs/             emcli/           instantclient/   jdk/             mesg/            olap/            oui/             racg/            sqldeveloper/    ucp/             
bin/             crs/             dc_ocm/          EMStage/         inventory/       jlib/            mgw/             OPatch/          owb/             rdbms/           sqlj/            uix/             
ccr/             csmig/           deinstall/       has/             j2ee/            ldap/            network/         opmn/            owm/             relnotes/        sqlplus/         usm/             
cdata/           css/             demo/            hs/              javavm/          lib/             nls/             oracore/         perl/            root.sh          srvm/            utl/             
cfgtoollogs/     ctx/             diagnostics/     ide/             jdbc/            log/             oc4j/            oraInst.loc      plsql/           scheduler/       sysman/          wwg/             
[root@oracle2 2016_07_06]# cd /u01/11g/dbs/
hc_pu.dat     init.ora      initpu.ora    lkPU          orapwpu       snapcf_pu.f   spfilepu.ora  
[root@oracle2 2016_07_06]# cd /u01/11g/dbs/
[root@oracle2 dbs]# ls
hc_pu.dat  init.ora  initpu.ora  lkPU  orapwpu  snapcf_pu.f  spfilepu.ora
[root@oracle2 dbs]# scp initpu.ora [email protected]:/u01
[email protected]'s password: 
initpu.ora                                                                                                                                                                                                 100% 2266     2.2KB/s   00:00    
[root@oracle2 dbs]# 




记录dbid(恢复的controlfile中会记录dbid,这里我们可以提前记录dbid)
SQL> select dbid from v$database;


      DBID
----------
2744947428




在b服务器上操作:
创建a服务器上的目录
[oracle@localhost oracle]$ grep / /u01/initpu.ora 
zhphpgg.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
pu.__oracle_base='/u01/oracle'#ORACLE_BASE set from environment
*.audit_file_dest='/u01/oracle/admin/pu/adump'
*.control_files='/u01/oracle/oradata/pu/control01.ctl','/u01/oracle/fast_recovery_area/pu/control02.ctl'
*.db_file_name_convert='/u01/oracle/oradata/zhphpgg/','/u01/oracle/oradata/pu/'
*.db_recovery_file_dest='/u01/oracle/fast_recovery_area'
*.diagnostic_dest='/u01/oracle'
[oracle@localhost oracle]$ mkdir -p /u01/oracle/admin/pu/adump
[oracle@localhost oracle]$ mkdir -p /u01/oracle/oradata/pu/
[oracle@localhost oracle]$ mkdir -p /u01/oracle/fast_recovery_area/pu/






使用a服务器上拷贝过来的pfile启动数据库到nomount状态(如果服务器的配置不同,记得调整pfile中记录的内存数值,否则会提示内存不支持错误)
SQL> startup nomount pfile='/u01/initpu.ora';
ORACLE instance started.


Total System Global Area 1068937216 bytes
Fixed Size                  2235208 bytes
Variable Size             918553784 bytes
Database Buffers          142606336 bytes
Redo Buffers                5541888 bytes








登陆rman恢复controlfile
[oracle@localhost ~]$ rman target /


Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 6 13:52:18 2016


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


connected to target database: PU (not mounted)


RMAN> restore controlfile from '/u01/o1_mf_ncnn0_TAG20160706T111222_cqrxvpr1_.bkp';


Starting restore at 06-JUL-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK


channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/oracle/oradata/pu/control01.ctl
output file name=/u01/oracle/fast_recovery_area/pu/control02.ctl
Finished restore at 06-JUL-16




打开数据库到mount状态
RMAN> alter database mount;


database mounted
released channel: ORA_DISK_1


RMAN> 




还原数据文件
[oracle@localhost ~]$ rman target /


Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 6 14:12:41 2016


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


connected to target database: PU (DBID=2744947428, not open)


RMAN> restore database;


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


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/06/2016 14:13:04
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore


RMAN> restore database validate;


Starting restore at 06-JUL-16
using channel ORA_DISK_1
using channel ORA_DISK_2


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/06/2016 14:15:11
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore


RMAN> list backup of datafile 1;


specification does not match any backup in the repository


RMAN> list incarnation;




List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       PU       2744947428       PARENT  995548     16-MAY-16
2       2       PU       2744947428       CURRENT 1302203    17-MAY-16


RMAN> list backup;


specification does not match any backup in the repository
这里遇到RMAN-06023错误,通过检查备份片和对比ab服务器的Incarnations,发现到问题
把备份片加载到controlfile中记录

RMAN> catalog start with '/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/';


searching for all files that match the pattern /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/


List of Files Unknown to the Database
=====================================
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrr22_.bkp
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrq9o_.bkp
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_ncnn0_TAG20160706T111222_cqrxvpr1_.bkp
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy08q_.bkp
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy0dx_.bkp


Do you really want to catalog the above files (enter YES or NO)? t^H^[[3~
"" is an invalid response - please re-enter.


Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done


List of Cataloged Files
=======================
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrr22_.bkp
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrq9o_.bkp
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_ncnn0_TAG20160706T111222_cqrxvpr1_.bkp
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy08q_.bkp
File Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy0dx_.bkp


再次还原数据库
RMAN> restore database;


Starting restore at 06-JUL-16
using channel ORA_DISK_1
using channel ORA_DISK_2


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 /u01/oracle/oradata/pu/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/oracle/oradata/pu/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/clsp01.dbf
channel ORA_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrq9o_.bkp
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 /u01/oracle/oradata/pu/system01.dbf
channel ORA_DISK_2: restoring datafile 00002 to /u01/oracle/oradata/pu/sysaux01.dbf
channel ORA_DISK_2: restoring datafile 00006 to /u01/salary01.dbf
channel ORA_DISK_2: restoring datafile 00007 to /u01/TEST01.DBF
channel ORA_DISK_2: reading from backup piece /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrr22_.bkp
channel ORA_DISK_1: piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrq9o_.bkp tag=TAG20160706T111222
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:17
channel ORA_DISK_2: piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrr22_.bkp tag=TAG20160706T111222
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:01:17
Finished restore at 06-JUL-16






恢复数据库
RMAN> recover database;


Starting recover at 06-JUL-16
using channel ORA_DISK_1
using channel ORA_DISK_2


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=412
channel ORA_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy08q_.bkp
channel ORA_DISK_2: starting archived log restore to default destination
channel ORA_DISK_2: restoring archived log
archived log thread=1 sequence=413
channel ORA_DISK_2: reading from backup piece /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy0dx_.bkp
channel ORA_DISK_1: piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy08q_.bkp tag=TAG20160706T111511
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_412_cqs98v5v_.arc thread=1 sequence=412
channel default: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_412_cqs98v5v_.arc RECID=365 STAMP=916496923
channel ORA_DISK_2: piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy0dx_.bkp tag=TAG20160706T111511
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:01
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_413_cqs98v68_.arc thread=1 sequence=413
channel default: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_413_cqs98v68_.arc RECID=366 STAMP=916496923
unable to find archived log
archived log thread=1 sequence=414
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/06/2016 14:28:44
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 414 and starting SCN of 5627202


RMAN> recover database using backup controlfile until cancel;


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "using": expecting one of: "allow, archivelog, auxiliary, check, clear, delete, exclude, from, high, noparallel, noredo, parallel, preview, restore, skip readonly, skip, tablespace, test, to restore point, undo, until restore point, until, validate, ;"
RMAN-01007: at line 1 column 18 file: standard input


RMAN> restore archivelog all;


Starting restore at 06-JUL-16
using channel ORA_DISK_1
using channel ORA_DISK_2


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/06/2016 14:29:52
RMAN-06026: some targets not found - aborting restore
RMAN-06025: no backup of archived log for thread 1 with sequence 411 and starting SCN of 5626942 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 410 and starting SCN of 5626665 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 409 and starting SCN of 5626657 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 408 and starting SCN of 5626419 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 407 and starting SCN of 5617178 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 406 and starting SCN of 5606945 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 405 and starting SCN of 5585418 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 404 and starting SCN of 5565355 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 403 and starting SCN of 5542711 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 402 and starting SCN of 5540392 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 401 and starting SCN of 5511631 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 400 and starting SCN of 5496552 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 399 and starting SCN of 5461468 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 398 and starting SCN of 5442324 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 397 and starting SCN of 5429918 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 396 and starting SCN of 5403469 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 395 and starting SCN of 5387614 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 394 and starting SCN of 5364207 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 393 and starting SCN of 5361298 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 392 and starting SCN of 5333729 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 391 and starting SCN of 5312232 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 390 and starting SCN of 5288857 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 389 and starting SCN of 5286135 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 388 and starting SCN of 5279410 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 387 and starting SCN of 5245844 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 386 and starting SCN of 5213468 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 385 and starting SCN of 5212205 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 384 and starting SCN of 5205956 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 383 and starting SCN of 5174001 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 382 and starting SCN of 5139910 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 381 and starting SCN of 5135035 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 380 and starting SCN of 5115087 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 379 and starting SCN of 5081742 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 378 and starting SCN of 5065172 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 377 and starting SCN of 5060097 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 376 and starting SCN of 5026489 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 375 and starting SCN of 4993184 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 374 and starting SCN of 4982966 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 373 and starting SCN of 4950226 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 372 and starting SCN of 4934026 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 371 and starting SCN of 4907121 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 370 and starting SCN of 4883152 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 369 and starting SCN of 4874537 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 368 and starting SCN of 4856680 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 367 and starting SCN of 4829948 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 366 and starting SCN of 4806161 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 365 and starting SCN of 4797297 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 364 and starting SCN of 4789001 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 363 and starting SCN of 4764023 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 362 and starting SCN of 4742220 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 361 and starting SCN of 4721226 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 360 and starting SCN of 4702689 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 359 and starting SCN of 4688203 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 358 and starting SCN of 4656282 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 357 and starting SCN of 4643671 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 356 and starting SCN of 4621271 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 355 and starting SCN of 4610951 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 354 and starting SCN of 4579189 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 353 and starting SCN of 4571231 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 352 and starting SCN of 4567776 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 351 and starting SCN of 4537564 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 350 and starting SCN of 4521750 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 349 and starting SCN of 4492970 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 348 and starting SCN of 4463844 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 347 and starting SCN of 4447408 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 346 and starting SCN of 4418877 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 345 and starting SCN of 4408676 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 344 and starting SCN of 4379603 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 343 and starting SCN of 4355137 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 342 and starting SCN of 4345147 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 341 and starting SCN of 4341099 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 340 and starting SCN of 4328243 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 339 and starting SCN of 4296928 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 338 and starting SCN of 4272284 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 337 and starting SCN of 4261813 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 336 and starting SCN of 4257512 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 335 and starting SCN of 4229688 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 334 and starting SCN of 4216952 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 333 and starting SCN of 4185294 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 332 and starting SCN of 4184286 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 331 and starting SCN of 4154992 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 330 and starting SCN of 4141473 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 329 and starting SCN of 4110882 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 328 and starting SCN of 4090292 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 327 and starting SCN of 4078385 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 326 and starting SCN of 4046154 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 325 and starting SCN of 4046146 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 324 and starting SCN of 4045484 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 323 and starting SCN of 4045475 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 322 and starting SCN of 4036699 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 321 and starting SCN of 4026353 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 320 and starting SCN of 4003829 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 319 and starting SCN of 3980879 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 318 and starting SCN of 3945422 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 317 and starting SCN of 3933555 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 316 and starting SCN of 3920345 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 315 and starting SCN of 3870140 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 314 and starting SCN of 3852226 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 313 and starting SCN of 3822618 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 312 and starting SCN of 3804389 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 311 and starting SCN of 3793774 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 310 and starting SCN of 3765318 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 309 and starting SCN of 3743307 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 308 and starting SCN of 3722698 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 307 and starting SCN of 3714036 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 306 and starting SCN of 3702534 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 305 and starting SCN of 3667799 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 304 and starting SCN of 3641267 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 303 and starting SCN of 3635320 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 302 and starting SCN of 3601086 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 301 and starting SCN of 3567153 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 300 and starting SCN of 3564497 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 299 and starting SCN of 3541458 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 298 and starting SCN of 3506259 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 297 and starting SCN of 3491533 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 296 and starting SCN of 3426662 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 295 and starting SCN of 3415266 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 294 and starting SCN of 3411528 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 293 and starting SCN of 3408688 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 292 and starting SCN of 3408595 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 291 and starting SCN of 3407743 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 290 and starting SCN of 3407654 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 289 and starting SCN of 3407369 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 288 and starting SCN of 3407177 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 287 and starting SCN of 3406290 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 286 and starting SCN of 3401334 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 285 and starting SCN of 3396814 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 284 and starting SCN of 3394698 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 283 and starting SCN of 3393857 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 282 and starting SCN of 3393685 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 281 and starting SCN of 3393596 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 280 and starting SCN of 3393307 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 279 and starting SCN of 3393093 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 278 and starting SCN of 3376321 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 277 and starting SCN of 3349156 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 276 and starting SCN of 3325454 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 275 and starting SCN of 3293780 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 274 and starting SCN of 3268172 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 273 and starting SCN of 3247664 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 272 and starting SCN of 3225002 found to restore
RMAN-00567: Recovery Manager could not print some error messages


RMAN> recover database;


Starting recover at 06-JUL-16
using channel ORA_DISK_1
using channel ORA_DISK_2


starting media recovery


unable to find archived log
archived log thread=1 sequence=414
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/06/2016 14:30:16
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 414 and starting SCN of 5627202


RMAN> exit




Recovery Manager complete.
[oracle@localhost ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 6 14:31:48 2016


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




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


SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done




SQL> 








RMAN> recover database;


Starting recover at 06-JUL-16
using channel ORA_DISK_1
using channel ORA_DISK_2


starting media recovery


unable to find archived log
archived log thread=1 sequence=414
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/06/2016 14:30:16
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 414 and starting SCN of 5627202


RMAN> exit




Recovery Manager complete.
[oracle@localhost ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 6 14:31:48 2016


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




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


SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done




SQL>  recover database using backup controlfile until cancel;
ORA-00279: change 5627202 generated at 07/06/2016 11:15:11 needed for thread 1
ORA-00289: suggestion :
/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_414_%u_.arc
ORA-00280: change 5627202 for thread 1 is in sequence #414




Specify log: {=suggested | filename | AUTO | CANCEL}    ---输入auto
auto
ORA-00308: cannot open archived log
'/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_414_%u_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3




ORA-00308: cannot open archived log
'/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_414_%u_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3




SQL> alter database open resetlogs;


Database altered.


rman命令模式下的recover和sql命令模式下的recover命令结构不同,rman模式下只需要敲recover database即可从备份中执行所有的自动恢复,包括归档日志。而sql命令模式下有时候需要置顶归档日志路径名称,例如:recover database using backup controlfile until cancel;
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup pfile='/u01/initpu.ora';
ORACLE instance started.


Total System Global Area 1068937216 bytes
Fixed Size                  2235208 bytes
Variable Size             918553784 bytes
Database Buffers          142606336 bytes
Redo Buffers                5541888 bytes
Database mounted.
Database opened.
SQL> create spfile from pfile;
create spfile from pfile
*
ERROR at line 1:
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/11g/dbs/initpu.ora'




SQL> create spfile from pfile='/u01/initpu.ora';     -------创建参数文件


File created.


SQL> 
--至此整个异机0级恢复完成




增量恢复测试
create table clspuser.test1(id number);
create table clspuser.test2(name varchar(20));
在a服务器上操作:
创建测试表
SQL> create table clspuser.test1(id number);


Table created.


SQL> create table clspuser.test2(name varchar(20));


Table created.


SQL> insert into clspuser.test1 values(100)
  2  ;


1 row created.


SQL> inset
SP2-0042: unknown command "inset" - rest of line ignored.
SQL> commit;


Commit complete.


SQL> insert into clspuser.test2 values('old diver');


1 row created.


SQL> commit
  2  ;


Commit complete.


SQL> alter system archive log current;


System altered.


SQL> 




-----1级备份
RMAN> run{
2> backup incremental level 1 database include current controlfile;
3> sql 'alter system archive log current';
4> backup  archivelog all delete input;
5> }


Starting backup at 06-JUL-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=34 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=46 device type=DISK
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/u01/clsp01.dbf
input datafile file number=00003 name=/u01/oracle/oradata/pu/undotbs01.dbf
input datafile file number=00004 name=/u01/oracle/oradata/pu/users01.dbf
channel ORA_DISK_1: starting piece 1 at 06-JUL-16
channel ORA_DISK_2: starting incremental level 1 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/oracle/oradata/pu/sysaux01.dbf
input datafile file number=00001 name=/u01/oracle/oradata/pu/system01.dbf
input datafile file number=00006 name=/u01/salary01.dbf
input datafile file number=00007 name=/u01/TEST01.DBF
channel ORA_DISK_2: starting piece 1 at 06-JUL-16
channel ORA_DISK_1: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd1_TAG20160706T154648_cqsfvb38_.bkp tag=TAG20160706T154648 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting incremental level 1 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
channel ORA_DISK_2: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd1_TAG20160706T154648_cqsfvbbk_.bkp tag=TAG20160706T154648 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:01:16
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 06-JUL-16
channel ORA_DISK_1: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_ncnn1_TAG20160706T154648_cqsfxp5n_.bkp tag=TAG20160706T154648 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-JUL-16


Starting Control File and SPFILE Autobackup at 06-JUL-16
piece handle=/u01/rmanbackup/controlfile_c-2744947428-20160706-05 comment=NONE
Finished Control File and SPFILE Autobackup at 06-JUL-16


sql statement: alter system archive log current


Starting backup at 06-JUL-16
current log archived
using channel ORA_DISK_1
using channel ORA_DISK_2
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=414 RECID=367 STAMP=916500939
channel ORA_DISK_1: starting piece 1 at 06-JUL-16
channel ORA_DISK_2: starting archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=415 RECID=368 STAMP=916501692
input archived log thread=1 sequence=416 RECID=369 STAMP=916501693
channel ORA_DISK_2: starting piece 1 at 06-JUL-16
channel ORA_DISK_1: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T154813_cqsfxyk0_.bkp tag=TAG20160706T154813 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_414_cqsf6c83_.arc RECID=367 STAMP=916500939
channel ORA_DISK_2: finished piece 1 at 06-JUL-16
piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T154813_cqsfxysm_.bkp tag=TAG20160706T154813 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:04
channel ORA_DISK_2: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_415_cqsfxwmn_.arc RECID=368 STAMP=916501692
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_416_cqsfxxnz_.arc RECID=369 STAMP=916501693
Finished backup at 06-JUL-16


Starting Control File and SPFILE Autobackup at 06-JUL-16
piece handle=/u01/rmanbackup/controlfile_c-2744947428-20160706-06 comment=NONE
Finished Control File and SPFILE Autobackup at 06-JUL-16












[oracle@localhost ~]$ rman target /


Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 6 16:06:20 2016


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


connected to target database: PU (DBID=2744947428, not open)


RMAN> list backup;


using target database control file instead of recovery catalog


List of Backup Sets
===================




BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
31      Incr 0  613.38M    DISK        00:01:12     06-JUL-16      
        BP Key: 33   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T111222
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrq9o_.bkp
  List of Datafiles in backup set 31
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  3    0  Incr 5627103    06-JUL-16 /u01/oracle/oradata/pu/undotbs01.dbf
  4    0  Incr 5627103    06-JUL-16 /u01/oracle/oradata/pu/users01.dbf
  5    0  Incr 5627103    06-JUL-16 /u01/clsp01.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
32      Incr 0  1.36G      DISK        00:00:00     06-JUL-16      
        BP Key: 32   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T111222
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrr22_.bkp
  List of Datafiles in backup set 32
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 5627104    06-JUL-16 /u01/oracle/oradata/pu/system01.dbf
  2       Full 5627104    06-JUL-16 /u01/oracle/oradata/pu/sysaux01.dbf
  6       Full 5627104    06-JUL-16 /u01/salary01.dbf
  7       Full 5627104    06-JUL-16 /u01/TEST01.DBF


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
33      Incr 0  9.64M      DISK        00:00:00     06-JUL-16      
        BP Key: 34   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T111222
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_ncnn0_TAG20160706T111222_cqrxvpr1_.bkp
  Control File Included: Ckp SCN: 5627138      Ckp time: 06-JUL-16


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
34      46.00K     DISK        00:00:00     06-JUL-16      
        BP Key: 35   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T111511
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy08q_.bkp


  List of Archived Logs in backup set 34
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    412     5626950    06-JUL-16 5627194    06-JUL-16


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
35      2.00K      DISK        00:00:00     06-JUL-16      
        BP Key: 36   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T111511
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy0dx_.bkp


  List of Archived Logs in backup set 35
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    413     5627194    06-JUL-16 5627202    06-JUL-16


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
36      Incr 1  9.14M      DISK        00:00:00     06-JUL-16      
        BP Key: 37   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T154648
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd1_TAG20160706T154648_cqsfvbbk_.bkp
  List of Datafiles in backup set 36
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1    1  Incr 5640134    06-JUL-16 /u01/oracle/oradata/pu/system01.dbf
  2    1  Incr 5640134    06-JUL-16 /u01/oracle/oradata/pu/sysaux01.dbf
  6    1  Incr 5640134    06-JUL-16 /u01/salary01.dbf
  7    1  Incr 5640134    06-JUL-16 /u01/TEST01.DBF


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
37      13.50M     DISK        00:00:00     06-JUL-16      
        BP Key: 38   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T154813
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T154813_cqsfxyk0_.bkp


  List of Archived Logs in backup set 37
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    414     5627202    06-JUL-16 5639697    06-JUL-16


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
38      229.00K    DISK        00:00:00     06-JUL-16      
        BP Key: 39   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T154813
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T154813_cqsfxysm_.bkp


  List of Archived Logs in backup set 38
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    415     5639697    06-JUL-16 5640198    06-JUL-16
  1    416     5640198    06-JUL-16 5640206    06-JUL-16


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
39      Incr 1  7.09M      DISK        00:00:00     06-JUL-16      
        BP Key: 40   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T154648
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd1_TAG20160706T154648_cqsfvb38_.bkp
  List of Datafiles in backup set 39
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  3    1  Incr 5640133    06-JUL-16 /u01/oracle/oradata/pu/undotbs01.dbf
  4    1  Incr 5640133    06-JUL-16 /u01/oracle/oradata/pu/users01.dbf
  5    1  Incr 5640133    06-JUL-16 /u01/clsp01.dbf


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
40      Incr 1  9.64M      DISK        00:00:00     06-JUL-16      
        BP Key: 41   Status: AVAILABLE  Compressed: NO  Tag: TAG20160706T154648
        Piece Name: /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_ncnn1_TAG20160706T154648_cqsfxp5n_.bkp
  Control File Included: Ckp SCN: 5640174      Ckp time: 06-JUL-16
  
  
全部拷贝到b服务器
restore controlfile from '/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_ncnn1_TAG20160706T154648_cqsfxp5n_.bkp'


注意:需要使用1级备份的控制文件启动数据库,而不是0级备份的控制文件

  RMAN> run{
2> set until scn=5640198;     ----最大的scn号
3> restore database;
4> recover database;
5> }


executing command: SET until clause


Starting restore at 06-JUL-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=20 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 00003 to /u01/oracle/oradata/pu/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/oracle/oradata/pu/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/clsp01.dbf
channel ORA_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrq9o_.bkp
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 /u01/oracle/oradata/pu/system01.dbf
channel ORA_DISK_2: restoring datafile 00002 to /u01/oracle/oradata/pu/sysaux01.dbf
channel ORA_DISK_2: restoring datafile 00006 to /u01/salary01.dbf
channel ORA_DISK_2: restoring datafile 00007 to /u01/TEST01.DBF
channel ORA_DISK_2: reading from backup piece /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrr22_.bkp
channel ORA_DISK_1: piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrq9o_.bkp tag=TAG20160706T111222
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_2: piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_nnnd0_TAG20160706T111222_cqrxrr22_.bkp tag=TAG20160706T111222
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:56
Finished restore at 06-JUL-16


Starting recover at 06-JUL-16
using channel ORA_DISK_1
using channel ORA_DISK_2


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=412
channel ORA_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy08q_.bkp
channel ORA_DISK_2: starting archived log restore to default destination
channel ORA_DISK_2: restoring archived log
archived log thread=1 sequence=413
channel ORA_DISK_2: reading from backup piece /u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy0dx_.bkp
channel ORA_DISK_1: piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy08q_.bkp tag=TAG20160706T111511
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_412_cqsh41y6_.arc thread=1 sequence=412
channel default: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_412_cqsh41y6_.arc RECID=367 STAMP=916502913
channel ORA_DISK_2: piece handle=/u01/oracle/fast_recovery_area/PU/backupset/2016_07_06/o1_mf_annnn_TAG20160706T111511_cqrxy0dx_.bkp tag=TAG20160706T111511
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:02
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_413_cqsh41yw_.arc thread=1 sequence=413
channel default: deleting archived log(s)
archived log file name=/u01/oracle/fast_recovery_area/PU/archivelog/2016_07_06/o1_mf_1_413_cqsh41yw_.arc RECID=368 STAMP=916502913
media recovery complete, elapsed time: 00:00:02
Finished recover at 06-JUL-16


RMAN>




至此整个异机1级恢复完成,


注意:1、上面的例子是环境完全一致(sid和软件路劲完全一致)的异地恢复,
如果环境不一致的,需要修改路径
run{


set newname for datafile  1 to"/u01/oracle/oradate/pu/SYSTEM01.DBF";


set newname for datafile  2 to"/u01/oracle/oradate/pu/UNDOTBS01.DBF";


set newname for datafile  3 to"/u01/oracle/oradate/pu/SYSAUX01.DBF";


set newname for datafile  4 to"/u01/oracle/oradate/pu/USERS01.DBF";


...................


restore database;


switch datafile all;


}


2、加载备份片到控制文件中,否则无法识别
catalog start with  .....



你可能感兴趣的:(oracle数据库)