Transactions
Transactions
Transactions
CONCURRENCY CONTROL
DATABASE RECOVERY
DATABASE SECURITY
TRANSACTION PROCESSING
Def:
A Transaction is a program unit (
deletion, creation, updating etc)
whose execution preserves the
consistency of a database.
States of a transaction
The keywords BEGIN TRANSACTION,
COMMIT, and ROLLBACK are available
in many data manipulation languages to
delimit transactions.
If these delimiters are not used, the
entire program is usually regarded as a
single transaction, with the DBMS
automatically performing a COMMIT
when the program terminates correctly
and a ROLLBACK if it does not.
Active, the initial state; the transaction stays in this state
while it is executing.
Partially committed, after the final statement has been
executed.
Failed, after the discovery that normal execution can no
longer proceed.
Aborted, after the transaction has been rolled back and
the database has been restored to its state prior to the
start of the transaction.
Committed, after successful completion.
A transaction comprises a sequence of
operations consisting of read and/or
write actions to the database, followed
by a commit or abort action.
TRANSACTION PROCESSING
To ensure that the above is met a
transaction must be
Atomic
Execute to completion
Consistency
Isolation
Durability
PROPERTIES OF A TRANSACTION
atomicity
Also known as the all nothing
property
A transaction is an individual unit
one another.
Durability
The effects of a successfully completed
(150+100).
The Lost Update Problem
4) TB increases to 350 (150+200).
5) TA writes back balance of 250.
• Example
1) TA retrieves Account 1234.
Value of balance is 50.
2) TA reduces balance by
100. Leaving it as -50.
3) TA writes back value of -
50.
uncommitted dependency
result.
Inconsistent Analysis
TA
Select Sum (Balance)
From Account;
TB
Update Accounts
Set Balance = Balance - 100 Where Accno = 3;
Update Accounts
Set Balance = Balance + 100 Where Accno = 1;
Inconsistent Analysis
TA result.
A procedure used to control concurrent
access to data. When one transaction is
accessing the database, a lock may
deny access to other transactions to
prevent incorrect results.
Locking
Growing phase
A transaction acquires all the
for.
The WFG is a directed graph G = (N, E)
that consists of a set of nodes N and a
set of directed edges E, which is
constructed as follows:
Create a node for each transaction.
Create a directed edge T T, if transaction
Tis waiting to lock an item that is currently
locked by T
Deadlock exists if and only if the WFG
contains a cycle
DATABASE RECOVERY
Def:
This is the process of restoring
Loss of Confidentiality
Loss of privacy
Loss of Integrity
Loss of Availability
THEFT/FRAUD
This the acquisition of data illegally
Confidentiality
Refers to the need to maintain
secrecy over the data usually that
which is critical to an organization
Privacy
Refers to the need to protect data
about individuals , loss would lead
to legal action taken against the
organization
Integrity
Loss results in invalid and
corrupted data
Availability
Data must be available to
authorized persons at an
appropriate time ( when as
required)
Loss leads to the inability to access
data.
Database Security
Measures that can be used to
safeguard databases from
anticipated threats
Authorization
Authentication
Views or subschema
encryption
Authentication
Mechanisms that determines
whether a user is s/he what s/he
claims to be
Establishing proof of identity
Physical traits
Pin codes
Cards etc
Authorization
QUESTIONS????