如何生成指定SQL语句的AWR报表

php中文网
发布: 2016-06-07 17:24:44
原创
1247人浏览过

如果希望对多实例的数据库做对比,那就要使用$ORACLE_HOME/rdbms/admin/awrddrpi.sql脚本了。该脚本的操作基本与单实例基本相同,

1,生成指定sql语句的统计报表
  如果希望对多实例的数据库做对比,那就要使用$oracle_home/rdbms/admin/awrddrpi.sql脚本了。该脚本的操作基本与单实例基本相同,这里不再演示,感兴趣的朋友可以自己测试下。

2 ,,生成指定SQL语句的统计报表
  这项统计专门用来分析某条指定的SQL语句,通过awrsqrpt.sql脚本,awr能够生成指定sql(曾经执行过的SQL)的执行计划,消耗的资源等等信息,有助于DBA进行SQL调优。
[oracle@even ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 23 11:39:53 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining options

SQL> exec dbms_workload_repository.create_snapshot;

PL/SQL procedure successfully completed.

SQL> @$ORACLE_HOME/rdbms/admin/awrsqrpt.sql

Current Instance
~~~~~~~~~~~~~~~~

  DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 2100083002 TEST                1 test


Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: html

Type Specified:  html


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  DB Id    Inst Num DB Name      Instance    Host
------------ -------- ------------ ------------ ------------
* 2100083002        1 TEST        test        even.oracle.
                                                com

Using 2100083002 for database Id
Using          1 for instance number

AI社交封面生成器
AI社交封面生成器

一句话/一张图一键智能生成社交媒体图片的AI设计神器

AI社交封面生成器 30
查看详情 AI社交封面生成器


Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed.  Pressing without
specifying a number lists all completed snapshots.


Enter value for num_days: 1

Listing the last day's Completed Snapshots

                                                        Snap
Instance    DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
test        TEST                34 23 Dec 2012 11:00      1
                                35 23 Dec 2012 11:30      1
                                36 23 Dec 2012 11:40      1

 

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 34
Begin Snapshot Id specified: 34

Enter value for end_snap: 36
End  Snapshot Id specified: 36

 


Specify the SQL Id
~~~~~~~~~~~~~~~~~~
  注意,这里要指定分析的SQL_ID,你可能想问,要分析的SQL ID从何而来呢?一般来说,SQL_ID可以通过V$SQL(及其它相关视图),要么是通过AWR/STATSPACK等工具。
Enter value for sql_id: 4vsh055snc3du
SQL ID specified:  4vsh055snc3du

Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrsqlrpt_1_34_36.html.  To use this name,
press to continue, otherwise enter an alternative.

Enter value for report_name: /home/oracle/awr_20121231.html

Using the report name /home/oracle/awr_20121231.html


AWR SQL Report
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门推荐
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号