Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Article 4

$
0
0

Script to Enable Plan Baseline 



set long 32767
set pages 9999
set lines 200
set serveroutput on size 1000000


accept SQL_Handle prompt "Enter the SQL handle: ";

accept plan_name  prompt "Enter the SQL plan name : ";


DECLARE
    lv_plans       pls_integer;
    lv_sql_handle  VARCHAR2(30) := '&SQL_Handle';
    lv_plan_name   VARCHAR2(30) := '&plan_name';
BEGIN
    lv_plans := DBMS_SPM.alter_SQL_PLAN_BASELINE (
        sql_handle => lv_sql_handle,
        plan_name  => lv_plan_name,
        attribute_name  => 'enabled',
        attribute_value => 'YES'
    );
    DBMS_OUTPUT.PUT_LINE('Plans Altered: '||TO_CHAR(lv_plans));
    EXCEPTION
        WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE(SQLERRM);

END;
/

Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>