oracle10g R2 v$session视图详解

引言: 从10g开始,伴随ASH功能的引入,对V$SESSION视图进行了彻底改造。

        从Oracle10gR1开始,Oracle在V$SESSION中增加关于等待事件的字段,实际上也就是把原来V$SESSION_WAIT视图中的所有字段全部整合到了V$SESSION视图中,开始的时候我还以为ASH是依赖联合查询来获取信息的,仔细一看才发现现在V$SESSION已经发生了变化。(如果进一步研究你会发现,实际上V$SESSION的底层查询语句及X$表已经有了变化)


  这一变化使得我们的查询得以简化,但是也使得V$SESSION_WAIT开始变得多余,此外V$SESSION中还增加了BLOCKING_SESSION等字段,以前我们需要通dba_waiters等视图才能获得的信息,现在也可以直接从V$SESSION中得到了。既然这样,让我们好好研究V$SESSION视图中每个字段的含义。


        首先,请看官方文档上面关于V$SESSION字段的说明:


        v$session:This view has one row for every session connected to the database instance. The sessions include user sessions, as well as background processes like DBWR, LGWR, archiver.


        下面为每个字段的详细说明。


Column

Datatype

Description

SADDR

RAW(4 | 8)

Session address

SID

NUMBER

Session identifier

SERIAL#

NUMBER

Session serial number. Used to uniquely identify a session's objects. Guarantees that session-level commands are applied to the correct session objects if the session ends and another session begins with the same session ID.

AUDSID

NUMBER

Auditing session ID

PADDR

RAW(4 | 8)

Address of the process that owns the session

USER#

NUMBER

Oracle user identifier

USERNAME

VARCHAR2(30)

Oracle username

COMMAND

NUMBER

Command in progress (last statement parsed); for a list of values, see Table 7-5. These values also appear in the AUDIT_ACTIONS table.

OWNERID

NUMBER

The column contents are invalid if the value is 2147483644. Otherwise, this column contains the identifier of the user who owns the migratable session.

For operations using Parallel Slaves, interpret this value as a 4-byte value. The low-order 2 bytes of which represent the session number, and the high-order bytes the instance ID of the query coordinator.

TADDR

VARCHAR2(8)

Address of transaction state object

LOCKWAIT

VARCHAR2(8)

Address of lock waiting for; null if none

STATUS

VARCHAR2(8)

Status of the session:

·         ACTIVE - Session currently executing SQL

·         INACTIVE

·         KILLED - Session marked to be killed

·         CACHED - Session temporarily cached for use by Oracle*XA

·         SNIPED - Session inactive, waiting on the client

SERVER

VARCHAR2(9)

Server type (DEDICATED| SHARED| PSEUDO|NONE)

SCHEMA#

NUMBER

Schema user identifier

SCHEMANAME

VARCHAR2(30)

Schema user name

OSUSER

VARCHAR2(30)

Operating system client user name

PROCESS

VARCHAR2(12)

Operating system client process ID

MACHINE

VARCHAR2(64)

Operating system machine name

TERMINAL

VARCHAR2(30)

Operating system terminal name

PROGRAM

VARCHAR2(48)

Operating system program name

TYPE

VARCHAR2(10)

Session type

SQL_ADDRESS

RAW(4 | 8)

Used with SQL_HASH_VALUE to identify the SQL statement that is currently being executed

SQL_HASH_VALUE

NUMBER

Used with SQL_ADDRESS to identify the SQL statement that is currently being executed

SQL_ID

VARCHAR2(13)

SQL identifier of the SQL statement that is currently being executed

SQL_CHILD_NUMBER

NUMBER

Child number of the SQL statement that is currently being executed

PREV_SQL_ADDR

RAW(4 | 8)

Used with PREV_HASH_VALUE to identify the last SQL statement executed

PREV_HASH_VALUE

NUMBER

Used with SQL_HASH_VALUE to identify the last SQL statement executed

PREV_SQL_ID

VARCHAR2(13)

SQL identifier of the last SQL statement executed

PREV_CHILD_NUMBER

NUMBER

Child number of the last SQL statement executed

MODULE

VARCHAR2(48)

Name of the currently executing module as set by calling the DBMS_APPLICATION_INFO.SET_MODULE procedure

MODULE_HASH

NUMBER

Hash value of the above MODULE

ACTION

VARCHAR2(32)

Name of the currently executing action as set by calling the DBMS_APPLICATION_INFO.SET_ACTION procedure

ACTION_HASH

NUMBER

Hash value of the above action name

CLIENT_INFO

VARCHAR2(64)

Information set by the DBMS_APPLICATION_INFO.SET_CLIENT_INFO procedure

FIXED_TABLE_SEQUENCE

NUMBER

This contains a number that increases every time the session completes a call to the database and there has been an intervening select from a dynamic performance table. This column can be used by performance monitors to monitor statistics in the database. Each time the performance monitor looks at the database, it only needs to look at sessions that are currently active or have a higher value in this column than the highest value that the performance monitor saw the last time. All the other sessions have been idle since the last time the performance monitor looked at the database.

ROW_WAIT_OBJ#

NUMBER

Object ID for the table containing the row specified in ROW_WAIT_ROW#

ROW_WAIT_FILE#

NUMBER

Identifier for the datafile containing the row specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value ofROW_WAIT_OBJ# is not-1.

ROW_WAIT_BLOCK#

NUMBER

Identifier for the block containing the row specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value ofROW_WAIT_OBJ#

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值