Created
May 19, 2015 22:49
-
-
Save davidhooey/7f9c375ce12859aa39d7 to your computer and use it in GitHub Desktop.
Create Oracle SQL Tuning Set for an application's cached statements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Create SQL Tuning Set | |
-- | |
begin | |
dbms_sqltune.create_sqlset | |
( | |
sqlset_name => 'AppName_STS_01', | |
description => 'SQL Tuning Set for AppName', | |
sqlset_owner => 'SYS' | |
); | |
end; | |
/ | |
-- | |
-- Add Application Statements | |
-- | |
declare | |
sqlset_cur dbms_sqltune.sqlset_cursor; | |
bf varchar2(43); | |
begin | |
bf := 'upper(PARSING_SCHEMA_NAME) = ''APP_SCHEMA_NAME'''; | |
open sqlset_cur for | |
select value(p) | |
from table( dbms_sqltune.select_cursor_cache(attribute_list=>'TYPICAL', basic_filter=>bf) ) P; | |
dbms_sqltune.load_sqlset | |
( | |
sqlset_name => 'AppName_STS_01', | |
populate_cursor => sqlset_cur, | |
load_option => 'MERGE', | |
update_option => 'ACCUMULATE', | |
sqlset_owner => 'SYS' | |
); | |
end; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment