Chapter 12: Managing Multi

Download Report

Transcript Chapter 12: Managing Multi

Managing Multi-User
Databases
AIMS 3710
R. Nakatsu
Chapter 12
Multi-User Issues
• Transaction Management
• Database Recovery
• Database Administration
Chapter 12
Transaction Processing
What is a transaction?
A transaction is a logical unit of work that
must be entirely completed or aborted; no
intermediate states are accepted.
A transaction may consist of a series of
related UPDATE (or writes) to the
database.
Transaction: ExampleChapter 12
Scenario: A company makes a credit sale of a
product to a customer.
1. Generate an order on the Order table to record
the order.
2. Update the Inventory table by subtracting the
number of units of the product sold from the
quantity-on-hand.
3. Update the Account Receivable table to bill the
customer later.
If the three transactions are not completely
executed, the transaction will yield an inconsistent
database
Chapter 12
Transaction Management
with SQL
Two commands are useful to know:
1. COMMIT: When this statement is issued,
the changes are permanently recorded in
the database.
2. ROLLBACK: When this statement is
reached, the changes are aborted, and the
database is “rolled back” to its previous
consistent state.
Chapter 12
Database Recovery
The process of restoring the database
to a correct state in the event of a
failure.
• Via Reprocessing
• Via Rollback/Rollforward (Undo/Redo)
Recovery Facilities
Chapter 12
Backup Facilities: make periodic backup copies
of the database
Logging Facilities: keep track of all updates
made to the database
Checkpoint Facilities: maintain a point of
synchronization between the database and
the transaction log
Transaction Log
Chapter 12
Transaction records contain:
• Transaction identifier
• Time
• Type of transaction (transaction start,
insert, update, delete, abort, commit)
• Identifier of data item affected
• Before-image of the data item
• After-image of the data item
• Log management information (such as
pointers to previous and next log records
for the transaction)
Checkpoint
Chapter 12
The point of synchronization between the
database and the transaction log file. All
buffers are force-written to secondary
storage.
Checkpoints involve the following operations:
1. All log records in main memory are
written to secondary storage.
2. A checkpoint record is written to the log
file. The record contains the identifers
of all active transactions at the time the
checkpoint is taken.
Chapter 12
Checkpointing Example
T1
aTT
T2
T3
T4
T5
t0
tC
T6
tF
Chapter 12
Fault-Tolerant Computer
Systems…
are systems that contain extra hardware,
software, and power supply components
that can back up a system and keep it
running continuously to prevent system
failure.
Chapter 12
Technologies used to ensure
maximum performance
Load balancing distributes large numbers of
access requests across multiple servers.
Mirroring uses a backup server that
duplicates all the processes and
transactions of the primary server.
Clustering links two computers together so
that the second computer can act as a
backup to the primary computer.
RAID
Chapter 12
(Redundant Array of Independent
Disks)
• Technology that provides enhanced
performance and reliability through
redundancy
• Replicates data among multiple disk
drives
Question: Does RAID replace the need
for backups?
Chapter 12
Database Administration (DBA)
The overall responsibility of the DBA is
to facilitate the development and use
of the database.
DBA database administrator
–
–
–
–
–
manages the database structure
controls concurrent processing
develops database security
provides for database recovery
manages the DBMS
DBA Must Monitor DBMS
Performance
© 2000 Prentice Hall
Features of Multi-User DBMS Products
Chapter 12
• Support for SQL and other open standards
• Support for transaction processing
(commits and rollbacks)
• Transaction logging for quick recovery
• Security management
• Programmability (the ability to create
customized applications)
• Support for DBA functions (e.g.,
performance tuning and query optimization)