Jul 15, 2019

Database Table Lock Alter Query

This query will generate the ALTER SYSTEM KILL SESSION command for the locked objects with correct SID and SERIAL number. Once the result generate, execute the kill command from the different session but not in the same TOAD/SQL Developer session.

SELECT object_name,
  'ALTER SYSTEM KILL SESSION '
  ||''''
  ||sid
  ||','
  ||serial
  ||''';'
FROM
  (SELECT c.owner,
    b.username,
    c.object_name,
    c.object_type,
    b.sid sid,
    b.serial# serial,
    b.status,
    b.osuser,
    b.machine
  FROM v$locked_object a ,
    v$session b,
    dba_objects c
  WHERE b.sid     = a.session_id
  AND a.object_id = c.object_id
  );

Ex:

FND_CONCURRENT_QUEUES         ALTER SYSTEM KILL SESSION '155,61';
FND_CONCURRENT_REQUESTS ALTER SYSTEM KILL SESSION '935,31';

No comments:

Post a Comment

Useful Workflow Commands

  WFLOAD apps/columbus789 0 Y DOWNLOAD APEXP_FINDEV.wft APEXP Locations: $PO_TOP/patch/115/import/US/porpocha.wft $PO_TOP/patch/115/import/U...