甲骨文更新挂起 [英] Oracle Update Hangs
问题描述
我在与Oracle更新的麻烦。到的ExecuteNonQuery呼叫挂下去。
I'm having trouble with an Oracle update. The call to ExecuteNonQuery hangs indefinitely.
在code:
using (OracleCommand cmd = new OracleCommand(dbData.SqlCommandStr, conn))
{
foreach (string colName in dbData.Values.Keys)
cmd.Parameters.Add(colName, dbData.Values[colName]);
cmd.CommandTimeout = txTimeout;
int nRowsAffected = cmd.ExecuteNonQuery();
}
的CommandTimeout被设置为5,并且所述参数被设定为小的整数值。
CommandTimeout is being set to 5, and the parameters are being set to small integer values.
查询:
UPDATE "BEN"."TABLE03" SET "COLUMN03"=:1,"COLUMN04"=:2 WHERE COLUMN05 > 0
该查询从sqlplus中运行速度快,通常从我的code跑得快,但每过一段时间就挂起,直到永远。
The query runs quickly from sqlplus, and normally runs fast from my code, but every once in a while it hangs forever.
我跑的v $ LOCKED_OBJECT查询,并有一个记录参照此表,但我认为这是未完成更新。
I ran a query on v$locked_object, and there's one record referring to this table, but I think that's the update that isn't completing.
有两件事情我想知道:什么可能导致更新挂
There are two things I would like to know: What might cause the update to hang?
更重要的是,为什么不是一个异常被抛出在这里?我希望呼叫等待5秒钟,然后超时。
More importantly, why isn't an exception being thrown here? I would expect the call to wait five seconds, and then timeout.
推荐答案
我在搜索结果撞到这是由于它的网页排名。
I'm bumping this due to its page rank in search results.
在我的情况,那是因为我曾执行在sqlplus查询,但我忘了提交。在这种情况下,它被作为文森特说:行被锁在另一个会话
In my case, it was because I had executed a query in SqlPlus, but I forgot to commit it. In this case, it was as Vincent stated: the row was locked in another session.
在提交SQLPLUS更新解决了问题。
Committing the SqlPlus update resolved the issue.
这篇关于甲骨文更新挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!