如何利用ash监控会话
ash是非常有效的监控工具之一,1秒抓一次select max(sample_time)over(),min(sample_time)over() from dba_hist_active_sess_history; --8天 select max(sample_time)over(),min(sample_time)over() from v$active_session_history; --当天首先先了解几个视
ash是非常有效的监控工具之一,1秒抓一次 select max(sample_time)over(),min(sample_time)over() from dba_hist_active_sess_history; --8天 select max(sample_time)over(),min(sample_time)over() from v$active_session_history; --当天 首先先了解几个视图: V$ACTIVE_SESSION_HISTORY: 是ASH的核心,用以记录活动SESSION的历史等待信息,每秒采样一次,这部分内容记录在内存中,期望值是记录一个小时的内容。 WRH#_ACTIVE_SESSION_HISTORY : 是V$ACTIVE_SESSION_HISTORY在AWR的存储地。 V$ACTIVE_SESSION_HISTORY: 中的信息会被定期(每小时一次)的刷新到负载库中,并缺省保留一个星期用于分析。 DBA_HIST_ACTIVE_SESS_HISTORY: 视图是WRH#_ACTIVE_SESSION_HISTORY视图和其他几个视图的联合展现,通常通过这个视图进行历史数据的访问。 ------------------------------------ --V$ACTIVE_SESSION_HISTORY的监控:-- ------------------------------------ ------------session:1----------------- SQL> @big SID ---------- 131 Elapsed: 00:00:00.00 drop table big * ERROR at line 1: ORA-00942: table or view does not exist Elapsed: 00:00:00.03 Elapsed: 00:00:00.31 Elapsed: 00:00:00.34 Elapsed: 00:00:00.29 Elapsed: 00:00:00.73 Elapsed: 00:00:01.75 Elapsed: 00:00:10.59 Elapsed: 00:00:24.62 Elapsed: 00:00:00.01 BIG_M ---------- 522 Elapsed: 00:00:00.36 COUNT(*) ---------- 4650368 Elapsed: 00:00:26.70 ------------session:2----------------- SQL> @getash_sid Enter value for sid: 131 SESSION_ID NAME P_NAME P_VALUE SQL_ID WAIT_TIME CURRENT_OBJ# CURRENT_FILE# CURRENT_BLOCK# ---------- ---------------------------------------------------------------- --------------- --------------- ------------- ---------- ------------ ------------- --------- 131 db file sequential read file# 1 d2wbn28rdk8z4 0 547 1 3604 block# 53206 blocks 1 131 db file sequential read file# 1 d2wbn28rdk8z4 0 -1 0 0 block# 3009 blocks 1 131 db file scattered read file# 4 03b71c07nsc1a 0 134 1 1064 block# 4845 blocks 8 131 log buffer space 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch completion 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 6046 0 0 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 4995 block# 4995 blocks 5 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 7170 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 7170 0 0 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 8578 block# 8578 blocks 126 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 12802 block# 12802 blocks 126 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 12930 0 0 131 db file sequential read file# 1 aq32z6wjx1s4h 0 65921 201 3585 block# 2854 blocks 1 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 14084 block# 14084 blocks 124 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 18436 block# 18436 blocks 128 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 19972 block# 19972 blocks 128 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 21252 block# 21252 blocks 124 131 db file parallel read files 1 aq32z6wjx1s4h 0 76851 4 23424 blocks 29 requests 29 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 24320 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 24320 0 0 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 25856 block# 25856 blocks 128 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 27652 block# 27652 blocks 124 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 29312 block# 29312 blocks 32 131 Disk file operations I/O FileOperation 2 aq32z6wjx1s4h 0 76851 4 29952 fileno 0 filetype 2 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 30724 block# 30724 blocks 124 131 db file scattered read file# 4 aq32z6wjx1s4h 0 76851 4 34530 block# 34530 blocks 14 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 35716 0 0 131 log file switch (checkpoint incomplete) 0 aq32z6wjx1s4h 0 76851 4 35716 0 0 131 Disk file operations I/O FileOperation 5 aq32z6wjx1s4h 0 76851 4 37632 fileno 0 filetype 2 131 db file sequential read file# 4 fqcxb1n33642x 0 9 1 86832 block# 4999 blocks 1 131 db file scattered read file# 4 fqcxb1n33642x 0 9 1 86832 block# 10344 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 9 1 86832 block# 17409 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 9 1 86832 block# 22083 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 9 1 86832 block# 28549 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 9 1 86832 block# 34733 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 9 1 86832 block# 39217 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 9 1 86832 block# 45114 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 9 1 86832 block# 48836 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 9 1 86832 block# 52391 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 5196 block# 5196 blocks 6 131 db file sequential read file# 4 fqcxb1n33642x 0 76851 4 8261 block# 8261 blocks 1 131 db file sequential read file# 4 fqcxb1n33642x 0 76851 4 11318 block# 11318 blocks 1 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 14489 block# 14489 blocks 56 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 17935 block# 17935 blocks 50 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 21195 block# 21195 blocks 20 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 25170 block# 25170 blocks 2 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 28453 block# 28453 blocks 34 131 db file sequential read file# 4 fqcxb1n33642x 0 76851 4 33067 block# 33067 blocks 1 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 36991 block# 36991 blocks 13 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 41616 block# 41616 blocks 21 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 44055 block# 44055 blocks 8 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 2723 block# 2723 blocks 44 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 50056 block# 50056 blocks 9 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 53658 block# 53658 blocks 102 131 db file scattered read file# 4 fqcxb1n33642x 0 76851 4 56580 block# 56580 blocks 128 131 db file sequential read file# 4 fqcxb1n33642x 0 76851 4 60256 block# 60256 blocks 1 64 rows selected. Elapsed: 00:00:00.40 SQL> @getsql_sqlid Enter 1 for curr sql, 2 for hist sql,default 1: Enter value for sqlid: fqcxb1n33642x SQL_FULLTEXT --------------------------------------------------------------------------------------------- select count(*) from big Elapsed: 00:00:00.00 Elapsed: 00:00:00.00 SQL> @getobj_id Enter value for dblink: Enter value for obj_id: 76851 OWNER OBJECT_NAME OBJECT_TYPE CREATED STATUS -------------------- ------------------------------ ------------------- ------------------- ------- SCOTT BIG TABLE 2014-11-20 15:56:23 VALID 1 row selected. Elapsed: 00:00:00.01 SQL> @getobj_fb Enter value for file_id: 4 Enter value for block_id: 60256 OWNER SEGMENT_NAME SEGMENT_TY --------------- -------------------- ---------- SCOTT BIG TABLE 1 row selected. Elapsed: 00:00:00.37 --------------------------@脚本-------------------- --@big @sid set feedback off drop table big; create table big as select * from dba_objects; insert into big select * from big; / / / / / commit; select SUM(bytes) / 1024 / 1024 big_M from dba_segments where segment_name = 'BIG'; select count(*) from big; set feedback on --@getash_sid col p_name for a15 col p_value for a15 select SESSION_ID, NAME, P1TEXT||chr(10)||P2TEXT||chr(10)||P3TEXT p_name, p1||chr(10)||p2||chr(10)||p3 p_value, sql_id, WAIT_TIME, CURRENT_OBJ#, CURRENT_FILE#, CURRENT_BLOCK# from v$active_session_history ash, v$event_name enm where ash.event# = enm.event# and SESSION_ID = &sid order by sample_time; ---------------------------------------- --DBA_HIST_ACTIVE_SESS_HISTORY的监控:-- ---------------------------------------- --查当前时间 select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual; --根据时间找到snap_id(8天内,1小时前),因为基表非常大,利用snap_id的索引才能快速查询 select distinct snap_id from dba_hist_snapshot b where to_date('2014-11-20 14:08:12','yyyy-mm-dd hh24:mi:ss') between b.begin_interval_time and b.end_interval_time; --top instance select /*+parallel(a,8)*/instance_number,count(*) from dba_hist_active_sess_history a where a.snap_id=67421 group by instance_number; --top event select /*+parallel(a,8)*/event,count(*) from dba_hist_active_sess_history a where a.snap_id=67421 and instance_number=2 and sample_time>=to_timestamp('2014-11-20 14:07:12','yyyy-mm-dd hh24:mi:ss') and sample_time<=to_timestamp('2014-11-20 14:08:12','yyyy-mm-dd hh24:mi:ss') group by event order by count(*) desc; --top user select /*+parallel(a,8)*/user_id,(select username from dba_users b where b.user_id=a.user_id) username,count(*) from dba_hist_active_sess_history a where a.snap_id=67421 and instance_number=2 and sample_time>=to_timestamp('2014-11-20 14:07:12','yyyy-mm-dd hh24:mi:ss') and sample_time<=to_timestamp('2014-11-20 14:08:12','yyyy-mm-dd hh24:mi:ss') group by user_id order by count(*) desc; --top sql select /*+parallel(a,8)*/sql_id,count(*) from dba_hist_active_sess_history a where a.snap_id=67421 and instance_number=2 and sample_time>=to_timestamp('2014-11-20 14:07:12','yyyy-mm-dd hh24:mi:ss') and sample_time<=to_timestamp('2014-11-20 14:08:12','yyyy-mm-dd hh24:mi:ss') group by sql_id order by count(*) desc; -- select SQL_TEXT from dba_hist_sqltext where sql_id='49p4hfj6azw19'; --top program select /*+parallel(a,8)*/program,count(*) from dba_hist_active_sess_history a where a.snap_id=67421 and instance_number=2 and sample_time>=to_timestamp('2014-11-20 14:07:12','yyyy-mm-dd hh24:mi:ss') and sample_time<=to_timestamp('2014-11-20 14:08:12','yyyy-mm-dd hh24:mi:ss') group by program order by count(*) desc;

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

