103 lines
3.6 KiB
Plaintext
103 lines
3.6 KiB
Plaintext
SQL>REM
|
|
SQL>REM $Header: 215187.1 coe_xfr_sql_profile_9t7jvx0gm0m95_1509575125.sql 11.4.4.4 2026/07/08 carlos.sierra $
|
|
SQL>REM
|
|
SQL>REM Copyright (c) 2000-2012, Oracle Corporation. All rights reserved.
|
|
SQL>REM
|
|
SQL>REM AUTHOR
|
|
SQL>REM carlos.sierra@oracle.com
|
|
SQL>REM
|
|
SQL>REM SCRIPT
|
|
SQL>REM coe_xfr_sql_profile_9t7jvx0gm0m95_1509575125.sql
|
|
SQL>REM
|
|
SQL>REM DESCRIPTION
|
|
SQL>REM This script is generated by coe_xfr_sql_profile.sql
|
|
SQL>REM It contains the SQL*Plus commands to create a custom
|
|
SQL>REM SQL Profile for SQL_ID 9t7jvx0gm0m95 based on plan hash
|
|
SQL>REM value 1509575125.
|
|
SQL>REM The custom SQL Profile to be created by this script
|
|
SQL>REM will affect plans for SQL commands with signature
|
|
SQL>REM matching the one for SQL Text below.
|
|
SQL>REM Review SQL Text and adjust accordingly.
|
|
SQL>REM
|
|
SQL>REM PARAMETERS
|
|
SQL>REM None.
|
|
SQL>REM
|
|
SQL>REM EXAMPLE
|
|
SQL>REM SQL> START coe_xfr_sql_profile_9t7jvx0gm0m95_1509575125.sql;
|
|
SQL>REM
|
|
SQL>REM NOTES
|
|
SQL>REM 1. Should be run as SYSTEM or SYSDBA.
|
|
SQL>REM 2. User must have CREATE ANY SQL PROFILE privilege.
|
|
SQL>REM 3. SOURCE and TARGET systems can be the same or similar.
|
|
SQL>REM 4. To drop this custom SQL Profile after it has been created:
|
|
SQL>REM EXEC DBMS_SQLTUNE.DROP_SQL_PROFILE('coe_9t7jvx0gm0m95_1509575125');
|
|
SQL>REM 5. Be aware that using DBMS_SQLTUNE requires a license
|
|
SQL>REM for the Oracle Tuning Pack.
|
|
SQL>REM 6. If you modified a SQL putting Hints in order to produce a desired
|
|
SQL>REM Plan, you can remove the artifical Hints from SQL Text pieces below.
|
|
SQL>REM By doing so you can create a custom SQL Profile for the original
|
|
SQL>REM SQL but with the Plan captured from the modified SQL (with Hints).
|
|
SQL>REM
|
|
SQL>WHENEVER SQLERROR EXIT SQL.SQLCODE;
|
|
SQL>REM
|
|
SQL>VAR signature NUMBER;
|
|
SQL>VAR signaturef NUMBER;
|
|
SQL>REM
|
|
SQL>DECLARE
|
|
2 sql_txt CLOB;
|
|
3 h SYS.SQLPROF_ATTR;
|
|
4 PROCEDURE wa (p_line IN VARCHAR2) IS
|
|
5 BEGIN
|
|
6 DBMS_LOB.WRITEAPPEND(sql_txt, LENGTH(p_line), p_line);
|
|
7 END wa;
|
|
8 BEGIN
|
|
9 DBMS_LOB.CREATETEMPORARY(sql_txt, TRUE);
|
|
10 DBMS_LOB.OPEN(sql_txt, DBMS_LOB.LOB_READWRITE);
|
|
11 -- SQL Text pieces below do not have to be of same length.
|
|
12 -- So if you edit SQL Text (i.e. removing temporary Hints),
|
|
13 -- there is no need to edit or re-align unmodified pieces.
|
|
14 wa(q'[select * from t1 where i=5000]');
|
|
15 DBMS_LOB.CLOSE(sql_txt);
|
|
16 h := SYS.SQLPROF_ATTR(
|
|
17 q'[BEGIN_OUTLINE_DATA]',
|
|
18 q'[IGNORE_OPTIM_EMBEDDED_HINTS]',
|
|
19 q'[OPTIMIZER_FEATURES_ENABLE('19.1.0')]',
|
|
20 q'[DB_VERSION('19.1.0')]',
|
|
21 q'[ALL_ROWS]',
|
|
22 q'[OUTLINE_LEAF(@"SEL$1")]',
|
|
23 q'[INDEX_RS_ASC(@"SEL$1" "T1"@"SEL$1" ("T1"."I"))]',
|
|
24 q'[BATCH_TABLE_ACCESS_BY_ROWID(@"SEL$1" "T1"@"SEL$1")]',
|
|
25 q'[END_OUTLINE_DATA]');
|
|
26 :signature := DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(sql_txt);
|
|
27 :signaturef := DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(sql_txt, TRUE);
|
|
28 DBMS_SQLTUNE.IMPORT_SQL_PROFILE (
|
|
29 sql_text => sql_txt,
|
|
30 profile => h,
|
|
31 name => 'coe_9t7jvx0gm0m95_1509575125',
|
|
32 description => 'coe 9t7jvx0gm0m95 1509575125 '||:signature||' '||:signaturef||'',
|
|
33 category => 'DEFAULT',
|
|
34 validate => TRUE,
|
|
35 replace => TRUE,
|
|
36 force_match => FALSE /* TRUE:FORCE (match even when different literals in SQL). FALSE:EXACT (similar to CURSOR_SHARING) */ );
|
|
37 DBMS_LOB.FREETEMPORARY(sql_txt);
|
|
38 END;
|
|
39 /
|
|
|
|
PL/SQL procedure successfully completed.
|
|
|
|
SQL>WHENEVER SQLERROR CONTINUE
|
|
SQL>SET ECHO OFF;
|
|
|
|
SIGNATURE
|
|
---------------------
|
|
7022249984800062696
|
|
|
|
|
|
SIGNATUREF
|
|
---------------------
|
|
17325452017562678592
|
|
|
|
|
|
... manual custom SQL Profile has been created
|
|
|