CH6 Flashcards
Database Administration Functions
– Concurrency control
– Security
– Backup
– Recovery
Concurrency Control
ensures that one user’s actions do not impact another user’s actions
Concurrent Transaction
When two transactions are being processed against a database at the same time
Interdependency
Changes required by one user may impact others
Atomic Transactions
database operation typically involves several transactions.
transactions are atomic and are sometimes called logical units of work (LUW).
Lost Update Problem
• If two or more users are attempting to update the same piece of data at the same time, it is possible that one update may overwrite the other update
Concurrency Issues
- Dirty reads
* Phantom reads
Dirty reads
The transaction reads a changed record that has not been committed to the database
Phantom reads
The transaction re-reads a data set and finds that a new record has been added
Implicit locks
issued automatically by the DBMS based on an activity.
Explicit locks
issued by users requesting exclusive rights to the data.
Serializable Transactions
When two or more transactions are processed concurrently, the results in the database should be logically consistent with the results that would have been achieved had the transactions been processed in an arbitrary serial fashion
Two-Phased Locking
- One way to achieve serializable transactions is by using two-phased locking.
- Two-phased locking lets locks be obtained and released as they are needed
Growing phase
when the transaction continues to request additional locks
Shrinking phase
when the transaction begins to release the locks
Deadlock
On occasions, two transactions may indefinitely wait on each another to release resources
Optimistic Locking
Read transaction is processed, updates are issued
Pessimistic Locking
Locks are issued, the transaction is processed and then the locks are freed
Consistent Transactions
Consistent transactions are often referred to by the ACID. – Atomic – Consistent – Isolated – Durable
ACID: Atomic
- An atomic transaction is one in which all of the database actions occur or none of them do.
- A transaction consists of a series of steps. Each step must be successful for the transaction to be saved.
- This ensures that the transaction completes everything it intended to do before saving the changes.
ACID: Consistent
- No other transactions are permitted on the records until the current transaction finishes.
- This ensures that the transaction integrity has statement level consistency among all records.
ACID: Isolation
- Within multiuser environments, different transactions may be operating on the same data.
- As such, the sequencing of uncommitted updates, rollbacks, and commits continuously change the data content.
- The 1992 ANSI SQL standard defines four isolation levels that specify which of the concurrency control problems are allowed to occur
ACID: Durable
• A durable transaction is one in which all committed changes are permanent
Cursors
- A cursor is a pointer into a set of rows that are the result set from an SQL SELECT statement.
- Cursors are usually defined using SELECT statements.