家中監視器一般保存一到兩週。詳細介紹:1、更大的儲存容量,可以保存更長時間的錄影;2、硬碟的容量越大,可以保存的錄影時間就越長;3、根據不同地區和法律法規的要求,監控錄影的保存時間可能會有所不同;4、一些高級的監控系統還可以根據運動檢測或特定事件觸發錄像,從而節省存儲空間並提供更有用的錄像。

如何利用GitLab進行專案文件管理一、背景介紹在軟體開發過程中,專案文件是非常重要的資料,不僅能夠幫助開發團隊了解專案的需求和設計,還能提供給測試團隊和客戶參考。為了方便專案文件的版本控制和團隊協作,我們可以利用GitLab來進行專案文件管理。 GitLab是一個基於Git的版本控制系統,除了支援程式碼管理,還可以管理專案文件。二、GitLab環境建置首先,我

在當今的數位時代,了解網站上的最新變化對於各種目的至關重要,例如追蹤競爭對手網站上的更新、監控產品可用性或隨時了解重要資訊。手動檢查網站是否有更改可能既耗時又低效。這就是自動化發揮作用的地方。在這篇文章中,我們將探討如何建立Python腳本來監控網站變更。透過利用Python的強大功能和一些方便的庫,我們可以自動化檢索網站內容、與先前的版本進行比較並通知我們任何更改的過程。這使我們能夠保持主動並及時對我們監控的網站上的更新或修改做出反應。設定環境在開始編寫腳本來監控網站變更之前,我們需要設定P

