2026-05-01 07:25:46
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
set serveroutput ON
|
||||
|
||||
declare
|
||||
sql_text CLOB;
|
||||
h SYS.SQLPROF_ATTR;
|
||||
signature NUMBER;
|
||||
signaturef NUMBER;
|
||||
begin
|
||||
/* Replace values as you wish */
|
||||
|
||||
h := SYS.SQLPROF_ATTR(
|
||||
q'[BEGIN_OUTLINE_DATA]',
|
||||
q'[IGNORE_OPTIM_EMBEDDED_HINTS]',
|
||||
q'[OPTIMIZER_FEATURES_ENABLE('19.1.0')]',
|
||||
q'[DB_VERSION('19.1.0')]',
|
||||
q'[ALL_ROWS]',
|
||||
q'[OUTLINE_LEAF(@"SEL$1")]',
|
||||
q'[FULL(@"SEL$1" "D"@"SEL$1")]',
|
||||
q'[END_OUTLINE_DATA]'
|
||||
);
|
||||
|
||||
select SQL_FULLTEXT into sql_text from gv$sql where sql_id='&&1' and CHILD_NUMBER=0;
|
||||
|
||||
signature := DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(sql_text);
|
||||
signaturef := DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(sql_text, TRUE);
|
||||
|
||||
DBMS_SQLTUNE.IMPORT_SQL_PROFILE (
|
||||
sql_text => sql_text,
|
||||
profile => h,
|
||||
name => 'sqlprof_&&1',
|
||||
description => 'sqlprof_&&1 '||signature||' '||signaturef||'',
|
||||
category => 'DEFAULT',
|
||||
validate => TRUE,
|
||||
replace => TRUE,
|
||||
force_match => FALSE /* TRUE:FORCE (match even when different literals in SQL). FALSE:EXACT (similar to CURSOR_SHARING) */ );
|
||||
|
||||
exception
|
||||
when others then
|
||||
dbms_output.put_line('Getting error: '||sqlerrm);
|
||||
|
||||
end;
|
||||
/
|
||||
|
||||
set serveroutput OFF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user