Oracle重新绑定执行计划,Oracle 执行计划快速绑定

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;

/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值