Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • get_vmstat.ksh for Solaris Oracle
  • S3 Basic info AWS
  • GSQ.sql Oracle
  • on IBM-AIX for display Linux/Unix
  • Move WordPress site from one hosting service to other. PHP/MYSQL/Wordpress
  • RAC 11g with vmware Oracle
  • Jai Shree Ram Oracle
  • pvm_metric.sql for gathering report from vmstat tables Oracle
  • pvmehta.com SQL scripts
    Find which sessions is accessing object that prevent your session to have exclusive locks in Oracle Oracle
  • create database syntax Oracle
  • VIvek Encryption Package and Its Usage Oracle
  • Changing Instance Name ( No DB_NAME) Oracle
  • cold backup scripts to copy locally Linux/Unix
  • sql_doing_fts.sql Oracle
  • Remove duplicate rows from table Oracle

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

  • Oracle 11g Environment Setup Oracle
  • Oracle 11g Training on 29JAN1010 Oracle
  • mutex in Oracle 10.2.0.2 or Oracle 10g Oracle
  • Export Import with QUERY Oracle
  • DBMS_JOB all example Oracle
  • Create type and Grant on it. Oracle

Leave a Reply Cancel reply

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

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (342)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • Complete Git Tutorial for Beginners25-Dec-2025
  • Postgres DB user and OS user.25-Dec-2025
  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • How To Transfer Passwords Between Databases (ref note: 199582.1) Oracle
  • Vivek’s egrep commands to trace problem. (on linux x86-64) Linux/Unix
  • In Addition to previous note, following grants needed on PERFSTAT user. Oracle
  • tuning commmand for cpu, ip and memory stats Linux/Unix
  • To see how much time or progress of long transaction Oracle
  • Best approach for Oracle database patching sequence to latest/required patchset along with CPU/PSU/any-other-one-off patch ID 865255.1 Oracle
  • pvm_metric.sql for gathering report from vmstat tables Oracle
  • Single character replacement in Unix Linux/Unix

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme