美文网首页
RMAN 备份控制文件报错 ORA-00230

RMAN 备份控制文件报错 ORA-00230

作者: e652d1fb12eb | 来源:发表于2020-11-14 09:29 被阅读0次

本文转发自https://www.modb.pro/db/29932

  • 登陆数据库查看 Alert 日志发现以下报错:

不允许操作:快照控制文件入队不可用

RMAN-03009: failure of backup command on t1 channel at 07/20/2020 11:09:25 
ORA-00230: operation disallowed: snapshot control file enqueue unavailable

首先便去查看控制文件:

sqlplus / as sysdba
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA/cmdb/controlfile/current.260.912246715

rman target /
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name CMASDB are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 31 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+DATA/cmdb/controlfile/snapcf_cmdb.f';
RMAN> exit

rman 记录控制文件位置也在共享存储中,无任何问题,便使用系统自带的 oerr 查看错误提示:

JiekeXuDB1:/home/oracle$oerr ora 230
00230, 00000, "operation disallowed: snapshot control file enqueue unavailable"
// *Cause:  The attempted operation cannot be executed at this time because
//          another process currently holds the snapshot control file enqueue.
// *Action: Retry the operation after the concurrent operation that is holding
//          the snapshot control file enqueue terminates.

译为:
操作不允许:快照控制文件入队不可用。
此时无法执行尝试的操作,因为另一个进程当前持有快照控制文件入队。在持有快照控制文件队列的并发操作终止后重试操作。
意思是说有进程在占用,于是利用搜索引擎查查其他人是怎么说的。查阅网上介绍 rman 备份遇到 ORA-00230 有 2 个原因,一是 9.2.0.8 的数据库的 rman 配置了磁带库备份,在备份时磁带库故障响应超时导致,二是数据库在之前的 rman 备份过程中被异常中断,残留有上次 rman 的备份进程。我们的数据库是 11204 没有 9i 版本,排除第一种可能。咨询相关人员后确认是由于上次将备份任务异常终止导致的,那么接下来按 RMAN 备份异常中断导致控制文件无法备份的处理过程。

  • 网上给出了查询异常终止的 SQL 亲测可用,但据说也有没法查看的。
set line 345
col user for a20 
col MODULE for a30 
col ACTION for a20 
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;
  • --下面便是实际生产环境处理过程
JiekeXuDB1:/home/oracle$
SQL> col user for a20 
SQL> col MODULE for a30 
SQL> col ACTION for a20 
SQL> SELECT s.SID, USERNAME AS "User", PROGRAM, MODULE,
  2   ACTION, LOGON_TIME "Logon"
  3   FROM V$SESSION s, V$ENQUEUE_LOCK l
  4  WHERE l.SID = s.SID
  5  AND l.TYPE = 'CF'
  6  AND l.ID1 = 0
 AND l.ID2 = 2;
  7  
       SID User                 PROGRAM                                          MODULE                         ACTION               Logon
---------- -------------------- ------------------------------------------------ ------------------------------ -------------------- -------------------
       101 SYS                  rman@JiekeXuDB1 (TNS V1-V3)                       backup full datafile           0000040 STARTED16    2020-07-14 22:43:54
  • --根据查到的 SID 查看操作系统 SPID。
SQL> select spid from v$process where addr in(select paddr from v$session where sid=101);


SPID
------------------------
27394192
  • --根据 SPID 进程查看具体的进程名,判断进程的作用。LOCAL=YES 非数据库核心进程,便可以直接 kill -9 杀掉。
JiekeXuDB1:/home/oracle$ps -ef | grep 27394192
  oracle 27394192        1   0   Jul 14      -  0:05 oraclecmdb1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))) 
JiekeXuDB1:/home/oracle$kill -9 27394192
JiekeXuDB1:/home/oracle$
JiekeXuDB1:/home/oracle$ps -ef | grep 27394192
  oracle 19726386 38928542   0 16:10:00  pts/0  0:00 grep 27394192
  • --数据库再次查看已经没有进程占用了,可以正常备份了。
SQL> SELECT s.SID, USERNAME AS "User", PROGRAM, MODULE, ACTION, LOGON_TIME "Logon"
  3   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;
  4    5    6    7  
no rows selected
  • --前面说上面 SQL 不太好使,所以另一套数据库同样的问题使用另一个 SQL 查看,如下:
- --查看被占用的进程 SID 
SQL> col MODULE for a30 
SQL> col BLOCK for a45
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_TIME   ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------- ------------------------------ ------------------------------------------------ ------------------------------ ------------------------------ ------------ ---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
      2281                                oracle@ZB12GHCW1 (CKPT)                                                                                        26-MAR-20    0700010266E4B6F0 0700010266E4B748       2281 CF          0          0          2          0   10011939 ##########
      2283 SYS                            rman@ZB12GHCW1 (TNS V1-V3)                       backup incr datafile           0000040 STARTED16              14-JUL-20    0700010266E4EF50 0700010266E4EFA8       2283 CF          0          2          4          0     493750 ##########

---此处查看到有 SID 为 2281 的 CKPT 检查点进程和 SID 为 2283 的 RMAN 进程。

---下面使用拼接语句直接拼接出来,直接 kill 掉。      
SQL> select 'kill -9 '||spid from v$process where addr = (select paddr from v$session where sid=&sid);
Enter value for sid: 2283
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=2283)

'KILL-9'||SPID
--------------------------------
kill -9 15007754
SQL> host kill -9 15007754

-- -接下来查看已经没有 2283 的进程了。

SQL> set line 345 
SQL> set pages 345 
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_TIME   ADDR             KADDR                   SID TY        ID1        ID2      LMODE    REQUEST      CTIME      BLOCK
---------- --------------- ------------------------------ -------------------- ------------ ------------ ---------------- ---------------- ---------- -- ---------- ---------- ---------- ---------- ---------- ----------
      2281                 oracle@ZB12GHCW1 (CKPT)                                          26-MAR-20    0700010266E4B6F0 0700010266E4B748       2281 CF          0          0          2          0  26-MAR-20          2

处理完后,备份便可以正常进行了,记录至此,以备不时之需,希望可以帮助读者朋友。

相关文章

网友评论

      本文标题:RMAN 备份控制文件报错 ORA-00230

      本文链接:https://www.haomeiwen.com/subject/dymibktx.html