Presentation is loading. Please wait.

Presentation is loading. Please wait.

DBMS Functions Data, Storage, Retrieval, and Update

Similar presentations


Presentation on theme: "DBMS Functions Data, Storage, Retrieval, and Update"— Presentation transcript:

1 DBMS Functions Data, Storage, Retrieval, and Update
Provides users with the ability to store, retrieve, and update the data that are in the database.

2 DBMS Functions Shared Update
Ensures accuracy when several users are updating the database at the same time.

3 Avoiding Inconsistent Data
Prohibit shared update. Use batch processing Lock other users from accessing records that are being updated by another. In batch processing, a separate transaction file is created. So any changes that the users make to the database is not actually recorded till the transaction program is run. This means the data in the database is not current till the batch processing takes place. This cannot work for airlines, banks, inventory etc.

4 Concurrency Control The DBMS must prevent or overcome the interference of transactions of multiple users Locking different levels of granularity (records to tables) The bigger the item that is locked the longer the wait for transactions even though they may not really access the same data The smaller the lockable item the more complex the locking mechanism 60

5 Avoiding the Problem Two-Phase Locking Deadlock
Locks are held until all the required updates have been completed. Deadlock Occurs when two users hold more than one lock at a time. Locking on PC-Based DBMSs Usually much more limited than locking facilities provided by mainframe DBMSs. The two phases are the growing and the shrinking phases. e.g. Adding a new order may involve updating not just the order table but also reducing the inventory, adjusting the customer's balance on the invoice, and increasing the salesman’s commission. Thus locks should be held till all the required updates are completed. Hence more and more rows will be locked in the growing phase and after all the locks are acquired, the database will be updated. Once the update is successfully completed, the locks are released in the shrinking phase.

6 Record Locking Deadlock prevention Deadlock resolution Deadly embrace
1. User must lock all records required in the beginning of a transaction (not practical) 2. The DBMS can detect and break deadlocks by backing out of one transaction 63

7 Avoiding the Problem Timestamping
The DBMS assigns to each database update the unique time when the update started, called a timestamp. Avoids the need to lock rows and eliminates the processing time needed to apply and release locks; also detects and resolves deadlocks.

8 Backup and Recovery Provides a mechanism for recovering the database in the event that the database is damaged in any way. The process of returning the database to a correct state is called recovery. Periodically making a copy of the database is called backup.

9 Replication A way to manage copies of the same data at multiple locations.

10 Security The protection of the database against unauthorized access.
Passwords Encryption Views

11 Integrity Integrity constraints, or conditions, fall into four categories: Data type Legal values Format Key constraints

12 Integrity Constraints in a DBMS

13 Data Independence Facilities that allow programs to be independent of the structure of the database. Addition of a field Changing the length of a field Creating a new index Adding or changing a relationship Data independence protects the application investment

14 ACID properties Atomic Consistent Isolated Durable
all of a transaction should be executed or none Consistent the database should be in a “consistent” state after the transaction is completed Isolated Updates of concurrent transactions should be concealed from each other, till committed Durable once a transaction commits, its updates survive even if there is a subsequent system crash Atomic: withdraw money from ATM and debit account Consistent: No seat may be assigned to 2 different customers Isolated: If only 1 seat left and 2 requests one should be granted and the other denied Durable: A log of all transactions is first written to disk & then changes are made to the database. Even if system fails immediately after transaction, log will show changes 59


Download ppt "DBMS Functions Data, Storage, Retrieval, and Update"

Similar presentations


Ads by Google