![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
# v_sql_id varchar2(13) := '0wnf3cqjjuw0b'; v_sql_id varchar2(13) := '6tm6vjxx9wwp9'; |
#3
| |||
| |||
|
|
In 11.2.0.3, DBMS_SPM.LOAD_FROM_CURSOR_CACHE refuse to load if the SQL_ID of the statement for which I'm loading the plan and the plan that I'm trying to load are not the same: declare v_sql_text CLOB; # v_sql_id varchar2(13) := '0wnf3cqjjuw0b'; v_sql_id varchar2(13) := '6tm6vjxx9wwp9'; v_hash number := 599409829; plans_loaded number; begin plans_loaded:=dbms_spm.load_plans_from_cursor_cach e( sql_id=>v_sql_id, plan_hash_value=>v_hash); dbms_output.put_line('Loaded '||plans_loaded||' plans.'); end; / Basically, I'm trying to hint a SQL statement and loaded a hinted plan as described here:http://tinyurl.com/4y28t92 On 11.2.0.3, this doesn't work. Any ideas? According to the blog, this should be possible. Is this a new feature of Oracle 11.2.0.3? --http://mgogala.byethost5.com |
#4
| |||
| |||
|
|
I don't think that you're following the exact procedure outlined - the point is that you need to specify either a SQL_HANDLE of an already existing baseline or a SQL_TEXT of the unhinted SQL in addition to which you want to apply the plan of the hinted query. So the SQL_ID and PLAN_HASH_VALUE refer to the hinted query but the SQL_HANDLE or SQL_TEXT refer to the unhinted version of the query. Look carefully at the provided examples. Hope this helps, Randolf |
#5
| |||
| |||
|
|
I don't think that you're following the exact procedure outlined - the point is that you need to specify either a SQL_HANDLE of an already |
#6
| |||
| |||
|
|
On Tue, 11 Oct 2011 13:19:27 -0700, Randolf Geist wrote: I don't think that you're following the exact procedure outlined - the point is that you need to specify either a SQL_HANDLE of an already Randolf, I followed the exact procedure, to no avail. The procedure will simply not associate the plan generated by the different statement with the given statement id. |
#7
| |||
| |||
|
|
Basically, I just switched the plans for the baseline. The "load_plans_from_cursor_cache" function will only load the baseline and it accompanying plan. It will check whether the SQL_ID in the plan and the one from the V$SQL table are the same and will not cooperate if they are not the same. Once both baselines are loaded, it is possible to switch the plan name in the baseline. |
#8
| |||
| |||
|
|
Basically, it is not possible to associate plan from one statement with another. I tested it and the article from oracle blog is incorrect. I am 100% certain. |
#9
| ||||||
| ||||||
|
|
Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | |
|
0 | SELECT STATEMENT | | | | 2 (100)| | 1 | INDEX FULL SCAN | PK_T1 | 1 | 13 | 2 (0)| 00:00:01 | |
|
Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | |
|
0 | SELECT STATEMENT | | | | 2 (100)| | 1 | TABLE ACCESS FULL| T1 | 1 | 13 | 2 (0)| 00:00:01 | |
|
Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | |
|
0 | SELECT STATEMENT | | | | 26 (100)| | 1 | INDEX FULL SCAN | PK_T1 | 82 | 1066 | 26 (0)| 00:00:01 | |
#10
| |||
| |||
|
|
On Tue, 11 Oct 2011 13:19:27 -0700, Randolf Geist wrote: I don't think that you're following the exact procedure outlined - the point is that you need to specify either a SQL_HANDLE of an already existing baseline or a SQL_TEXT of the unhinted SQL in addition to which you want to apply the plan of the hinted query. So the SQL_ID and PLAN_HASH_VALUE refer to the hinted query but the SQL_HANDLE or SQL_TEXT refer to the unhinted version of the query. Look carefully at the provided examples. Hope this helps, Randolf Did you try it? Does it work? --http://mgogala.byethost5.com |
![]() |
| Thread Tools | |
| Display Modes | |
| |