PLSQL_性能优化系列19_Oracle Explain Plan解析计划通过Profile绑定

本文涉及的产品
全局流量管理 GTM,标准版 1个月
公共DNS(含HTTPDNS解析),每月1000万次HTTP解析
云解析 DNS,旗舰版 1个月
简介: 20150529 Created By BaoXinjian   一、摘要   1. 应用场景 当运行很久的Job突然出现性能问题时,并排除数据量突然变大,可能原因有执行的脚本的某些对应的SQL的解析计划变更,在Oracle 10g中可以通过绑定profile,在11g中可以通过baseline进行绑定 2.

20150529 Created By BaoXinjian

 

一、摘要 


 1. 应用场景

当运行很久的Job突然出现性能问题时,并排除数据量突然变大,可能原因有执行的脚本的某些对应的SQL的解析计划变更,在Oracle 10g中可以通过绑定profile,在11g中可以通过baseline进行绑定

2. 解决步骤

Step1. 通过对应的User或者其他信息查找Session ID

Step2. 通过Session_ID查看该SQL_ID历史的解析计划变换 

Step3. 如果最近发生解析计划变更,并导致效率变慢,通过Profile绑定之前的解析计划 

Step4. 确定解析计划是否绑定 

Step5. 如果脚本还在运行,让客户停掉脚本,并重新运行,以测试绑定的新的解析计划是否满足期望 

Step6. 如果绑定的解析计划并不能解决性能问题,验证后将其删除

 

二、步骤


Step1. 通过对应的User或者其他信息查找Session ID

select sql_id, username, osuser, machine, program
  from v$session
 where username = 'gavin'

Step2. 查看该SQL_ID历史的解析计划变换

复制代码
select distinct a.instance_number,
                trunc(b.begin_interval_time, 'mi'), sql_id, plan_hash_value from dba_hist_sqlstat a, dba_hist_snapshot b where a.snap_id = b.snap_id and sql_id = '089dbukv1aanh' order by 2, 1
复制代码

Step3. 如果最近发生解析计划变更,并导致效率变慢,通过Profile绑定之前的解析计划 (脚本coe_xfr_sql_profile.sql)

SQL>@D:/Gavin/coe_xfr_sql_profile.sql

Parameter 1:
SQL_ID (required)

Enter value for 1: 6abthk1u14yb7


PLAN_HASH_VALUE AVG_ET_SECS
--------------- -----------
     2848324471        .002

Parameter 2:
PLAN_HASH_VALUE (required)

Enter value for 2: 2848324471

Values passed:
~~~~~~~~~~~~~
SQL_ID         : "6abthk1u14yb7"
PLAN_HASH_VALUE: "2848324471"


Execute coe_xfr_sql_profile_6abthk1u14yb7_2848324471.sql
on TARGET system in order to create a custom SQL Profile
with plan 2848324471 linked to adjusted sql_text.


COE_XFR_SQL_PROFILE completed.

Step4. 运行产生的sql script脚本(coe_xfr_sql_profile_6abthk1u14yb7_2848324471.sql) 

