Skip to main content

Posts

Showing posts from September, 2022

SQL ID Baseline

set linesize 200 pagesize 0 SELECT * FROM TABLE(DBMS_XPLAN.display_cursor(sql_id=>'&sql_id', format=>'ALLSTATS LAST +cost +bytes +outline +PEEKED_BINDS +adaptive')); select * from table(dbms_xplan.display_awr(sql_id=>'&sql_id', format=>'ALLSTATS LAST +cost +bytes +outline +PEEKED_BINDS +adaptive')); select * from table(dbms_xplan.display_sql_plan_baseline('&sql_handle','&plan_name','typical')); col begin_interval_time for a30 col end_interval_time for a30 select snap_id,begin_interval_time,end_interval_time from dba_hist_snapshot order by snap_id asc / select snap_id,BEGIN_INTERVAL_TIME, startup_time from dba_hist_snapshot where trunc(end_interval_time) > (SELECT trunc(NEXT_DAY(sysdate,'FRIDAY')) -14 FROM dual) AND trunc(end_interval_time) 6hxw283cyw0ub and plan_hash_value for good plan that we want to force is 95728747.*/ Follow below steps to create sql baseline for sql_id STEP...