如何在FastAPI中實現請求日誌記錄和監控引言:FastAPI是一個基於Python3.7+的高效能Web框架,它提供了許多強大的功能和特性,包括自動化的請求和回應模型驗證、安全性、效能最佳化等。在實際開發中,我們經常需要在應用程式中記錄請求日誌以便進行排錯和監控分析。本文將介紹如何在FastAPI中實作請求日誌記錄和監控,並提供對應的程式碼範例。一、安裝依

Linux下的即時日誌監控與分析在日常的系統管理和故障排查中,日誌是一個非常重要的資料來源。透過對系統日誌的即時監控和分析,我們可以及時發現異常情況並進行相應的處理。本文將介紹Linux下如何進行即時日誌監控和分析,並提供對應的程式碼範例。一、即時日誌監控在Linux下,最常用的日誌系統是rsyslog。透過配置rsyslog,我們可以實現將不同應用程式的日誌

在Laravel監控錯誤方面,是提升應用穩定性的重要一環。在開發過程中,難免會遇到各種錯誤,而如何及時發現並解決這些錯誤,是保障應用正常運作的關鍵之一。 Laravel提供了豐富的工具和功能來幫助開發者監控和處理錯誤,本文將介紹其中一些重要的方法,並附上具體的程式碼範例。一、使用日誌記錄日誌記錄是監控錯誤的重要手段之一。 Laravel內建了強大的日誌系統,開發者

C#開發建議:日誌記錄與監控系統摘要:在軟體開發過程中,日誌記錄與監控系統是至關重要的工具。本文章將介紹C#開發中日誌記錄與監控系統的作用與實施建議。引言:在大型軟體開發專案中,日誌記錄和監控是不可或缺的工具。它們可以幫助我們即時了解程式運行狀況,快速發現並解決問題。本文將討論C#開發中如何使用日誌記錄和監控系統,以提高軟體品質和開發效率。日誌記錄系統的作用

在Slim框架中使用會話(Sessions)進行使用者認證的方法在Web應用程式中,使用者認證是一個重要的功能,它確保只有被授權的使用者可以存取受限資源。會話(Sessions)是一種常用的認證方法,透過儲存使用者身分和狀態訊息,確保使用者在整個會話期間保持認證狀態。 Slim框架提供了方便的工具和中間件來處理會話和使用者認證。下面我們將介紹如何在Slim框架中使用會話進
