当前位置:网站首页>An example of SPM manual binding execution plan
An example of SPM manual binding execution plan
2022-06-24 03:11:00 【laosu】
background
oracle 11.2.0.4
primary sql A Don't walk index , select /*+ no_index(t1 idx_01)*/ from t1 where object_id=5;
Manually generate indexed SQL B Implementation plan of ,select /*+ index(t1 idx_01)*/ from t1 where object_id=5;
take B The execution plan of is bound to A, send SQL A Go to the index .
The detailed steps
see sql A Of SQL_ID and PLAN_HASH_VALUE
-- from v$sql View query select sql_id,plan_hash_value,sql_text,parse_calls,executions from v$sql where sql_text like 'select /*+ no_index(t1 idx_01)*%'; -- or sqlplus in , After execution sql After execution select * from table(dbms_xplan.display_cursor(null,null,'advanced'));
establish sql A Of baseline, Generate sql_handle
declare tmp number; begin tmp := DBMS_SPM.LOAD_PLANS_FROM_CURSOR_CACHE(sql_id => 'g3auf3vcmtr6z',plan_hash_value => 3910739905,enabled => 'NO'); end; /
see baseline,A Of sql_handle
select sql_handle,plan_name,origin,enabled,accepted,sql_text from dba_sql_plan_baselines where sql_text like 'select /*+ no_index(t1 idx_01)*/%';
Generate what you need sql B Implementation plan of
Execute multiple times as follows SQL select /*+ index(t1 idx_01)*/ from t1 where object_id=5; obtain SQL B Of sql id and plan_hash value, The above two methods are acceptable select * from table(dbms_xplan.display_cursor(null,null,'advanced')); select sql_id,plan_hash_value,sql_text,parse_calls,executions from v$sql where sql_text like 'select /*+ index(t1 idx_01)*%';
take sql A Of sql_handle And B Associated with the execution plan
declare tmp number; begin tmp := DBMS_SPM.load_plans_from_cursor_cache(sql_id => 'fsfyjhcrv6kwb', -- new sql_id ,sql B plan_hash_value => 34099177, --new plan_hash_value, sql B sql_handle => 'SQL_4fd8b0b98686fd73' -- primary sql Of sql_handle, sql A ); end; / or : exec :tmp :=dbms_spm.load_plans_from_cursor_cache(sql_id=>'fsfyjhcrv6kwb',plan_hash_value=>34099177,sql_handle=>'SQL_4fd8b0b98686fd73');
see sql_handle, And delete the original execution plan
-- Check out the original SQL handle Implementation plan of select sql_handle,plan_name,origin,enabled,accepted,sql_text from dba_sql_plan_baselines where sql_handle='SQL_4fd8b0b98686fd73'; -- see baseline sql_handle Execution plan content select * from table(dbms_xplan.display_sql_plan_baseline(sql_handle=>'SQL_4fd8b0b98686fd73',plan_name=>'SQL_PLAN_4zq5hr638dzbmd147f332')); -- Delete exec :tmp := dbms_spm.drop_sql_plan_baseline(sql_handle=>'SQL_4fd8b0b98686fd73',plan_name=>'SQL_PLAN_82y5y7jctbuxrb2fbea4c');
complete .
边栏推荐
- Tencent cloud CIF engineering effectiveness summit was successfully opened, and coding released a series of new products
- Cloud desktop server resource planning, what are the advantages of cloud desktop
- Process kill problem
- Ner's past, present and future Overview - past
- Tstor onecos, focusing on a large number of object scenes
- Sinclair radio stopped broadcasting many TV stations, suspected of being attacked by blackmail software
- 2022-2028 global third-party data platform industry research and trend analysis report
- 2022-2028 global portable two-way radio equipment industry research and trend analysis report
- Hunan data security governance Summit Forum was held, and Tencent built the best practice of government enterprise data security
- What are the security guarantees for cloud desktop servers? What are the cloud desktop server platforms?
猜你喜欢

What is etcd and its application scenarios

2022-2028 global cell-based seafood industry research and trend analysis report

2022-2028 global tungsten copper alloy industry research and trend analysis report
![[51nod] 2106 an odd number times](/img/af/59b441420aa4f12fd50f5062a83fae.jpg)
[51nod] 2106 an odd number times

Simple and beautiful weather code

2022-2028 global pilot night vision goggle industry research and trend analysis report

2022-2028 global genome editing mutation detection kit industry survey and trend analysis report

2022-2028 global marine wet exhaust hose industry research and trend analysis report
![[51nod] 2102 or minus and](/img/68/0d966b0322ac1517dd2800234d386d.jpg)
[51nod] 2102 or minus and

The cost of on-site development of software talent outsourcing is higher than that of software project outsourcing. Why
随机推荐
South Korea's national network is disconnected. Who launched the network "attack"?
AI intelligent analysis is innovated again. In the future, the technical reserve of the security industry will become the top priority
Micro build low code enterprise exchange day · Shenzhen station opens registration
How does easydss handle the problem that the sharing page cannot be opened due to cache problems?
2022-2028 global third-party data platform industry research and trend analysis report
What protocols do fortress computers have and what protocols do fortress computers generally use
How to set up a cloud desktop server? Is there a charge for cloud desktop server setup?
Industry experts talk about "extortion virus": how does e-government build a moat?
How to handle the occasional address request failure in easygbs live video playback?
Grand summary of boutique idea plug-ins! Worth collecting
Storage crash MySQL database recovery case
How to access the cloud game management server? Which cloud game management server can I choose?
Grpc: implement service end flow restriction
Double 11 will arrive soon. Is your website ready?
Is the cloud game edge computing server highly required? What problems will occur during the use of cloud game edge computing server?
Grp: how to gracefully shutdown a process?
2022-2028 global aircraft wireless intercom system industry research and trend analysis report
Gin framework: adding swagger UI
MySQL case deep excavation information_ Root causes of slow schema view query (Part 2)
PHP verify mailbox format