Monday, February 9, 2015

Running SQLs


Query to check Running SQLs on the Oracle DATABASE.



set lines 400
col USERNAME for a10
col SCHEMANAME for a10 
col PROCESS for a10 
col BLOCKING_SESSION for a20        
col SECONDS_IN_WAIT for a5
Col PROGRAM for a30
col blocking_session_status for a20
col SQL_ID for a15
col OSUSER for a10
SELECT s.SID, s.serial#, s.audsid, s.username, s.command, s.status, s.schemaname, s.osuser, s.process, UPPER (s.program) program, s.sql_id, s.row_wait_block#, s.row_wait_row#, s.blocking_session_status,s.blocking_session, s.seconds_in_wait, s.state FROM v$session s WHERE ( (s.username IS NOT NULL) AND (NVL (s.osuser, 'x') <> 'SYSTEM') AND (s.TYPE <> 'BACKGROUND') AND STATUS='ACTIVE'
) ORDER BY "PROGRAM";



No comments:

Post a Comment