You are on page 1of 2

Wednesday, 9 October 2013Session Info

1>How to display your Oracle session ID number


sid
from v$mystat;
SID
---------125

SQL> select distinct

SQL> select
to_number(substr(dbms_session.unique_session_id,1,4),'XXXX') mysid
from dual;
MYSID
---------125
SQL> select
sid
from
v$mystat
where
rownum <=1;
SID
---------125
SQL> select
sys_context('USERENV','SID')
from dual; 2
3
SYS_CONTEXT('USERENV','SID')
------------------------------------------------------------------------------------------------------------------------------------------------------------125
Step 1: Identify the session which is locking the object
select a.sid, a.serial#
from v$session a, v$locked_object b, dba_objects c
where b.object_id = c.object_id
and a.sid = b.session_id
and OBJECT_NAME='EMP';
Step 2: kill that session using
alter system kill session 'sid,serial#'; 3>number of session connectedset echo o
ff;
set termout on;
set linesize 80;
set pagesize 60;
set newpage 0;
================================================================================
=============
select
rpad(c.name||':',11)||rpad(' current logons='||
(to_number(b.sessions_current)),20)||'cumulative logons='||
rpad(substr(a.value,1,10),10)||'highwater mark='||
b.sessions_highwater Information
from

v$sysstat a,
v$license b,
v$database c
where
a.name = 'logons cumulative'
;
INFORMATION
-------------------------------------------------------------------------------PRIM:
current logons=2 cumulative logons=119
highwater mark=9
SQL> select count(*) from v$session where USERNAME is not null;
COUNT(*)
---------2

You might also like