declare
ar_profile_hints sys.sqlprof_attr;
cl_sql_text clob;
begin
select extractvalue(value(d), ‘/hint’) as outline_hints
bulk collect into ar_profile_hints
from xmltable(’/ */outline_data/hint’ passing
(select xmltype(other_xml) as xmlval
from v$sql_plan
where sql_id = ‘0g1n4yx6yprgk’
and PLAN_HASH_VALUE = ‘4170700152’
and other_xml is not null)) d;
select sql_fulltext
into cl_sql_text
from v$sql
where sql_id = ‘dtgz3afzvz5rc’ --需要绑定的sql_id
and PLAN_HASH_VALUE = 3956160932;
dbms_sqltune.import_sql_profile(sql_text => cl_sql_text,
profile => ar_profile_hints,
–category => ‘DEFAULT’,
name => ‘profile_dtgz3afzvz5rc’,
force_match => true,–该参数为true对于未绑定变量的SQL可以使用相同的profile
replace => true);
end;
/
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




