Script to display the SQL text for a specific SQL_ID

--> Purpose:    Script to display the SQL text  for a specific SQL_ID.
-->             It returns the SQL_TEXT.
--> Parameters: sql_id
--> To Run:     @sqltext.sql sql_id
--> Example:    @sqltext.sql 27b3qfm5x89xn
-->
--> Copyright 2020@The Ultimate SQL Tuning Formula

set echo off
set define '&'
set verify off
define _sql_id=&1
set verify off
set feedback off
set linesize 200
set heading on
set termout on
col sqltext format a100 word_wrapped
select  sql_text as sqltext
from gv$sqltext
where sql_id = '&_sql_id'
order by piece;

****************************************************************************************
--> Purpose:    Script to display the SQL text  for a specific SQL_ID.
-->             It returns the SQL_TEXT.
--> Caution:    This script requires that you have License
-->             for the Diagnostic and Tuning Pack 
-->
--> Parameters: sql_id
--> To Run:     @sqltext_awr.sql sql_id
--> Example:    @sqltext_awr.sql 27b3qfm5x89xn
set echo off
set define '&'
set verify off
define _sql_id=&1
set verify off
set feedback off
set linesize 200
set heading on
set termout on
col sqltext format a100 word_wrapped
select to_char(substr(sql_text,1,4000)) sqltext from dba_hist_sqltext where sql_id='&_sql_id';
****************************************************************************************
 
 

Comments

Post a Comment

Popular posts from this blog

Oracle Cloud Infrastructure(OCI) - Part2

How to Change Your EnterpriseOne Environment Color