Home  >  Article  >  Database  >  oracle被锁定的记录解锁?

oracle被锁定的记录解锁?

WBOY
WBOYOriginal
2016-06-07 15:13:22891browse

Oracal数据库中的一个表的一条记录被锁定,既不能修改也不能删除(只看到沙漏,等一个小时都是这样),删除表对象也不行,报错: ORA_00054:资源正忙,要求指定NOWAIT 解决方法: 1、当前session中commit、rollback都可以解锁 2、在别的session中(DBA)通过

Oracal数据库中的一个表的一条记录被锁定,既不能修改也不能删除(只看到沙漏,等一个小时都是这样),删除表对象也不行,报错:  
  ORA_00054:资源正忙,要求指定NOWAIT  

 

 

解决方法:

1、当前session中commit、rollback都可以解锁  
  2、在别的session中(DBA)通过  
  查找用户锁  
  select   s.username,  
  decode(l.type,'TM','TABLE   LOCK',  
                              'TX','ROW   LOCK',  
                              NULL)   LOCK_LEVEL,  
  o.owner,o.object_name,o.object_type,  
  s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuser  
  from   v$session   s,v$lock   l,dba_objects   o  
  where   s.sid=l.sid  
  and   o.object_id=l.id1  
  and   s.username   is   not   null  
  检查出来谁锁了该表  
  查看结果中object_name='你的表名'  
  然后得到sid,serial#  
  alter   system   kill   session   'sid,   serial#'    
  or  
  alter   system   disconnect   session   'sid,   serial#'   immediate;  
  3、select   *   from   table   for   update   nowait可以指定nowait

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn