Oracle

將 Oracle 數據庫從 Windows 複製到 Linux

  • May 26, 2017

我已經創建了一個正常的 Oracle 12c 數據庫,名為 ECLS。我得到了一堆 .BKP 文件,而不是來自這個數據庫,並被告知用這些文件的內容替換 ECLS 中的所有內容。

到目前為止,這是我嘗試這樣做的方式:

$ sqlplus / as sysdba
SQL> shutdown immediate;
SQL> startup pfile='/u01/app/oracle/product/12.1.0/db_1/dbs/initECLS.ora' nomount;
SQL> exit
$ rman auxiliary /
RMAN> duplicate database to ECLS backup location '/u01/dumpfilesgohere' NOFILENAMECHECK;

在 pfile 中,我設置了以下行:

*.enable_pluggable_database=true

它執行 2.5 小時,然後失敗並顯示以下錯誤消息:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 02/02/2017 14:05:04
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/u01/app/oracle/fast_recovery_area/ECLS/archivelog/2017_02_02/o1_mf_1_73358_d970psod_.arc'
ORA-10562: Error occurred while applying redo to data block (file# 66, block# 799698)
ORA-10564: tablespace NCDS_TS
ORA-01110: data file 66: '/u01/app/oracle/product/12.1.0/db_1/dbs/D:ORADATAFUUVZPD152204CC3CA44789537C2BE3F39041EDATAFILEO1_MF_NCDS_TS_CQ476L1O_.DBF'
ORA-10561: block type 'TRANSACTION MANAGED DATA BLOCK', data object# 106975
ORA-00600: internal error code, arguments: [ktbrcl:NOOP incompat_opt], [212], [], [], [], [], [], [], [], [], [], [] 

在日誌中/u01/app/oracle/diag/rdbms/ecls/ECLS/alert/log.xml我看到這些消息:

<msg time='2017-02-02T14:05:03.614-05:00' org_id='oracle' comp_id='rdbms' type='UNKNOWN' level='16' host_addr='127.0.0.1' pid='5138'>
<txt>Errors in file /u01/app/oracle/diag/rdbms/ecls/ECLS/trace/ECLS_pr07_5138.trc:
ORA-00308: cannot open archived log 'D:\ORADATA\FUUVZP\ONLINELOG\O1_MF_1_CQ39NGLV_.LOG'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00600: internal error code, arguments: [ktbrcl:NOOP incompat_opt], [67], [], [], [], [], [], [], [], [], [], []
</txt>
</msg>
<msg time='2017-02-02T14:05:03.614-05:00' org_id='oracle' comp_id='rdbms' type='UNKNOWN' level='16' host_addr='127.0.0.1' pid='5138'>
<txt>Slave exiting with ORA-10562 exception
</txt>
</msg>
<msg time='2017-02-02T14:05:03.614-05:00' org_id='oracle' comp_id='rdbms' type='UNKNOWN' level='16' host_addr='127.0.0.1' pid='5138'>
<txt>Errors in file /u01/app/oracle/diag/rdbms/ecls/ECLS/trace/ECLS_pr07_5138.trc:
ORA-10562: Error occurred while applying redo to data block (file# 66, block# 1200147)
ORA-10564: tablespace NCDS_TS
ORA-01110: data file 66: '/u01/app/oracle/product/12.1.0/db_1/dbs/D:ORADATAFUUVZPD152204CC3CA44789537C2BE3F39041EDATAFILEO1_MF_NCDS_TS_CQ476L1O_.DBF'
ORA-10561: block type 'TRANSACTION MANAGED DATA BLOCK', data object# 106975
ORA-00600: internal error code, arguments: [ktbrcl:NOOP incompat_opt], [67], [], [], [], [], [], [], [], [], [], []
</txt>
</msg>

我看到有關未找到文件和 Windows 文件路徑的 Linux 錯誤這一事實向我表明,這在某種程度上與 .BKP 文件是在 Windows 機器上生成的,而它們被使用的地方是Linux機器。

我該如何解釋呢?pfile我需要在其中更改某些設置startup嗎?或者是否有另一個參數需要在duplicate命令中傳遞給 RMAN?

一位 Oracle 員工告訴我,重做日誌與平台無關。他們告訴我,我要麼必須關閉 Windows 數據庫並在沒有任何重做日誌的情況下對其進行冷備份,要麼必須將我已經擁有的文件恢復到另一個在 Windows 上執行的 Oracle 數據庫。

我們最終設置了一台新的 Windows 機器來恢復數據庫。

設置您的恢復以將文件移動到它們的新位置,因為 Linux 和 Windows 不能具有相同的文件路徑。

使用這樣的東西(來自Oracle 文件):

RMAN> RUN
{
 #  If you need to restore the files to new locations,
 #  use SET NEWNAME commands:
 SET NEWNAME FOR DATAFILE 1 TO '/dev/vgd_1_0/rlvt5_500M_1';
 SET NEWNAME FOR DATAFILE 2 TO '/dev/vgd_1_0/rlvt5_500M_2';
 SET NEWNAME FOR DATAFILE 3 TO '/dev/vgd_1_0/rlvt5_500M_3';
 ALLOCATE CHANNEL t1 DEVICE TYPE sbt;
 RESTORE CONTROLFILE FROM AUTOBACKUP;
 ALTER DATABASE MOUNT;
 SET UNTIL SEQUENCE 124 THREAD 1;
 RESTORE DATABASE;
 SWITCH DATAFILE ALL; # Update control file with new location of datafiles.
 RECOVER DATABASE;
}

請注意,您需要知道哪個 Oracle 數據文件編號對應於備份中的哪個實際文件。

您可以使用此命令獲取備份文件編號及其原始文件名的列表:

RMAN> list backup of datafile 1;

這將提供與本文件底部類似的輸出。

 List of Datafiles in backup set 2
 File LV Type Ckp SCN    Ckp Time  Name
 ---- -- ---- ---------- --------- ----
 1       Full 175337     21-OCT-03 /oracle/dbs/tbs_01.f

引用自:https://dba.stackexchange.com/questions/163074