Oracle中V$SESSION等各表的字段解释,Oracle官方解释
一、常用的视图
1.会话相关视图
View | Description |
---|---|
|
Contains information about the currently active processes |
|
Lists session information for each current session |
|
Contains I/O statistics for each user session |
|
Displays the status of various operations that run for longer than 6 seconds (in absolute time). These operations currently include many backup and recovery functions, statistics gathering, and query execution. More operations are added for every Oracle Database release. |
|
Displays the current or last wait for each session |
|
Lists the last ten wait events for each active session |
|
Displays information about blocked sessions |
|
Contains session statistics |
|
Provides information about current and maximum global resource utilization for some system resources |
|
Contains statistics about shared SQL areas. Contains one row for each SQL string. Provides statistics about SQL statements that are in memory, parsed, and ready for execution |
2.锁相关的视图:
View Description Lists the locks currently held by Oracle Database and outstanding requests for a lock or latch
Displays a session if it is holding a lock on an object for which another session is waiting
Displays a session if it is waiting for a locked object
Lists all DDL locks held in the database and all outstanding requests for a DDL lock
Lists all DML locks held in the database and all outstanding requests for a DML lock
Lists all locks or latches held in the database and all outstanding requests for a lock or latch
Displays a row for each lock or latch that is being held, and one row for each outstanding request for a lock or latch
Lists all locks acquired by every transaction on the system
Lists the resources or events for which active sessions are waiting
Contains session statistics
Provides information about current and maximum global resource utilization for some system resources
Contains statistics about shared SQL area and contains one row for each SQL string. Also provides statistics about SQL statements that are in memory, parsed, and ready for execution
Contains statistics for nonparent latches and summary statistics for parent latches
二、V$SESSION
三、V$SESSION_WAIT
这里面有个event字段,event字段的枚举值可以存在下面的表中,可以这样查询:
SELECT name, wait_class FROM V$EVENT_NAME ORDER BY name
1. 查询会话正在等待行锁的会话:
select event,sid,p1,p2,p3 from v$session_wait where event='enq: TX - row lock contention';
三、V$LOCKED_OBJECT
1.简介及表字段
该表列出每个事务获取到的所有锁。它可以展示出哪个会话正在持有锁,在什么对象上持有锁,以及锁的模式。
Column Datatype Description
XIDUSN
NUMBER
Undo segment number
XIDSLOT
NUMBER
Slot number
XIDSQN
NUMBER
Sequence number
OBJECT_ID
NUMBER
Object ID being locked
SESSION_ID
NUMBER
Session ID
ORACLE_USERNAME
VARCHAR2(128)
Oracle user name
OS_USER_NAME
VARCHAR2(128)
Operating system user name
PROCESS
VARCHAR2(24)
Operating system process ID
LOCKED_MODE
NUMBER
Lock mode. The numeric values for this column map to these text values for the lock modes for table locks:
0
- NONE: lock requested but not yet obtained
1
- NULL
2
- ROWS_S (SS): Row Share Lock
3
- ROW_X (SX): Row Exclusive Table Lock
4
- SHARE (S): Share Table Lock
5
- S/ROW-X (SSX): Share Row Exclusive Table Lock
6
- Exclusive (X): Exclusive Table LockSee Also: Oracle Database Concepts for more information about lock modes for table locks
CON_ID
NUMBER
The ID of the container to which the data pertains. Possible values include:
0
: This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs.
1
: This value is used for rows containing data that pertain to only the rootn: Where n is the applicable container ID for the rows containing data
2.查询持有锁的会话
SELECT USERNAME, LOCKWAIT, STATUS, MACHINE, PROGRAM FROM V$SESSION WHERE SID IN (SELECT SESSION_ID FROM V$LOCKED_OBJECT);
3.查询持有锁的会话正在执行的sql
SELECT
SQL_TEXT
FROM
V$SQL
WHERE
HASH_VALUE IN (
SELECT
SQL_HASH_VALUE
FROM
V$SESSION
WHERE
SID IN (
SELECT
SESSION_ID
FROM
V$LOCKED_OBJECT
)
);
4.根据对象名查询持有该锁对象的会话
SELECT o.object_name,s.sid, s.serial#
FROM v$locked_object l, dba_objects o, v$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid AND o.object_name='SEATINFORMATION';
SEATINFORMATION为本地表的名字。
5.根据对象名查询持有该锁对象的会话及sql
SELECT o.object_name,s.sid, s.serial#,s.SQL_HASH_VALUE,v.*
FROM v$locked_object l, dba_objects o, v$session s, V$SQL v
WHERE l.object_id = o.object_id
AND l.session_id = s.sid and s.SQL_HASH_VALUE = v.HASH_VALUE AND o.object_name='INCIDENTINFORMATION';
四、V$LOCK
1.简介
该视图列出当前被oracle持有的锁。
Column Datatype Description
ADDR
RAW(4 | 8)
Address of lock state object
KADDR
RAW(4 | 8)
Address of lock
SID
NUMBER
Identifier for session holding or acquiring the lock
TYPE
VARCHAR2(2)
Type of user or system lock
The locks on the user types are obtained by user applications. Any process that is blocking others is likely to be holding one of these locks. The user type locks are:
TM
- DML enqueue
TX
- Transaction enqueue
UL
- User suppliedThe system type locks are listed in Table 8-1. Be aware that not all types of locks are documented. To find a complete list of locks for the current release, query the
V$LOCK_TYPE
data dictionary view, described on "V$LOCK_TYPE".-- 我们主要关注TX 和TM 两种类型的锁
--UL 锁用户自己定义的,一般很少会定义,基本不用关注
ID1
NUMBER
Lock identifier #1 (depends on type)
ID2
NUMBER
Lock identifier #2 (depends on type)
--- 当lock type 为TM 时,id1 为DML-locked object 的object_id
--- 当lock type 为TX 时,id1 为usn+slot ,而id2 为seq 。
-- 当lock type 为其它时,不用关注
LMODE
NUMBER
Lock mode in which the session holds the lock:
0
- none
1
- null (NULL)
2
- row-S (SS)
3
- row-X (SX)
4
- share (S)
5
- S/Row-X (SSX)
6
- exclusive (X)--大于0时表示 当前会话以某种模式 占有 该锁,等于0时表示当前会话正在等待该锁资源,即表示该会话被阻塞。
--大于0时表示 当前会话以某种模式 占有 该锁,等于0时表示当前会话正在等待该锁资源,即表示该会话被阻塞。
往往在发生TX 锁时,伴随着TM 锁,比如一个sid=9 会话拥有一个TM 锁,一般会拥有一个或几个TX锁,但他们的id1 和id2 是不同的,请注意
REQUEST
NUMBER
Lock mode in which the process requests the lock:
0
- none
1
- null (NULL)
2
- row-S (SS)
3
- row-X (SX)
4
- share (S)
5
- S/Row-X (SSX)
6
- exclusive (X)-- 大于0时,表示当前会话被阻塞,其它会话占有该锁的模式
CTIME
NUMBER
Time since current mode was granted
BLOCK
NUMBER
Indicates whether the lock in question is blocking other processes. The possible values are:
0
- The lock is not blocking any other processes
1
- The lock is blocking other processes
2
- The lock is not blocking any blocked processes on the local node, but it may or may not be blocking processes on remote nodes. This value is used only in Oracle Real Application Clusters (Oracle RAC) configurations (not in single instance configurations).
CON_ID
NUMBER
The ID of the container to which the data pertains. Possible values include:
0
: This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs.
1
: This value is used for rows containing data that pertain to only the rootn: Where n is the applicable container ID for the rows containing data
2.一个本地的死锁案例:
从oracle服务器的trace日志中看到:
会话432和会话188互相等待。
以下是相关信息:
2.1 会话432的持有的锁,被锁的对象,正在执行的sql:
SELECT * FROM V$LOCK l where l.sid = ;
https://logicalread.com/diagnosing-oracle-wait-for-tx-enqueue-mode-6-mc01/#.XBUGJM7_zIU
Oracle中V$SESSION等各表的字段解释,Oracle官方解释的更多相关文章
- Oracle 中 根据值 查询 所在 表和字段
-------------------- -- 这里是查询 数字型字段值 /*declare CURSOR cur_query IS select table_name, column_name, d ...
- Oracle中Kill session的研究(转 出自eagle)
itpub link: http://www.itpub.net/235873.html 我们知道,在Oracle数据库中,可以通过kill session的方式来终止一个进程,其基本语法结构为: a ...
- ORACLE 中KILL session
我们知道,在Oracle数据库中,可以通过kill session的方式来终止一个进程,其基本语法结构为: alter system kill session 'sid,serial#' ; 被kil ...
- Oracle中使用游标转换数据表中指定字段内容格式(拼音转数字)
应用场景:将数据表TB_USER中字段NNDP的内容中为[sannanyinv]转换为[3男1女] 主要脚本:一个游标脚本+分割字符串函数+拼音转数字脚本 操作步骤如下: 1.创建类型 create ...
- 恢复oracle中误删除drop掉的表 闪回的方法
恢复oracle中误删除drop掉的表 查看回收站中表 --需要在其所在用户下查询 回收站对象 select object_name,original_name,partition_name,ty ...
- ORACLE中如何找出大表分布在哪些数据文件中?
ORACLE中如何找出大表分布在哪些数据文件中? 在ORACLE数据中,我们能否找出一个大表的段对象分布在哪些数据文件中呢? 答案是可以,我们可以用下面脚本来找出对应表的区.段分别位于哪些数据文件 ...
- oracle中的rowid--伪列-删除表中的重复内容-实用
1.rowid是一个伪列,是用来确保表中行的唯一性,它并不能指示出行的物理位置,但可以用来定位行. 2.rowid是存储在索引中的一组既定的值(当行确定后).我们可以像表中普通的列一样将它选出来. 3 ...
- ASP.NET MVC中使用Session来保持表单的状态
本篇实践在ASP.NET MVC 4下使用Session来保持表单的状态. 本篇的源码在这里: https://github.com/darrenji/KeepFormStateUsingSessio ...
- Oracle中创建千万级大表归纳
从一月至今,我总共归纳了三种创建千万级大表的方案,它们是: 下面是这三种方案的对比表格: # 名称 地址 主要机制 速度 1 在Oracle中十分钟内创建一张千万级别的表 https://www.cn ...
随机推荐
- Python爬虫学习——获取网页
通过GET请求获取返回的网页,其中加入了User-agent信息,不然会抛出"HTTP Error 403: Forbidden"异常, 因为有些网站为了防止这种没有User-ag ...
- MySql数据库恢复(*frm)文件
mysql数据库恢复(*frm)文件 WorkBench 在使用虚拟服务器时,服务器提供商一般不会像我们使用本地数据库一样:使用导入导出(这样的文件后缀是*.sql).大部分时候提供的是一个文件夹,里 ...
- cordova ios and ios8
ios8发布后,一些用cordova编写的app会碰到问题,总的来说,cordova官方称是完全支持ios8的,而且由于ios8推出的WKWebView存在问题并没能很好的解决(看原文),仍旧用了UI ...
- kafka学习之-集群配置及安装
1.软件版本 kafka2.10_0.9.0.0 zookeeper_3.4.6 2.集群节点 一共有3台机器. 192.168.14.100 slave-01 192.168.14.105 slav ...
- 文字描边css
-webkit-text-stroke: 3.3px #2A75BF; -webkit-text-fill-color:#fff; 该方法在安卓端貌似不支持,显示为一团 或: -webkit-text ...
- 页面加载中jquery逐渐消失效果实现
为了获得更好的用户体验,现在大多数网页都会在页面中加一个加载中效果,这里实现一个加载中逐渐消失的效果,以至于看上去不那么生硬. html: <div id="loading" ...
- 适用于Win8的Office2003_SP3精简版集成各类补丁+兼容包
适用于Win8的Office2003_SP3精简版集成各类补丁+兼容包软件名称: Office 软件版本: Office2003_SP3 软件大小: 104M 软件语言: 简体中文 软件授权: 破解 ...
- @PropertySource加载文件的两种用法以及配置文件加载顺序
第一种: 现在我把资源文件的路径放在application.properties里 config.path=/home/myservice/config.properties @PropertySou ...
- C 修改命令行文本颜色
#include <Windows.h> #include <stdio.h> int main() { HANDLE h = GetStdHandle(STD_OUTPUT_ ...
- vmware centos7系统虚拟机复制到其他电脑后不能联网问题解决
虚拟机复制到别的电脑后,无法联网 使用ifconfig命令,没有显示出IP4的网址信息(显示ens33文件配置信息) 在网上查看相关资料,大部分说是mac地址不一致导致 如果配置了mac地址,那么在/ ...