【Oracle note】Select session in oracle



① Select all session

 select

       substr(a.spid,1,9) pid,

       substr(b.sid,1,5) sid,

       substr(b.serial#,1,5) ser#,

       substr(b.machine,1,6) box,

       substr(b.username,1,10) username,

--       b.server,

       substr(b.osuser,1,8) os_user,

       substr(b.program,1,30) program

from v$session b, v$process a

where

b.paddr = a.addr

and type='USER'

AND b.username = 'FSA_USR1'

order by spid; 

② Select lock session

select

   c.owner,

   c.object_name,

   c.object_type,

   b.sid,

   b.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;

③Kill lock session

  ALTER SYSTEM KILL SESSION '36, 20539';

Không có nhận xét nào

Được tạo bởi Blogger.