3034
3034
(Durame Campus)
Table of Contents
Page
1.1 Backup and Recovery Concepts ____________________________________________2
1.2. Backup and Recovery Operations___________________________________________2
2.1. Recovery Concepts Based on Deferred Update________________________________4
2.2 Deferred update in a single-user environment_________________________________5
2.3 Deferred update in a multi-user environment_________________________________ 7
3.1 Recovery Concepts Based on Immediate Update_______________________________8
4.1 Shadow Paging__________________________________________________________9
5.1 The ARIES Recovery Algorithm______________________________________________9
6.1. Recovery in Multi-database Systems________________________________________1
1
1.1 Backup and Recovery Concepts
Backup and recovery are essential techniques in database
management to ensure data availability and integrity. Backup
involves creating copies of the database at specific points in
time, serving as a restore point in case of data loss or
corruption. It involves strategies such as full backups (copying
the entire database), incremental backups (copying only the
changes since the last backup), and differential backups
(copying the changes since the last full backup). Recovery, on
the other hand, focuses on restoring the database to a
consistent state after a failure or system crash. This involves
restoring the database from a backup and applying transaction
logs to recover any lost or incomplete transactions.
2
Which Data Structures Are Important for
Backup and Recovery
Before you can begin thinking seriously about backup and recovery
strategy, you need to understand the physical data structures that are
relevant for backup and recovery operations. In this section we will
briefly discuss:
Oracle reads the data in a datafile during normal operation and stores it
in the in-memory buffer cache. For example, assume that a user wants to
access some data in a table. If the requested information is not already in
the buffer cache, Oracle reads it from the appropriate datafiles and stores
it in memory.
Control Files
Every Oracle database has a control file. A control file is an extremely important
binary file that contains the operating system filenames of all other files constituting
the database. It also contains consistency information that is used during recovery,
such as:
3
for just 5 or 10 minutes. Alternatively, imagine that you lose important
payroll datafiles due to a hard disk crash and cannot restore or recover them
because you do not have a backup. Depending on the size and value of the
lost information, the results can be devastating
A transaction reaches its commit point only when all REDO-type log
entries are recorded in the log, and the log buffer is forcefully written
to disk.
4
changes to the database on disk. However, the method described here has
certain limitations and considerations. One drawback is that it restricts the
concurrent execution of transactions because write-locked items remain
locked until the transaction reaches its commit point. Moreover, it may
require a significant amount of buffer space to hold all updated items until
the transactions are committed. Despite these limitations, the method
offers two main advantages
Notice that the transaction in the active list will have no effect on the database because
of the deferred update protocol, and is ignored completely by the recovery process. It is
5
implicitly rolled back, because none of its operations were reflected in the database.
However, the transaction must now be restarted, either automatically by the recovery
process or manually by the user.
The method’s main benefit is that any transaction operation need never be undone,
as a transaction does not record its changes in the database until it reaches its commit
point.
The protocol is summarised in the diagram below:
Figure 14.7
The diagram below shows an example of recovery in a single-user environment, where
the first failure occurs during execution of transaction T2. The recovery process will redo
the write_item(T1, D, 20) entry in the log by resetting the value of item D to 20 (its new
value). The write(T2, …) entries in the log are ignored by the recovery process because
T2 is not committed. If a second failure occurs during recovery from the first failure, the
same recovery process is repeated from start to finish, with identical results.
Figure 14.8
Figure 14.9
6
Consider a system in which concurrency control uses two-phase locking (basic 2PL) and
prevents deadlock by pre-assigning all locks to items needed by a transaction before the
transaction starts execution. To combine the deferred update methods for recovery with
this concurrency control technique, we can keep all the locks on items in effect until the
transaction reaches its commit point. After that, the locks can be released. This ensures
strict and serialisable schedules. Assuming that checkpoint entries are included in the
log, a possible recovery algorithm for this case is given below.
Use two lists of transactions maintained by the system: the committed transactions list
which contains all committed transactions since the last checkpoint, and the active
transactions list. REDO all the write operations of the committed transactions from the
log, in the order in which they were written into the log. The transactions in the active list
that are active and did not commit are effectively cancelled and must be resubmitted.
The REDO procedure is the same as defined earlier in the deferred update in the single-
user environment.
The diagram below shows an example schedule of executing transactions. When the
checkpoint was taken at time t1, transaction T1 had committed, whereas transaction T3
and T4 had not. Before the system crash at time t2, T3 and T2 were committed but not
T4 and T5. According to the deferred update method, there is no need to redo the write
operations of transaction T1 or any transactions committed before the last checkpoint
time t1. Write operations of T2 and T3 must be redone, however, because both
transactions reached their commit points after the last checkpoint. Recall that the log is
force-written before committing a transaction. Transaction T4 and T5 are ignored: they
are effectively cancelled and rolled back because none of their write operations were
recorded in the database under the deferred update protocol.
Figure 14.10
7
ensures that the database remains consistent by appropriately
handling transaction modifications.
8
5.1 The ARIES Recovery Algorithm
is relies on logging of all database operations with ascending
Sequence Numbers.
The ARIES (Algorithm for Recovery and Isolation Exploiting
Semantics) recovery algorithm is a widely used technique
for database recovery. ARIES follows the write-ahead
logging (WAL) principle, where changes to the database are
recorded in a transaction log before being applied to the
actual data. It combines the concepts of redo and undo
operations to ensure consistent recovery.
9
6.1. Recovery in Multi-database Systems
Recovery in multi-database systems involves restoring the
consistency and integrity of interconnected databases in the
event of failures or system crashes. In a multi-database
environment, where databases are distributed across different
systems or locations, recovery becomes more complex. It
requires distributed transaction management protocols to
coordinate and synchronize transactions across multiple
databases. Recovery in multi-database systems includes
techniques such as distributed checkpoints, distributed logging,
and global commit or abort decisions. Data replication and
backup strategies are crucial for ensuring data availability and
providing recovery options. Recovery in multi-database systems
ensures the consistency and durability of data across the
distributed environment.
10
11
References
12