SQL Query to view sql of a session

Posted on August 25, 2008. Filed under: DBA/Admin Tips, Diagnostics, R12, RAC, Scripts, TroubleShooting | Tags: , , , , |

SELECT
T.sql_text
FROM
v$session S,
v$sqltext_with_newlines T
WHERE
S.sid = &sid
AND S.serial# = &serial
AND S.sql_address = T.address
AND S.sql_hash_value = T.hash_value
ORDER BY T.piece
/

Replace v$session with gv$session if the database is running on RAC configuration.

cheers,
Ram.

Advertisements

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

One Response to “SQL Query to view sql of a session”

RSS Feed for OraclePitStop – Lets share some knowledge Comments RSS Feed


Where's The Comment Form?

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: