Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Temporary tablespace explaination Oracle
  • Adding a new disk and mount it automatically. on VMWARE LINUX Linux/Unix
  • DBMS_JOB all example Oracle
  • How To Limit The Access To The Database So That Only One User Per Schema Are Connected (One Concurrent User Per Schema) Oracle
  • 10g RAC: Troubleshooting CRS Root.sh Problems Oracle
  • OPENING A STANDBY DATABASE IN READ-ONLY MODE Oracle
  • oracle 10g on linux Linux/Unix
  • tar and untar a dolder with all its subfolder. Linux/Unix
  • Processes Parameter decision Oracle
  • Which environment is used by currently running process ( Very good) Linux/Unix
  • More info about /proc folder and its relation with processes. Linux/Unix
  • oracle 11g RAC on vmware Oracle
  • SQLPLUS COPY command Precautions. Oracle
  • TRUNCATE Privs Oracle
  • How does one overcome the Unix 2 Gig file limit? 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

  • create user with unlimited quota Oracle
  • 10g RAC: Troubleshooting CRS Root.sh Problems Oracle
  • before_trunc.sql Before Truncate table needs to execute following: Oracle
  • Finding locked objects Oracle
  • Renaming the column name Oracle
  • pvm_metric.sql for gathering report from vmstat tables 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
  • Very Good Oralce Internal Tuning Book Oracle
  • TRUNCATE Privs Oracle
  • Drop tempfiles from database Oracle
  • AWR license Oracle
  • Very clear article about oracle dataguard Oracle
  • How to see which patches are applied. Oracle
  • Pending Transaction Neighbors Script Oracle
  • Debugging Shell FIles Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme