Database Reference
In-Depth Information
Isolated: Data might temporarily be in an inconsistent during a transaction. It should not
be provided to other transactions until the data is once again consistent. No user should be
able to access inconsistent data during a transaction. For a transaction to be isolated, no
other transactions can affect that transaction.
Durable: committed changes must be reserved, and the data should be in a consistent state
and reliable, even if hardware or application errors occur.
6.4 Locking Mechanisms
A lock may deny access to other database session. A lock is a control placed in the database
to protect data so that only one database session may change it. When data is locked, no
other database session can update the data until the lock is released, which is usually done
with a COMMIT or ROLLBACK SQL statement.
Typical lock levels are as follows:
Database: The entire database can be locked so that only one database session may apply
updates. It very useful for maintenance of database, such as upgrading to a new version of
the database software. In Oracle, database is opened in exclusive mode, which restricts the
database to only one user session.
File: An entire database file can be locked. A file can have part of a table, an entire table,
or parts of many tables. This level is less favored in modern databases.
Table: An entire table can be locked. This is useful when a table-wide change are per-
formed such as reloading the data in the table, updating every row, or altering the table to
add or remove columns.
Block: A block within a database file can be locked. A block is the smallest unit of data
that the operating system can read from or write to a file. The block size is also called the
sector size. Some operating systems use pages instead of blocks. A page is a virtual block
of fixed size, typically 2K or 4K.
Row: A row in a table can be locked. This is the most common locking level. All modern
RDBMS support row level locking.
Column: Some columns within a row in the table can be locked. It is not very practical
because of the resources required to place and release locks at column level of granularity.
6.5 The two-phase Command protocol
Search WWH ::

Custom Search