ASM上恢復STANDBY資料庫出現ORA-15173錯誤

yangtingkun發表於2011-02-12

建立STANDBY資料庫時,在ASM上恢復主庫的資料檔案出現了ORA-15173錯誤。

 

 

主庫和備庫都是單例項資料庫,不過都使用ASM作為儲存方式。

在備庫上利用主庫的備份進行restore database操作,碰到了這個錯誤:

[oracle@localhost data]$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Sat Feb 12 14:43:29 2011

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

connected to target database: MOBILEDB (DBID=3009911466, not open)

RMAN> restore database;

Starting restore at 12-FEB-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1086 devtype=DISK

file 22 is excluded from whole database backup
file 25 is excluded from whole database backup
file 28 is excluded from whole database backup
file 30 is excluded from whole database backup
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +ORADG/mobiledb/datafile/system.260.649168943
restoring datafile 00002 to +ORADG/mobiledb/datafile/undotbs1.261.649168949
restoring datafile 00003 to +ORADG/mobiledb/datafile/sysaux.262.649168951
restoring datafile 00004 to +ORADG/mobiledb/datafile/users.264.649168953
restoring datafile 00005 to +ORAG2/mobiledb/datafile/club_stat.dbf
restoring datafile 00006 to +ORAG2/mobiledb/datafile/club_statindx.dbf
.
.
.
restoring datafile 00068 to +ORADG/mobiledb/datafile/users.328.652899937
channel ORA_DISK_1: reading from backup piece /rman_backup/data/df_MOBILEDB_5042_1_1
ORA-19870: error reading backup piece /rman_backup/data/df_MOBILEDB_5042_1_1
ORA-19504: failed to create file "+ORAG2/mobiledb/datafile/club_stat.dbf"
ORA-17502: ksfdcre:4 Failed to create file +ORAG2/mobiledb/datafile/club_stat.dbf
ORA-15173: entry 'mobiledb' does not exist in directory '/'
failover to previous backup

creating datafile fno=1 name=+ORADG/mobiledb/datafile/system.260.649168943
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/12/2011 14:50:44
ORA-01180: can not create datafile 1
ORA-01110: data file 1: '+ORADG/mobiledb/datafile/system.260.649168943'

導致這個錯誤的原因是RESTORE操作不會自動建立非資料庫所屬的目錄,雖然根據控制檔案中儲存的位置,控制檔案應該恢復到mobiledb目錄中,但是由於standby資料庫和primary資料庫的db_unique_name並不相同,因此實際RESTORE之後,資料檔案會放在standby資料庫db_unique_name對應的名稱MOBILEDB_N目錄下,對於MOBILEDB_N目錄以及其下的DATAFILEONLINELOG等目錄,RESTORE操作會自動建立,但是mobiledb及其下的目錄,RESTORE並不會自動建立,即使這個目錄並不會寫入內容。

解決方法也很簡單,只需要透過asmcmd手工建立對應的目錄結構即可:

[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ asmcmd
ASMCMD> cd +oradg
ASMCMD> mkdir mobiledb
ASMCMD> cd mobiledb
ASMCMD> mkdir datafile
ASMCMD> ls
datafile/
ASMCMD> cd ..
ASMCMD> ls
MOBILEDB_N/
mobiledb/
ASMCMD> cd +orag2 
ASMCMD> mkdir mobiledb
ASMCMD> cd mobiledb
ASMCMD> mkdir datafile
ASMCMD> exit

再次執行RESTORE DATABASE命令,問題解決。

RMAN> restore database;

Starting restore at 12-FEB-11
using channel ORA_DISK_1

file 22 is excluded from whole database backup
file 25 is excluded from whole database backup
file 28 is excluded from whole database backup
file 30 is excluded from whole database backup
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +ORADG/mobiledb/datafile/system.260.649168943
restoring datafile 00002 to +ORADG/mobiledb/datafile/undotbs1.261.649168949
restoring datafile 00003 to +ORADG/mobiledb/datafile/sysaux.262.649168951
restoring datafile 00004 to +ORADG/mobiledb/datafile/users.264.649168953
restoring datafile 00005 to +ORAG2/mobiledb/datafile/club_stat.dbf
restoring datafile 00006 to +ORAG2/mobiledb/datafile/club_statindx.dbf
.
.
.
restoring datafile 00068 to +ORADG/mobiledb/datafile/users.328.652899937
channel ORA_DISK_1: reading from backup piece /rman_backup/data/df_MOBILEDB_5042_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/rman_backup/data/df_MOBILEDB_5042_1_1 tag=TAG20110212T113309
channel ORA_DISK_1: restore complete, elapsed time: 01:28:47
failover to previous backup

Finished restore at 12-FEB-11

 

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4227/viewspace-687104/,如需轉載,請註明出處,否則將追究法律責任。

相關文章