SQL> @coe_xfr_sql_profile_6abthk1u14yb7_2848324471.sql
SQL> REM
SQL> REM $Header: 215187.1 coe_xfr_sql_profile_6abthk1u14yb7_2848324471.sql 11.4.1.4 2015/05/31 csie
SQL> REM
SQL> REM Copyright (c) 2000-2010, 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_6abthk1u14yb7_2848324471.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 6abthk1u14yb7 based on plan hash
SQL> REM   value 2848324471.
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_6abthk1u14yb7_2848324471.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_6abthk1u14yb7_2848324471');
SQL> REM   5. Be aware that using DBMS_SQLTUNE requires a license
SQL> REM         for the Oracle Tuning Pack.
SQL> REM
SQL> WHENEVER SQLERROR EXIT SQL.SQLCODE;
SQL> REM
SQL> VAR signature NUMBER;
SQL> REM
SQL> DECLARE
  2  sql_txt CLOB;
  3  h       SYS.SQLPROF_ATTR;
  4  BEGIN
  5  sql_txt := q'[
  6  SELECT VERSION FROM V$INSTANCE
  7  ]';
  8  h := SYS.SQLPROF_ATTR(
  9  q'[BEGIN_OUTLINE_DATA]',
 10  q'[IGNORE_OPTIM_EMBEDDED_HINTS]',
 11  q'[OPTIMIZER_FEATURES_ENABLE('11.2.0.1')]',
 12  q'[DB_VERSION('11.2.0.1')]',
 13  q'[ALL_ROWS]',
 14  q'[OUTLINE_LEAF(@"SEL$5C160134")]',
 15  q'[MERGE(@"SEL$335DD26A")]',
 16  q'[OUTLINE(@"SEL$1")]',
 17  q'[OUTLINE(@"SEL$335DD26A")]',
 18  q'[MERGE(@"SEL$3")]',
 19  q'[OUTLINE(@"SEL$2")]',
 20  q'[OUTLINE(@"SEL$3")]',
 21  q'[FULL(@"SEL$5C160134" "KS"@"SEL$3")]',
 22  q'[FULL(@"SEL$5C160134" "KV"@"SEL$3")]',
 23  q'[FULL(@"SEL$5C160134" "QU"@"SEL$3")]',
 24  q'[LEADING(@"SEL$5C160134" "KS"@"SEL$3" "KV"@"SEL$3" "QU"@"SEL$3")]',
 25  q'[USE_MERGE_CARTESIAN(@"SEL$5C160134" "KV"@"SEL$3")]',
 26  q'[USE_MERGE_CARTESIAN(@"SEL$5C160134" "QU"@"SEL$3")]',
 27  q'[END_OUTLINE_DATA]');
 28  :signature := DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(sql_txt);
 29  DBMS_SQLTUNE.IMPORT_SQL_PROFILE (
 30  sql_text    => sql_txt,
 31  profile     => h,
 32  name        => 'coe_6abthk1u14yb7_2848324471',
 33  description => 'coe 6abthk1u14yb7 2848324471 '||:signature||'',
 34  category    => 'DEFAULT',
 35  validate    => TRUE,
 36  replace     => TRUE,
 37  force_match => FALSE /* TRUE:FORCE (match even when different literals in SQL). FALSE:EXACT (si
 38  END;
 39  /

PL/SQL procedure successfully completed.

SQL> WHENEVER SQLERROR CONTINUE
SQL> SET ECHO OFF;

            SIGNATURE
---------------------
  6854104167049572323


... manual custom SQL Profile has been created


COE_XFR_SQL_PROFILE_6abthk1u14yb7_2848324471 completed
SQL> 

Step5. 确定Profile是否创建

select name, sql_text, created, description, type, status
  from dba_sql_profiles
where description like '%6abthk1u14yb7%'

 

Step6. 确定Profile是否绑定

select sql_id, sql_profile, plan_hash_value
  from v$sql
 where sql_id = '6abthk1u14yb7';

 

Step7. 如果脚本还在运行,让客户停掉脚本,并重新运行,以测试绑定的新的解析计划是否满足期望

alter system disconnect session '102,102' immediate; 

Step8. 如果绑定的解析计划并不能解决性能问题,验证后将其删除

--Disable Profile
EXEC DBMS_SQLTUNE.ALTER_SQL_PROFILE(Name => '<SQL PROFILE>', Attribute_Name => 'STATUS', Value => 'DISABLED');
--Drop Profile 
EXEC DBMS_SQLTUNE.DROP_SQL_PROFILE(Name => '<SQL PROFILE>');

 

三、代码


Oracle Metalink下载代码 - coe_xfr_sql_profile.sql

SPO coe_xfr_sql_profile.log;  
SET DEF ON TERM OFF ECHO ON FEED OFF VER OFF HEA ON LIN 2000 PAGES 100 LONG 8000000 LONGC 800000 TRIMS ON TI OFF TIMI OFF SERVEROUT ON SIZE 1000000 NUMF "" SQLP SQL>;  
REM  
REM $Header: 215187.1 coe_xfr_sql_profile.sql 11.4.1.4 2010/07/12 csierra $  
REM  
REM Copyright (c) 2000-2010, Oracle Corporation. All rights reserved.  
REM  
REM AUTHOR  
REM   carlos.sierra@oracle.com  
REM  
REM SCRIPT  
REM   coe_xfr_sql_profile.sql  
REM  
REM DESCRIPTION  
REM   This script generates another that contains the commands to  
REM   create a manual custom SQL Profile out of a known plan from  
REM   memory or AWR. The manual custom profile can be implemented  
REM   into the same SOURCE system where the plan was retrieved,  
REM   or into another similar TARGET system that has same schema  
REM   objects referenced by the SQL that generated the known plan.  
REM  
REM PRE-REQUISITES  
REM   1. Oracle Tuning Pack license.  
REM  
REM PARAMETERS  
REM   1. SQL_ID (required)  
REM   2. Plan Hash Value for which a manual custom SQL Profile is  
REM      needed (required). A list of known plans is presented.  
REM  
REM EXECUTION  
REM   1. Connect into SQL*Plus as SYSDBA or user with access to  
REM      data dictionary.  
REM   2. Execute script coe_xfr_sql_profile.sql passing SQL_ID and  
REM      plan hash value (parameters can be passed inline or until  
REM      requested).  
REM  
REM EXAMPLE  
REM   # sqlplus system  
REM   SQL> START coe_xfr_sql_profile.sql [SQL_ID] [PLAN_HASH_VALUE];  
REM   SQL> START coe_xfr_sql_profile.sql gnjy0mn4y9pbm 2055843663;  
REM   SQL> START coe_xfr_sql_profile.sql gnjy0mn4y9pbm;  
REM   SQL> START coe_xfr_sql_profile.sql;  
REM  
REM NOTES  
REM   1. For possible errors see coe_xfr_sql_profile.log  
REM   2. If SQLT is installed in SOURCE, you can use instead:  
REM      sqlt/utl/sqltprofile.sql  
REM   3. Be aware that using DBMS_SQLTUNE requires a license for  
REM      Oracle Tuning Pack.  
REM  
SET TERM ON ECHO OFF;  
PRO  
PRO Parameter 1:  
PRO SQL_ID (required)  
PRO  
DEF sql_id = '&1';  
PRO  
WITH  
p AS (  
SELECT plan_hash_value  
  FROM gv$sql_plan  
 WHERE sql_id = TRIM('&&sql_id.')  
   AND other_xml IS NOT NULL  
 UNION  
SELECT plan_hash_value  
  FROM dba_hist_sql_plan  
 WHERE sql_id = TRIM('&&sql_id.')  
   AND other_xml IS NOT NULL ),  
m AS (  
SELECT plan_hash_value,  
       SUM(elapsed_time)/SUM(executions) avg_et_secs  
  FROM gv$sql  
 WHERE sql_id = TRIM('&&sql_id.')  
   AND executions > 0  
 GROUP BY  
       plan_hash_value ),  
a AS (  
SELECT plan_hash_value,  
       SUM(elapsed_time_total)/SUM(executions_total) avg_et_secs  
  FROM dba_hist_sqlstat  
 WHERE sql_id = TRIM('&&sql_id.')  
   AND executions_total > 0  
 GROUP BY  
       plan_hash_value )  
SELECT p.plan_hash_value,  
       ROUND(NVL(m.avg_et_secs, a.avg_et_secs)/1e6, 3) avg_et_secs  
  FROM p, m, a  
 WHERE p.plan_hash_value = m.plan_hash_value(+)  
   AND p.plan_hash_value = a.plan_hash_value(+)  
 ORDER BY  
       avg_et_secs NULLS LAST;  
PRO  
PRO Parameter 2:  
PRO PLAN_HASH_VALUE (required)  
PRO  
DEF plan_hash_value = '&2';  
PRO  
PRO Values passed:  
PRO ~~~~~~~~~~~~~  
PRO SQL_ID         : "&&sql_id."  
PRO PLAN_HASH_VALUE: "&&plan_hash_value."  
PRO  
SET TERM OFF ECHO ON;  
WHENEVER SQLERROR EXIT SQL.SQLCODE;  
  
VAR sql_text CLOB;  
VAR other_xml CLOB;  
EXEC :sql_text := NULL;  
EXEC :other_xml := NULL;  
  
-- get sql_text from memory  
DECLARE  
  l_sql_text VARCHAR2(32767);  
BEGIN -- 10g see bug 5017909  
  FOR i IN (SELECT DISTINCT piece, sql_text  
              FROM gv$sqltext_with_newlines  
             WHERE sql_id = TRIM('&&sql_id.')  
             ORDER BY 1, 2)  
  LOOP  
    IF :sql_text IS NULL THEN  
      DBMS_LOB.CREATETEMPORARY(:sql_text, TRUE);  
      DBMS_LOB.OPEN(:sql_text, DBMS_LOB.LOB_READWRITE);  
    END IF;  
    l_sql_text := REPLACE(i.sql_text, CHR(00), ' ');  
    DBMS_LOB.WRITEAPPEND(:sql_text, LENGTH(l_sql_text), l_sql_text);  
  END LOOP;  
  IF :sql_text IS NOT NULL THEN  
    DBMS_LOB.CLOSE(:sql_text);  
  END IF;  
EXCEPTION  
  WHEN OTHERS THEN  
    DBMS_OUTPUT.PUT_LINE('getting sql_text from memory: '||SQLERRM);  
    :sql_text := NULL;  
END;  
/  
  
-- get sql_text from awr  
BEGIN  
  IF :sql_text IS NULL OR NVL(DBMS_LOB.GETLENGTH(:sql_text), 0) = 0 THEN  
    SELECT REPLACE(sql_text, CHR(00), ' ')  
      INTO :sql_text  
      FROM dba_hist_sqltext  
     WHERE sql_id = TRIM('&&sql_id.')  
       AND sql_text IS NOT NULL  
       AND ROWNUM = 1;  
  END IF;  
EXCEPTION  
  WHEN OTHERS THEN  
    DBMS_OUTPUT.PUT_LINE('getting sql_text from awr: '||SQLERRM);  
    :sql_text := NULL;  
END;  
/  
  
SELECT :sql_text FROM DUAL;  
  
-- get other_xml from memory  
BEGIN  
  FOR i IN (SELECT other_xml  
              FROM gv$sql_plan  
             WHERE sql_id = TRIM('&&sql_id.')  
               AND plan_hash_value = TO_NUMBER(TRIM('&&plan_hash_value.'))  
               AND other_xml IS NOT NULL  
             ORDER BY  
                   child_number, id)  
  LOOP  
    :other_xml := i.other_xml;  
    EXIT; -- 1st  
  END LOOP;  
EXCEPTION  
  WHEN OTHERS THEN  
    DBMS_OUTPUT.PUT_LINE('getting other_xml from memory: '||SQLERRM);  
    :other_xml := NULL;  
END;  
/  
  
-- get other_xml from awr  
BEGIN  
  IF :other_xml IS NULL OR NVL(DBMS_LOB.GETLENGTH(:other_xml), 0) = 0 THEN  
    FOR i IN (SELECT other_xml  
                FROM dba_hist_sql_plan  
               WHERE sql_id = TRIM('&&sql_id.')  
                 AND plan_hash_value = TO_NUMBER(TRIM('&&plan_hash_value.'))  
                 AND other_xml IS NOT NULL  
               ORDER BY  
                     id)  
    LOOP  
      :other_xml := i.other_xml;  
      EXIT; -- 1st  
    END LOOP;  
  END IF;  
EXCEPTION  
  WHEN OTHERS THEN  
    DBMS_OUTPUT.PUT_LINE('getting other_xml from awr: '||SQLERRM);  
    :other_xml := NULL;  
END;  
/  
  
SELECT :other_xml FROM DUAL;  
  
-- generates script that creates sql profile in target system:  
SET ECHO OFF;  
PRO coe_xfr_sql_profile_&&sql_id._&&plan_hash_value..sql.  
SET FEED OFF LIN 666 TRIMS ON TI OFF TIMI OFF SERVEROUT ON SIZE 1000000 FOR WOR;  
SPO OFF;  
SPO coe_xfr_sql_profile_&&sql_id._&&plan_hash_value..sql;  
DECLARE  
  l_pos NUMBER;  
  l_hint VARCHAR2(32767);  
BEGIN  
  DBMS_OUTPUT.PUT_LINE('SPO coe_xfr_sql_profile_&&sql_id._&&plan_hash_value..log;');  
  DBMS_OUTPUT.PUT_LINE('SET ECHO ON TERM ON LIN 2000 TRIMS ON NUMF 99999999999999999999;');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('REM $Header: 215187.1 coe_xfr_sql_profile_&&sql_id._&&plan_hash_value..sql 11.4.1.4 '||TO_CHAR(SYSDATE, 'YYYY/MM/DD')||' csierra $');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('REM Copyright (c) 2000-2010, Oracle Corporation. All rights reserved.');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('REM AUTHOR');  
  DBMS_OUTPUT.PUT_LINE('REM   carlos.sierra@oracle.com');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('REM SCRIPT');  
  DBMS_OUTPUT.PUT_LINE('REM   coe_xfr_sql_profile_&&sql_id._&&plan_hash_value..sql');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('REM DESCRIPTION');  
  DBMS_OUTPUT.PUT_LINE('REM   This script is generated by coe_xfr_sql_profile.sql');  
  DBMS_OUTPUT.PUT_LINE('REM   It contains the SQL*Plus commands to create a custom');  
  DBMS_OUTPUT.PUT_LINE('REM   SQL Profile for SQL_ID &&sql_id. based on plan hash');  
  DBMS_OUTPUT.PUT_LINE('REM   value &&plan_hash_value..');  
  DBMS_OUTPUT.PUT_LINE('REM   The custom SQL Profile to be created by this script');  
  DBMS_OUTPUT.PUT_LINE('REM   will affect plans for SQL commands with signature');  
  DBMS_OUTPUT.PUT_LINE('REM   matching the one for SQL Text below.');  
  DBMS_OUTPUT.PUT_LINE('REM   Review SQL Text and adjust accordingly.');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('REM PARAMETERS');  
  DBMS_OUTPUT.PUT_LINE('REM   None.');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('REM EXAMPLE');  
  DBMS_OUTPUT.PUT_LINE('REM   SQL> START coe_xfr_sql_profile_&&sql_id._&&plan_hash_value..sql;');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('REM NOTES');  
  DBMS_OUTPUT.PUT_LINE('REM   1. Should be run as SYSTEM or SYSDBA.');  
  DBMS_OUTPUT.PUT_LINE('REM   2. User must have CREATE ANY SQL PROFILE privilege.');  
  DBMS_OUTPUT.PUT_LINE('REM   3. SOURCE and TARGET systems can be the same or similar.');  
  DBMS_OUTPUT.PUT_LINE('REM   4. To drop this custom SQL Profile after it has been created:');  
  DBMS_OUTPUT.PUT_LINE('REM      EXEC DBMS_SQLTUNE.DROP_SQL_PROFILE(''coe_&&sql_id._&&plan_hash_value.'');');  
  DBMS_OUTPUT.PUT_LINE('REM   5. Be aware that using DBMS_SQLTUNE requires a license');  
  DBMS_OUTPUT.PUT_LINE('REM      for the Oracle Tuning Pack.');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('WHENEVER SQLERROR EXIT SQL.SQLCODE;');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('VAR signature NUMBER;');  
  DBMS_OUTPUT.PUT_LINE('REM');  
  DBMS_OUTPUT.PUT_LINE('DECLARE');  
  DBMS_OUTPUT.PUT_LINE('sql_txt CLOB;');  
  DBMS_OUTPUT.PUT_LINE('h       SYS.SQLPROF_ATTR;');  
  DBMS_OUTPUT.PUT_LINE('BEGIN');  
  DBMS_OUTPUT.PUT_LINE('sql_txt := q''[');  
  WHILE NVL(LENGTH(:sql_text), 0) > 0  
  LOOP  
    l_pos := INSTR(:sql_text, CHR(10));  
    IF l_pos > 0 THEN  
      DBMS_OUTPUT.PUT_LINE(SUBSTR(:sql_text, 1, l_pos - 1));  
      :sql_text := SUBSTR(:sql_text, l_pos + 1);  
    ELSE  
      DBMS_OUTPUT.PUT_LINE(:sql_text);  
      :sql_text := NULL;  
    END IF;  
  END LOOP;  
  DBMS_OUTPUT.PUT_LINE(']'';');  
  DBMS_OUTPUT.PUT_LINE('h := SYS.SQLPROF_ATTR(');  
  DBMS_OUTPUT.PUT_LINE('q''[BEGIN_OUTLINE_DATA]'',');  
  FOR i IN (SELECT /*+ opt_param('parallel_execution_enabled', 'false') */  
                   SUBSTR(EXTRACTVALUE(VALUE(d), '/hint'), 1, 4000) hint  
              FROM TABLE(XMLSEQUENCE(EXTRACT(XMLTYPE(:other_xml), '/*/outline_data/hint'))) d)  
  LOOP  
    l_hint := i.hint;  
    WHILE NVL(LENGTH(l_hint), 0) > 0  
    LOOP  
      IF LENGTH(l_hint) <= 500 THEN  
        DBMS_OUTPUT.PUT_LINE('q''['||l_hint||']'',');  
        l_hint := NULL;  
      ELSE  
        l_pos := INSTR(SUBSTR(l_hint, 1, 500), ' ', -1);  
        DBMS_OUTPUT.PUT_LINE('q''['||SUBSTR(l_hint, 1, l_pos)||']'',');  
        l_hint := '   '||SUBSTR(l_hint, l_pos);  
      END IF;  
    END LOOP;  
  END LOOP;  
  DBMS_OUTPUT.PUT_LINE('q''[END_OUTLINE_DATA]'');');  
  DBMS_OUTPUT.PUT_LINE(':signature := DBMS_SQLTUNE.SQLTEXT_TO_SIGNATURE(sql_txt);');  
  DBMS_OUTPUT.PUT_LINE('DBMS_SQLTUNE.IMPORT_SQL_PROFILE (');  
  DBMS_OUTPUT.PUT_LINE('sql_text    => sql_txt,');  
  DBMS_OUTPUT.PUT_LINE('profile     => h,');  
  DBMS_OUTPUT.PUT_LINE('name        => ''coe_&&sql_id._&&plan_hash_value.'',');  
  DBMS_OUTPUT.PUT_LINE('description => ''coe &&sql_id. &&plan_hash_value. ''||:signature||'''',');  
  DBMS_OUTPUT.PUT_LINE('category    => ''DEFAULT'',');  
  DBMS_OUTPUT.PUT_LINE('validate    => TRUE,');  
  DBMS_OUTPUT.PUT_LINE('replace     => TRUE,');  
  DBMS_OUTPUT.PUT_LINE('force_match => FALSE /* TRUE:FORCE (match even when different literals in SQL). FALSE:EXACT (similar to CURSOR_SHARING) */ );');  
  DBMS_OUTPUT.PUT_LINE('END;');  
  DBMS_OUTPUT.PUT_LINE('/');  
  DBMS_OUTPUT.PUT_LINE('WHENEVER SQLERROR CONTINUE');  
  DBMS_OUTPUT.PUT_LINE('SET ECHO OFF;');  
  DBMS_OUTPUT.PUT_LINE('PRINT signature');  
  DBMS_OUTPUT.PUT_LINE('PRO');  
  DBMS_OUTPUT.PUT_LINE('PRO ... manual custom SQL Profile has been created');  
  DBMS_OUTPUT.PUT_LINE('PRO');  
  DBMS_OUTPUT.PUT_LINE('SET TERM ON ECHO OFF LIN 80 TRIMS OFF NUMF "";');  
  DBMS_OUTPUT.PUT_LINE('SPO OFF;');  
  DBMS_OUTPUT.PUT_LINE('PRO');  
  DBMS_OUTPUT.PUT_LINE('PRO COE_XFR_SQL_PROFILE_&&sql_id._&&plan_hash_value. completed');  
END;  
/  
SPO OFF;  
SET DEF ON TERM ON ECHO OFF FEED 6 VER ON HEA ON LIN 80 PAGES 14 LONG 80 LONGC 80 TRIMS OFF TI OFF TIMI OFF SERVEROUT OFF NUMF "" SQLP SQL>;  
PRO  
PRO Execute coe_xfr_sql_profile_&&sql_id._&&plan_hash_value..sql  
PRO on TARGET system in order to create a custom SQL Profile  
PRO with plan &&plan_hash_value linked to adjusted sql_text.  
PRO  
UNDEFINE 1 2 sql_id plan_hash_value  
PRO  
PRO COE_XFR_SQL_PROFILE completed. 

 

Thanks and Regards

参考:Oracle Metalink

ERP技术讨论群: 288307890
技术交流,技术讨论,欢迎加入
Technology Blog Created By Oracle ERP - 鲍新建
相关文章
|
2月前
|
域名解析 网络协议 CDN
阿里云服务器购买后如何解析域名,三步操作即可解析绑定
阿里云服务器购买后如何解析域名,三步操作即可解析绑定
|
2月前
|
缓存 前端开发 JavaScript
Webpack技术深度解析:模块打包与性能优化
【10月更文挑战第13天】Webpack技术深度解析:模块打包与性能优化
|
4月前
|
JavaScript 前端开发 算法
【Vue秘籍揭秘】:掌握这一个技巧,让你的列表渲染速度飙升!——深度解析`key`属性如何成为性能优化的秘密武器
【8月更文挑战第20天】Vue.js是一款流行前端框架,通过简洁API和高效虚拟DOM更新机制简化响应式Web界面开发。其中,`key`属性在列表渲染中至关重要。本文从`key`基本概念出发,解析其实现原理及最佳实践。使用`key`帮助Vue更准确地识别列表变动,优化DOM更新过程,确保组件状态正确维护,提升应用性能。通过示例展示有无`key`的区别,强调合理使用`key`的重要性。
64 3
|
3月前
|
图形学 iOS开发 Android开发
从Unity开发到移动平台制胜攻略:全面解析iOS与Android应用发布流程,助你轻松掌握跨平台发布技巧,打造爆款手游不是梦——性能优化、广告集成与内购设置全包含
【8月更文挑战第31天】本书详细介绍了如何在Unity中设置项目以适应移动设备,涵盖性能优化、集成广告及内购功能等关键步骤。通过具体示例和代码片段,指导读者完成iOS和Android应用的打包与发布,确保应用顺利上线并获得成功。无论是性能调整还是平台特定的操作,本书均提供了全面的解决方案。
153 0
|
4月前
|
开发者 测试技术 Android开发
Xamarin 开发者的五大常见问题及解决方案:从环境搭建到性能优化,全面解析高效跨平台应用开发的技巧与代码实例
【8月更文挑战第31天】Xamarin 开发者常遇问题及解决方案覆盖环境搭建至应用发布全流程,助新手克服技术难关。首先需正确安装配置 Visual Studio 及 Xamarin 支持,设置 iOS/Android 测试环境。利用 Xamarin.Forms 和 XAML 实现高效跨平台开发,共享 UI 和业务逻辑代码。针对性能优化,采取减少 UI 更新、缓存计算结果等措施,复杂问题则借助 Xamarin Profiler 分析。
49 0
|
4月前
|
SQL 存储 数据库
|
5月前
|
缓存 监控 NoSQL
深入解析数据库性能优化:策略与实践
【7月更文挑战第23天】数据库性能优化是一个复杂而持续的过程,涉及硬件、软件、架构、管理等多个方面。通过本文的介绍,希望能够为读者提供一个全面的性能优化框架,帮助大家在实际工作中更有效地提升数据库性能。记住,优化不是一蹴而就的,需要持续的观察、分析和调整。
|
4月前
|
XML JSON Go
[gin]数据解析和绑定
[gin]数据解析和绑定
|
5月前
|
存储 算法 搜索推荐
深入解析String数组的操作与性能优化策略
深入解析String数组的操作与性能优化策略
|
12天前
|
监控 Java 应用服务中间件
高级java面试---spring.factories文件的解析源码API机制
【11月更文挑战第20天】Spring Boot是一个用于快速构建基于Spring框架的应用程序的开源框架。它通过自动配置、起步依赖和内嵌服务器等特性,极大地简化了Spring应用的开发和部署过程。本文将深入探讨Spring Boot的背景历史、业务场景、功能点以及底层原理,并通过Java代码手写模拟Spring Boot的启动过程,特别是spring.factories文件的解析源码API机制。
42 2

推荐镜像

更多
下一篇
无影云桌面