Overview of Autonomous Transactions (150)

tsinglee發表於2007-11-06

Autonomous transactions are independent transactions that can be called from within
another transaction. An autonomous transaction lets you leave the context of the
calling transaction, perform some SQL operations, commit or undo those operations,
and then return to the calling transaction’s context and continue with that transaction.
Once invoked, an autonomous transaction is totally independent of the main
transaction that called it. It does not see any of the uncommitted changes made by the
main transaction and does not share any locks or resources with the main transaction.
Changes made by an autonomous transaction become visible to other transactions
upon commit of the autonomous transactions.
One autonomous transaction can call another. There are no limits, other than resource
limits, on how many levels of autonomous transactions can be called.
Deadlocks are possible between an autonomous transaction and its calling transaction.
Oracle detects such deadlocks and returns an error. The application developer is
responsible for avoiding deadlock situations.
Autonomous transactions are useful for implementing actions that need to be
performed independently, regardless of whether the calling transaction commits or
rolls back, such as transaction logging and retry counters.

自治事務塊
1. 自治事務塊獨立與呼叫他的主事務
2. 自治事務可以再呼叫其他自治事務 , 除了資源上的限制 ,自治事務呼叫的巢狀層次沒有限制.
3. 自治事務適合於獨立的操作(不管呼叫事務是否提交或回滾) , 如 : 事務日誌 ,及重試計數.

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10599713/viewspace-980974/,如需轉載,請註明出處,否則將追究法律責任。

相關文章