2012年2月23日 星期四

Oracle DB Restore error

其實我只是半調子的DBA,沒有接受過正規的訓練就硬上,真的搞的我好痛苦
因為Oracle ERP 要還原資料庫到測試區,所以開始按照SOP進行操作,對於這個還原動作
其實我做過很多次了,每次也都很順利阿!
不過這兩天在還原的時候一直有問題 ,磁帶機跑個幾分鐘就結束了, 畫面還給我顯示完成

bash-2.03$ rman target / catalog rman/rman@rcat

====================================================================
Recovery Manager: Release 9.2.0.7.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
connected to target database: PROD (not mounted)
connected to recovery catalog database

RMAN> list backup of archivelog from time='sysdate-1';
List of Backup Sets
===================
  List of Archived Logs in backup set 3841856
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    267247  6969521319 23-FEB-12 6969522190 23-FEB-12
  1    267248  6969522190 23-FEB-12 6969529596 23-FEB-12
  1    267249  6969529596 23-FEB-12 6969541532 23-FEB-12
  1    267250  6969541532 23-FEB-12 6969562012 23-FEB-12
  1    267251  6969562012 23-FEB-12 6969583421 23-FEB-12
  1    267252  6969583421 23-FEB-12 6969590201 23-FEB-12
  1    267253  6969590201 23-FEB-12 6969605419 23-FEB-12
  1    267254  6969605419 23-FEB-12 6969626002 23-FEB-12
  1    267255  6969626002 23-FEB-12 6969642047 23-FEB-12
  1    267256  6969642047 23-FEB-12 6969680909 23-FEB-12
  1    267257  6969680909 23-FEB-12 6969710928 23-FEB-12

  1    267258  6969710928 23-FEB-12 6969710946 23-FEB-12
  1    267259  6969710946 23-FEB-12 6969710956 23-FEB-12

RMAN> run
{
allocate channel t1 type 'sbt_tape' parms="ENV=(NB_ORA_CLIENT=OOOprod)";
allocate channel d1 type disk;
restore archivelog from logseq 267258 until logseq 267259;
release channel d1;
release channel t1;
}
2> 3> 4> 5> 6> 7> 8>
allocated channel: t1
channel t1: sid=13 devtype=SBT_TAPE
channel t1: VERITAS NetBackup for Oracle - Release 5.0GA (2005030612)

allocated channel: d1
channel d1: sid=14 devtype=DISK

Starting restore at 23-FEB-12

channel t1: starting archive log restore to default destination
channel t1: restoring archive log
archive log thread=1 sequence=267258
channel t1: restoring archive log
archive log thread=1 sequence=267259
channel t1: restored backup piece 1
piece handle=al_90123_1_775995936 tag=TAG20120223T101834 params=NULL
channel t1: restore complete
Finished restore at 23-FEB-12

released channel: d1

released channel: t1

RMAN> exit




bash-2.03$ vi /AP/OOOprod/clone_prod.sh
"/AP/OOOprod/clone_prod.sh" 20 lines, 475 characters
#!/bin/sh

TARGET_CONNECT_STR=/
CATALOG_CONNECT_STR=rman/rman@rcat

rman target / catalog $CATALOG_CONNECT_STR << EOF
run
{
allocate channel t1 type 'sbt_tape' parms="ENV=(NB_ORA_CLIENT=OOOprod)";
allocate channel d1 type disk;
restore controlfile ;
alter database mount;
set until logseq 267259 thread 1;
restore database;
recover database;
alter database open resetlogs;
release channel d1;
release channel t1;
}
EOF
~
====================================================================



試了好幾次都不行,本來想直接找維護廠商救援,後來很不信邪再是一次,這次用tail -f nohup.out 去看一下輸出的內容發現failed to create file "/PROD_DB/proddata/cntrl01.dbf" ,


====================================================================


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/23/2012 11:36:19
ORA-19504: failed to create file "/PROD_DB/proddata/cntrl01.dbf"
ORA-27040: skgfrcre: create error, unable to create file
SVR4 Error: 13: Permission denied

RMAN>

Recovery Manager complete.
====================================================================



想一下有這種可能的話應該就是資料夾權限有問題, 因此又從新再做了一次 chown -fR oraprod:dba proddata
然後再試一次!


靠.....好了!  當下好想哭喔    搞很久耶


====================================================================
Starting restore at 23-FEB-12
channel t1: starting datafile backupset restore
channel t1: specifying datafile(s) to restore from backup set
restoring datafile 00013 to /PROD_DB/proddata/fax01.dbf
restoring datafile 00022 to /PROD_DB/proddata/cctx01.dbf
restoring datafile 00027 to /PROD_DB/proddata/icxd01.dbf
restoring datafile 00033 to /PROD_DB/proddata/bisd01.dbf
restoring datafile 00034 to /PROD_DB/proddata/bisx01.dbf
restoring datafile 00082 to /PROD_DB/proddata/opix01.dbf
restoring datafile 00104 to /PROD_DB/proddata/bimx01.dbf
restoring datafile 00130 to /PROD_DB/proddata/xdpx01.dbf
restoring datafile 00159 to /PROD_DB/proddata/ontd01.dbf
restoring datafile 00167 to /PROD_DB/proddata/wshd01.dbf
restoring datafile 00184 to /PROD_DB/proddata/iemx01.dbf
restoring datafile 00258 to /PROD_DB/proddata/psbx01.dbf
restoring datafile 00287 to /PROD_DB/proddata/fvd01.dbf
restoring datafile 00302 to /PROD_DB/proddata/enix01.dbf
restoring datafile 00414 to /PROD_DB/proddata/xdod01.dbf

沒有留言:

張貼留言