DAY11 DBMSFunctions
DAY11 DBMSFunctions
Management System
Functions of a DBMS
C.J. Date
Backup/Recovery
Indexing
Views
Design
Security
Documentation
Integrity
Update/Query
Concurrency
Views
Views Permit
Maintaining a constant user interface
Restricting access to specified
attributes
Specifying user rights
Views
3 Schema Architecture
Database administrators
CONCEPTUAL model for the data (E-R
diagrams)
User DBMS
Procedures Constraints DBMS
Integrity
CREATE TABLE … or
ALTER TABLE … ADD
CHECK(condition)
PRIMARY KEY attribute-name
FOREIGN KEY attribute-name
REFERENCES parent-table
The parent table must already have a primary key defined
Concurrency
Lockout
Restricting access to users who could be
misled by partial transactions
Versioning
Making trial updates on versions of the
database and denying one if there is a data
conflict.
Locks
Master
Program 1 locks record
Student Grade
<exclusive>.
00 Fred No other program can
01 Anthony read the record.
No program can have
02 Steve an active lock.
03 Ivan Program 2 locks record
<shared>
Other programs can
read, but not change
record.
No program can have
an exclusive lock.
Locks
Exclusivity
Granularity
• Exclusive
Field
• Shared
Record
• Table
• Database
Concurrency
Deadlock
Version 1
Time 1 Version 2
Version 3
Time 2
Time 3
Backup Copies
• Master
• Transaction Log
Journalization
• Forward Log
• Backward Log
Checkpoints
DBMS Logs
Master Transaction
Student Grade Insert Li with grade A
00 Fred Change Fred’s grade to A
01 Anthony
02 Steve
03 Ivan
Recover from Backup
Transac-
Backup + tion = Recovered
Database
Slow
May give different answers from original
DBMS Logs
Transaction Forward Log
Ins Li with grade A Student Grade
Chg Fred’s grade to A 03 Li A
00 Fred A
Backward
Contaminated
Database
- Log = Correct at
Checkpoint
Recent
+ Transactions = Recovered
Database
Transaction Processing
Transaction Boundary
• Locking
Exclusive Shared
• Logging
Forward Backward Transaction
• Modification
Delete Insert Update
• Commitment
Commit Rollback
Transaction Boundaries
Set Boundary
• Obtain Locks
• Execute Code Modules
• Evaluate Correctness
Commit or Rollback
• Release Locks
Transaction Boundaries
Set savepoint:
SAVEPOINT order_save;
Commit or rollback:
ROLLBACK TO order_save;
Transaction Boundaries
Premiere Products Example
SALESREP CUSTOMER
ORDER
PRODUCT ORDER-PRODUCT
SALESREP CUSTOMER
ORDER
PRODUCT ORDER-PRODUCT
Backup/Recovery
Indexing
Views
Design
Security
Documentation
Integrity
Update/Query
Concurrency