Savepoints In Transactions

原创 2007年09月25日 16:41:00

Savepoints In Transactions

You can declare intermediate markers called savepoints within the context of a transaction. Savepoints divide a long transaction into smaller parts.

Using savepoints, you can arbitrarily mark your work at any point within a long transaction. You then have the option later of rolling back work performed before the current point in the transaction but after a declared savepoint within the transaction. For example, you can use savepoints throughout a long complex series of updates, so if you make an error, you do not need to resubmit every statement.

Savepoints are similarly useful in application programs. If a procedure contains several functions, then you can create a savepoint before each function begins. Then, if a function fails, it is easy to return the data to its state before the function began and re-run the function with revised parameters or perform a recovery action.

After a rollback to a savepoint, Oracle releases the data locks obtained by rolled back statements. Other transactions that were waiting for the previously locked resources can proceed. Other transactions that want to update previously locked rows can do so.

When a transaction is rolled back to a savepoint, the following occurs:

  1. Oracle rolls back only the statements run after the savepoint.

  2. Oracle preserves the specified savepoint, but all savepoints that were established after the specified one are lost.

  3. Oracle releases all table and row locks acquired since that savepoint but retains all data locks acquired previous to the savepoint.

The transaction remains active and can be continued.

Whenever a session is waiting on a transaction, a rollback to savepoint does not free row locks. To make sure a transaction does not hang if it cannot obtain a lock, use FOR UPDATE ... NOWAIT before issuing UPDATE or DELETE statements. (This refers to locks obtained before the savepoint to which has been rolled back. Row locks obtained after this savepoint are released, as the statements executed after the savepoint have been rolled back completely.)

 摘自:

http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/transact.htm#sthref602

Distributed transactions in Spring, with and without XA

While it's common to use the Java Transaction API and the XA protocol for distributed transactions ...
  • zootial
  • zootial
  • 2015年11月13日 15:12
  • 306

For different transaction types,What's the meaning of fields in MTL_MATERIAL_TRANSACTIONS

Account Receipt      Account Alias Receipt Cycle Count Adjust     Intransit Receipt  ...

How to Purge Apply Spilled Transactions in Streams Environment. (Doc ID 472440.1)

In this Document Goal   Solution   References AP...

Spring JTA multiple resource transactions in Tomcat with Atomikos example

In this tutorial we shall show you how to implement JTA multiple resource transactions in a Tomcat s...
  • gmemai
  • gmemai
  • 2015年09月04日 20:53
  • 213

How to Purge Apply Spilled Transactions in Streams Environment. [ID 472440.1]

最近在搞stream做全库复制,出现了一些问题,查阅了mos的文档 记录于此   Modified 11-APR-2012     Type HOWTO     Status PU...

Transactions in ODBC

Transactions in ODBC are managed at the connection level. When an application completes a transactio...
  • sptoor
  • sptoor
  • 2011年11月22日 16:36
  • 515

Android in-app billing: 关于 RESTORE_TRANSACTIONS

Choosing a Purchase Type An item's purchase type controls how Google Play manages the purchase of...

Distributed Transactions in MySQL

  • 2016年07月12日 16:04
  • 636KB
  • 下载

Transactions in j2ee(Redbooks).pdf

  • 2010年04月21日 16:53
  • 506KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Savepoints In Transactions
举报原因:
原因补充:

(最多只允许输入30个字)