联系:QQ(5163721)
标题:固定执行计划-使用coe_xfr_sql_profile(BASELINE)固定执行计划
作者:Lunar©版权所有[文章允许转载,但必须以链接方式注明源地址,否则追究法律责任.]
测试目的: 使用coe_xfr_sql_profile的方式固定执行计划和hint中指定no index,谁的优先级高?
在SQLT工具中包含了几个轻巧方便的coe脚本,用来固定执行计划,其中coe_xfr_sql_profile是我常用的。
.
固定执行计划-使用SQL Tuning Advisor
固定执行计划-手工指定PLAN OUTLINE
固定执行计划-手工指定索引名称的方式
固定执行计划-使用coe_xfr_sql_profile固定执行计划
固定执行计划-使用SPM(Sql Plan Management)固定执行计划
.
查看当前的SQL Profile:
LUNAR@lunardb>select * from dba_sql_profiles;
NAME CATEGORY SIGNATURE SQL_TEXT
------------------------------ ------------------------------ ---------------- --------------------------------------------------------------------------------
CREATED LAST_MODIFIED
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TYPE STATUS FOR TASK_ID TASK_EXEC_NAME TASK_OBJ_ID TASK_FND_ID TASK_REC_ID
------- -------- --- ---------------- ------------------------------ ---------------- ---------------- ----------------
Lunar_bjgduva68mbqm_profile DEFAULT 9.9008162990E+18 select /*+ no_index(lunartest1 idx_lunartest1_n) */ * from lunartest1 where n=1
12-JAN-16 10.53.46.000000 AM 12-JAN-16 10.53.46.000000 AM
MANUAL ENABLED YES
Elapsed: 00:00:00.00
LUNAR@lunardb>
LUNAR@lunardb>exec dbms_sqltune.drop_sql_profile('Lunar_bjgduva68mbqm_profile');
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.14
LUNAR@lunardb>select * from dba_sql_profiles;
no rows selected
Elapsed: 00:00:00.01
LUNAR@lunardb>
使用coe_xfr_sql_profile脚本自动识别和指定执行计划:
LUNAR@lunardb>@coe_xfr_sql_profile.sql bjgduva68mbqm
Parameter 1:
SQL_ID (required)
PLAN_HASH_VALUE AVG_ET_SECS
---------------- ----------------
1172089107 .003
Parameter 2:
PLAN_HASH_VALUE (required)
Enter value for 2: 1172089107
Values passed to coe_xfr_sql_profile:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SQL_ID : "bjgduva68mbqm"
PLAN_HASH_VALUE: "1172089107"
SQL>BEGIN
2 IF :sql_text IS NULL THEN
3 RAISE_APPLICATION_ERROR(-20100, 'SQL_TEXT for SQL_ID &&sql_id. was not found in memory (gv$sqltext_with_newlines) or AWR (dba_hist_sqltext).');
4 END IF;
5 END;
6 /
SQL>SET TERM OFF;
SQL>BEGIN
2 IF :other_xml IS NULL THEN
3 RAISE_APPLICATION_ERROR(-20101, 'PLAN for SQL_ID &&sql_id. and PHV &&plan_hash_value. was not found in memory (gv$sql_plan) or AWR (dba_hist_sql_plan).');
4 END IF;
5 END;
6 /
SQL>SET TERM OFF;
Execute coe_xfr_sql_profile_bjgduva68mbqm_1172089107.sql
on TARGET system in order to create a custom SQL Profile
with plan 1172089107 linked to adjusted sql_text.
COE_XFR_SQL_PROFILE completed.
SQL>
SQL>@coe_xfr_sql_profile_bjgduva68mbqm_1172089107.sql
SQL>REM
SQL>REM $Header: 215187.1 coe_xfr_sql_profile_bjgduva68mbqm_1172089107.sql 11.4.4.4 2016/01/12 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_bjgduva68mbqm_1172089107.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 bjgduva68mbqm based on plan hash
SQL>REM value 1172089107.
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_bjgduva68mbqm_1172089107.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_bjgduva68mbqm_1172089107');
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 /*+ no_index(lunartest1 idx_lunartest1_n) */ * from lunar]');
15 wa(q'[test1 where n=1]');
16 DBMS_LOB.CLOSE(sql_txt);
17 h := SYS.SQLPROF_ATTR(
18 q'[BEGIN_OUTLINE_DATA]',
19 q'[IGNORE_OPTIM_EMBEDDED_HINTS]',
20 q'[OPTIMIZER_FEATURES_ENABLE('11.2.0.4')]',
21 q'[DB_VERSION('11.2.0.4')]',
22 q'[ALL_ROWS]',
23 q'[OUTLINE_LEAF(@"SEL$1")]',
24 q'[FULL(@"SEL$1" "LUNARTEST1"@"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_bjgduva68mbqm_1172089107',
32 description => 'coe bjgduva68mbqm 1172089107 '||: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
---------------------
659415202199990108
SIGNATUREF
---------------------
9900816299026594015
... manual custom SQL Profile has been created
COE_XFR_SQL_PROFILE_bjgduva68mbqm_1172089107 completed
SQL>
因为删除了SQL Profile,对应的执行计划也会被删除,因此当前只有一个全表扫描的执行计划(上次测试留下的),以前的执行计划都不在了。
上面的执行过程中已经告诉我们,这个执行计划会使用全表扫描(q'[FULL(@”SEL$1″ “LUNARTEST1″@”SEL$1”)]’):
16 DBMS_LOB.CLOSE(sql_txt);
17 h := SYS.SQLPROF_ATTR(
18 q'[BEGIN_OUTLINE_DATA]',
19 q'[IGNORE_OPTIM_EMBEDDED_HINTS]',
20 q'[OPTIMIZER_FEATURES_ENABLE('11.2.0.4')]',
21 q'[DB_VERSION('11.2.0.4')]',
22 q'[ALL_ROWS]',
23 q'[OUTLINE_LEAF(@"SEL$1")]',
24 q'[FULL(@"SEL$1" "LUNARTEST1"@"SEL$1")]',
25 q'[END_OUTLINE_DATA]');
我们查看一下这个SQL Profile的主要内容:
SYS@lunardb>conn lunar/lunar
Connected.
LUNAR@lunardb>select * from dba_sql_profiles;
NAME CATEGORY SIGNATURE SQL_TEXT
------------------------------ ------------------------------ ---------------- --------------------------------------------------------------------------------
CREATED LAST_MODIFIED
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TYPE STATUS FOR TASK_ID TASK_EXEC_NAME TASK_OBJ_ID TASK_FND_ID TASK_REC_ID
------- -------- --- ---------------- ------------------------------ ---------------- ---------------- ----------------
coe_bjgduva68mbqm_1172089107 DEFAULT 6.5941520220E+17 select /*+ no_index(lunartest1 idx_lunartest1_n) */ * from lunartest1 where n=1
12-JAN-16 11.24.18.000000 AM 12-JAN-16 11.24.18.000000 AM
coe bjgduva68mbqm 1172089107 659415202199990108 9900816299026594015
MANUAL ENABLED NO
Elapsed: 00:00:00.01
LUNAR@lunardb>
LUNAR@lunardb>SELECT extractValue(value(h),'.') AS hint
2 FROM sys.sqlobj$data od, sys.sqlobj$ so,
3 table(xmlsequence(extract(xmltype(od.comp_data),'/outline_data/hint'))) h
4 WHERE so.name = 'coe_bjgduva68mbqm_1172089107'
5 AND so.signature = od.signature
6 AND so.category = od.category
7 AND so.obj_type = od.obj_type
8 AND so.plan_id = od.plan_id;
HINT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BEGIN_OUTLINE_DATA
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('11.2.0.4')
DB_VERSION('11.2.0.4')
ALL_ROWS
OUTLINE_LEAF(@"SEL$1")
FULL(@"SEL$1" "LUNARTEST1"@"SEL$1")
END_OUTLINE_DATA
8 rows selected.
Elapsed: 00:00:00.02
LUNAR@lunardb>
现在我们产生一个正确的执行计划,让该sql执行时使用到索引:
LUNAR@lunardb>select * from lunartest1 where n=1;
Elapsed: 00:00:00.00
Execution Plan
----------------------------------------------------------
Plan hash value: 3241900148
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 4 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| IDX_LUNARTEST1_N | 1 | 4 | 1 (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("N"=1)
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
3 consistent gets
0 physical reads
0 redo size
519 bytes sent via SQL*Net to client
524 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
LUNAR@lunardb>
找出sqlid
SYS@lunardb>select sql_id,sql_text from v$sql where sql_text like '%select * from lunartest1 where n=1%'; SQL_ID ------------- SQL_TEXT -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4b2bfyz3qnrxu EXPLAIN PLAN SET STATEMENT_ID='PLUS80018' FOR select * from lunartest1 where n=1 fjmxgdhw858hz select * from lunartest1 where n=1 8ka8pzvvkqwwg select sql_id,sql_text from v$sql where sql_text like '%select * from lunartest1 where n=1%' Elapsed: 00:00:00.02 SYS@lunardb>
找出正确的outline:
SYS@lunardb>select * from table(dbms_xplan.display_cursor('fjmxgdhw858hz',null,'outline'));
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID fjmxgdhw858hz, child number 0
-------------------------------------
select * from lunartest1 where n=1
Plan hash value: 3241900148
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 1 (100)| |
|* 1 | INDEX RANGE SCAN| IDX_LUNARTEST1_N | 1 | 4 | 1 (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Outline Data
-------------
/*+
BEGIN_OUTLINE_DATA
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('11.2.0.4')
DB_VERSION('11.2.0.4')
ALL_ROWS
OUTLINE_LEAF(@"SEL$1")
INDEX(@"SEL$1" "LUNARTEST1"@"SEL$1" ("LUNARTEST1"."N"))
END_OUTLINE_DATA
*/
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("N"=1)
32 rows selected.
Elapsed: 00:00:00.02
SYS@lunardb>
这里我们看到已经使用了索引。
使用coe_xfr_sql_profile固定执行计划:
LUNAR@lunardb>@coe_xfr_sql_profile.sql bjgduva68mbqm
Parameter 1:
SQL_ID (required)
PLAN_HASH_VALUE AVG_ET_SECS
---------------- ----------------
1172089107 .003
Parameter 2:
PLAN_HASH_VALUE (required)
Enter value for 2: 3241900148
Values passed to coe_xfr_sql_profile:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SQL_ID : "bjgduva68mbqm"
PLAN_HASH_VALUE: "3241900148"
SQL>BEGIN
2 IF :sql_text IS NULL THEN
3 RAISE_APPLICATION_ERROR(-20100, 'SQL_TEXT for SQL_ID &&sql_id. was not found in memory (gv$sqltext_with_newlines) or AWR (dba_hist_sqltext).');
4 END IF;
5 END;
6 /
SQL>SET TERM OFF;
SQL>BEGIN
2 IF :other_xml IS NULL THEN
3 RAISE_APPLICATION_ERROR(-20101, 'PLAN for SQL_ID &&sql_id. and PHV &&plan_hash_value. was not found in memory (gv$sql_plan) or AWR (dba_hist_sql_plan).');
4 END IF;
5 END;
6 /
SQL>SET TERM OFF;
Execute coe_xfr_sql_profile_bjgduva68mbqm_3241900148.sql
on TARGET system in order to create a custom SQL Profile
with plan 3241900148 linked to adjusted sql_text.
COE_XFR_SQL_PROFILE completed.
SQL>
现在,测试一下,使用SYS用户绑定是否会影响其他用户使用执行计划:
SYS@lunardb>@coe_xfr_sql_profile_bjgduva68mbqm_3241900148.sql
SYS@lunardb>REM
SYS@lunardb>REM $Header: 215187.1 coe_xfr_sql_profile_bjgduva68mbqm_3241900148.sql 11.4.4.4 2016/01/12 carlos.sierra $
SYS@lunardb>REM
SYS@lunardb>REM Copyright (c) 2000-2012, Oracle Corporation. All rights reserved.
SYS@lunardb>REM
SYS@lunardb>REM AUTHOR
SYS@lunardb>REM carlos.sierra@oracle.com
SYS@lunardb>REM
SYS@lunardb>REM SCRIPT
SYS@lunardb>REM coe_xfr_sql_profile_bjgduva68mbqm_3241900148.sql
SYS@lunardb>REM
SYS@lunardb>REM DESCRIPTION
SYS@lunardb>REM This script is generated by coe_xfr_sql_profile.sql
SYS@lunardb>REM It contains the SQL*Plus commands to create a custom
SYS@lunardb>REM SQL Profile for SQL_ID bjgduva68mbqm based on plan hash
SYS@lunardb>REM value 3241900148.
SYS@lunardb>REM The custom SQL Profile to be created by this script
SYS@lunardb>REM will affect plans for SQL commands with signature
SYS@lunardb>REM matching the one for SQL Text below.
SYS@lunardb>REM Review SQL Text and adjust accordingly.
SYS@lunardb>REM
SYS@lunardb>REM PARAMETERS
SYS@lunardb>REM None.
SYS@lunardb>REM
SYS@lunardb>REM EXAMPLE
SYS@lunardb>REM SQL> START coe_xfr_sql_profile_bjgduva68mbqm_3241900148.sql;
SYS@lunardb>REM
SYS@lunardb>REM NOTES
SYS@lunardb>REM 1. Should be run as SYSTEM or SYSDBA.
SYS@lunardb>REM 2. User must have CREATE ANY SQL PROFILE privilege.
SYS@lunardb>REM 3. SOURCE and TARGET systems can be the same or similar.
SYS@lunardb>REM 4. To drop this custom SQL Profile after it has been created:
SYS@lunardb>REM EXEC DBMS_SQLTUNE.DROP_SQL_PROFILE('coe_bjgduva68mbqm_3241900148');
SYS@lunardb>REM 5. Be aware that using DBMS_SQLTUNE requires a license
SYS@lunardb>REM for the Oracle Tuning Pack.
SYS@lunardb>REM 6. If you modified a SQL putting Hints in order to produce a desired
SYS@lunardb>REM Plan, you can remove the artifical Hints from SQL Text pieces below.
SYS@lunardb>REM By doing so you can create a custom SQL Profile for the original
SYS@lunardb>REM SQL but with the Plan captured from the modified SQL (with Hints).
SYS@lunardb>REM
SYS@lunardb>WHENEVER SQLERROR EXIT SQL.SQLCODE;
SYS@lunardb>REM
SYS@lunardb>VAR signature NUMBER;
SYS@lunardb>VAR signaturef NUMBER;
SYS@lunardb>REM
SYS@lunardb>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 /*+ no_index(lunartest1 idx_lunartest1_n) */ * from lunar]');
15 wa(q'[test1 where n=1]');
16 DBMS_LOB.CLOSE(sql_txt);
17 h := SYS.SQLPROF_ATTR(
18 q'[BEGIN_OUTLINE_DATA]',
19 q'[IGNORE_OPTIM_EMBEDDED_HINTS]',
20 q'[OPTIMIZER_FEATURES_ENABLE('11.2.0.4')]',
21 q'[DB_VERSION('11.2.0.4')]',
22 q'[ALL_ROWS]',
23 q'[OUTLINE_LEAF(@"SEL$1")]',
24 q'[INDEX(@"SEL$1" "LUNARTEST1"@"SEL$1" ("LUNARTEST1"."N"))]',
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_bjgduva68mbqm_3241900148',
32 description => 'coe bjgduva68mbqm 3241900148 '||: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.
Elapsed: 00:00:00.11
SYS@lunardb>WHENEVER SQLERROR CONTINUE
SYS@lunardb>SET ECHO OFF;
SIGNATURE
---------------------
659415202199990108
SIGNATUREF
---------------------
9900816299026594015
... manual custom SQL Profile has been created
COE_XFR_SQL_PROFILE_bjgduva68mbqm_3241900148 completed
SYS@lunardb>
SYS@lunardb>select * from dba_sql_profiles;
NAME CATEGORY SIGNATURE SQL_TEXT
------------------------------ ------------------------------ ---------------- --------------------------------------------------------------------------------
CREATED LAST_MODIFIED
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TYPE STATUS FOR TASK_ID TASK_EXEC_NAME TASK_OBJ_ID TASK_FND_ID TASK_REC_ID
------- -------- --- ---------------- ------------------------------ ---------------- ---------------- ----------------
coe_bjgduva68mbqm_3241900148 DEFAULT 6.5941520220E+17 select /*+ no_index(lunartest1 idx_lunartest1_n) */ * from lunartest1 where n=1
12-JAN-16 11.24.18.000000 AM 12-JAN-16 11.40.52.000000 AM
coe bjgduva68mbqm 3241900148 659415202199990108 9900816299026594015
MANUAL ENABLED NO
Elapsed: 00:00:00.00
SYS@lunardb>
再次执行查询:
LUNAR@lunardb>select /*+ no_index(lunartest1 idx_lunartest1_n) */ * from lunartest1 where n=1;
Elapsed: 00:00:00.01
Execution Plan
----------------------------------------------------------
Plan hash value: 3241900148
-------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 4 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| IDX_LUNARTEST1_N | 1 | 4 | 1 (0)| 00:00:01 |
-------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("N"=1)
Note
-----
- SQL profile "coe_bjgduva68mbqm_3241900148" used for this statement
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
3 consistent gets
0 physical reads
0 redo size
519 bytes sent via SQL*Net to client
524 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
LUNAR@lunardb>
这里我们看到该SQL还是忽略了hint而使用了索引。
结论:
1,使用SYS用户绑定执行计划不会影响其他用户使用该SQL Profile及执行效果
2,这里已经使用了我们的SQL PROFILE(coe_bjgduva68mbqm_3241900148),sql使用了索引,说明coe_xfr_sql_profile绑定执行计划的方式比hint的优先级高
