首页 > 代码库 > Oracle检查锁及其等待的行ROWID
Oracle检查锁及其等待的行ROWID
SELECT l.session_id sid ,
substr(o.owner,
1,
8) owner,
o.object_type object_type,
substr(o.object_name,
1,
18) object_name,
decode(l.locked_mode,
0,
‘None‘,
1,
‘Null‘,
2,
‘Row-S‘,
3,
‘Row-X‘,
4,
‘Share‘,
5,
‘S/Row-X‘,
6,
‘Exclusive‘) locked_mode,
l.oracle_username username,
l.os_user_name osuser,
to_char(s.logon_time,
‘YYYY/MM/DD HH24:MI:SS‘) logon_time,
decode(s.row_wait_obj#,
- 1,
NULL,
dbms_rowid.rowid_create( 1,
s.row_wait_obj#,
s.row_wait_file#,
s.row_wait_block#,
s.row_wait_row#)) row_id
FROM gv$locked_object l, --gv$locked_object
all_objects o,
gv$session s --gv$session
WHERE l.object_id = o.object_id
AND l.session_id = s.sid
--AND l.inst_id = s.inst_id
substr(o.owner,
1,
8) owner,
o.object_type object_type,
substr(o.object_name,
1,
18) object_name,
decode(l.locked_mode,
0,
‘None‘,
1,
‘Null‘,
2,
‘Row-S‘,
3,
‘Row-X‘,
4,
‘Share‘,
5,
‘S/Row-X‘,
6,
‘Exclusive‘) locked_mode,
l.oracle_username username,
l.os_user_name osuser,
to_char(s.logon_time,
‘YYYY/MM/DD HH24:MI:SS‘) logon_time,
decode(s.row_wait_obj#,
- 1,
NULL,
dbms_rowid.rowid_create( 1,
s.row_wait_obj#,
s.row_wait_file#,
s.row_wait_block#,
s.row_wait_row#)) row_id
FROM gv$locked_object l, --gv$locked_object
all_objects o,
gv$session s --gv$session
WHERE l.object_id = o.object_id
AND l.session_id = s.sid
--AND l.inst_id = s.inst_id
-- AND o.object_name = ‘LOCK_TEST‘;
--杀死session及进程
SELECT s.sid session_id,
p.spid os_process_id,
p.pid oracle_process_id,
‘alter system kill session ‘‘‘ || to_char(s.sid) || ‘,‘ || to_char(s.serial#) || ‘‘‘ immediate;‘ kill_db_session,
‘kill -9 ‘ || p.spid kill_os_session
FROM v$process p,
v$session s
WHERE p.addr = s.paddr
AND s.sid = &sid;
Oracle检查锁及其等待的行ROWID
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。