Explicit (Manual) Data Locking (364)
Oracle always performs locking automatically to ensure data concurrency, data
integrity, and statement-level read consistency. However, you can override the Oracle
default locking mechanisms. Overriding the default locking is useful in situations such
as these:
■ Applications require transaction-level read consistency or repeatable reads. In
other words, queries in them must produce consistent data for the duration of the
transaction, not reflecting changes by other transactions. You can achieve
transaction-level read consistency by using explicit locking, read-only transactions,
serializable transactions, or by overriding default locking.
■ Applications require that a transaction have exclusive access to a resource so that
the transaction does not have to wait for other transactions to complete.
Oracle’s automatic locking can be overridden at the transaction level or the session
level.
At the transaction level, transactions that include the following SQL statements
override Oracle’s default locking:
■ The SET TRANSACTION ISOLATION LEVEL statement
■ The LOCK TABLE statement (which locks either a table or, when used with views,
the underlying base tables)
■ The SELECT ... FOR UPDATE statement
Locks acquired by these statements are released after the transaction commits or rolls
back.
At the session level, a session can set the required transaction isolation level with the
ALTER SESSION statement.
Note: If Oracle’s default locking is overridden at any level, the
database administrator or application developer should ensure that
the overriding locking procedures operate correctly. The locking
procedures must satisfy the following criteria: data integrity is
guaranteed, data concurrency is acceptable, and deadlocks are not
possible or are appropriately handled.
顯示(手工)加鎖
在以下情況下手工加鎖(覆蓋Oracle預設的鎖機制)非常有用
1. 應用需要事務級別的一致性讀或者可重複讀. 使用者可以顯示地對資料加鎖,使用只讀事務
或序列化事務,或覆蓋預設的鎖,從而實現事務級的讀一致性
2. 應用要求事務必須以排他地訪問某種資源,而不需要等待其他事務完成
3. 使用者可以在事務級或會話級覆蓋 Oracle 預設採用的鎖
4. 在事務級別 , 可以使用下面的語句來覆蓋Oracle預設的鎖 ... , 這些鎖在事務提交或回滾後
釋放
5. 在會話級別,可以使用alter session 設定事務隔離級別
6. 手工加鎖操作必須滿足以下標準:保證資料完整性,提供足夠的資料併發能力,
不會發生死鎖或能夠正確處理死鎖
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10599713/viewspace-992629/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 8.0 Reference Manual(讀書筆記63節--InnoDB Locking)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記66節--locking read 與lock)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記59節-- Buffering and Caching 和 Locking)MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記39節-- Data Types(1))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記40節-- Data Types(2))MySql筆記
- MySQL 8.0 Reference Manual(讀書筆記41節-- Data Types(3))MySql筆記
- AtCoder Beginner Contest 364
- [題解]ABC364 A~F
- ABC364 DEF 題解
- oracle9i(9204)dg(data guard)_ place the standby database in manual recovery modeOracleDatabase
- C# explicit與implicitC#
- How Oracle Locking WorksOracle
- Modes of Locking (334)
- C++關鍵字explicitC++
- 淺談mysql innodb lockingMySql
- Service異常:Service Intent must be explicitIntent
- Android:Unable to find explicit activity classAndroid
- REFERENTIAL INTEGRITY AND LOCKING [ID 33453.1]
- Overview of Locking Mechanisms (310)View
- C++ explicit&noexcept關鍵字C++
- MySQL 5.5 -- Metadata Locking Within TransactionsMySql
- Oracle 11G OCP 1Z0-053 364Oracle
- AtCoder Beginner Contest 364 補題記錄(A~F)
- Entity Framework Tutorial Basics(38):Explicit LoadingFramework
- C# 自定義 implicit和explicit轉換C#
- data gurad物理備份方式下standby_file_management為manual時修改表空間的操作
- 如何查詢 library locking 問題
- Mysql next-locking 間隙鎖MySql
- C# 顯式轉換關鍵字 explicitC#
- [Libcurl]Build&Use ManualUI
- /usr/bin/xauth: error in locking authority file錯誤Error
- C++霧中風景5:Explicit's better thaC++
- [Warning] TIMESTAMP with implicit DEFAULT --explicit_defaults_for_timestamp
- GNU make manual 翻譯(五十九)
- httpd的manual列目錄漏洞httpd
- GNU make manual 翻譯(三十六)
- 異常 This application has no explicit mapping for /error so yAPPError
- Default Locking for INSERT, UPDATE, DELETE, and SELECT ... FOR UPDATE (351)delete