How to directly update the hint set in SQL Profile

If more than several hints should be added to the issue SQL, the sql patch is not suitable due to line size limitation (241).

Also if the sql has no ideal plan in the memory nor AWR, direct updating hint set in SQL Profile will be one of options.

#1. connect the db with sysdba user and run the coe_xfr_sql_profile.sql with the following method. 
i.e.
$sqlplus / as sysdba 
sql>@coe_xfr_sql_profile.sql 5xppvgwhp5rdr 482745184 

Then it generates the following file. 
coe_xfr_sql_profile_5xppvgwhp5rdr_482745184.sql

Open this file with some editor. And go to outline data section.

h := SYS.SQLPROF_ATTR(
q'[BEGIN_OUTLINE_DATA]',
q'[IGNORE_OPTIM_EMBEDDED_HINTS]',
...
q'[LEADING(@"SEL$5428C7F1" "PAY_PAC"@"SEL$1" "POG"@"SEL$1" "PAP"@"SEL$1" "PR"@"SEL$2" "PRE"@"SEL$1" "PAY_REL_GROUPS_DN"@"SEL$3")]',
q'[USE_NL(@"SEL$5428C7F1" "POG"@"SEL$1")]',
q'[USE_NL(@"SEL$5428C7F1" "PAP"@"SEL$1")]',
q'[USE_NL(@"SEL$5428C7F1" "PR"@"SEL$2")]',
q'[USE_NL(@"SEL$5428C7F1" "PRE"@"SEL$1")]',
q'[USE_NL(@"SEL$5428C7F1" "PAY_REL_GROUPS_DN"@"SEL$3")]',
....
q'[END_OUTLINE_DATA]');

If the query needs new join ( PR beforE PAP) and hash join on PAP, PR, PRE and PAY_REL_GROUPS_DN, the following will be worked..

q'[LEADING(@"SEL$5428C7F1" "PAY_PAC"@"SEL$1" "POG"@"SEL$1" "PR"@"SEL$2" "PAP"@"SEL$1" "PRE"@"SEL$1" "PAY_REL_GROUPS_DN"@"SEL$3")]',
q'[USE_NL(@"SEL$5428C7F1" "POG"@"SEL$1")]',
q'[USE_HASH(@"SEL$5428C7F1" "PAP"@"SEL$1")]',
q'[USE_HASH(@"SEL$5428C7F1" "PR"@"SEL$2")]',
q'[USE_HASH(@"SEL$5428C7F1" "PRE"@"SEL$1")]',
q'[USE_HASH(@"SEL$5428C7F1" "PAY_REL_GROUPS_DN"@"SEL$3")]',

Once modification is finished, the file(coe_xfr_sql_profile_5xppvgwhp5rdr_482745184.sql) should be saved to apply the environment.

Note. The above outline is made for example. not real one.

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值