v$session的解釋

mengzhaoliang發表於2009-04-13

在本檢視中,每一個連線到資料庫例項中的session都擁有一條記錄。包括使用者session及後臺程式如DBWRLGWRarcchiver等等。

 

V$SESSION 中的常用列

V$SESSION 是基礎資訊檢視,用於找尋使用者SIDSADDR。不過,它也有一些列會動態的變化,可用於檢查使用者。如例:

 

欄位解釋:

欄位1SARRD: raw(4)Session Address,session的地址

欄位2SIDRAW(4):Session Identifier,session的識別符號

欄位3SERIAL# NUMBER

Session serial numberSession的序列號。 Used to identify uniquely 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

如果某個SID又被其它的session使用的話則此數值自增加(當一個 SESSION 結束,另一個SESSION開始並使用了同一個SID)

欄位4AUDSIDnumberAuditing session ID

審查session ID唯一性,確認它通常也用於當尋找並行查詢模式。

欄位5PARRDRAW(4):Address of the process that owns this session

這個session擁有的程式地址

 

 

欄位6USER#numberOracle user identified

Oracle使用者的識別符號

欄位7USERNAMEvarchar2(30):Oracle username,Oracle的使用者名稱

欄位8COMMAND:number:

Command in progress (last statement parsed); for a list of values, see Table 3-7

session 的命令所對應的sql對應數字值:預設為0

欄位8OWNERID 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 4Byte value. The low-order 2Bytes of which represent the session number, and the high-order bytes the instance ID of the query coordinator

欄位9TADDRVARCHAR2(8) Address of transaction state object 

事務狀態物件的地址

欄位10LOCKWAIT VARCHAR2(8) 
Address of lock waiting for; NULL if none 

鎖等待的地址,如果為空的話則沒有等待

 

 

欄位11STATUS VARCHAR2(8) 
Status of the session: ACTIVE (currently executing
), INACTIVE, KILLED (marked to be killed), CACHED (temporarily cached for use by Oracle*XA), SNIPED (session inactive, waiting on the client) 

這列用來判斷session狀態是:

Active :活動狀態,正執行SQL語句

Inactive :不活動狀態

Killed :被標註為刪除

CachedOracle中的臨時緩衝區使用

SNIPEDsession不活動,等待客戶端操作

欄位12SERVER VARCHAR2(9) 
Server type: DEDICATED, SHARED, PSEUDO, NONE 

使用連線資料庫伺服器的型別

DEDICATED:專用伺服器

SHARED:共享伺服器

PSEUDO

NONE

欄位13SCHEMA# NUMBER 
Schema user identifier 

Schema 使用者識別符號所對應的數字值

欄位14SCHEMANAME VARCHAR2(30) 
Schema user name 

Schema的使用者名稱

欄位15OSUSER VARCHAR2(15) 
Operating system client user name 

客戶端作業系統的使用者名稱

 

 

欄位16PROCESS 
VARCHAR2(9) 
Operating system client process ID 

客戶端作業系統的程式ID(識別符號)

欄位17MACHINE 
VARCHAR2(64) 
Operating system machine name 

連線資料庫的客戶端作業系統的機器名稱

欄位18TERMINAL 
VARCHAR2(10) 
Operating system terminal name 

連線資料庫的客戶端作業系統的終端名稱

欄位19PROGRAM 
VARCHAR2(48) 
Operating system program name 

連線資料庫的客戶端作業系統的程式名稱

欄位20TYPE 
VARCHAR2(10) 
Session type 

Session的型別

 

 

欄位21SQL_ADDRESS 
RAW(4) 
Used with SQL_HASH_VALUE to identify the SQL statement that is currently being executed 

當前正在執行的SQL語句的SQL_HASH_VALUE

 

欄位22SQL_HASH_VALUE 
NUMBER 
Used with SQL_ADDRESS to identify the SQL statement that is currently being executed 

當前正在執行的SQL語句的SQL_ADDRESS

SQL_HASH_VALUE SQL_ADDRESS:這兩列用於鑑別預設被session執行的SQL語句。如果為null0,那就說明這個session沒有執行任何SQL語句。PREV_HASH_VALUEPREV_ADDRESS兩列用來鑑別被session執行的上一條語句。

欄位23SQL_ID

VARCHAR2(13)

SQL identifier of the SQL statement that is currently being executed

正在執行的SQL語句的識別符號

欄位24SQL_CHILD_NUMBER

number

Child number of the SQL statement that is currently being executed

欄位25PREV_SQL_ADDR

raw4

Used with PREV_HASH_VALUE to identify the last SQL statement executed

 

 

欄位26PREV_HASH_VALUE

Number

Used with SQL_HASH_VALUE to identify the last SQL statement executed

欄位27PREV_SQL_ID

Varchar213

SQL identifier of the last SQL statement executed

