如何生成指定SQL语句的AWR报表
来源:互联网 发布:通用字体软件下载 编辑:程序博客网 时间:2024/04/30 13:00
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
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 <return> 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 <return> 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
<HTML><HEAD><TITLE>AWR SQL Report</TITLE><style type="text/css">body.awr {font:bold 10pt Arial,Helvetica,Geneva,sans-serif;color:black;
......
......
.....
</BODY></HTML>
Report written to /home/oracle/awr_20121231.html
- 如何生成指定SQL语句的AWR报表
- 为一条SQL语句生成AWR报告!
- AWR、ASH和Statspack的生成语句
- AWR生成标准统计报表
- 使用sql语句直接生成dataset做为报表的数据源!
- oracle_慢SQL的优化过程(awr报表)
- 如何生成awr报告
- 如何生成awr报告
- 如何查看awr/statspack报表,来定位系统的问题
- 用SQL生成awr报表中的“SQL ordered by Elapsed Time” 部分
- 用SQL生成awr报表中的“SQL ordered by Elapsed Time” 部分
- AWR报告的生成
- 结合AWR报告生成HTML格式的SQL执行计划
- 11g_awr:如何生成AWR
- oracle如何生成AWR报告
- 如何生成Oracle AWR报告
- thinkphp如何查看方法自动sql生成的sql语句
- 如何批量生成sql语句
- 清空目录下的日志
- Nmap参考指南(Man Page)
- OGRE 1.7 例子程序分析
- 如何校验两日期是否是同一年
- Why "I" in Iphone, Imac, Itouch?
- 如何生成指定SQL语句的AWR报表
- 实践EFI、GPT安装windows 8和archlinux双系统
- MFC ActiveX 控件在IE下闪烁的问题
- VIM vimrc
- Jackson快速指南
- 查看vim 的启动过程。 确定自己vim 插件的存放位置
- 职业生涯:倒退一下又何妨
- UIScreen,UIView,UIWindow和UIViewController的介绍和区别
- what a fuck memset!