查看被锁的数据[Z]

SELECT LOCK_INFO.OWNER || ‘.‘ || LOCK_INFO.OBJ_NAME AS OBJ_NAME --对象名称(已经被锁住)
      ,LOCK_INFO.SUBOBJ_NAME AS SUBOBJ_NAME --子对象名称(已经被锁住)
      ,SESS_INFO.MACHINE AS MACHINE --机器名称
      ,LOCK_INFO.SESSION_ID AS SESSION_ID --会话SESSION_ID
      ,SESS_INFO.SERIAL# AS SERIAL# --会话SERIAL#
      ,LOCK_INFO.ORA_USERNAME AS ORA_USERNAME --ORACLE系统用户名称
      ,LOCK_INFO.OS_USERNAME AS OS_USERNAME --操作系统用户名称
      ,LOCK_INFO.PROCESS AS PROCESS --进程编号
      ,LOCK_INFO.OBJ_ID AS OBJ_ID --对象ID
      ,LOCK_INFO.OBJ_TYPE AS OBJ_TYPE --对象类型
      ,SESS_INFO.LOGON_TIME AS LOGON_TIME --登录时间
      ,SESS_INFO.PROGRAM AS PROGRAM --程序名称
      ,SESS_INFO.STATUS AS STATUS --会话状态
      ,SESS_INFO.LOCKWAIT AS LOCKWAIT --等待锁
      ,SESS_INFO.ACTION AS ACTION --动作
      ,SESS_INFO.CLIENT_INFO AS CLIENT_INFO --客户信息
  FROM (SELECT obj.OWNER                AS OWNER
              ,obj.OBJECT_NAME          AS OBJ_NAME
              ,obj.SUBOBJECT_NAME       AS SUBOBJ_NAME
              ,obj.OBJECT_ID            AS OBJ_ID
              ,obj.OBJECT_TYPE          AS OBJ_TYPE
              ,lock_obj.SESSION_ID      AS SESSION_ID
              ,lock_obj.ORACLE_USERNAME AS ORA_USERNAME
              ,lock_obj.OS_USER_NAME    AS OS_USERNAME
              ,lock_obj.PROCESS         AS PROCESS
          FROM (SELECT *
                  FROM all_objects
                 WHERE object_id IN (SELECT object_id FROM v$locked_object)) obj
              ,v$locked_object lock_obj
         WHERE obj.object_id = lock_obj.object_id) LOCK_INFO
      ,(SELECT SID
              ,SERIAL#
              ,LOCKWAIT
              ,STATUS
              ,PROGRAM
              ,ACTION
              ,CLIENT_INFO
              ,LOGON_TIME
              ,MACHINE
          FROM v$session) SESS_INFO
 WHERE LOCK_INFO.SESSION_ID = SESS_INFO.SID;

查看被锁的数据

时间: 2024-10-06 19:18:08

查看被锁的数据[Z]的相关文章

sql数据库表复制、查看是否锁表

1.不同数据库之间复制表的数据的方法: 当表目标表存在时: insert into 目的数据库..表 select * from 源数据库..表 当目标表不存在时: select * into 目的数据库..表 from 源数据库..表 2. 查看是否锁表 show OPEN TABLES where In_use > 0;

oracle查看被锁的表和解锁

--以下几个为相关表SELECT * FROM v$lock;SELECT * FROM v$sqlarea;SELECT * FROM v$session;SELECT * FROM v$process ;SELECT * FROM v$locked_object;SELECT * FROM all_objects;SELECT * FROM v$session_wait; --查看被锁的表select b.owner,b.object_name,a.session_id,a.locked_m

Log Explorer 查看和恢复数据库数据

[转自:作者出处:Ronli (Http://Ronli.cnblogs.com/)] [Log Explorer]查看和恢复数据库数据 使用Log Explorer查看和恢复数据 Log Explorer 4.1.可用于SQL Server2005的日志查看工具 使用方法: 打开Log Explorer -> Attach Log File -> 选择SQL Server服务器和登陆方式 -> Connect -> 在Database Name中选择数据库 -> Attac

oracle查看被锁的表和被锁的进程,杀掉进程

-- 1. 查看被锁的表 SELECT p.spid, a.serial#, c.object_name, b.session_id, b.oracle_username,b.os_user_name FROM v$process p, v$session a, v$locked_object b, all_objects c WHERE p.addr = a.paddr AND a.process = b.process AND c.object_id = b.object_id -- 2.

查看Mysql锁表语句

大早上的刷数据,大量的改表结构alter语句,就把表锁了. 数据库的使用过程中可能遇到锁表的情况,导致其他进程访问同样的表时出现超时的情况,如果是生产还会看到大量的pool 跪了,如果你在刷sql,你应该立即就会明白什么情况了. show full processlist; 显示哪些线程正在运行,查看锁表语句等: 锁表的情况如上图:waiting for table metadata lock,如果不是和其他事物冲突的情况下,它会自己好,也可以停掉自己刷的sql它就会释放锁,和其他事物冲突的情况

SqlServer 查看被锁的表和解除被锁的表

查看被锁的表 select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type='OBJECT' 解除被锁的表 declare @spid int Set @spid = 74 --锁表进程 declare @sql varchar(1000) set @sql='kill '+cast(@spid as va

MVC5 + EF6 + Bootstrap3 (13) 查看详情、编辑数据、删除数据

Slark.NET-博客园 http://www.cnblogs.com/slark/p/mvc5-ef6-bs3-get-started-rud.html 系列教程:MVC5 + EF6 + Bootstrap3 上一节:MVC5 + EF6 + Bootstrap3 (12) 新建数据 源码下载:点我下载 目录 前言 添加链接 查看详情 编辑数据 删除数据 结尾 前言 所谓万事开头难,前面用两节介绍了查询页面,一节介绍了创建数据.由于前面做了大量的铺垫,本节就能顺利的将查看详情.编辑数据.删

zbb20170816 oracle Oracle 查看表空间、数据文件的大小及使用情况sql语句

oracle Oracle 查看表空间.数据文件的大小及使用情况sql语句 --表空间 --1G=1024MB --1M=1024KB --1K=1024Bytes --1M=11048576Bytes --1G=1024*11048576Bytes=11313741824Bytes SELECT a.tablespace_name "表空间名", total "表空间大小", free "表空间剩余大小", (total - free) &qu

170308、oracle查看被锁的表和解锁

--以下几个为相关表SELECT * FROM v$lock;SELECT * FROM v$sqlarea;SELECT * FROM v$session;SELECT * FROM v$process ;SELECT * FROM v$locked_object;SELECT * FROM all_objects;SELECT * FROM v$session_wait; --查看被锁的表 select b.owner,b.object_name,a.session_id,a.locked_