首页 > 代码库 > oracle遇到的锁异常,oralce record is locked by another user

oracle遇到的锁异常,oralce record is locked by another user

由于我在前不久的一次项目调试的时候,将一条数据的ID与另一条数据的ID相同了,但不知为什么没有报错,当在页面发现问题时,删除这条数据时就报错了,oralce record is locked by another user

 将锁图标打开也不行,于是找了网上很多解决方式,但说得都不尽详细,最后自己根据其他人的写法,最终将错误数据成功删除
 
 
 
 
 
 
 
 
 
 
 
select session_id from v$locked_object;SELECT sid, serial#, username, osuser FROM v$session where sid = 131;ALTER SYSTEM KILL SESSION 131,498;

这是我当时的SQL代码

实际根据

select session_id from v$locked_object;SELECT sid, serial#, username, osuser FROM v$session where sid = session_id;ALTER SYSTEM KILL SESSION sid,serial#;

在从另一个数据库导入表时,有时候两张表的数据字段并不一致相等,需要有其他的做法,我的做法是

insert into DM.DM_MAT_AUX_PLAN_REC(select SYS_GUID(),I_YEAR,I_MONTH,PLANTCODE,‘‘,DEPARTCODE,‘‘,MAT_NO,MAT_DESC,UNIT,F_PRICE,F_NUMBER,INSERTDATE,RECFLAG from NAMM.mm_plan_fc_rec);select distinct COM_CODE_,COM_NAME_ from DM.DM_MAT_AUX_PLAN_RECupdate DM.DM_MAT_AUX_PLAN_REC set COM_NAME_ = (select ORG_NAME_ from OM.om_org where ORG_CODE_ = 6) where COM_CODE_ = 6select distinct DEPT_CODE_,DEPT_NAME_ from DM.DM_MAT_AUX_PLAN_RECupdate DM.DM_MAT_AUX_PLAN_REC set DEPT_NAME_ = (select ORG_NAME_ from OM.om_org where ORG_CODE_ = 605) where DEPT_CODE_ = 605

对于空缺的再去重逐个导入

oracle遇到的锁异常,oralce record is locked by another user