SPM_SQL_PROFILE
SPM_SQL_PROFILE
https://community.oracle.com/thread/3695707
Question: SQLT SQL Profile not "Sticking", how do I eliminate inefficient Plan Hash Value?
https://community.oracle.com/thread/3683705
When it comes to SQL plan baseline you have to be careful about their reproducibility. The
reproducibility of the SPM plan by the CBO is possible only if the phv2 of the execution plan the CBO
came up with when hard parsing the query equals the planId of one of the stored SPM plan.
You can get the phv2 of your CBO plan using the following query
SELECT
p.sql_id
,p.plan_hash_value
,p.child_number
,t.phv2
FROM
v$sql_plan p
,xmltable('for $i in /other_xml/info
where $i/@type eq "plan_hash_2"
return $i'
passing xmltype(p.other_xml)
columns phv2 number path '/') t
WHERE p.sql_id = 'your_sql_id'
AND p.other_xml is not null;
And you can get the planId of your SPM plan using the following query:
select
a.plan_name
,b.plan_id
,a.enabled
,a.accepted
from
dba_sql_plan_baselines a
,sys.sqlobj$ b
where
a.signature = b.signature
and a.plan_name = b.name
and a.signature = <your_plan_signature>