Ai
1 Star 1 Fork 0

冯际成/Oracle_SQL_Scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
locks_dml_ddl_10g.sql 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
Abdul mohammed 提交于 2016-02-06 08:58 +08:00 . Fri Feb 5 18:58:16 CST 2016
-- | PURPOSE : Query all DML and DDL locks in the database. This script will |
-- | query critical information about the lock including Lock Type, |
-- | Object Name/Owner, OS/Oracle User and Wait time (in minutes). |
-- | NOTE : As with any code, ensure to test this script in a development |
-- | environment before attempting to run it in production. |
-- +----------------------------------------------------------------------------+
SET PAGESIZE 66
COLUMN Object FORMAT a30 HEADING 'Object'
COLUMN Type FORMAT a4 HEADING 'Type'
COLUMN UserID FORMAT a20 HEADING 'OS/Oracle'
COLUMN Hold FORMAT a10 HEADING 'Hold'
COLUMN Program FORMAT a35 HEADING 'Program'
COLUMN usercode FORMAT a12 HEADING 'SID/Serial#'
COLUMN WaitMin FORMAT 999,999 HEADING 'Wait Time (minutes)'
SELECT
a.osuser || ':' || a.username UserID
, a.sid || '/' || a.serial# usercode
, b.lock_type Type, b.mode_held Hold
, c.owner || '.' || c.object_name Object
, a.program Program
, d.seconds_in_wait WaitSec
FROM
v$session a
, dba_locks b
, sys.dba_objects c
, v$session_wait d
WHERE
a.sid = b.session_id
AND b.lock_type IN ('DML','DDL')
AND b.lock_id1 = c.object_id
AND b.session_id = d.sid
/
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sapall/Oracle_SQL_Scripts.git
git@gitee.com:sapall/Oracle_SQL_Scripts.git
sapall
Oracle_SQL_Scripts
Oracle_SQL_Scripts
master

搜索帮助