SELECT object_name, machine, s.sid, s.serial#
FROM gv$locked_object l, dba_objects o, gv$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid;
--释放SESSION SQL:
--alter system kill session 'sid, serial#';
ALTER system kill session '70, 4397';
select
A.OWNER "用户名称",
c.TABLE_NAME "主键表",
d.COLUMN_NAME "主键字段",
B.R_CONSTRAINT_NAME "主键约束",
a.TABLE_NAME "外键表",
a.COLUMN_NAME "外键字段",
A.constraint_name "外键约束"
from user_cons_columns a,user_constraints b,user_constraints C,user_cons_columns D
where a.constraint_name = b.constraint_name
and B.constraint_type = 'R'
And B.R_CONSTRAINT_NAME=C.CONSTRAINT_NAME
And C.constraint_type = 'P'
And C.constraint_name =D.constraint_name
order by "用户名称","主键表","主键字段","主键约束","外键表","外键字段","外键约束"