Professional Documents
Culture Documents
DATABASE MANAGEMENT
SYSTEMS (DBMS II)
CHAPTER 01
TRANSACTION MANAGEMENT
&
CONCURRENCY CONTROL
DATABASE MANAGEMENT SYSTEMS (DBMS II)
► The DBMS is marketed in many forms. Some of the more popular examples of DBMS
solutions are:
1. MICROSOFT ACCESS.
2. SQL SERVER.
3. ORACLE.
4. OTHER DATABASES.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
►A Transaction Characteristics:
►Definition of ACID: In computer science, ACID (atomicity,
consistency, isolation, durability) is a set of properties that guarantee
database transactions are processed reliably.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
► These transactions are required to fulfil certain characteristics and
they are:
1) Implicit transactions
2) Explicit transactions.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
1) Implicit transactions:
❖ Definition:
Implicit part of the Transaction are those that need to be
specified as a command like all INSERT, DELETE, UPDATE,
CREATE, DROP & OTHER KEY statements they run as
implicit transactions.
For example: if an update query is runed, and a primary key
constraint is violated, a rollback will occur and changes will not
occur.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
►The status of the Implicit Transaction can be either :
A. Commit.
B. Roll-back.
A- Commit transaction:
Commit transaction signals (shows) that the transaction was
successfully executed and the changes/ updates (if any) made
by the transaction have been committed to the database and
these changes cannot be undone.
B- Roll-back transaction:
Roll-back signals (shows) that the transaction was not
successfully executed, and the changes/updates made by the
transaction have to be undone.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
EXPLICIT TRANSACTIONS:
Definition: These are the statements written by the programmer. In order
to execute a group of statements to be enforced on the data inside
databases or tables in order to obtain changes. as a transaction we
write the statements within a BEGIN TRANSACTION and COMMIT
TRANSACTION block.
► If an error occurs we can use ROLLBACK, so that previous data state is
restored.
Implicit transactions are those that mark beginning and end of the
transaction, each statement like update, delete, insert run within these
implicit transactions or the statements written by the user to be enforced on
the data inside databases or tables.
However, you can explicitly specify the beginning and ending of the
transaction by "begin transaction" and "end transaction" statements
respectively. All the statements within these two boundaries will be
marked as one transaction.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
2. LOGICAL BACKUPS:
logical backups contain logical data in software mode in a
standard system & it’s not stored in a backup device or
back up utilities. (for example, tables and stored
procedures) extracted with the DBMS backup utilities. We
can use logical backups to supplement physical backups.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
►What is Database recovery ?
Database recovery is the process of restoring the database to a correct state
following a failure. The failure may be the result of a system crash due to
hardware or software errors, a media failure, such asa head crash, or a
software error in the application, such as a logical error in the program that is
accessing the database. It may also be the result of unintentional or
intentional corruption or destruction of data.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
Data Storage The storage of data generally includes four different types of
media with an increasing degree of reliability. These are:
1. Main memory
2. Magnetic disk
3. Magnetic tape
4. Optical disk
►Stable Storage is the storage in which information is never lost. Stable
storage devices are the theoretically impossible to obtain. But, we must use
some technique to design a storage system in which the chances of data loss
are extremely low.
►Implementation of Storage such as RAID (Redundant Array of Independent
Disk) is commonly used. In case of RAID, information is replicated on several
disks in form of array and each disk has independent failure modes. So, in
this case failure of single disk does not result in loss of data. RAID system
however cannot prevent data loss in case natural disasters like fires or
flooding.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
►What do we mean by Recovery from failure in DBMS:
❖ Actions taken during normal transaction processing to ensure enough
information exists & returned to it’s prior state before failure.
❖ Actions taken following a failure to recover the database to a state that
is known to be correct.
There are two techniques for recovery:
1. Deferred Database Recovery Modification
2. Immediate Database Modification
❖ Deferred Database Modification:
It means that in this case during write operation the modified values of local
variable are not copied into database backup devices immediately but
according to time frame placed by the DATABASE administrators , but the
corresponding new and old values are stored in the PC OR SERVER
WHERE THE DBMS IS LOCATED. But when the transaction successfully
performed all the operations, then the information stored at log record is used
to set the value of data items
DATABASE MANAGEMENT SYSTEMS (DBMS II)
❖ Immediate Database Modification:
❖ It means that in this case during write operation the modified values of local
variable are copied into database items backup devices immediately & the
corresponding new and old values are also stored in the PC OR SERVER
WHERE THE DBMS IS LOCATED.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
► What is the difference between Backup & restore?
►Restoring and Recovering a Database:
►Backup is the process where we create a copies of an existing data in
order to use them when data loss happens.
►Restoring is the process where we Restore or reuse those copies of data
that have been made during the backup process.
►Common problems of backup & recovery:
►Or Causes of backup failures :
Several problems can halt the normal backup operation of a database or affect database I/O
backup operations. The following are the most common types of problems.
1. Media Failure
2. User Error
3. Database Instance Failure
4. Statement Failure
5. Process Failure
6. Network Failure
DATABASE MANAGEMENT SYSTEMS (DBMS II)
1. Media Failure:
► An error can occur when we are trying to write or read a file on disk that is
required to by the backup process on database. This occurrence is called
media failure because there is a physical problem reading or writing to files
on the storage medium.
► A common example of media failure is a disk head crash that causes the
loss of all database files on a disk drive. All files associated with a database
are vulnerable to a disk crash, including data files, control files, online redo
logs, and archived logs.
►The appropriate recovery from a media failure depends on the files affected.
Media failure is the primary concern of a backup and recovery strategy,
because it typically requires restoring some or all database files and the
application of DATABASE during recovery.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
2. User Error
As an administrator, We can do little to prevent user errors such as
accidentally dropping a table. Often, user error can be reduced by increased
training on database and application principles .We can also avoid user
errors by administering privileges correctly so that users are able to do less
potential damage. Furthermore, by planning an effective recovery
scheme ahead of time, We can ease the work necessary to recover from
user errors.
3. Database Failure: Database instance failure occurs when a problem
prevents an SQL database instance from continuing to run. An instance
failure can result from a hardware problem, such as a power outage, or a
software problem, such as an operating system crash. Instance failure also
results when We issue a SHUTDOWN ABORT or STARTUP FORCE.
4. Statement Failure : Statement failure occurs when there is a logical failure
in the handling of a statement in an SQL program. For example, assume that
all extents of a table (in other words, the number of extents specified in the
NAME parameter of the CREATE TABLE statement) are allocated, and are
completely filled with data. Or for example A valid INSERT statement cannot
insert a row because no space is available. Therefore, the statement fails.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
If a statement failure occurs, then the SQL software or operating system returns
an error. A statement failure usually requires no recovery steps: SQL
automatically corrects for statement failure by rolling back any effects of the
statement and returning control to the application.
The user can simply re-execute the statement after the problem indicated by
the error message is corrected. For example, if insufficient extents are
allocated, then the DBA needs to allocate more extents so that the user's
statement can execute.
5. Process Failure
A process failure is a failure in a user, server, or background process of a
database instance such as an abnormal disconnect or process termination.
When a process failure occurs, the failed subordinate process cannot
continue or work, although the other processes of the database instance can
continue.
DATABASE MANAGEMENT SYSTEMS (DBMS II)
6. Network Failure
When your system uses networks such as local area networks and phone
lines to connect client workstations to database servers, or to connect
several database servers to form a distributed database system, network
failures such as aborted phone connections or network communication
software failures can interrupt the normal operation of a database system.
For example:
• A network failure can interrupt normal execution of a client application and
cause a process failure to occur. In this case, the SQL background process it
detects and resolves the aborted server process for the disconnected user
process, as described in the previous section.
DATABASE MANAGEMENT
SYSTEMS (DBMS II)
END of CHAPTER 01
TRANSACTION MANAGEMENT
&
CONCURRENCY CONTROL
THANK YOU FOR YOUR TIME
DATABASE MANAGEMENT SYSTEMS (DBMS II)