测试备份oracle的job中,始终无法备份成功,检查后台log, 发现如下错误信息:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of Control File and SPFILE Autobackup command on cspfile channel at 10/17/2008 1...
ORA-00230: operation disallowed: snapshot controlfile enqueue unavailable
Recovery Manager complete.
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of Control File and SPFILE Autobackup command on cspfile channel at 10/17/2008 1...
ORA-00230: operation disallowed: snapshot controlfile enqueue unavailable
Recovery Manager complete.
google 得到此是一个enqueue lock存在导致备份失败,原来多次运行备份作业,然后中途又取消,导致残留一个rman进程在后台。
开始执行:
[root@testdb ~]# ps -efw | grep rman
找到一进程ID,kill 掉,但错误依旧。
用如下语句检查:
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'
and l.id1 = 0
and l.id2 = 2
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
发觉还残留一进程,通过SID查找其OS对应SID:
select 'kill -9 '||spid from v$process where addr = (select paddr from v$session where sid=&sid);
在后台继续 kill 掉该 process, 备份任务终于恢复正常。