ORACLE rman備份之ORA-00230

清風艾艾發表於2016-04-13
    2016年4月13日接到一呼叫平臺負責人告警,oracle 9.2.0.8資料庫的rman備份出現異常,控制檔案無法備份,報錯資訊如下:
RMAN> run{
2> allocate channel c1 type disk;
3> backup current controlfile format '/tmp/ora_contr.bak';
4> release channel c1;
5> }
using target database controlfile instead of recovery catalog
allocated channel: c1
channel c1: sid=411 devtype=DISK
Starting backup at 13-APR-16
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
waiting for snapshot controlfile enqueue
waiting for snapshot controlfile enqueue
waiting for snapshot controlfile enqueue
waiting for snapshot controlfile enqueue
waiting for snapshot controlfile enqueue
cannot make a snapshot controlfile
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on c1 channel at 04/13/2016 10:37:24
ORA-00230: operation disallowed: snapshot controlfile enqueue unavailable
   查閱網上介紹rman備份遇到ORA00230有2個原因,一是9.2.0.8的資料庫的rman配置了磁帶庫備份,在備份時磁帶庫故障響應超時導致,二是資料庫在之前的rman備份過程中被異常中斷,殘留有上次rman的備份程式。
    經過核實,當前資料庫確實是9.2.0.8,作業系統是AIX6.1,為了排除磁帶庫故障,特地使用磁碟備份進行測試,測試結果如上rman備份失敗報錯資訊,因此排除磁帶庫故障的原因;接下來是RMAN備份異常中斷導致控制檔案無法備份的處理過程:
   --登入資料庫查詢殘留的RMAN備份程式
SQL*Plus: Release 9.2.0.8.0 - Production on Wed Apr 13 10:17:00 2016
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> SELECT s.SID, USERNAME AS "User", PROGRAM, MODULE,
ACTION, LOGON_TIME "Logon"
 FROM V$SESSION s, V$ENQUEUE_LOCK l
WHERE l.SID = s.SID
AND l.TYPE = 'CF'
AND l.ID1 = 0
AND l.ID2 = 2; --網上給的方法,沒有查出結果,看來網上的方法不總是那麼可靠,╮(╯▽╰)╭

no rows selected
   --修改查詢方法,查出了RMAN殘留備份程式
SQL> select s.sid, username, program, module, action, logon_time, l.*
from v$session s, v$enqueue_lock l
where l.sid = s.sid
and l.type = 'CF';
      SID USERNAME PROGRAM                           MODULE                                        ACTION                  LOGON_TIM ADDR                     KADDR                 TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------- --------------- -------------------------------------   ------------------------------------------------    --------------------------- -------------    ---------------------------- -----------------          ---------- ---------- ----------    ---------- ----------       ----------      ----------
    377  SYS          rman@cncora2 (TNS V1-V3)  backup full datafile: ORA_SBT_TAPE_1 0000014 STARTED 13-APR-16  07000000C50A59B8 07000000C50A59D8 CF      0          2 
    4          0                1217          2
   --查出sid=377的作業系統程式號
SQL> select 'kill -9 '||spid from v$process where addr = (select paddr from v$session where sid=&sid);
Enter value for sid: 377
old   1: select 'kill -9 '||spid from v$process where addr = (select paddr from v$session where sid=&sid)
new   1: select 'kill -9 '||spid from v$process where addr = (select paddr from v$session where sid=377)
'KILL-9'||SPID
--------------------------------------------
kill -9 2322660
    --檢視2322660程式是否是資料庫核心程式(不會是)
[cncora2]$ps -ef|grep 2322660
  oracle 2322660       1   0 10:26:02      -  0:01 oracleora922 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))) 
  oracle 2404512 2359338   0 10:53:40  pts/4  0:00 grep 2322660 
    --殺掉2322660
[cncora2]$kill -9 2322660
   --核實2322660是否被殺掉
[cncora2]$ps -ef|grep 2322660
  oracle 2322674 2359338   0 10:54:45  pts/4  0:00 grep 2322660 
[cncora2]$sqlplus /nolog
SQL*Plus: Release 9.2.0.8.0 - Production on Wed Apr 13 10:54:53 2016
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> select s.sid,username,program,module,action,logon_time,l.*
  2  from v$session s,v$enqueue_lock l
  3  where l.sid=s.sid
  4  and l.type='CF';
no rows selected
SQL> quit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning and Real Application Clusters options
   --測試控制檔案是否可以備份
[cncora2]$rman target /
Recovery Manager: Release 9.2.0.8.0 - 64bit Production
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
connected to target database: ORA92 (DBID=1953009355)
RMAN> run{
2> allocate channel c1 type disk;
3> backup current controlfile format '/tmp/ora_ctl.bak';
4> release channel c1;
5> }
using target database controlfile instead of recovery catalog
allocated channel: c1
channel c1: sid=404 devtype=DISK
Starting backup at 13-APR-16
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
including current controlfile in backupset
channel c1: starting piece 1 at 13-APR-16
channel c1: finished piece 1 at 13-APR-16
piece handle=/tmp/ora_ctl.bak comment=NONE
channel c1: backup set complete, elapsed time: 00:00:04
Finished backup at 13-APR-16
Starting Control File and SPFILE Autobackup at 13-APR-16
piece handle=/home/oracle/app/oracle/product/9.2.0.8.0/dbs/c-1953009355-20160413-00 comment=NONE
Finished Control File and SPFILE Autobackup at 13-APR-16
released channel: c1
RMAN> quit
Recovery Manager complete.
[cncora2]$cd /tmp
[cncora2]$ls -l ora*
-rw-r-----   1 oracle   dba         9224192 Apr 13 11:00 ora_ctl.bak
-rwxr-xr-x   1 root     system          677 Dec 07 2007  orainstRoot.sh
    到此,故障處理完成。




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

相關文章