Вы находитесь на странице: 1из 5

Issues ORA 0054 - Resource busy and acquire

--------------------------------------------------------------------------------------------------------------------------------------Date - Jun 4 14
When - Creating an index on WF Notification OUt table
________________________________________________________________________________
___________________________________________________________
Contents
-------Observation
Error code
Description
Diagnosis query
Available Applied Solution/work around
Applied Solution/work around
Log
Useful links
Referred MOS notes
DBA views involved
Unix/linux commands used
Google search terms used
________________________________________________________________________________
___________________________________________________________
Observation
-----------------------------------------------------------------------------------------------------------------------------------------ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
occurs while creating index
________________________________________________________________________________
___________________________________________________________
Error code
-----------------------------------------------------------------------------------------------------------------------------------------ORA-00054
________________________________________________________________________________
___________________________________________________________
Description
-----------------------------------------------------------------------------------------------------------------------------------------Error occurs as there are parallel sessions holding locks on the object and y
our ddl session is
1. unable to acquire lock
2. or timing out before acquiring lock
________________________________________________________________________________
___________________________________________________________
Diagnosis query
-----------------------------------------------------------------------------------------------------------------------------------------1. to check gv$access
2. to check locked objects
3. monitor session - check hema/dba/querries
4. kill session
- check hema/dba/querries
5. get details of session using the objects
1. to check gv$access
select s.sid ,s.serial#, s.inst_id, s.status, s.last_call_et/60 as "ela
psed", s.logon_time
,s.action, s.module, s.program, s.machine, s.terminal, s.process as "cl
ient_pid", s.client_identifier , p.spid as "server_pid"

,s.blocking_session_status ||'.'||s.blocking_session ||'.'||s.blocking_


instance as "Blkg: Status.sess.Inst"
-- ,s.sql_id, s.prev_sql_id, s.sql_exec_start,s.sql_exec_id
-- ,s.state, s.event, s.wait_class, s.SECONDS_IN_WAIT
-- ,s.p1Text||'.'||s.p2Text||'.'||s.p3Text as "p1.p2.p3 Text", s.p1||'.'
||s.p2||'.'||s.p3 as "p1.p2.p3"
from gv$session s,
gv$process p,
gv$access gva
where
s.inst_id=p.inst_id
and p.addr=s.paddr
and s.sid=gva.sid
and gva.inst_id=s.inst_id
and gva.object='&TAB_NAME'
2. to check locked objects
SELECT username U_NAME, owner OBJ_OWNER,object_name, object_type, s.osu
ser,s.sid,s.serial#,s.inst_id,s.program,s.action,s.module,s.client_identifier,
DECODE(l.block,
0, 'Not Blocking',
1, 'Blocking',
2, 'Global') STATUS,
DECODE(v.locked_mode,
0, 'None',
1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'Exclusive', TO_CHAR(lmode)
) MODE_HELD
FROM gv$locked_object v, dba_objects d,
gv$lock l, gv$session s
WHERE v.object_id = d.object_id
AND (v.object_id = l.id1)
AND v.session_id = s.sid
AND d.object_name in ('WF_NOTIFICATION_OUT')
--and v.locked_mode=6
ORDER BY username, session_id;
3. monitor session - check hema/dba/querries
4. kill session
- check hema/dba/querries
5. get details of session using the object
SELECT O.OBJECT_NAME, S.SID, S.SERIAL#, P.SPID, S.PROGRAM,SQ.SQL_FULLTEXT,
S.LOGON_TIME
FROM V$LOCKED_OBJECT L,
DBA_OBJECTS O,
V$SESSION S,
V$PROCESS P,
V$SQL SQ
WHERE L.OBJECT_ID = O.OBJECT_ID
AND L.SESSION_ID = S.SID
AND S.PADDR = P.ADDR
AND S.SQL_ADDRESS = SQ.ADDRESS;
6. get details of application session from port - useful for java application
s
SELECT O.OBJECT_NAME, S.SID, S.SERIAL#, P.SPID, S.PROGRAM,S.USERNAME,S.MAC
HINE,S.PORT ,S.LOGON_TIME,SQ.SQL_FULLTEXT
FROM V$LOCKED_OBJECT L,

