ITPub博客

首页 > 数据库 > Oracle > 执行计划变动导致查询sql慢处理

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

原创 Oracle 作者:lmxx2020 时间:2024-01-22 14:19:37 0 删除 编辑

查询慢的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 ;


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22967847/viewspace-3004662/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2024-01-09

  • 博文量
    106
  • 访问量
    90383