不成功的RMAN恢復到其他機器的例子


事實上,RMAN備份的時候,如果是使用control file 來作catalog,那么一定要把control file和spfile恢復到另外的機器上面。

否則,會出現類似如下的錯誤:

原來的實例:

 

[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 6 15:54:41 2014

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

connected to target database: ORCL (DBID=1370687811)

RMAN> backup tablespace users;

Starting backup at 06-APR-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 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=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 06-APR-14
channel ORA_DISK_1: finished piece 1 at 06-APR-14
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/o1_mf_nnndf_TAG20140406T155529_9n223km6_.bkp tag=TAG20140406T155529 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-APR-14

RMAN> quit


Recovery Manager complete.
[oracle@localhost ~]$

 

然后,如果我另外再安裝一套oracle,會發生什么狀況呢?

[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 6 16:00:00 2014

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

connected to target database: ORCL (DBID=1371965186, not open)

RMAN> list backup;

using target database control file instead of recovery catalog
specification does not match any backup in the repository

RMAN> restore tablespace users from '/u01/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/o1_mf_nnndf_TAG20140406T155529_9n223km6_.bkp';

Starting restore at 06-APR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/06/2014 16:00:38
RMAN-06509: only SPFILE or control file can be restored from AUTOBACKUP

RMAN>

 

一開始,我對上述的RMAN-06509非常不理解,后來參考了如下的網站,明白了錯誤所在。

http://www.doc88.com/p-900857827054.html

 

由於RMAN要依賴於catalog,當catalog是controle file的形式的時候,需要先把control file和spfile拿到新的數據庫實例的對應的目錄下,那樣才可以繼續進行restore/recover的活動。

 

***********************************************

接着我又進行了試驗,看看把control file 挪過來回如何:

舊實例上:

RMAN> backup current controlfile;

Starting backup at 06-APR-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 device type=DISK
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
channel ORA_DISK_1: starting piece 1 at 06-APR-14
channel ORA_DISK_1: finished piece 1 at 06-APR-14
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/o1_mf_ncnnf_TAG20140406T213831_9n2p6rw4_.bkp tag=TAG20140406T213831 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-APR-14

RMAN>

 

在舊實例上:

RMAN> backup current controlfile;

Starting backup at 06-APR-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 device type=DISK
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
channel ORA_DISK_1: starting piece 1 at 06-APR-14
channel ORA_DISK_1: finished piece 1 at 06-APR-14
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/o1_mf_ncnnf_TAG20140406T213831_9n2p6rw4_.bkp tag=TAG20140406T213831 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-APR-14

RMAN>

 

[oracle@localhost ~]$ cd /u01/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/

[oracle@localhost 2014_04_06]$ cp o1_mf_ncnnf_TAG20140406T213831_9n2p6rw4_.bkp /u02/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/

 

然后,啟動新實例

 

 

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 814227456 bytes
Fixed Size 2257640 bytes
Variable Size 528485656 bytes
Database Buffers 281018368 bytes
Redo Buffers 2465792 bytes
SQL>

 

[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 6 21:45:09 2014

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

connected to target database: ORCL (not mounted)

RMAN>

 

開始恢復control file,進而得到備份集的信息:

RMAN> restore controlfile from '/u02/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/o1_mf_ncnnf_TAG20140406T213831_9n2p6rw4_.bkp';

Starting restore at 06-APR-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u02/app/oracle/oradata/orcl/control01.ctl
output file name=/u02/app/oracle/fast_recovery_area/orcl/control02.ctl
Finished restore at 06-APR-14

RMAN> list backup;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of list command at 04/06/2014 21:46:06
ORA-01507: database not mounted

RMAN> quit

 

********************************************************

 

SQL> alter database mount;

Database altered.

SQL>

 

[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Apr 6 21:46:42 2014

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

connected to target database: ORCL (DBID=1370687811, 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
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 1.43M DISK 00:00:00 06-APR-14
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20140406T155529
Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/o1_mf_nnndf_TAG20140406T155529_9n223km6_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 988907 06-APR-14 /u01/app/oracle/oradata/orcl/users01.dbf

RMAN>

 

這些個信息里面記的都是舊實例所擁有的位置信息。

 

再試驗看:

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
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 1.43M DISK 00:00:00 06-APR-14
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20140406T155529
Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/o1_mf_nnndf_TAG20140406T155529_9n223km6_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 988907 06-APR-14 /u01/app/oracle/oradata/orcl/users01.dbf

RMAN> restore tablespace users from '/u01/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/o1_mf_nnndf_TAG20140406T155529_9n223km6_.bkp';

Starting restore at 06-APR-14
Starting implicit crosscheck backup at 06-APR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 06-APR-14

Starting implicit crosscheck copy at 06-APR-14
using channel ORA_DISK_1
Finished implicit crosscheck copy at 06-APR-14

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u02/app/oracle/fast_recovery_area/ORCL/backupset/2014_04_06/o1_mf_ncnnf_TAG20140406T213831_9n2p6rw4_.bkp
File Name: /u02/app/oracle/fast_recovery_area/ORCL/archivelog/2014_04_06/o1_mf_1_3_9n22917q_.arc

using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/06/2014 21:56:09
RMAN-06509: only SPFILE or control file can be restored from AUTOBACKUP

RMAN>

因為新舊實例不同,所以會出問題。

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM