【xplan】创建存储提纲稳定执行计划


创建提纲

1、为该sql创建一个存储提纲

create outline  otln_tb_ctrlscheme for category outline2 on

          <sql>

2、激活该提纲

Alter system set use_stored_outlines= outline2(categorg)

 

侵入提纲(适用于不能加hint的场景)          

          1、为该sql创建一个存储提供

          create outline  otln_tb_ctrlscheme for category outline2 on

          <sql>

          

          2、为该公共提纲创建一个私有提纲

          create private outline otln_pri from otln_tb_ctrlscheme;

          

          3、创建另一个hint的私有提纲

          create private outline otln_hint on

          <sql>

          

          4、交换两个私有提纲的内容

          update ol$hints

          set ol_name =

              case ol_name

                when 'otln_hint'

                  then 'otln_pri'

                when 'otln_pri'

                   then 'otln_hint'

                else ol_name

                end

           where ol_name in ('otln_hint','otln_pri')

           

           update ol$ ol1

             set  hintcount =

                  (select hintcount

                     from ol$ ol2

                    where ol2.ol_name in ('otln_hint','otln_pri')

                      and ol2.ol_name != ol1.ol_name

                  )

             where ol1.ol_name in ('otln_hint','otln_pri')

             

          5、私有提供复制会共有存储提纲

            create or replace outline otln_tb_ctrlscheme

                   from private otln_pri for category outline2;

          

          6、激活公有提纲

                Alter system set use_stored_outlines= outline2(categorg)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值