Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • scp with ssh2 Linux/Unix
  • good linux notes Linux/Unix
  • mutex in Oracle 10.2.0.2 or Oracle 10g Oracle
  • find_string_in_database.sql Oracle
  • copying/removing directory with all its subdirectory Linux/Unix
  • Sequence Resetting Oracle
  • Find_table_size.sql Oracle
  • sid_wise_sql.sql Further explaination Oracle
  • When to rebuld B-tree index Oracle
  • Good Oracle Architecture In Short and point to point Oracle
  • runsql_once.ksh Linux/Unix
  • Rename Tablespace Oracle
  • Adding Datafile on Primary Server and Impact on Standby Server Oracle
  • TABLE SIZING WITH DB_BLOCK ARCHITECTURE Reference : Metalink note : 10640.1 Oracle
  • Nice Article about semaphores and init.ora Processes parameter relations Linux/Unix

Load SPM baseline from AWR

Posted on 05-Jun-2025 By Admin No Comments on Load SPM baseline from AWR
accept v_sqlid prompt 'Enter sqlid '
accept v_phv prompt 'Enter PHV '
set serveroutput on
DECLARE
v_first_snapid number;
v_last_snapid number;
v_sqlset varchar2(1000);
loaded_plans number;
BEGIN
select max(ss.snap_id)-3, max(ss.snap_id)
into v_first_snapid, v_last_snapid
from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS
where sql_id = '&v_sqlid'
and plan_hash_value = '&v_phv'
and ss.snap_id = S.snap_id
and ss.instance_number = S.instance_number
and executions_delta > 0 ;
loaded_plans := dbms_spm.load_plans_from_awr( begin_snap=>v_first_snapid,end_snap=>v_last_snapid,
basic_filter=>q'# sql_id='&v_sqlid' and plan_hash_value='&v_phv' #' );
dbms_output.put_line('loaded-plans= ' || loaded_plans);
dbms_output.put_line('v_first_snapid ' || v_first_snapid);
END;
/
Oracle, SQL scripts

Post navigation

Previous Post: Drop specific SQL plan baseline – spm
Next Post: Drop all SPM baselines for SQL handle

Related Posts

  • Good notes for shared pool Oracle
  • Find Multiple levels of object dependencies : depen.sql Oracle
  • load SPM baseline from cursor cache Oracle
  • oradebug ipcrm ipcs Oracle
  • SQL Tracker by SID sqltrackerbysid.sql Oracle
  • Clean up Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Vivek’s egrep commands to trace problem. (on linux x86-64) Linux/Unix
  • USE_NL and INDEX hints example Oracle
  • fuser to check who is using diretory Linux/Unix
  • Wait.sql Oracle
  • arch_configUOCIOTTO.ora Oracle
  • Export Oracle data and Compress at same time Oracle
  • Disbaling DBA_SCHEDULER_JOBS Oracle
  • Generate SSH without password authentication. Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme