Oracle 11g RMAN 異機恢復報錯 RMAN-06172、ORA-07202

feelpurple發表於2016-02-24
Oracle 11g RMAN 異機恢復,恢復引數檔案的時候報錯。

RMAN> startup nomount

Oracle instance started

Total System Global Area   17103163392 bytes

Fixed Size                     2245480 bytes
Variable Size               2181041304 bytes
Database Buffers           14898167808 bytes
Redo Buffers                  21708800 bytes

RMAN> RUN
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk;
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata/bk/rman/%F';
  RESTORE SPFILE 
    TO PFILE '/u01/app/oracle/product/11.2.0/db_1/dbs/initaftdb.ora' 
    FROM AUTOBACKUP;
  SHUTDOWN ABORT;
2> 3> 4> 5> 6> 7> 8> 9> }

allocated channel: c1
channel c1: SID=1072 device type=DISK

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 24-FEB-16

channel c1: looking for AUTOBACKUP on day: 20160224
channel c1: looking for AUTOBACKUP on day: 20160223
channel c1: looking for AUTOBACKUP on day: 20160222
channel c1: looking for AUTOBACKUP on day: 20160221
channel c1: looking for AUTOBACKUP on day: 20160220
channel c1: looking for AUTOBACKUP on day: 20160219
channel c1: looking for AUTOBACKUP on day: 20160218
channel c1: no AUTOBACKUP in 7 days found
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/24/2016 15:52:07
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

報錯原因:
使用 FROM AUTOBACKUP 語句時,預設會搜尋7天內的備份資料,如果我們進行恢復的控制檔案超過了這個時間範圍,就會報錯。

解決辦法:
可以在語句上面指定 MAXDAYS 引數,將擴大搜尋的時間範圍,最大可以指定366天。

RMAN> RUN
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk;
  SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata/bk/rman/%F';
  RESTORE SPFILE 
    TO PFILE '/u01/app/oracle/product/11.2.0/db_1/dbs/initaftdb.ora' 
    FROM AUTOBACKUP  MAXDAYS 30;
  SHUT2> 3> 4> 5> 6> 7> 8> DOWN ABORT;
}9> 

allocated channel: c1
channel c1: SID=1072 device type=DISK

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 24-FEB-16

channel c1: looking for AUTOBACKUP on day: 20160224
channel c1: looking for AUTOBACKUP on day: 20160223
channel c1: looking for AUTOBACKUP on day: 20160222
channel c1: looking for AUTOBACKUP on day: 20160221
channel c1: looking for AUTOBACKUP on day: 20160220
channel c1: looking for AUTOBACKUP on day: 20160219
channel c1: looking for AUTOBACKUP on day: 20160218
channel c1: looking for AUTOBACKUP on day: 20160217
channel c1: AUTOBACKUP found: /oradata/bk/rman/c-1864798816-20160217-00
channel c1: restoring spfile from AUTOBACKUP /oradata/bk/rman/c-1864798816-20160217-00
channel c1: SPFILE restore from AUTOBACKUP complete
Finished restore at 24-FEB-16

Oracle instance shut down

--恢復控制檔案的時候報錯 ORA-07202

RMAN> RUN 
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk;
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata/bk/rman/%F';
  RESTORE CONTROLFILE FROM AUTOBACKUP MAXDAYS 30;
  ALTER DATABASE MOUNT;
}2> 3> 4> 5> 6> 7> 

allocated channel: c1
channel c1: SID=1174 device type=DISK

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 24-FEB-16

recovery area destination: /oradata/aftdb
database name (or database unique name) used for search: AFTDB
channel c1: no AUTOBACKUPS found in the recovery area
channel c1: looking for AUTOBACKUP on day: 20160224
channel c1: looking for AUTOBACKUP on day: 20160223
channel c1: looking for AUTOBACKUP on day: 20160222
channel c1: looking for AUTOBACKUP on day: 20160221
channel c1: looking for AUTOBACKUP on day: 20160220
channel c1: looking for AUTOBACKUP on day: 20160219
channel c1: looking for AUTOBACKUP on day: 20160218
channel c1: looking for AUTOBACKUP on day: 20160217
channel c1: AUTOBACKUP found: /oradata/bk/rman/c-1864798816-20160217-00
channel c1: restoring control file from AUTOBACKUP /oradata/bk/rman/c-1864798816-20160217-00
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/24/2016 17:28:38
ORA-07202: sltln: invalid parameter to sltln.

仔細檢視引數檔案,發現 db_recovery_file_dest 配置成資料檔案的上級目錄

*.control_files='/oradata/aftdb/controlfile/control01.ctl','/oradata/aftdb/controlfile/control02.ctl'
*.db_create_file_dest='/oradata/aftdb/data'
*.db_create_online_log_dest_1='/oradata/aftdb/log'
*.db_create_online_log_dest_2='/oradata/aftdb/log'
*.db_recovery_file_dest='/oradata/aftdb/'
*.LOG_ARCHIVE_DEST_1='LOCATION=/oradata/aftdb/arc'

更改如下

*.control_files='/oradata/aftdb/controlfile/control01.ctl','/oradata/aftdb/controlfile/control02.ctl'
*.db_create_file_dest='/oradata/aftdb/data'
*.db_create_online_log_dest_1='/oradata/aftdb/log'
*.db_create_online_log_dest_2='/oradata/aftdb/log'
*.db_recovery_file_dest='/oradata/aftdb/recovery'
*.LOG_ARCHIVE_DEST_1='LOCATION=/oradata/aftdb/arc'

使用新改正後的引數檔案重新啟動資料庫,報錯消失,正常恢復控制檔案。

RMAN>  RUN 
{
  ALLOCATE CHANNEL c1 DEVICE TYPE disk;
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oradata/bk/rman/%F';
  RESTORE CONTROLFILE FROM AUTOBACKUP MAXDAYS 30;
  ALTER DATABASE MOUNT;
}2> 3> 4> 5> 6> 7> 

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=1174 device type=DISK

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 25-FEB-16

recovery area destination: /oradata/aftdb/recovery
database name (or database unique name) used for search: AFTDB
channel c1: no AUTOBACKUPS found in the recovery area
channel c1: looking for AUTOBACKUP on day: 20160225
channel c1: looking for AUTOBACKUP on day: 20160224
channel c1: looking for AUTOBACKUP on day: 20160223
channel c1: looking for AUTOBACKUP on day: 20160222
channel c1: looking for AUTOBACKUP on day: 20160221
channel c1: looking for AUTOBACKUP on day: 20160220
channel c1: looking for AUTOBACKUP on day: 20160219
channel c1: looking for AUTOBACKUP on day: 20160218
channel c1: looking for AUTOBACKUP on day: 20160217
channel c1: AUTOBACKUP found: /oradata/bk/rman/c-1864798816-20160217-00
channel c1: restoring control file from AUTOBACKUP /oradata/bk/rman/c-1864798816-20160217-00
channel c1: control file restore from AUTOBACKUP complete
output file name=/oradata/aftdb/controlfile/control01.ctl
output file name=/oradata/aftdb/controlfile/control02.ctl
Finished restore at 25-FEB-16

database mounted
released channel: c1

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

相關文章