Skip to content
March 17, 2017 / doganay

EXTRACT SQL HINTS FROM A RUNNING SQL


1)

select CHR(9)||''''
||regexp_replace(extractvalue(value(d),'/hint'),'''','''''')
|| ''','
from xmltable('/*/outline_data/hint'
passing (select xmltype(other_xml) as xmlval
from gv$sql_plan
where sql_id = '&V_SQL_ID'
and CHILD_NUMBER = 0
and other_xml is not null)) d;


2)
This also prints current sql hints:

select * from table(dbms_xplan.display_cursor('&V_SQL_ID',null,'OUTLINE'));
Advertisements

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

%d bloggers like this: