<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: SQL Profiles</title>
	<atom:link href="http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/feed/" rel="self" type="application/rss+xml" />
	<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/</link>
	<description>Just another Oracle blog</description>
	<pubDate>Thu, 29 Jul 2010 12:04:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: osborne</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-14297</link>
		<dc:creator>osborne</dc:creator>
		<pubDate>Tue, 06 Jul 2010 13:54:28 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-14297</guid>
		<description>Yuvaraj,

  The script is prompting for a child number as opposed to a plan hash value. The child_number should be 2 in your example.

Kerry</description>
		<content:encoded><![CDATA[<p>Yuvaraj,</p>
<p>  The script is prompting for a child number as opposed to a plan hash value. The child_number should be 2 in your example.</p>
<p>Kerry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yuvaraj</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-14141</link>
		<dc:creator>Yuvaraj</dc:creator>
		<pubDate>Mon, 05 Jul 2010 00:57:46 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-14141</guid>
		<description>Thanks for the excellent blog. Very useful information. I am getting following error message while trying to create a SQL profile.

Enter value for sql_id: a0j23muc76nuz
Enter value for plan_hash_value: 2627696582
Enter value for category:
Enter value for force_matching:
old  18: sql_id = '&#38;&#38;1'
new  18: sql_id = 'a0j23muc76nuz'
old  19: and child_number = &#38;&#38;2
new  19: and child_number = 2627696582
old  31: sql_id = '&#38;&#38;1'
new  31: sql_id = 'a0j23muc76nuz'
old  32: and child_number = &#38;&#38;2;
new  32: and child_number = 2627696582;
old  37: , category =&#62; '&#38;&#38;3'
new  37: , category =&#62; 'DEFAULT'
old  38: , name =&#62; 'PROFILE_&#38;&#38;1'
new  38: , name =&#62; 'PROFILE_a0j23muc76nuz'
old  43: , force_match =&#62; &#38;&#38;4
new  43: , force_match =&#62; false
declare
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 24

Two hash values exists for a SQL_id.
#	Plan Hash Value	Total Elapsed Time(ms)	Executions	1st Capture Snap ID	Last Capture Snap ID
1 	3347154448 	68,154,693 	31,359 	981 	1060
2 	2627696582 	31,026,788 	185 	1061 	1101</description>
		<content:encoded><![CDATA[<p>Thanks for the excellent blog. Very useful information. I am getting following error message while trying to create a SQL profile.</p>
<p>Enter value for sql_id: a0j23muc76nuz<br />
Enter value for plan_hash_value: 2627696582<br />
Enter value for category:<br />
Enter value for force_matching:<br />
old  18: sql_id = &#8216;&amp;&amp;1&#8242;<br />
new  18: sql_id = &#8216;a0j23muc76nuz&#8217;<br />
old  19: and child_number = &amp;&amp;2<br />
new  19: and child_number = 2627696582<br />
old  31: sql_id = &#8216;&amp;&amp;1&#8242;<br />
new  31: sql_id = &#8216;a0j23muc76nuz&#8217;<br />
old  32: and child_number = &amp;&amp;2;<br />
new  32: and child_number = 2627696582;<br />
old  37: , category =&gt; &#8216;&amp;&amp;3&#8242;<br />
new  37: , category =&gt; &#8216;DEFAULT&#8217;<br />
old  38: , name =&gt; &#8216;PROFILE_&amp;&amp;1&#8242;<br />
new  38: , name =&gt; &#8216;PROFILE_a0j23muc76nuz&#8217;<br />
old  43: , force_match =&gt; &amp;&amp;4<br />
new  43: , force_match =&gt; false<br />
declare<br />
*<br />
ERROR at line 1:<br />
ORA-01403: no data found<br />
ORA-06512: at line 24</p>
<p>Two hash values exists for a SQL_id.<br />
#	Plan Hash Value	Total Elapsed Time(ms)	Executions	1st Capture Snap ID	Last Capture Snap ID<br />
1 	3347154448 	68,154,693 	31,359 	981 	1060<br />
2 	2627696582 	31,026,788 	185 	1061 	1101</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: osborne</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-7630</link>
		<dc:creator>osborne</dc:creator>
		<pubDate>Tue, 23 Feb 2010 14:50:57 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-7630</guid>
		<description>Hi Shruti,

  If a Profile exists for a given statement it should be used regardless of which user is executing the statement. There are a couple of things you can check to make sure it should be used. Look at the signature columns in v$sql and dba_sql_profiles. They should match. Also, if the statement is using the Profile, the sql_profile column in v$sql will have the name of the profile in it. If the signatures match but it's not being picked up, that's probably a bug. I have seen this happen with force_matching=true. So you might try without setting that option. By the way, there are many posts on this site with information on how Profiles work "under the covers". Good luck. 

Kerry</description>
		<content:encoded><![CDATA[<p>Hi Shruti,</p>
<p>  If a Profile exists for a given statement it should be used regardless of which user is executing the statement. There are a couple of things you can check to make sure it should be used. Look at the signature columns in v$sql and dba_sql_profiles. They should match. Also, if the statement is using the Profile, the sql_profile column in v$sql will have the name of the profile in it. If the signatures match but it&#8217;s not being picked up, that&#8217;s probably a bug. I have seen this happen with force_matching=true. So you might try without setting that option. By the way, there are many posts on this site with information on how Profiles work &#8220;under the covers&#8221;. Good luck. </p>
<p>Kerry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shruti</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-7610</link>
		<dc:creator>Shruti</dc:creator>
		<pubDate>Mon, 22 Feb 2010 19:57:02 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-7610</guid>
		<description>Hi

I created SQl profile through EM via advisory central using system .
Now if the same query gets executed via other user profile does not get used. How do i transfer that profile for all the users?</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I created SQl profile through EM via advisory central using system .<br />
Now if the same query gets executed via other user profile does not get used. How do i transfer that profile for all the users?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: osborne</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-6702</link>
		<dc:creator>osborne</dc:creator>
		<pubDate>Mon, 25 Jan 2010 23:53:31 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-6702</guid>
		<description>Wow. That's quite a change - going from 200K lio's to 4 Billion lio's per exec. Glad the script was able to help. Good job getting it fixed that quickly. Thanks for letting me know. ;)

Kerry</description>
		<content:encoded><![CDATA[<p>Wow. That&#8217;s quite a change - going from 200K lio&#8217;s to 4 Billion lio&#8217;s per exec. Glad the script was able to help. Good job getting it fixed that quickly. Thanks for letting me know. ;)</p>
<p>Kerry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Motzer</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-6701</link>
		<dc:creator>Brian Motzer</dc:creator>
		<pubDate>Mon, 25 Jan 2010 23:24:26 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-6701</guid>
		<description>Kerry,

Wanted to drop a line to say thanks for the create_sql_profile_awr.sql script. I found a situation today that allowed me to solve a production issue using it. I have a script that shows sql execution stats over time from awr. Note that on the 25th of Jan at 10am there was a plan change and buffer gets shot through the roof, at 16:00 we ran your sql script picking a previous hash plan value and the timings returned to normal.

&lt;pre&gt;
TIMESTAMP       #PLANS                     #EXEC        ROWS_PROC    DISKREADS        GETS/EXEC        IOWAIT   SECS/EXEC    TOTSECS
--------------- --------------- ---------------- ---------------- ------------ ---------------- ------------- ----------- ----------
24-JAN-10 19:00 1                             12            4,111    1,236,962          141,876      28967057      109.34       1312
24-JAN-10 20:00 1                             39           17,606    3,896,737          137,358      18416723      138.30       5394
24-JAN-10 21:00 1                              5                0      388,688           81,958       1040703       68.50        342
24-JAN-10 22:00 1                              8               17      675,832          116,810      16315202       81.39        651
25-JAN-10 00:00 1                             24           12,503    2,419,987          144,586      20789949      104.10       2498
25-JAN-10 04:00 1                              8                1      661,590          105,532       4596278       87.86        703
25-JAN-10 05:00 1                             26            1,234    2,536,143          124,302      12789703      109.04       2835
25-JAN-10 06:00 1                             24           38,856    2,655,137          239,436      28886629      126.63       3039
25-JAN-10 07:00 1                              5               23      442,966          238,767       6298353       75.51        378
25-JAN-10 08:00 1                              2              340      357,109          139,357      51294885      104.54        209
25-JAN-10 10:00 1 (plan change)               27              446      130,702       81,869,479      79355932      356.71       9631
25-JAN-10 11:00 1                              7            1,268    1,765,948      570,996,611    2281600856    3,380.09      23661
25-JAN-10 12:00 1                              7              934    1,506,704      500,435,949    1813018245    6,662.60      46638
25-JAN-10 13:00 1                              3            1,493       65,852    1,283,852,131      99695415   16,010.25      48031
25-JAN-10 14:00 1                              1            1,247       34,879    4,227,746,967      19951869   48,673.53      48674
25-JAN-10 15:00 1                              5            2,020       63,546      800,010,218     100884565    9,538.32      47692
25-JAN-10 16:00 1 (plan change)                1                1      247,574          141,598      44470601      127.12        127
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Kerry,</p>
<p>Wanted to drop a line to say thanks for the create_sql_profile_awr.sql script. I found a situation today that allowed me to solve a production issue using it. I have a script that shows sql execution stats over time from awr. Note that on the 25th of Jan at 10am there was a plan change and buffer gets shot through the roof, at 16:00 we ran your sql script picking a previous hash plan value and the timings returned to normal.</p>
<pre>
TIMESTAMP       #PLANS                     #EXEC        ROWS_PROC    DISKREADS        GETS/EXEC        IOWAIT   SECS/EXEC    TOTSECS
--------------- --------------- ---------------- ---------------- ------------ ---------------- ------------- ----------- ----------
24-JAN-10 19:00 1                             12            4,111    1,236,962          141,876      28967057      109.34       1312
24-JAN-10 20:00 1                             39           17,606    3,896,737          137,358      18416723      138.30       5394
24-JAN-10 21:00 1                              5                0      388,688           81,958       1040703       68.50        342
24-JAN-10 22:00 1                              8               17      675,832          116,810      16315202       81.39        651
25-JAN-10 00:00 1                             24           12,503    2,419,987          144,586      20789949      104.10       2498
25-JAN-10 04:00 1                              8                1      661,590          105,532       4596278       87.86        703
25-JAN-10 05:00 1                             26            1,234    2,536,143          124,302      12789703      109.04       2835
25-JAN-10 06:00 1                             24           38,856    2,655,137          239,436      28886629      126.63       3039
25-JAN-10 07:00 1                              5               23      442,966          238,767       6298353       75.51        378
25-JAN-10 08:00 1                              2              340      357,109          139,357      51294885      104.54        209
25-JAN-10 10:00 1 (plan change)               27              446      130,702       81,869,479      79355932      356.71       9631
25-JAN-10 11:00 1                              7            1,268    1,765,948      570,996,611    2281600856    3,380.09      23661
25-JAN-10 12:00 1                              7              934    1,506,704      500,435,949    1813018245    6,662.60      46638
25-JAN-10 13:00 1                              3            1,493       65,852    1,283,852,131      99695415   16,010.25      48031
25-JAN-10 14:00 1                              1            1,247       34,879    4,227,746,967      19951869   48,673.53      48674
25-JAN-10 15:00 1                              5            2,020       63,546      800,010,218     100884565    9,538.32      47692
25-JAN-10 16:00 1 (plan change)                1                1      247,574          141,598      44470601      127.12        127
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fredy Mercy</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-5904</link>
		<dc:creator>Fredy Mercy</dc:creator>
		<pubDate>Fri, 11 Dec 2009 06:59:17 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-5904</guid>
		<description>Kerry, 

Thanks for your reply. 

I’ve solved plan instability by manually correcting statistics (DBMS_STATS.SET_TABLE_STATS) that caused the execution plan to change. 


Regards
Fredy</description>
		<content:encoded><![CDATA[<p>Kerry, </p>
<p>Thanks for your reply. </p>
<p>I’ve solved plan instability by manually correcting statistics (DBMS_STATS.SET_TABLE_STATS) that caused the execution plan to change. </p>
<p>Regards<br />
Fredy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: osborne</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-5898</link>
		<dc:creator>osborne</dc:creator>
		<pubDate>Thu, 10 Dec 2009 16:44:53 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-5898</guid>
		<description>Fredy,

  Sorry, I completely missed your point on the first post - skipped over the multi-table insert part. Yes, that restriction appears to have been carried over to SQL Profiles. I expect they took the Outline code as a baseline and modified it to come up with SQL Profiles and Baselines in 11g. It doesn't appear that SQL Profiles or Baselines will work for multi-table inserts. If you look in the other_xml column of v$sql you won't see any hints (which is normally what's used when you create an Outline or Baseline).

Note, you can use this script to see the hints that Oracle will use to create an Outline:

http://kerryosborne.oracle-guy.com/scripts/sql_hints.sql

I did a quick test to see if a one line SQL Profile could be created and applied that didn't depend on the Outline Hints and even that did not work. It created the Profile, but did not apply it to the statement. So I believe you are correct in that you can't apply a SQL Profile to a multi-table insert.

Kerry</description>
		<content:encoded><![CDATA[<p>Fredy,</p>
<p>  Sorry, I completely missed your point on the first post - skipped over the multi-table insert part. Yes, that restriction appears to have been carried over to SQL Profiles. I expect they took the Outline code as a baseline and modified it to come up with SQL Profiles and Baselines in 11g. It doesn&#8217;t appear that SQL Profiles or Baselines will work for multi-table inserts. If you look in the other_xml column of v$sql you won&#8217;t see any hints (which is normally what&#8217;s used when you create an Outline or Baseline).</p>
<p>Note, you can use this script to see the hints that Oracle will use to create an Outline:</p>
<p><a href="http://kerryosborne.oracle-guy.com/scripts/sql_hints.sql"  rel="nofollow">http://kerryosborne.oracle-guy.com/scripts/sql_hints.sql</a></p>
<p>I did a quick test to see if a one line SQL Profile could be created and applied that didn&#8217;t depend on the Outline Hints and even that did not work. It created the Profile, but did not apply it to the statement. So I believe you are correct in that you can&#8217;t apply a SQL Profile to a multi-table insert.</p>
<p>Kerry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fredy Mercy</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-5897</link>
		<dc:creator>Fredy Mercy</dc:creator>
		<pubDate>Thu, 10 Dec 2009 16:08:14 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-5897</guid>
		<description>Hi Kerry,

When I execute DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE, I get signature value of 15926012898303819840, 
and when I query dba_sql_profiles table, I get in signature field value of 1,59260128983038E19. 
That means that it should work, but accepted SQL Profile is still not used 
(I can see it from SELECT * FROM table(dbms_xplan.display(NULL,NULL,'basic +note')); after I do 
explain plan for my SQL statement).

I’ve also tried to store my SQL in CLOB in table, and pull the stored SQL text back as imput in 
DBMS_SQLTUNE.CREATE_TUNING_TASK procedure, but still with no success.

I’ve tried to create and accept SQL Profile for my SQL statement from AWR, but without success too.


My conclusion is that it must be some restriction in Oracle SQL Profile functionality that prevents 
Oracle engine to use my complex DML SQL statement (multi-table insert which includes db_links) 
which is generated by Oracle Warehouse builder.

I know that there are a lot of restrictions in Stored Outlines (multi table insert, remote tables...). Maybe is the same with SQL Profiles.

For less compex statements,  SQL Profile works fine.

Regards,

Fredy</description>
		<content:encoded><![CDATA[<p>Hi Kerry,</p>
<p>When I execute DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE, I get signature value of 15926012898303819840,<br />
and when I query dba_sql_profiles table, I get in signature field value of 1,59260128983038E19.<br />
That means that it should work, but accepted SQL Profile is still not used<br />
(I can see it from SELECT * FROM table(dbms_xplan.display(NULL,NULL,&#8217;basic +note&#8217;)); after I do<br />
explain plan for my SQL statement).</p>
<p>I’ve also tried to store my SQL in CLOB in table, and pull the stored SQL text back as imput in<br />
DBMS_SQLTUNE.CREATE_TUNING_TASK procedure, but still with no success.</p>
<p>I’ve tried to create and accept SQL Profile for my SQL statement from AWR, but without success too.</p>
<p>My conclusion is that it must be some restriction in Oracle SQL Profile functionality that prevents<br />
Oracle engine to use my complex DML SQL statement (multi-table insert which includes db_links)<br />
which is generated by Oracle Warehouse builder.</p>
<p>I know that there are a lot of restrictions in Stored Outlines (multi table insert, remote tables&#8230;). Maybe is the same with SQL Profiles.</p>
<p>For less compex statements,  SQL Profile works fine.</p>
<p>Regards,</p>
<p>Fredy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: osborne</title>
		<link>http://kerryosborne.oracle-guy.com/2009/04/oracle-sql-profiles/#comment-5896</link>
		<dc:creator>osborne</dc:creator>
		<pubDate>Thu, 10 Dec 2009 14:48:43 +0000</pubDate>
		<guid isPermaLink="false">http://kerryosborne.oracle-guy.com/?p=1092#comment-5896</guid>
		<description>Hi Fredy (or is it Freedy?),

There are not any restrictions that I'm aware of. But it's possible. When you say that you can't persuade Oracle to use it, if you mean that you create a SQL Profile on a statement, but when it is executed the next time, the Profile is not used at all, then this should only happen if the text doesn't really match. If you mean, it's used but you don't get the plan you expect, there are all kinds of things that can cause that to happen, especially on complex statements. If you send a few more details I'll be happy to try to help.

Kerry</description>
		<content:encoded><![CDATA[<p>Hi Fredy (or is it Freedy?),</p>
<p>There are not any restrictions that I&#8217;m aware of. But it&#8217;s possible. When you say that you can&#8217;t persuade Oracle to use it, if you mean that you create a SQL Profile on a statement, but when it is executed the next time, the Profile is not used at all, then this should only happen if the text doesn&#8217;t really match. If you mean, it&#8217;s used but you don&#8217;t get the plan you expect, there are all kinds of things that can cause that to happen, especially on complex statements. If you send a few more details I&#8217;ll be happy to try to help.</p>
<p>Kerry</p>
]]></content:encoded>
	</item>
</channel>
</rss>