DBA_OBJECTS O,
V$SESSION S,
V$PROCESS P,
V$SQL SQ
WHERE
L.OBJECT_ID = O.OBJECT_ID
AND L.SESSION_ID = S.SID
AND S.PADDR = P.ADDR
AND S.SQL_ADDRESS = SQ.ADDRESS;
7. Get details of process initiating tcp network connection
netstat -ap | grep <proces_id>
tcp
0
0 machine.name:34465 oracle.db.com:ncube-lm ESTABLISHED
<PID>/java
________________________________________________________________________________
___________________________________________________________
Available Applied Solution/work around
-----------------------------------------------------------------------------------------------------------------------------------------Three approaches,
1. Retry the transaction after some time
2. Make the table read only temporarily - suggested by burleson - check im
pact before trying this
ALTER TABLE tab_name READ ONLY
SELECT table_name, read_only FROM dba_tables WHERE table_name = '&ta
b_name';
ALTER TABLE tab_name READ WRITE;
3. check gv$access, gv$locked_objects find who is locking the program. -refer queries
4. try increasing DDL_LOCK_TIMEOUT for the session and retry the DDL. -- n
ew feature in 11g ?
show parameter ddl_lock_timeout
alter session set ddl_lock_timeout=300 ;
________________________________________________________________________________
___________________________________________________________
Applied Solution/work around
-----------------------------------------------------------------------------------------------------------------------------------------which one worked out here
combination of 3 and 4 helped fixing this.
________________________________________________________________________________
___________________________________________________________
Log
-----------------------------------------------------------------------------------------------------------------------------------------SQL> show parameter ddl
NAME
TYPE
VALUE
------------------------------------ ----------- ----------------------------ddl_lock_timeout
integer
0
enable_ddl_logging
boolean
FALSE
SQL> conn applsys
Enter password:
Connected.
SQL> show user
USER is "APPLSYS"
SQL> CREATE INDEX WF_NOTIFICATION_OUT_N1 ON WF_NOTIFICATION_OUT(CORRID)
STORAGE (INITIAL 1M NEXT 1M MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
0)

TABLESPACE APPS_TS_QUEUES; 2
3
CREATE INDEX WF_NOTIFICATION_OUT_N1 ON WF_NOTIFICATION_OUT(CORRID)
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expi
red
SQL> alter session set ddl_log ck_timeout=300 ;
Session altered.
SQL> CREATE INDEX WF_NOTIFICATION_OUT_N1 ON WF_NOTIFICATION_OUT(CORRID)
STORAGE (INITIAL 1M NEXT 1M MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
0)
TABLESPACE APPS_TS_QUEUES; 2

Index created.
SQL> exit ;
________________________________________________________________________________
___________________________________________________________
MOS notes
-----------------------------------------------------------------------------------------------------------------------------------------________________________________________________________________________________
___________________________________________________________
DBA views involved
-----------------------------------------------------------------------------------------------------------------------------------------view
column
description
gv$access
object
object being used
sid, inst_id
session inst_id -> gv$session
gv$locked_objects object_name
object being locked
locked_mode
0 - none 1 - null 2 - Row-S SS 3 - Row
-X SX 4 - Share 5 S/Row-X SSX 6 Exclusive
gv$block
block
blocked or not [0-no block 1-blocking
2-global]
dba_objects
object_name
object_type
gv$session
port
________________________________________________________________________________
___________________________________________________________
Unix/linux commands used
-----------------------------------------------------------------------------------------------------------------------------------------netstat
-a
list all
-p
process
________________________________________________________________________________
___________________________________________________________
Useful Links
-----------------------------------------------------------------------------------------------------------------------------------------Burleson
Description, source, table readonly
http://www
.dba-oracle.com/t_ora_00054_locks.htm
Oracle base
stimulation, cause, explanation
http://www.
oracle-base.com/articles/11g/ddl-lock-timeout-11gr1.php

Oracle Doc 11gr1


DDL_Lock_timeout parameter documentation
http://docs
.oracle.com/cd/B28359_01/server.111/b28320/initparams068.htm#REFRN10267
Morgan library
DDL_LOCK_TIMEOUT parameter demo
http://www.
morganslibrary.org/reference/ddl_stmnts.html
decipher infosys
Speaks about option 2
http://deci
pherinfosys.wordpress.com/2007/12/07/oracle-11g-alter-table-read-only/
abeytom
Find, fix resource busy error
http://abey
tom.blogspot.in/2012/08/finding-and-fixing-ora-00054-resource.html
https://learnwithme11g.wordpress.com/tag/ddl_lock_timeout/
select for update oracle example