學用ORACLE AWR和ASH特性(4)-生成指定SQL的統計報表
2.3 生成指定SQL語句的統計報表
這項統計專門用來分析某條指定的SQL語句,通過awrsqrpt.sql指令碼,awr能夠生成指定sql(曾經執行過的SQL)的執行計劃,消耗的資源等等資訊,有助於DBA進行SQL調優。
具體操作如下,首先還是執行生成指令碼:
SQL> @$ORACLE_HOME/rdbms/admin/awrsqrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id DB Name Inst Num Instance
----------- ------------ -------- ------------
3812548755 TEST08 1 test08
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選擇生成的報表格式,沒啥說的,就預設的html格式吧。
Type Specified: html
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ -------- ------------ ------------ ------------
* 3812548755 1 TEST08 test08 yans1
Using 3812548755 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
specifying a number lists all completed snapshots.
Enter value for num_days: 2指定報表快照的生成區間!
Listing the last 2 days of Completed Snapshots
Snap
Instance DB Name Snap Id Snap Started Level
------------ ------------ --------- ------------------ -----
test08 TEST08 7450 25 10 月 2009 00:00 1
7451 25 10 月 2009 01:00 1
7452 25 10 月 2009 02:00 1
7453 25 10 月 2009 03:00 1
7454 25 10 月 2009 04:00 1
7455 25 10 月 2009 05:00 1
7456 25 10 月 2009 06:00 1
7457 25 10 月 2009 07:00 1
7458 25 10 月 2009 08:00 1
7459 25 10 月 2009 09:00 1
7460 25 10 月 2009 10:00 1
7461 25 10 月 2009 11:00 1
7462 25 10 月 2009 12:00 1
7463 25 10 月 2009 13:00 1
7464 25 10 月 2009 14:00 1
7465 25 10 月 2009 15:00 1
7466 25 10 月 2009 16:00 1
7467 25 10 月 2009 17:00 1
7468 25 10 月 2009 18:00 1
7469 25 10 月 2009 19:00 1
7470 25 10 月 2009 20:00 1
7471 25 10 月 2009 21:00 1
7472 25 10 月 2009 22:00 1
7473 25 10 月 2009 23:00 1
7474 26 10 月 2009 00:00 1
7475 26 10 月 2009 01:00 1
7476 26 10 月 2009 02:00 1
7477 26 10 月 2009 03:00 1
7478 26 10 月 2009 04:00 1
7479 26 10 月 2009 05:00 1
7480 26 10 月 2009 06:00 1
7481 26 10 月 2009 07:00 1
7482 26 10 月 2009 08:00 1
7483 26 10 月 2009 09:00 1
7484 26 10 月 2009 10:00 1
Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 7451
Begin Snapshot Id specified: 7451
Enter value for end_snap: 7475
End Snapshot Id specified: 7475指定開始和結束的快照ID:
Specify the SQL Id
~~~~~~~~~~~~~~~~~~
Enter value for sql_id: a51q9un8j1kv6注意嘍,這裡要指定分析的SQL_ID,你可能想問,要分析的SQL ID從何而來呢?一般來說,提出這種問題說明你還未操作過awr或看到一條SQL。為什麼這麼說呢,因為一般來講,獲取問題SQL的途徑要麼是通過V$SQL(及其它相關檢視),要麼是通過AWR/STATSPACK等工具,而這些方式找到SQL語句時,只要你再稍微拿眼神的旁光這麼一掃,就會發現在語句的旁邊有一條SQL ID靜靜的矗立著:)
SQL ID specified: a51q9un8j1kv6
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrsqlrpt_1_7451_7475.html. To use this name,
press
Enter value for report_name: awr_sqlrpt_1_7451_7475.html
Using the report name awr_sqlrpt_1_7451_7475.html
相關文章
- ASH可以生成指定的session或sql_id的報告,ASH和AWR的區別SessionSQL
- ORACLE AWR效能報告和ASH效能報告的解讀Oracle
- [轉]Oracle資料庫ASH和AWR的簡單介紹Oracle資料庫
- 【AWR】Oracle批量生成awr報告指令碼Oracle指令碼
- Oracle生成awr報告操作步驟Oracle
- Oracle 11.2.0.3.0中執行awrrpt.sql生成awr報告報ora-06502錯誤OracleSQL
- statspack、awr、addm,ash影片分享
- [20230220][20230110]生成相關備庫的awr報表
- oracle 10G特性之awrOracle 10g
- Oracle 客戶端生成AWR方法Oracle客戶端
- oracle rac 單個例項不能生成awr報告的問題Oracle
- 統計報表 -- sql統計語句SQL
- sql統計-關於學生成績SQL
- ash報告中無sql_id的情況SQL
- [20201106]奇怪的awr報表.txt
- Oracle AWR無法生成快照(ORA-32701)Oracle
- [20230303]生成相關備庫的awr報表(補充說明).txt
- ORACLE AWROracle
- Oracle 18c新特性詳解 - 表和表空間相關的新特性Oracle
- awr報告每天自動生成指令碼指令碼
- Oracle 20c 新特性:SQL 巨集支援(SQL Macro)Scalar 和 Table 模式OracleSQLMac模式
- oracle工具 awr formatOracleORM
- oracle 11g awr不自動生成的臨時解決辦法Oracle
- Oracle 12.2 physical standby備庫收集AWR報告Oracle
- SQL、Excel都沒用!再複雜的報表,用對工具就能統統解決SQLExcel
- AWR佔用sysaux表空間太大UX
- 【AWR】Oracle資料庫建立awr基線Oracle資料庫
- 本機生成遠端資料庫AWR報告資料庫
- AWR TOP SQL實現SQL
- Oracle 查詢佔用臨時表空間大的歷史會話和SQLOracle會話SQL
- 【效能調優】Oracle AWR報告指標全解析Oracle指標
- 【SCRIPT】Oracle統計資訊相關SQLOracleSQL
- 學生成績管理系統——課程設計報告
- 【TUNE_ORACLE】檢視錶,列和索引的統計資訊SQL參考Oracle索引SQL
- 自動生成Sql--基於Mybatis的單表SqlSQLMyBatis
- Python 高階特性(4)- 生成器Python
- oracle 11g資料庫三大最佳化手段之一的ash生成及詳解Oracle資料庫
- oracle之 AWR固定基線Oracle
- 【AWR】Oracle awr相關檢視及體系介紹Oracle