RMAN recover中遇到 RMAN-20505,ORA-0119,ORA-27400

來源:互聯網
上載者:User

RMAN recover中遇到 RMAN-20505,ORA-0119,ORA-27400

這是一次RAMN恢複的工作,生產端是Oracle 11.2.0.4 RAC,資料檔案儲存在檔案系統上。災備端是Oracle11.2.0.4單一實例+ASM方式儲存資料檔案。檢修計劃需要將生產庫做一次RMAN全備,然後在災備端恢複。由於生產端和災備端的儲存方式不一樣,檔案路徑也不一樣,所以災備端RMAN恢複的時候需要採用set newname的方式將檔案路徑轉換一次。

執行指令碼如下:

run{
set newname for datafile 1 to '+DATA';
set newname for datafile 2 to '+DATA';
set newname for datafile 3 to '+DATA’;

… 500多個資料檔案

restore database;
switch datafile all;
recover database;
}

在執行到recover database 過程中出現錯誤,提示第545號資料檔案IDX_S007.dbf建立失敗。

RMAN-20505: create datafile during recovery
ORA-0119: error in creating database file '/sgpmdb/oradata/u07/cmsdb/IDX_S007.dbf'
ORA-27400: file create error, unable to create file
HPUX-ia Error: 2: No such file or directory
Additional information: 1
RMAN-11003: failure during parse/execution of SQL statement: alter database recover log file '/orabak/arch/2_147320_666569930.arc'
ORA-00283: recovery session canceled due to errors
ORA-01244: unnamed datafile(s) added to control file by media recovery
ORA-01110: data file 545: '/spgmdb/oradata/u07/cmsdb/IDX_S007.dbf'

分析原因如下:
生產庫做完全備後又做了一些DDL操作,如添加資料檔案等。 這些新的操作記錄在全備之後的歸檔日誌中(/orabak/arch/2_147320_666569930.arc
)。在重演歸檔日誌中建立資料檔案的部分時找不到生產環境的目錄,所以報錯(HPUX-ia Error: 2: No such file or directory)
該檔案被臨時記錄在了/app/oracle/product/11.2.0/db_1/dbs,但也只是控制檔案中的記錄,磁碟上時沒有該檔案。

第545號資料檔案在控制檔案中的記錄如下,不是我們預期的+DATA
SQL> select name from v$datafile where name like '%545%;

NAME
——————————————————
/app/oracle/product/11.2.0/db_1/dbs/UNAMED00545

解決方案

在RMAN下使用set newname命令先資料檔案的目錄位址改為+DATA/cmsdb/datafile。然後重新restore一次該資料檔案,最後switch資料檔案。

run{
set newname for datafile '/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00545' to '+DATA/cmsdb/datafile/IDX_S007.dbf';
restore datafile '/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00545';
switch datafile '/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00545';
}

也可以寫成
run{
set newname for datafile 545 to '+DATA';
restore datafile 545;
switch datafile 545;
}

輸出如下:
executing command: SET NEWNAME

Staring restore at 27-OCT-14
using channel ORA_DISK1

creating datafile file number=545 name=+DATA/cmsdb/datafile/IDX_S007.dbf
restore not done: all files read only, offline, or already restored
Finished restore at 27-OCT-14

datafile 545 switched to datafile copy
input datafile copy RECID=3615 STAMP=862057086 file name=+DATA/cmsdb/datafile/IDX_S007.dbf

本次操作使用的用戶端主機安全層級很高,不允許用隨身碟複製任何檔案,包括secureCRT的日誌等。所有錯誤資訊和螢幕輸出都是我手敲的,如果有錯誤敬請諒解。

--------------------------------------推薦閱讀 --------------------------------------

RMAN 配置歸檔日誌刪除策略

Oracle基礎教程之通過RMAN複製資料庫

RMAN備份策略制定參考內容

RMAN備份學習筆記

OracleDatabase Backup加密 RMAN加密

--------------------------------------分割線 --------------------------------------

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.