ORA-00604 error while batch insertion inside TransactionScope

六月ゝ 毕业季﹏ 提交于 2020-01-06 20:08:42

问题


I am trying to batch insert 100k+ items to my Oracle db using ADO.NET inside a TransactionScope. Like this:

using (TransactionScope transaction = new TransactionScope())
{
    while(/* Pagination logic - send insertion command on every 250 items */)
    {
        using (OracleCommand command = new OracleCommand(query, connection))
        {
            command.ArrayBindCount = 250;

            //Add parameters
            command.Parameters.Add(":BLAH", OracleDbType.Long);
            command.Parameters[0].Value = LUC.ToArray();

            command.ExecuteNonQuery(); //Error occurs here after N-times inside while
        }
    }
    transaction.Complete();
}

For items lower than this (10k-30k) transaction is completed successfully. However for higher items (like 100k) I get ORA-00604: error occurred at recursive SQL level %s.

If I remove TransactionScope altogether, I don't get any error with any item size, it just works.

How can I make TransactionScope work with huge number of items?


回答1:


Turns out, it was a transactional timeout problem.

After I increased the timeout, I have inserted my list successfully:

using (TransactionScope transaction = 
         new TransactionScope(TransactionScopeOption.Required, 
                 new TimeSpan(0, 30, 0))) //30 minute timeout limit


来源:https://stackoverflow.com/questions/33517597/ora-00604-error-while-batch-insertion-inside-transactionscope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!