Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
32
Добавлен:
16.04.2013
Размер:
4.96 Mб
Скачать

 

 

Ensuring Repeatable Reads with Read-Only Transactions

 

 

 

 

Table 5–1 (Cont.)

Use of COMMIT, SAVEPOINT, and ROLLBACK

 

 

 

 

SQL Statement

Results

 

 

 

 

ROLLBACK TO b;

INSERT statement is rolled back, savepoint C is lost, savepoint B

 

 

remains defined

 

ROLLBACK TO c;

ORA-01086 error; savepoint C no longer defined

 

INSERT INTO...;

New DML statement in this transaction

 

COMMIT;

Commits all actions performed by the first DML statement (the

 

 

DELETE statement) and the last DML statement (the second

 

 

INSERT statement)

 

 

All other statements (the second and the third statements) of the

 

 

transaction were rolled back before the COMMIT. The savepoint A

 

 

is no longer active.

 

 

 

Privileges Required for Transaction Management

No privileges are required to control your own transactions; any user can issue a COMMIT, ROLLBACK, or SAVEPOINT statement within a transaction.

Ensuring Repeatable Reads with Read-Only Transactions

By default, the consistency model for Oracle Database guarantees statement-level read consistency, but does not guarantee transaction-level read consistency (repeatable reads). If you want transaction-level read consistency, and if your transaction does not require updates, then you can specify a read-only transaction. After indicating that your transaction is read-only, you can execute as many queries as you like against any database table, knowing that the results of each query in the read-only transaction are consistent with respect to a single point in time.

A read-only transaction does not acquire any additional data locks to provide transaction-level read consistency. The multi-version consistency model used for statement-level read consistency is used to provide transaction-level read consistency; all queries return information with respect to the system change number (SCN) determined when the read-only transaction begins. Because no data locks are acquired, other transactions can query and update data being queried concurrently by a read-only transaction.

Long-running queries sometimes fail because undo information required for consistent read operations is no longer available. This happens when committed undo blocks are overwritten by active transactions. Automatic undo management provides a way to explicitly control when undo space can be reused; that is, how

How Oracle Database Processes SQL Statements 5-7

Тут вы можете оставить комментарий к выбранному абзацу или сообщить об ошибке.

Оставленные комментарии видны всем.

Соседние файлы в папке Oracle 10g