Getting ora error ORA-00054: resource busy when gathering stats.
FranklinFaces.com
FranklinFaces.com - Oracle & SQL Server Database Forums for all IT Professionals
 Home          Members     Calendar     Who's On

Welcome Guest ( Login | Register )
        



Getting ora error ORA-00054: resource busy... Expand / Collapse
Message
Posted 1/15/2009 1:21:39 AM Post #36
 

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being
Anyone have an idea of what to do about this?

I have GATHER_STATS_JOB running daily on our production box. Majority of the runs it gives the following error in the alert log (but no error is seen in the job history log):

GATHER_STATS_JOB encountered errors. Check the trace file.
ORA-00054: resource busy

The trace file holds the following:

ORACLE V10.2.0.3.0 - Production vsnsta=0
vsnsql=14 vsnxtr=3
Oracle Database 10g Release 10.2.0.3.0 - Production
Windows NT Version V5.2 Service Pack 1
CPU : 2 - type 586, 2 Physical Cores
Process Affinity : 0x00000000
Memory (Avail/Total): Ph:732M/2046M, Ph+PgF:2481M/3947M, VA:942M/2047M
Redo thread mounted by this instance: 1
Oracle process number: 15
Windows thread id: 8712, image: ORACLE.EXE (J001)
*** 2007-12-08 06:01:26.781
*** ACTION NAMEGATHER_STATS_JOB) 2007-12-08 06:01:26.781
*** MODULE NAMEDBMS_SCHEDULER) 2007-12-08 06:01:26.781
*** SERVICE NAMESYS$USERS) 2007-12-08 06:01:26.781
*** SESSION ID135.52155) 2007-12-08 06:01:26.781
ORA-00054: resource busy and acquire with NOWAIT specified
*** 2007-12-08 06:01:26.781
GATHER_STATS_JOB: GATHER_TABLE_STATS('"SYS"','"WRI$_ADV_OBJECTS"','""', ...)
ORA-00054: resource busy and acquire with NOWAIT specified

Posted 1/15/2009 1:26:57 AM Post #37
 

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member
Hi,

Since this isn't a Scheduler ora error but a problem with the gather_stats job being executed, you might get better understand if you take a look at any locks or dead locks you have in your system.

You maybe running this at the same time another process is running.

You can try to kill of the process if you see a dead lock or have it run at a different time so you won't get the message.

Here are some useful queries to run to see what's running in the db.


column oracle_username format a15
column os_user_name format a15
column object_name format a37
column object_type format a37

select a.session_id,a.oracle_username, a.os_user_name, b.owner "OBJECT OWNER", b.object_name,b.object_type,a.locked_mode from
(select object_id, SESSION_ID, ORACLE_USERNAME, OS_USER_NAME, LOCKED_MODE from v$locked_object) a,
(select object_id, owner, object_name,object_type from dba_objects) b
where a.object_id=b.object_id;

SELECT LPAD(' ',DECODE(l.xidusn,0,3,0)) || l.oracle_username "User Name",
o.owner, o.object_name, o.object_type
FROM v$locked_object l, dba_objects o
WHERE l.object_id = o.object_id
ORDER BY o.object_id, 1 desc;



SELECT a.sid,a.serial#, a.username,c.os_user_name,a.terminal,
b.object_id,substr(b.object_name,1,40) object_name
from v$session a, dba_objects b, v$locked_object c
where a.sid = c.session_id
and b.object_id = c.object_id;



You can run this to find out the currently running query:

set pagesize 24
set newpage 1
set linesize 125

column sql_text format a100
column user_name format a12

select
u.sid,
substr(u.username,1,12) user_name,
s.sql_text
from
v$sql s,
v$session u
where
s.hash_value = u.sql_hash_value
and
sql_text not like '%from v$sql s, v$session u%'
order by
u.sid;


This all depends on what version of oracle you are running.


Hope this helps.

Stacy
Posted 1/16/2009 12:35:57 AM Post #41
 

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being
Thank you!! This certainly help.

Appreciate it.
Posted 1/16/2009 1:18:28 AM Post #45
 

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member
Your very welcome.

Will continue to post..  ..

Stacy

Posted 6/17/2010 2:13:27 PM Post #411
 

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

ORA-00054:

resource busy and acquire with NOWAIT specified
Cause:Resource interested is busy.
Action:Retry if necessary.
Posted 6/17/2010 2:15:18 PM Post #412
 

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

