------誰正在訪問數據庫?
Select c.sid, c.serial#,c.username,a.object_id,b.object_name,
c.program,c.status,d.name,c.osuser
from v$Locked_object a,
All_objects b,
v$session c,
audit_actions d
where a.object_id=b.object_id
and a.session_id =c.sid(+)
and c.command=d.action;
alter system kill session ’&1,&2’;
Select a.sid,a.serial#,a.username,a.status,a.program,b.name,a.osuser
from v$session a,audit_actions b
where a.command=b.action
And username=’&1’;
------誰被鎖住?
Select a.sid,a.serial#,a.username,A.LOCKWAIT,a.status,a.program,b.name
from v$session a,audit_actions b
where a.command=b.action
AND LOCKWAIT IS NOT NULL;
------誰在鎖表?
Select a.sid,a.serial#,a.username,A.LOCKWAIT,a.status,a.program,b.name
from v$session a,audit_actions b
where a.command=b.action
AND STATUS=’ACTIVE’;
Select sid, serial#, object_name, row_wait_block#,
row_wait_row#, row_wait_file#
from all_objects, v$session
where row_wait_obj#=object_id and type=’USER’
and lockwait is not null ;
Select sl.username, sl.sid, sl.serial#
from v_$lock l1, v$session s1
where exists (select * from v_$lock l2, v$session s2
where l2.sid=s2.sid and l2.id1=l1&nbs