plsql锁表解决办法

1、执行以下语句可查询被锁的表

  1. select b.owner,b.object_name,a.session_id,a.locked_mode
  2. from v$locked_object a,dba_objects b
  3. where b.object_id = a.object_id;

2、执行以下语句可查询被锁的session和serial

  1. select b.username,b.sid,b.serial#,logon_time
  2. from v$locked_object a,v$session b
  3. where a.session_id = b.sid order by b.logon_time;

3、删除锁住的session和serial

如果执行第三步的时候没有权限,执行以下语句为数据库增加修改权限后在执行第三步的删除

  1. alter system kill session '5732,8215';