是不是在update语句前面 把要更新的行加上锁select ... for update 等到这个事务完成的时候 将锁撤销对于这方面 我也不很明了 关注
还是我自己来回答吧:How Oracle Locks Data Locks are mechanisms that prevent destructive interaction between transactions accessing the same resource?either user objects such as tables and rows or system objects not visible to users, such as shared data structures in memory and data dictionary rows.In all cases, Oracle automatically obtains necessary locks when executing SQL statements, so users need not be concerned with such details. Oracle automatically uses the lowest applicable level of restrictiveness to provide the highest degree of data concurrency yet also provide fail-safe data integrity. Oracle also allows the user to lock data manually. Transactions and Data Concurrency Oracle provides data concurrency and integrity between transactions using its locking mechanisms. Because the locking mechanisms of Oracle are tied closely to transaction control, application designers need only define transactions properly, and Oracle automatically manages locking.Keep in mind that Oracle locking is fully automatic and requires no user action. Implicit locking occurs for all SQL statements so that database users never need to lock any resource explicitly. Oracle's default locking mechanisms lock data at the lowest level of restrictiveness to guarantee data integrity while allowing the highest degree of data concurrency. 上述资料来源于Oracle在线文档: http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/consist.htm#i5704 ^_^
比如说更新一个表时,这个表就需要被锁定,那么这个加锁操作是在哪里执行的(持久层使用JDBC实现)?多个事务更新同一个表的时候,锁的管理在哪里进行?每个应用程序都要实现一个锁管理器么??
等到这个事务完成的时候 将锁撤销对于这方面 我也不很明了 关注
Locks are mechanisms that prevent destructive interaction between transactions accessing the same resource?either user objects such as tables and rows or system objects not visible to users, such as shared data structures in memory and data dictionary rows.In all cases, Oracle automatically obtains necessary locks when executing SQL statements, so users need not be concerned with such details. Oracle automatically uses the lowest applicable level of restrictiveness to provide the highest degree of data concurrency yet also provide fail-safe data integrity. Oracle also allows the user to lock data manually.
Transactions and Data Concurrency
Oracle provides data concurrency and integrity between transactions using its locking mechanisms. Because the locking mechanisms of Oracle are tied closely to transaction control, application designers need only define transactions properly, and Oracle automatically manages locking.Keep in mind that Oracle locking is fully automatic and requires no user action. Implicit locking occurs for all SQL statements so that database users never need to lock any resource explicitly. Oracle's default locking mechanisms lock data at the lowest level of restrictiveness to guarantee data integrity while allowing the highest degree of data concurrency.
上述资料来源于Oracle在线文档:
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/consist.htm#i5704
^_^
比较经典的文章,特别是乐观锁和悲观锁的说明