Home » RDBMS Server » Server Administration » Blocking/locking issue in Oracle 9i Database
Blocking/locking issue in Oracle 9i Database [message #151579] Thu, 15 December 2005 13:59 Go to next message
humair77
Messages: 13
Registered: August 2005
Junior Member
I need to find out what is the besy way to resolve blocking/locking issue in the database in case of when users are complaining his processes is hanging for last many hours.
I tried to find out the actuall process that cause blocking by running queries against dba_blockers and dba_waiters but my queries also hanging since last several hours.
I killed my own session and ran the query against these views but nothing coming back. Please let me know if I should be looking at something else than dba_blockers or dba_waiters
Any idea why I am NOT getting anything back? Please let me know what is the best approach to resolve this issue.

Your help will be greatly apprciated .

Thanks
Steve
Re: Blocking/locking issue in Oracle 9i Database [message #151664 is a reply to message #151579] Fri, 16 December 2005 01:32 Go to previous message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Try mine.

column holder format a12
column waiter format a12
column object format a30

SELECT waitsess.osuser || '(' || waiter.sid || ')' waiter,
        waiter.type,
        case waiter.request
                when 0 then null
                when 1 then null
                when 2 then 'row-S'
                when 3 then 'row-X'
                when 4 then 'share'
                when 5 then 'sRowX'
                when 6 then 'excl'
        end req,
        holdsess.osuser  || '(' || holder.sid || ')' holder,
        case holder.lmode
                when 0 then null
                when 1 then null
                when 2 then 'row-S'
                when 3 then 'row-X'
                when 4 then 'share'
                when 5 then 'sRowX'
                when 6 then 'excl'
        end held,
        nvl(obj.object_name, waiter.id1 || ',' || waiter.id2) object
FROM sys.v_$lock holder
JOIN sys.v_$lock waiter
        ON (
                holder.id1 = waiter.id1
        AND     holder.id2 = waiter.id2
        AND     holder.type = waiter.type
        )
JOIN sys.v_$session holdsess
        ON (holdsess.sid = holder.sid)
JOIN sys.v_$session waitsess
        ON (waitsess.sid = waiter.sid)
LEFT OUTER JOIN sys.v_$lock tmhold
        ON (tmhold.type = 'TM' and tmhold.sid = holder.sid)
LEFT OUTER JOIN sys.v_$lock tmwait
        ON (tmwait.type = 'TM'
        AND tmwait.sid = waiter.sid)
LEFT OUTER JOIN dba_objects obj
        ON (obj.object_id = tmwait.id1)
WHERE holder.request = 0
AND holder.block = 1
AND waiter.request > 0
AND nvl(tmhold.id1,0) = nvl(tmwait.id1, 0)
/


_____________
Ross Leishman
Previous Topic: Using DBMS_METADATA API's
Next Topic: ORA-03113: end-of-file on communication - (Ora 9.0.1.1.1)
Goto Forum:
  


Current Time: Thu Feb 13 17:00:16 CST 2025