当前位置:Gxlcms > 数据库问题 > Oracle锁表及解锁

Oracle锁表及解锁

时间:2021-07-01 10:21:17 帮助过:6人阅读

lock table 表名 in <share or share update or exclusive mode>

共有三种锁表模式:

     共享模式(in share mode)

     共享更新模式(in share update mode)

     排他锁模式(in exclusive mode)

锁表实例:
//以排他锁模式锁定tRun表
lock table tRun in exclusive mode

 

2,查看某个表被锁定

查看被锁定的表:
select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b 
where b.object_id = a.object_id

 

3,查询sid及serial#

查询sid及serial#
select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b 
where a.session_id = b.sid order by b.logon_time

 

4,删除锁

删除锁表:
//其中,159为sid;107为serial#
alter system kill session 159,107

 

Oracle锁表及解锁

标签:

人气教程排行