[20230906]顯示最近統計分析的操作報表.txt
[20230906]顯示最近統計分析的操作報表.txt
--//有時候上班業務突然出現異常,想快速瞭解昨天晚上那些表做了分析。
--//可以檢視DBA_OPTSTAT_OPERATIONS檢視,瞭解做了那些操作。當然許多檢視也能瞭解什麼時間做了分析.
--//oracle的DBMS_STATS.REPORT_STATS_OPERATIONS也可以實現類似功能測試看看。
1.環境:
SCOTT@test01p> @ ver1
PORT_STRING VERSION BANNER CON_ID
------------------------------ -------------- -------------------------------------------------------------------------------- ----------
IBMPC/WIN_NT64-9.1.0 12.2.0.1.0 Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 0
2.分析表:
--//順便找兩個表T1,T2分析看看。
3.測試DBMS_STATS.REPORT_STATS_OPERATIONS:
--//然後執行如下:
column my_report format a200
variable my_report clob;
BEGIN
:my_report := DBMS_STATS.REPORT_STATS_OPERATIONS (
since => SYSDATE-1
, until => SYSDATE
, detail_level => 'TYPICAL'
, format => 'TEXT'
);
END;
/
SCOTT@test01p> print :my_report
MY_REPORT
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| CDB Id | Operation Id | Operation | Target | Start Time | End Time | Status | Total Tasks | Successful Tasks | Failed Tasks | Active Tasks |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 3 | 5484 | gather_table_stats | SCOTT.T2 | 2023-09-06 21:31:18.340000 | 2023-09-06 21:31:19.922000 | COMPLETED | 2 | 2 | 0 | 0 |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 3 | 5464 | gather_table_stats | SCOTT.T1 | 2023-09-06 21:31:09.927000 | 2023-09-06 21:31:13.899000 | COMPLETED | 1 | 1 | 0 | 0 |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4.可以單獨執行DBMS_STATS.REPORT_SINGLE_STATS_OPERATION函式瞭解一些細節:
BEGIN
:my_report :=DBMS_STATS.REPORT_SINGLE_STATS_OPERATION (
OPID => 5484
, FORMAT => 'TEXT'
);
END;
/
SCOTT@test01p> print my_report
MY_REPORT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Operation Id | Operation | Target | Start Time | End Time | Status | Total Tasks | Successful Tasks | Failed Tasks | Active Tasks |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 5484 | gather_table_stats | SCOTT.T2 | 2023-09-06 21:31:18.340000 | 2023-09-06 21:31:19.922000 | COMPLETED | 2 | 2 | 0 | 0 |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| T A S K S |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| | Target | Type | Start Time | End Time | Status | |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| | SCOTT.T2 | TABLE | 2023-09-06 21:31:18.353000 | 2023-09-06 21:31:19.903000 | COMPLETED | |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| | SCOTT.T2_I2 | INDEX | 2023-09-06 21:31:19.196000 | 2023-09-06 21:31:19.831000 | COMPLETED | |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| |
| |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--//有點太花俏,估計很少查細節。也可以支援html格式。
BEGIN
:my_report :=DBMS_STATS.REPORT_SINGLE_STATS_OPERATION (
OPID => 5484
, FORMAT => 'HTML'
);
END;
/
SCOTT@test01p> spool myoutput.html
SCOTT@test01p> print my_report
...
SCOTT@test01p> spool off
SCOTT@test01p> host "E:\Progra~1\Mozill~1\firefox.exe" d:\tmp\myoutput.html
--//可以開啟瀏覽器檢視。不知道為什麼僅僅支援"E:\Progra~1\Mozill~1\firefox.exe"這樣寫,如果有空格解析錯誤.
4.根據前面測試可以建立指令碼如下:
$ cat report_stats.sql
column my_report format a200
variable my_report clob;
BEGIN
:my_report := DBMS_STATS.REPORT_STATS_OPERATIONS (
since => &1
, until => &2
, detail_level => 'TYPICAL'
, format => 'TEXT'
);
END;
/
prompt BEGIN
prompt :my_report :=DBMS_STATS.REPORT_SINGLE_STATS_OPERATION (
prompt OPID => &OPID
prompt , FORMAT => 'TEXT'
prompt );;
prompt END;;
prompt /
prompt
prompt print :my_report
print :my_report
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2985170/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 設計好的報表是如何在 web 上顯示的Web
- [20190321]smem的顯示缺陷.txt
- win10 如何不顯示最近活動 怎麼在win10不顯示最近使用Win10
- [20231207]ls -f的顯示問題.txt
- 在同一頁面顯示多個JavaScript統計圖表JavaScript
- [20190720]12cR2顯示執行計劃.txt
- [20180811]windows 7 顯示桌面.txtWindows
- [20211020]奇怪lsnrctl status顯示.txt
- [20201103]lsof顯示link=0的檔案.txt
- [20230405]奇怪的顯示輸出寬度.txt
- linux檔案管理命令例項分析【顯示、檢視、統計等】Linux
- [20190412]bash顯示日期相減.txt
- [20180628]顯示bbed x命令格式.txt
- [20210301]延遲顯示輸出.txt
- [20201106]奇怪的awr報表.txt
- win10系統microsoft edge桌面顯示的操作步驟Win10ROS
- txt最近開啟記錄 win10怎麼看_win10檢視最近開啟txt檔案操作方法Win10
- 報表的查詢皮膚怎麼顯示在左側?
- SAP WM 顯示TR ITEM的標準報表LX09
- Dynamics 365 Online fetchXml報表的顯示數量的限制與否XML
- [20181207]sqlplus下顯示資料精度.txtSQL
- [20180312]iostat顯示輸出問題.txtiOS
- 統計報表 -- sql統計語句SQL
- 設定SAP標準報表顯示介面預設值的方式
- Win10 - 開始選單不顯示最近常用的應用Win10
- 不同系統裡同一Customizing activity的顯示差異分析
- Win10系統快速訪問怎麼顯示最近使用的檔案和資料夾Win10
- PbootCMS前臺顯示留言條數統計boot
- [20200217]bash顯示path環境變數.txt變數
- [20201121]顯示時間戳高精度版本.txt時間戳
- [20220317]補充完善TPT 顯示欄位列的指令碼.txt指令碼
- 研究顯示安全分析師 25% 的時間浪費在誤報上
- element table 表頭顯示 tooltip
- navicat 表中文顯示? 解決
- 直播平臺原始碼,隱藏app圖示並不在最近執行中顯示原始碼APP
- Win10系統顯示卡驅動報錯怎麼辦?Win10 2004系統顯示卡驅動報錯的解決方法Win10
- [20230501]為什麼沒有顯示輸出.txt
- [20191104]sqlplus下顯示資料精度2.txtSQL