Script to see if There is SQL profile created for any particular SQL ID

Accept sql_id prompt ‘Enter SQL ID:’

column name format a30
column category format a30
column status format a10

select
a.name,
a.status,
a.CREATED,
a.LAST_MODIFIED,
a.CATEGORY,
b.sql_id
from
DBA_SQL_PROFILES a,
(select distinct sql_id,sql_profile from (select sql_id,sql_profile from DBA_HIST_SQLSTAT where sql_id =’&sql_id’
union
select sql_id,sql_profile from v$sql where sql_id =’&sql_id’)) b
where a.name=b.sql_profile;

You can also modidfy the script to include another prompt for SQL Text as well.

Leave a comment

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