开发者

DB synchronisation behavior

开发者 https://www.devze.com 2023-03-22 12:57 出处:网络
I have a oracle database. I use the OracleDataAdapter(Oracle.DataAccess.dll) for select, up开发者_如何转开发date, insert, delete operations. I don\'t set any (table) locks on my own(I only start a tra

I have a oracle database. I use the OracleDataAdapter(Oracle.DataAccess.dll) for select, up开发者_如何转开发date, insert, delete operations. I don't set any (table) locks on my own(I only start a transaction). I have a oracle table named "test" with the entry "test1".

Now my question:

Can Person A read the entry "test1" while Person B is updating/deleting the entry at the exact same time?

What happens in the worst case? An old match/empty match or can it cause any kind of exception/error(e.g. "TableLocked-Exception")?

Thank you


In Oracle, readers do not block writers. So one session can read a row at the same time that another session is updating or deleting that row. The reader will see the row as it existed at the system change number (SCN) that the query began.

The only time that there would be blocking would be if two sessions were both attempting to update or delete the same row at the same time. That would not generally generate any exceptions. Instead, whichever session was waiting on the lock would simply block until the holding session released the lock by ending its transaction. You could get an exception if you specify a timeout to wait for a lock or if Oracle detects that your code has deadlocked and has to kill one of the deadlocking sessions in order to resolve the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消