How to get complete sessions information
*
SID - Session identifier
SERIAL - Session serial number
USERNAME - Oracle username
HOLDING_SESSION - Blocker SID
(holding a lock on an object for which another session is waiting)
TIME_MIN - Active time (minutes)
TIME_SEC - Active time (seconds)
UNDO_RECORDS - Number of Undo Records
PROGRESS - progress of work done so far
(only for longops operation)
WAIT_EVENT - current wait event
PGA_SIZE - PGA size
UGA_SIZE - UGA size
COMMITS - number of commits
SQL_USED - current/last SQL
LONG_OPS - Statistics summary message
(only for longops operation)
TRACE_FILE_NAME - name of the trace filename
RESOURCE_CONSUMER_GROUP - Name of the session's current resource consumer group
(Resource Manager feature)
STATUS - Status of the session
SERVER - Server type
OSUSER - Operating system client user name
PROGRAM - Operating system program name
MODULE - Name of the currently executing module
ACTION - Name of the currently executing action
MACHINE - Operating system machine name
*/
SELECT SID,
serial#,
username,
(SELECT holding_session
FROM dba_waiters
WHERE waiting_session = s.SID
AND ROWNUM = 1
AND holding_session NOT IN (SELECT waiting_session
FROM dba_waiters))
holding_session,
DECODE (s.status,
'ACTIVE', ROUND (last_call_et / 60),
0
) time_min,
DECODE (s.status,
'ACTIVE', last_call_et,
0
) time_sec,
(SELECT used_urec
FROM v$transaction t
WHERE t.addr = s.taddr) undo_records,
(SELECT ROUND (sl.sofar / sl.totalwork * 100, 2)
FROM v$session_longops sl
WHERE s.SID = sl.SID
AND s.serial# = sl.serial#
AND s.status = 'ACTIVE'
AND sl.time_remaining > 0) progress,
(SELECT event
FROM v$session_wait w
WHERE w.SID = s.SID) wait_event,
(SELECT ROUND (VALUE / 1024 / 1024, 2) || 'M'
FROM v$sesstat
WHERE SID = s.SID
AND statistic# = 20) pga_size,
(SELECT ROUND (VALUE / 1024 / 1024, 2) || 'M'
FROM v$sesstat
WHERE SID = s.SID
AND statistic# = 15) uga_size,
(SELECT VALUE
FROM v$sesstat
WHERE SID = s.SID
AND statistic# = 4) commits,
(SELECT sql_text
FROM v$sql t
WHERE s.sql_address = t.address
AND s.sql_hash_value = t.hash_value
AND ROWNUM = 1) sql_used,
(SELECT MESSAGE
FROM v$session_longops sl
WHERE s.SID = sl.SID
AND s.serial# = sl.serial#
AND s.status = 'ACTIVE'
AND sl.time_remaining > 0) long_ops,
(SELECT LOWER (ins.instance_name)
|| '_ora_'
|| LTRIM (TO_CHAR (a.spid))
|| '.trc' filename
FROM v$process a
WHERE a.addr = s.paddr) trace_file_name,
resource_consumer_group,
s.status,
server,
osuser,
program,
module,
action,
NVL (LOWER (s.machine), ins.host_name) machine
FROM v$session s,
v$instance ins
WHERE username IS NOT NULL
AND s.status = 'ACTIVE'
AND s.audsid <> USERENV ('sessionid')
ORDER BY DECODE (s.status,
'ACTIVE', ROUND (last_call_et),
0
) DESC
/
SID - Session identifier
SERIAL - Session serial number
USERNAME - Oracle username
HOLDING_SESSION - Blocker SID
(holding a lock on an object for which another session is waiting)
TIME_MIN - Active time (minutes)
TIME_SEC - Active time (seconds)
UNDO_RECORDS - Number of Undo Records
PROGRESS - progress of work done so far
(only for longops operation)
WAIT_EVENT - current wait event
PGA_SIZE - PGA size
UGA_SIZE - UGA size
COMMITS - number of commits
SQL_USED - current/last SQL
LONG_OPS - Statistics summary message
(only for longops operation)
TRACE_FILE_NAME - name of the trace filename
RESOURCE_CONSUMER_GROUP - Name of the session's current resource consumer group
(Resource Manager feature)
STATUS - Status of the session
SERVER - Server type
OSUSER - Operating system client user name
PROGRAM - Operating system program name
MODULE - Name of the currently executing module
ACTION - Name of the currently executing action
MACHINE - Operating system machine name
*/
SELECT SID,
serial#,
username,
(SELECT holding_session
FROM dba_waiters
WHERE waiting_session = s.SID
AND ROWNUM = 1
AND holding_session NOT IN (SELECT waiting_session
FROM dba_waiters))
holding_session,
DECODE (s.status,
'ACTIVE', ROUND (last_call_et / 60),
0
) time_min,
DECODE (s.status,
'ACTIVE', last_call_et,
0
) time_sec,
(SELECT used_urec
FROM v$transaction t
WHERE t.addr = s.taddr) undo_records,
(SELECT ROUND (sl.sofar / sl.totalwork * 100, 2)
FROM v$session_longops sl
WHERE s.SID = sl.SID
AND s.serial# = sl.serial#
AND s.status = 'ACTIVE'
AND sl.time_remaining > 0) progress,
(SELECT event
FROM v$session_wait w
WHERE w.SID = s.SID) wait_event,
(SELECT ROUND (VALUE / 1024 / 1024, 2) || 'M'
FROM v$sesstat
WHERE SID = s.SID
AND statistic# = 20) pga_size,
(SELECT ROUND (VALUE / 1024 / 1024, 2) || 'M'
FROM v$sesstat
WHERE SID = s.SID
AND statistic# = 15) uga_size,
(SELECT VALUE
FROM v$sesstat
WHERE SID = s.SID
AND statistic# = 4) commits,
(SELECT sql_text
FROM v$sql t
WHERE s.sql_address = t.address
AND s.sql_hash_value = t.hash_value
AND ROWNUM = 1) sql_used,
(SELECT MESSAGE
FROM v$session_longops sl
WHERE s.SID = sl.SID
AND s.serial# = sl.serial#
AND s.status = 'ACTIVE'
AND sl.time_remaining > 0) long_ops,
(SELECT LOWER (ins.instance_name)
|| '_ora_'
|| LTRIM (TO_CHAR (a.spid))
|| '.trc' filename
FROM v$process a
WHERE a.addr = s.paddr) trace_file_name,
resource_consumer_group,
s.status,
server,
osuser,
program,
module,
action,
NVL (LOWER (s.machine), ins.host_name) machine
FROM v$session s,
v$instance ins
WHERE username IS NOT NULL
AND s.status = 'ACTIVE'
AND s.audsid <> USERENV ('sessionid')
ORDER BY DECODE (s.status,
'ACTIVE', ROUND (last_call_et),
0
) DESC
/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9932141/viewspace-667689/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- How To Automate Disconnection of Idle SessionsSession
- How to Find Sessions Generating Lots of Redo or Archive logsSessionHive
- Using SQL Script Get Information about ASMSQLORMASM
- SQL: How to Find Sessions Generating Lots of Redo or Archive logsSQLSessionHive
- How to get propose products in Sales Order
- How to get SCN ,TIMESTAMP ,CHECKPOINT
- How to get the donuts in Lode Runner 2
- How to restore ASM based OCR after complete loss of the CRS diskgroupRESTASM
- how to get sharepoint lookup value
- Oracle HowTo:How to get Oracle SCN?Oracle
- How to get and set the system socket buffer in AIXAI
- How to get Timer Job History
- SQL: How to Find Sessions Generating Lots of Redo or Archive logs-167492.1SQLSessionHive
- How to get the description of blast hit using blastdbcmd?AST
- How to get ORACLE_HOME from data dictionaryOracle
- Metlink:How to Modify Public Network Information including VIP in CrsORM
- How to See Supplier Contact Information Using SQL in R12ORMSQL
- How can I get the followling results?
- How to get the exact duration of an audio file in js All In OneJS
- Kill SessionsSession
- Using Diagwait as a diagnostic to get more information for diagnosing Oracle Clusterware Node evictiAIORMOracle
- pdd.fulfillment.information.get跨境全託管發貨單詳情介面ORM
- SESSIONS, PROCESSES, TRANSACTIONSSession
- Sessions & Processes parameterSession
- limit active sessionsMITSession
- Sessions Get Killed if Connection Use Default Service name (Same as db_name) (Doc ID 730315.1)Session
- How to Get a 10046 trace for a Parallel Query [ID 1102801.1]Parallel
- Uncertainy and informationAIORM
- Code Complete (轉)
- FSM:The complete FSM
- [20190522]How to get dump or list parameters set at session level.txtSession
- 會話控制利器 gorilla/sessions會話GoSession
- Inhomogeneous deployment for replicated sessions is not allowed.Session
- sessions,processes的監控方法Session
- Kill all sessions of a specified user nameSession
- Connections and Sessions (110)Session
- redis:auto-completeRedis
- The complete timer