执行计划变动导致查询sql慢处理

来源:这里教程网 时间:2026-03-03 19:18:38 作者:

查询慢的sql_id的执行计划:

@?/rdbms/admin/awrsqrpt

Specify the Begin and End Snapshot Ids

Enter value for begin_snap: 114616
Begin Snapshot Id specified: 114616
Enter value for end_snap: 115125
End   Snapshot Id specified: 115125
Specify the SQL Id
~~~~~~~~~~~~~~~~~~
Enter value for sql_id: 0zk89hwkxh4aw
SQL ID specified:  0zk89hwkxh4aw
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrsqlrpt_3_114616_115125.html.  To use this name,
press <return> to continue, otherwise enter an alternative.
Enter value for report_name:
Using the report name awrsqlrpt_3_114616_115125.html

执行慢的的执行计划:

执行快的执行计划:

生成绑定文件

SQL> @coe_xfr_sql_profile

绑定

@coe_xfr_sql_profile_0zk89hwkxh4aw_2216941556.sql

如果绑定不对可以通过下面方式删除:

查询出sqlprofile名:

SQL> select name from dba_sql_profiles;

coe_0zk89hwkxh4aw_2216941556

删除sql_profile:

Exec dbms_sqltune.drop_sql_profile('coe_0zk89hwkxh4aw_2216941556');

select * from dba_advisor_sqlplans ;

select * from dba_sql_plan_baselines ;

相关推荐