Friday, October 4, 2019

How to force a sql id with specific plan?


How to force a sql_id to use a specific plan
dbms_spm.load_plans_from_cursor_cache( sql_id =>'xxxx', plan_hash_value => 2234234234) ;

-- above did not work for me.  I used this instead:
select sql_id,plan_hash_value from gv$sql  where sql_id = 'f751w9ks0vvby';


 SET SERVEROUTPUT ON

DECLARE

  l_plans_loaded  PLS_INTEGER;

BEGIN

  l_plans_loaded := DBMS_SPM.load_plans_from_cursor_cache(

    sql_id => 'f751w9ks0vvby',

    plan_hash_value => '550040265'); DBMS_OUTPUT.put_line('Plans Loaded: ' || l_plans_loaded);

END;

/


No comments:

Post a Comment