Oracle Full Open Cursors SQL by SID
Displays the full SQL text for open cursors held by a specific Oracle session (SID). Useful when the standard open cursor views show truncated SQL and full statements are required for troubleshooting.
oraclesqlmonitoring-alertsv1.0.0
0 stars0 downloads12 views0 comments
By OracleDba • Created
Code
(23 lines)1234567891011121314151617181920212223
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/monitoring/open_cursors_full_by_sid.sql
-- Author : Tim Hall
-- Description : Displays the SQL statement held for a specific SID.
-- Comments : The SID can be found by running session.sql or top_session.sql.
-- Requirements : Access to the V$ views.
-- Call Syntax : @open_cursors_full_by_sid (sid)
-- Last Modified: 15/07/2000
-- -----------------------------------------------------------------------------------
SET LINESIZE 500
SET PAGESIZE 1000
SET VERIFY OFF
SELECT st.sql_text
FROM v$sqltext st,
v$open_cursor oc
WHERE st.address = oc.address
AND st.hash_value = oc.hash_value
AND oc.sid = &1
ORDER BY st.address, st.piece;
PROMPT
SET PAGESIZE 14