Monday, December 27, 2010

Query to findout locked objects in Oracle and Kill the session in Oracle

Query for Locked objects in Oracle

SELECT    DO.owner
        , DO.object_name
        , DO.object_type
        , vs.SID
        , vs.serial#
        , vs.status
        , vs.osuser
        , vs.machine
        , vs.program
        , vs.module
        , vs.action
    FROM  v$locked_object vlo
        , v$session vs
        , dba_objects DO
   WHERE
        vs.SID = vlo.session_id
        AND vlo.object_id = DO.object_id
ORDER BY module

How to kill the session in oracle.

Execute the above to get the sid and serial#

alter system kill session 'sid,serial#'
e.g.
altery system kill session '351,13545'

No comments:

Post a Comment