Thursday, March 25, 2010

To Get Active Sessions and SQL Info

Here is a quick SQL to get session and SQL information:

select /*+RULE */ SID,SPID,ses.SERIAL#,ses.USERNAME,ses.module,SQL_TEXT,pro.TERMINAL
from v$sqlarea sql, v$session ses,v$process pro where HASH_VALUE=SQL_HASH_VALUE and status = 'ACTIVE' and
ses.username is not null and
ses.PADDR = pro.ADDR
order by sql_text;
The above SQL statement can be customized based on requirement and if you need more information.
Note: The above SQL is for informational only that I used on a daily basis

No comments: