Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Space padding in korn shell Linux/Unix
  • Small sample shell program Linux/Unix
  • find the files that are 1 day old. Linux/Unix
  • Pending Transaction Neighbors Script Oracle
  • Does DBMS_JOB recompute the NEXT_DATE interval after or before Oracle
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • TOP-N Sql to find Nth max or Top N rows Oracle
  • Create type and Grant on it. Oracle
  • Find execution plan from dba_hist_sql_plan for a specific SQL_ID and PLAN_HASH_VALUE fplan.sql Oracle
  • Global Unique Identifier Generation in Oracle 9.2 SYS_GUID() Oracle
  • chk_space_SID.ksh Linux/Unix
  • How to specify 2 arch location to avoid any kind of DB hanging. Oracle
  • Renaming Global Name GLOBAL_NAME Oracle
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Looping for remote servers and find its database from oratab file. 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

  • findinfo.sql (SQL for getting CPU and Active session info) Oracle
  • mutex in Oracle 10.2.0.2 or Oracle 10g Oracle
  • How to Make Trace Files Created by Oracle Readable by All Users ? Oracle
  • Configure ssh authentications for RAC Oracle
  • Find_stale_dr.sql finding stale physical DR.. Oracle
  • Generating XML from SQLPLUS 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
  • cache buffer chain latch Oracle
  • Kernel Parameters for Solaris Linux/Unix
  • Updated LCK.SQL file. Oracle
  • How to set Processes Parameter Oracle
  • To check whether standby is recovering properly or not?? Oracle
  • Implementing Listener Security Oracle
  • RAC with RHEL4 and 11g Oracle
  • Privilege to describe the table. Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme