1.首先在A机上做一个全库备份
[oracle@localhost ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 6 00:51:28 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> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 768294912 bytes Fixed Size 2257192 bytes Variable Size 503320280 bytes Database Buffers 260046848 bytes Redo Buffers 2670592 bytes Database mounted. SQL> alter database archivelog; Database altered. SQL> alter database open; Database altered. SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@localhost ~]$ rman target / Recovery Manager: Release 11.2.0.4.0 - Production on Tue Sep 6 00:54:00 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1448371606) RMAN> backup database; Starting backup at 06-SEP-16 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=32 device type=DISK 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=/u01/app/oracle/oradata/orcl/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf channel ORA_DISK_1: starting piece 1 at 06-SEP-16 channel ORA_DISK_1: finished piece 1 at 06-SEP-16 piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_nnndf_TAG20160906T005447_cwv8tqsm_.bkp tag=TAG20160906T005447 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05 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 06-SEP-16 channel ORA_DISK_1: finished piece 1 at 06-SEP-16 piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_ncsnf_TAG20160906T005447_cwv8wt7p_.bkp tag=TAG20160906T005447 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 06-SEP-16 RMAN> list backupset; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 4 Full 1.09G DISK 00:01:05 06-SEP-16 BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20160906T005447 Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_nnndf_TAG20160906T005447_cwv8tqsm_.bkp List of Datafiles in backup set 4 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 1020116 06-SEP-16 /u01/app/oracle/oradata/orcl/system01.dbf 2 Full 1020116 06-SEP-16 /u01/app/oracle/oradata/orcl/sysaux01.dbf 3 Full 1020116 06-SEP-16 /u01/app/oracle/oradata/orcl/undotbs01.dbf 4 Full 1020116 06-SEP-16 /u01/app/oracle/oradata/orcl/users01.dbf 5 Full 1020116 06-SEP-16 /u01/app/oracle/oradata/orcl/example01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 5 Full 9.36M DISK 00:00:01 06-SEP-16 BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20160906T005447 Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_ncsnf_TAG20160906T005447_cwv8wt7p_.bkp SPFILE Included: Modification time: 06-SEP-16 SPFILE db_unique_name: ORCL Control File Included: Ckp SCN: 1020245 Ckp time: 06-SEP-16 RMAN>
2.在B主机同样目录拷贝A主机上的备份集(创建目录省略)
[oracle@localhost 2016_09_06]$ scp 192.168.56.5:/u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/* .
3.在B主机开始恢复操作
[oracle@localhost ~]$ rman target / Recovery Manager: Release 11.2.0.4.0 - Production on Tue Sep 6 01:06:34 2016 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 '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora' starting Oracle instance without parameter file for retrieval of spfile Oracle instance started Total System Global Area 1068937216 bytes Fixed Size 2260088 bytes Variable Size 281019272 bytes Database Buffers 780140544 bytes Redo Buffers 5517312 bytes RMAN> restore spfile from '/u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_ncsnf_TAG20160906T005447_cwv8wt7p_.bkp'; Starting restore at 06-SEP-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 spfile from AUTOBACKUP /u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_ncsnf_TAG20160906T005447_cwv8wt7p_.bkp channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete Finished restore at 06-SEP-16 RMAN> shutdown immediate Oracle instance shut down RMAN> startup nomount; connected to target database (not started) Oracle instance started Total System Global Area 768294912 bytes Fixed Size 2257192 bytes Variable Size 503320280 bytes Database Buffers 260046848 bytes Redo Buffers 2670592 bytes RMAN> restore controlfile from '/u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_ncsnf_TAG20160906T005447_cwv8wt7p_.bkp'; Starting restore at 06-SEP-16 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/app/oracle/oradata/orcl/control01.ctl output file name=/u01/app/oracle/fast_recovery_area/orcl/control02.ctl Finished restore at 06-SEP-16 RMAN> alter database mount; database mounted released channel: ORA_DISK_1 run{ set newname for datafile 1 to '/u01/app/oradata/orcl/system01.dbf'; set newname for datafile 2 to '/u01/app/oradata/orcl/sysaux01.dbf'; set newname for datafile 3 to '/u01/app/oradata/orcl/undotbs01.dbf'; set newname for datafile 4 to '/u01/app/oradata/orcl/users01.dbf'; set newname for datafile 5 to '/u01/app/oradata/orcl/example01.dbf'; restore database; switch datafile all; 9> } executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME executing command: SET NEWNAME Starting restore at 06-SEP-16 Starting implicit crosscheck backup at 06-SEP-16 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=19 device type=DISK Crosschecked 1 objects Finished implicit crosscheck backup at 06-SEP-16 Starting implicit crosscheck copy at 06-SEP-16 using channel ORA_DISK_1 Finished implicit crosscheck copy at 06-SEP-16 searching for all files in the recovery area cataloging files... cataloging done List of Cataloged Files ======================= File Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_ncsnf_TAG20160906T005447_cwv8wt7p_.bkp using channel ORA_DISK_1 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 /u01/app/oradata/orcl/system01.dbf channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oradata/orcl/sysaux01.dbf channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oradata/orcl/undotbs01.dbf channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oradata/orcl/users01.dbf channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oradata/orcl/example01.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_nnndf_TAG20160906T005447_cwv8tqsm_.bkp channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2016_09_06/o1_mf_nnndf_TAG20160906T005447_cwv8tqsm_.bkp tag=TAG20160906T005447 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:55 Finished restore at 06-SEP-16 datafile 1 switched to datafile copy input datafile copy RECID=7 STAMP=921805758 file name=/u01/app/oradata/orcl/system01.dbf datafile 2 switched to datafile copy input datafile copy RECID=8 STAMP=921805758 file name=/u01/app/oradata/orcl/sysaux01.dbf datafile 3 switched to datafile copy input datafile copy RECID=9 STAMP=921805758 file name=/u01/app/oradata/orcl/undotbs01.dbf datafile 4 switched to datafile copy input datafile copy RECID=10 STAMP=921805758 file name=/u01/app/oradata/orcl/users01.dbf datafile 5 switched to datafile copy input datafile copy RECID=11 STAMP=921805758 file name=/u01/app/oradata/orcl/example01.dbf RMAN> recover database; Starting recover at 06-SEP-16 using channel ORA_DISK_1 starting media recovery unable to find archived log archived log thread=1 sequence=7 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 09/06/2016 01:09:48 RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 7 and starting SCN of 1020116 RMAN> exit Recovery Manager complete. [oracle@localhost ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 6 01:10:47 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> alter database open resetlogs; Database altered. SQL>
4.看看文件
SQL> select * from v$logfile; GROUP# STATUS TYPE MEMBER IS_ ---------- ------- ------- -------------------------------------------------- --- 3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log NO 2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log NO 1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log NO SQL> set lines 200 SQL> desc dba_data_files Name Null? Type ----------------------------------------- -------- ---------------------------- FILE_NAME VARCHAR2(513) FILE_ID NUMBER TABLESPACE_NAME VARCHAR2(30) BYTES NUMBER BLOCKS NUMBER STATUS VARCHAR2(9) RELATIVE_FNO NUMBER AUTOEXTENSIBLE VARCHAR2(3) MAXBYTES NUMBER MAXBLOCKS NUMBER INCREMENT_BY NUMBER USER_BYTES NUMBER USER_BLOCKS NUMBER ONLINE_STATUS VARCHAR2(7) SQL> select file_name,tablespace_name from dba_data_files; FILE_NAME TABLESPACE_NAME -------------------------------------------------- ------------------------------ /u01/app/oradata/orcl/users01.dbf USERS /u01/app/oradata/orcl/undotbs01.dbf UNDOTBS1 /u01/app/oradata/orcl/sysaux01.dbf SYSAUX /u01/app/oradata/orcl/system01.dbf SYSTEM /u01/app/oradata/orcl/example01.dbf EXAMPLE SQL> desc dba_temp_files; Name Null? Type ----------------------------------------- -------- ---------------------------- FILE_NAME VARCHAR2(513) FILE_ID NUMBER TABLESPACE_NAME VARCHAR2(30) BYTES NUMBER BLOCKS NUMBER STATUS VARCHAR2(9) RELATIVE_FNO NUMBER AUTOEXTENSIBLE VARCHAR2(3) MAXBYTES NUMBER MAXBLOCKS NUMBER INCREMENT_BY NUMBER USER_BYTES NUMBER USER_BLOCKS NUMBER ONLINE_STATUS VARCHAR2(7) SQL> select file_name,tablespace_name from dba_temp_files; FILE_NAME TABLESPACE_NAME -------------------------------------------------- ------------------------------ /u01/app/oracle/oradata/orcl/temp01.dbf TEMP
版权声明:本文为博主原创文章,未经博主允许不得转载。
oracle