SQL ID Information


set head off
set verify off
set echo off
set pages 1500
set linesize 100
set lines 120
alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
prompt
prompt Details of SID / SPID / Client PID
prompt ==================================
select * from
(select /*+ CHOOSE*/
'Session Id.............................................: '||s.sid,
'Serial Num..............................................: '||s.serial#,
'SQL ID..................................................: '||s.sql_id,
'User Name ..............................................: '||s.username,
'Session Status .........................................: '||s.status,
'Client Process Id on Client Machine ....................: '||''||s.process||'' Client,
'Server Process ID ......................................: '||p.spid Server,
'Sql_Address ............................................: '||s.sql_address,
'Sql_hash_value .........................................: '||s.sql_hash_value,
'Schema Name ..... ......................................: '||s.SCHEMANAME,
'Program ...............................................: '||s.program,
'Module .................................................: '|| s.module,
'Action .................................................: '||s.action,
'Terminal ...............................................: '||s.terminal,
'Client Machine .........................................: '||s.machine,
'CLIENT_IDENTIFIER...................................: '||s.client_identifier,
'LOGON_TIME..........................................: '||s.logon_time,
 'LAST_CALL_ET ...........................................: '||s.last_call_et,
'S.LAST_CALL_ET/3600 ....................................: '||s.last_call_et/3600,
'OS USER ...............................................'||s.OSUSER,
'P.USERNAME .............................................'||p.username,
'SCHEMANAME......................................'||s.SCHEMANAME
from v$session s, v$process p
where p.addr=s.paddr and
s.sid=nvl('&sid',s.sid))
,(select /*+ CHOOSE*/
'SQL Text...: '||sql_fulltext
from gv$session ses, gv$sqlarea sql where
ses.sql_hash_value = sql.hash_value(+) and ses.sql_address = sql.address(+) and
ses.sid='&sid');

No comments:

Post a Comment