oracle检测到死锁后,能先对一个事务commit而不是rollback?

[复制链接]
查看11 | 回复4 | 2006-11-25 16:02:41 | 显示全部楼层 |阅读模式
10g的文档里面:
A deadlock is a special example of a lock conflict. Deadlocks arise when two or more sessions wait for data locked by each other. Because each is waiting for the other, neither can complete their transaction to resolve the conflict.
The Oracle database automatically detects deadlocks and terminates the statement with an error. The proper response to that error is either commit or rollback, which releases any other locks in that session so that the other session can continue its transaction.
In the example in the slide, Transaction 1 must either commit or roll back in response to the deadlock detected error. If it commits, it would need to resubmit the second update to complete its transaction. If it performs a rollback, it must resubmit both statements to accomplish its transaction.

这个commit如何实现的?以前一直理解为先rollback一事务
回复

使用道具 举报

千问 | 2006-11-25 16:02:41 | 显示全部楼层
我理解也是此种狀況應該是rollback動作。
如commit動作,可能會產生邏輯上的不一緻狀況。最典型的例子是,銀行存取款作業 !
回复

使用道具 举报

千问 | 2006-11-25 16:02:41 | 显示全部楼层
这是10g ocp教材上原话。。。。。。。。。。
回复

使用道具 举报

千问 | 2006-11-25 16:02:41 | 显示全部楼层
不应该是commit;
然后再看看concepts里面的原话;
Deadlock Detection
Oracle automatically detects deadlock situations and resolves them by rolling back one of the statements involved in the deadlock, thereby releasing one set of the conflicting row locks. A corresponding message also is returned to the transaction that undergoes statement-level rollback. The statement rolled back is the one belonging to the transaction that detects the deadlock. Usually, the signalled transaction should be rolled back explicitly, but it can retry the rolled-back statement after waiting.
Note:
In distributed transactions, local deadlocks are detected by analyzing wait data, and global deadlocks are detected by a time out. Once detected, nondistributed and distributed deadlocks are handled by the database and application in the same way.
Deadlocks most often occur when transactions explicitly override the default locking of Oracle. Because Oracle itself does no lock escalation and does not use read locks for queries, but does use row-level locking (rather than page-level locking), deadlocks occur infrequently in Oracle.
回复

使用道具 举报

千问 | 2006-11-25 16:02:41 | 显示全部楼层
你所说的这段话,只是针对于事物1来说的.原文是这段话.
In the example in the slide, Transaction 1 must either commit or roll back in response to
the deadlock detected error. If it commits, it would need to resubmit the second update to
complete its transaction. If it performs a rollback, it must resubmit both statements to
accomplish its transaction.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行