Friday, 18 November 2016

Query to check locked objects


Below query will provide list of objects are under particular Schema.

SELECT a.sid,
       a.serial#,
       a.username,
       c.os_user_name,
       a.program,
       a.logon_time,
       a.machine,
       a.terminal,
       b.object_id,
       substr(b.object_name, 1, 40) object_name,
       DECODE(c.locked_mode,
              1,
              'No Lock',
              2,
              'Row Share',
              3,
              'Row Exclusive',
              4,
              'Shared Table',
              5,
              'Shared Row Exclusive',
              6,
              'Exclusive') locked_mode
  from v$session a, dba_objects b, v$locked_object c
 where a.sid = c.session_id
   and b.object_id = c.object_id
--   and a.USERNAME = 'CNYCBAIND'.





































Now use Below command to kill session.

Syntax: ALTER SYSTEM KILL SESSION 'SID,SERIAL#' IMMEDIATE;

SQL> ALTER SYSTEM KILL SESSION '483,6849' immediate;



session will be killed.

No comments:

Post a Comment