ORA-00054: resource busy and acquire with NOWAIT specified

Problem Description
In my production database Oracle 10.2g while I was adding column to one of my transaction table it fails with ORA-54 error as below.

SQL> alter table student add b number;
alter table student add b number
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified

Description of the Problem
Let's try to produce the problem in our development environment. I have opened two session that connected to database under a schema. In one session, I have created a table and inserted data into it.
SQL> create table a (a number);

Table created.

SQL> insert into a values(1);

1 row created.

I did not yet committed data in session 1. Now in another session whenever I try to any ddl like (alter table, drop table) ORA-00054 will produce.

In another session,
SQL> alter table a add b number;
alter table a add b number
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified


SQL> drop table a;

drop table a
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified

SQL> lock table a in exclusive mode nowait;

lock table a in exclusive mode nowait
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified


Cause of the Problem
Whenever you try to do any structural changes on a table oracle try to lock the table exclusively with NOWAIT option(this is in 10.2g while in 11g you can change the wait timeout). If oracle fails to lock the table exclusively then ORA-00054 will occur.

Solution of the Problem
In 10.2g you are limited to several choices to solve the problem. To avoid it,

-Re run the DDL at a later time when the database become idle.
or,

-Kill the sessions that are preventing the exclusive lock.
or,

-Prevent end user to connect to the database and then run the DDL.

You have different views to see locking information about the table.
1)DBA_BLOCKERS: Displays a session if it is not waiting for a locked object but is holding a lock on an object for which another session is waiting. In our scenario this view will not help.

2)DBA_DDL_LOCKS: It lists all DDL locks held in the database and all outstanding requests for a DDL lock.

3)DBA_DML_LOCKS: It lists all DML locks held in the database and all outstanding requests for a DML lock.
If you query from it in the mode_held field you will see 'row exclusive lock'.
SQL> select mode_held from dba_dml_locks where owner='MAXIMSG';

MODE_HELD
-------------
Row-X (SX)

4)DBA_LOCK: It lists all locks or latches held in the database, and all outstanding requests for a lock or latch.

5)DBA_LOCK_INTERNAL: It displays a row for each lock or latch that is being held, and one row for each outstanding request for a lock or latch.

6)DBA_LOCKS is a synonym for DBA_LOCK.

7)DBA_WAITERS: Shows all the sessions that are waiting for a lock.

8)V$LOCK: It lists the locks currently held by the Oracle Database and outstanding requests for a lock or latch.

9)V$LOCK_ACTIVITY: This view is deprecated.

10)V$LOCKED_OBJECT: This view lists all locks acquired by every transaction on the system.

In order to see locked object query,
SQL> set linesize 130
SQL> set pages 100
SQL> col username       format a20
SQL> col sess_id        format a10
SQL> col object format a25
SQL> col mode_held      format a10
SQL> select     oracle_username || ' (' || s.osuser || ')' username,  
s.sid || ',' || s.serial# sess_id,  
owner || '.' || object_name object,  
object_type,  
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       v$locked_object v,  dba_objects d,  v$lock l,  v$session s
where      v.object_id = d.object_id
and        v.object_id = l.id1
and        v.session_id = s.sid
order by oracle_username,  session_id
/
 
USERNAME             SESS_ID    OBJECT                    OBJECT_TYPE         STATUS       MODE_HELD
-------------------- ---------- ------------------------- ------------------- ------------ ----------
MAXIMSG (A)          142,232    MAXIMSG.A                 TABLE               Not Blocking Row-X (SX)OMS (DBA2\ershad)    143,280   
 OMS.T                     TABLE               Not Blocking Row-X (SX)OMS (DBA2\ershad)    143,280    OMS.T1                   
 TABLE               Not Blocking Row-X (SX)

Here we see there is 3 types of locking. In our case the object is A. And we see the sid=142 and serial#=232 is preventing us from locking the table in exclusive mode. So to achieve our task we can kill the session as below.

SQL> alter system kill session '142, 232';

System altered.

SQL> alter table a add b number;

Table altered.

Now in the first session whenever you try to access error will be generated saying that session has been killed. In the first session.
SQL> commit;
commit
*
ERROR at line 1:
ORA-00028: your session has been killed
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: silencer

Permissions Expand / Collapse

All times are GMT -5:00, Time now is 7:29am

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0.084. 8 queries. Compression Disabled.