v$session之小測試(二)_與v$sql
先羅列一點官方手冊:
V$SQL lists statistics on shared SQL area without the GROUP BY clause and contains one row for each child of the original SQL text entered. Statistics displayed in V$SQL are normally updated at the end of query execution. However, for long running queries, they are updated every 5 seconds. This makes it easy to see the impact of long running SQL statements while they are still in progress.
簡譯如下:v$sql除了 group by 不顯示,其它皆會顯示(共享sql,說白了就是shared pool 中的library cache);另外:一些長查詢,它是每5秒更新一條統計資訊,其它的查詢sql則是每次查詢執行完就會更新統計資訊了
--以下就是根據v$session的sql_adress及sql_hash_value二者匹配v$sql檢視正在及剛剛執行過的會話sql
select sql_text,address,hash_value --檢視正在執行會話對應的sql
from v$sql
where (address,hash_value)
in (select sql_address,sql_hash_value from v$session where sid=976 and username='PD')
from v$sql
where (address,hash_value)
in (select sql_address,sql_hash_value from v$session where sid=976 and username='PD')
SQL_TEXT ADDRESS HASH_VALUE
---------------------------------------------------------------------------------------------------- -------- ----------
update t1 set a=2 --這是等待鎖的會話對應的sql 32D4D31C 3205622493 --sql地址及hash_value
---------------------------------------------------------------------------------------------------- -------- ----------
update t1 set a=2 --這是等待鎖的會話對應的sql 32D4D31C 3205622493 --sql地址及hash_value
--查詢上次剛剛執行過的會話所對應的sql
SQL> select sql_text,address,hash_value from v$sql where (address,hash_value) in (select prev_sql_addr,prev_hash_value from v$session where username='PD');
SQL> select sql_text,address,hash_value from v$sql where (address,hash_value) in (select prev_sql_addr,prev_hash_value from v$session where username='PD');
SQL_TEXT ADDRESS HASH_VALUE
---------------------------------------------------------------------------------------------------- -------- ----------
select distinct sid from v$mystat 32D4D020 2171660009
select count(*) from c_chapter_info 35589288 962805696
update t1 set a=1 --這不把持鎖會話(剛執行過的會話的sql) 32D39BF0 3163124029
---------------------------------------------------------------------------------------------------- -------- ----------
select distinct sid from v$mystat 32D4D020 2171660009
select count(*) from c_chapter_info 35589288 962805696
update t1 set a=1 --這不把持鎖會話(剛執行過的會話的sql) 32D39BF0 3163124029
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-669829/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- v$session之小測試(一)_與v$lockSession
- v$session之小測試(三)_與dba_objectsSessionObject
- v$transaction事務_v$session會話_v$rollstat_v$rollname關聯測試_概念Session會話
- v$session與v$sql連線現在使用哪個欄位?SessionSQL
- v$sql.command_type and v$session.commandSQLSession
- oracle11g v$sql_v$sqlarea_version_count測試OracleSQL
- V$SESSIONSession
- V$session 檢視的小運用Session
- 【Oracle】-【v$session】v$session的SNIPED狀態OracleSession
- 關於v$process與v$session中process的理解Session
- v session_wait v session_event v system_eventSessionAI
- v$session_event , v$system_event , v$session_waitSessionAI
- 幾個檢視 v$mystat v$systata v$sessionSession
- V$SQL、V$SQLSTATS、V$SQLAREASQL
- session和v$session說明Session
- cursor_sharing與v$sqlarea_v$sql_v$sql_shared_cursorSQL
- 【SESSION】v$session and v$license 中sessions_current 的區別Session
- v$session_wait和v$session_event檢視SessionAI
- 查詢等待事件(wait event)相關的SQL - v$session_wait, v$rowcache,v$sqltext事件AISQLSession
- Oracle9i中v$sql、v$sqlarea、v$sqltext、v$sql_plan的聯絡與區別OracleSQL
- V$session 及該檢視的小運用Session
- 10.17 V$SESSIONSession
- V$SESSION COMMANDSession
- v$Session詳解Session
- v$session 檢視Session
- V$sql_text v$sqlarea v$sql 的區別SQL
- 幾個重要檢視(V$SYSTEM_EVENT V$SESSION_EVENT V$SESSION_WAIT)SessionAI
- In V$SESSION, column SQL_ID is not NULL while STATUS is INACTIVESessionSQLNullWhile
- v$sql,v$sqlarea,v$sqltext區別SQL
- 軟體測試模型-V 模型模型
- 問題:V$SESSION SQL_ID 為空,找不到SQL_IDSessionSQL
- v$action_session_historySession
- V$SESSION_LONGOPSSessionGo
- v$session的解釋Session
- v$session的來源Session
- v$session中的serverSessionServer
- V$SESSION_WAITSessionAI
- 10G V$SESSIONSession