Table 7-5 COMMAND Column of V$SESSION and Corresponding Commands

Number Command Number Command

1

CREATE TABLE

2

INSERT

3

SELECT

4

CREATE CLUSTER

5

ALTER CLUSTER

6

UPDATE

7

DELETE

8

DROP CLUSTER

9

CREATE INDEX

10

DROP INDEX

11

ALTER INDEX

12

DROP TABLE

13

CREATE SEQUENCE

14

ALTER SEQUENCE

15

ALTER TABLE

16

DROP SEQUENCE

17

GRANT OBJECT

18

REVOKE OBJECT

19

CREATE SYNONYM

20

DROP SYNONYM

21

CREATE VIEW

22

DROP VIEW

23

VALIDATE INDEX

24

CREATE PROCEDURE

25

ALTER PROCEDURE

26

LOCK

27

NO-OP

28

RENAME

29

COMMENT

30

AUDIT OBJECT

31

NOAUDIT OBJECT

32

CREATE DATABASE LINK

33

DROP DATABASE LINK

34

CREATE DATABASE

35

ALTER DATABASE

36

CREATE ROLLBACK SEG

37

ALTER ROLLBACK SEG

38

DROP ROLLBACK SEG

39

CREATE TABLESPACE

40

ALTER TABLESPACE

41

DROP TABLESPACE

42

ALTER SESSION

43

ALTER USER

44

COMMIT

45

ROLLBACK

46

SAVEPOINT

47

PL/SQL EXECUTE

48

SET TRANSACTION

49

ALTER SYSTEM

50

EXPLAIN

51

CREATE USER

52

CREATE ROLE

53

DROP USER

54

DROP ROLE

55

SET ROLE

56

CREATE SCHEMA

57

CREATE CONTROL FILE

59

CREATE TRIGGER

60

ALTER TRIGGER

61

DROP TRIGGER

62

ANALYZE TABLE

63

ANALYZE INDEX

64

ANALYZE CLUSTER

65

CREATE PROFILE

66

DROP PROFILE

67

ALTER PROFILE

68

DROP PROCEDURE

70

ALTER RESOURCE COST

71

CREATE MATERIALIZED VIEW LOG

72

ALTER MATERIALIZED VIEW LOG

73

DROP MATERIALIZED VIEW LOG

74

CREATE MATERIALIZED VIEW

75

ALTER MATERIALIZED VIEW

76

DROP MATERIALIZED VIEW

77

CREATE TYPE

78

DROP TYPE

79

ALTER ROLE

80

ALTER TYPE

81

CREATE TYPE BODY

82

ALTER TYPE BODY

83

DROP TYPE BODY

84

DROP LIBRARY

85

TRUNCATE TABLE

86

TRUNCATE CLUSTER

91

CREATE FUNCTION

92

ALTER FUNCTION

93

DROP FUNCTION

94

CREATE PACKAGE

95

ALTER PACKAGE

96

DROP PACKAGE

97

CREATE PACKAGE BODY

98

ALTER PACKAGE BODY

99

DROP PACKAGE BODY

100

LOGON

101

LOGOFF

102

LOGOFF BY CLEANUP

103

SESSION REC

104

SYSTEM AUDIT

105

SYSTEM NOAUDIT

106

AUDIT DEFAULT

107

NOAUDIT DEFAULT

108

SYSTEM GRANT

109

SYSTEM REVOKE

110

CREATE PUBLIC SYNONYM

111

DROP PUBLIC SYNONYM

112

CREATE PUBLIC DATABASE LINK

113

DROP PUBLIC DATABASE LINK

114

GRANT ROLE

115

REVOKE ROLE

116

EXECUTE PROCEDURE

117

USER COMMENT

118

ENABLE TRIGGER

119

DISABLE TRIGGER

120

ENABLE ALL TRIGGERS

121

DISABLE ALL TRIGGERS

122

NETWORK ERROR

123

EXECUTE TYPE

157

CREATE DIRECTORY

158

DROP DIRECTORY

159

CREATE LIBRARY

160

CREATE JAVA

161

ALTER JAVA

162

DROP JAVA

163

CREATE OPERATOR

164

CREATE INDEXTYPE

165

DROP INDEXTYPE

167

DROP OPERATOR

168

ASSOCIATE STATISTICS

169

DISASSOCIATE STATISTICS

170

CALL METHOD

171

CREATE SUMMARY

172

ALTER SUMMARY

173

DROP SUMMARY

174

CREATE DIMENSION

175

ALTER DIMENSION

176

DROP DIMENSION

177

CREATE CONTEXT

178

DROP CONTEXT

179

ALTER OUTLINE

180

CREATE OUTLINE

181

DROP OUTLINE

182

UPDATE INDEXES

183

ALTER OPERATOR

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12778571/viewspace-588832/,如需轉載,請註明出處,否則將追究法律責任。

相關文章