0% found this document useful (0 votes)
23 views10 pages

DBMS

Dbms notes

Uploaded by

benazirrose2704
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views10 pages

DBMS

Dbms notes

Uploaded by

benazirrose2704
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

DISTRIBUTED DATABASE:

It’s a collection of multiple inter connected database, which are


spread physically across various locations that communicate via a
computer network. Eg: Amazon

In India there are many branches are there multiple users are
using this big platform. For Example

DELHI

Network

CHENNAI
MUMBAI

Each cities has a different data through the network database are inter
connected. So maintaining database in various cities it’s all inter
connected by means of network (internet) Eg: Mumbai uses will
access their database.
It’s like a server.
With the help of distributed database easy to access and speed level
will be high.
Simply we can use and access at any place in any location. Through
the network connecting each cities database, then it is called as
distributed database.
DISTRIBUTED DATABASE MANAGEMENT SYSTEM
• A Distributed database management system (DDBMS) is a
centralized software system that manages a distributed
database is a manner as fit it were all stored is a single
location.
• It will control and manage the overall database.
ARCHITECTURE DIAGRAM FOR DISTRIBUTED DATABASE:
1. CLIENT-SERVER ARCHITECTURE OF DISTRIBUTED
SYSTEM:
 Client-server architecture has a no. of clients and few
servers connected in a network.
 A client sends a query to one of the server the earliest
available server solves it and replies.
 A client-server architecture is simple of implement and
execute due to centralized server system.

Client 1
Communication
network

Client 2 Server

2. COLLABORATING SERVER ARCHITECTURE:


 It is designed to run a single query to multiple server.
 It breaks single query into multiple small query and
result is sent to the client.
 Collecting server arch has a collection of database
server.
Each Server is capable for executing the current transactions across
the database.
Receiving Division of Run Query on
query Query local servers

Query Combining the result


Optimization
n

Sends query to server


Client

Server returns result Server


3. MIDDLE WARE ARCHITECTURE:
 These are designed in such a way that single query is
executed on multiple servers.
 This system needs only one server which is capable of
merging queries and transactions from multiple
servers.
 Middle ware architecture uses local servers to handle
local queries and transactions.
 The software are used to execution of queries and
transactions across one or more independent database
server that type of software is called as middle ware
architecture.
Types of Distributed Databases
Distributed databases can be broadly classified into homogeneous and
heterogeneous distributed database.

Homogeneous Distributed Databases:


In a homogeneous distributed database, all the sites use identical DBMS
and operating systems. Its properties are,

•The sites use very similar software.


•The sites use identical DBMS or DBMS from the same vendor.
•Each site is aware of all other sites and cooperates with other sites to
process user requests.
•The database is accessed through a single interface as if it is a single
database.

Types of Homogeneous Distributed Database:


There are two types of homogeneous distributed database.
•Autonomous − Each database is independent that functions on its
own. They are integrated by a controlling application and use message
passing to share data updates.

•Non-autonomous − Data is distributed across the homogeneous


nodes and a central or master DBMS co-ordinates data updates across
the sites.

Heterogeneous Distributed Databases:


In a heterogeneous distributed database, different sites have different
operating systems.

•Different sites use dissimilar schemas and software.


•The system may be composed of a variety of DBMS like relational,
network, hierarchical or object oriented.
•Query processing is complex due to dissimilar schemas.
•Transaction processing is complex due to dissimilar software.
Types of Heterogeneous Distributed Databases:
•Federated − The heterogeneous database systems are independent
in nature and integrated together so that they function as a single
database system.

•Un-federated − The database systems employ a central coordinating


module through which the databases are accessed.

FEATURES OF DATABASE
➢ Data is stored at a no.of sites.
➢ Sites are interconnected by a network.
➢ Distributed database is logically a single database.
➢ DDBMS has full functionality of DBMS.

ADVANTAGES OF DISTRIBUTED DATABASE:


➢ Sharing of data in multi location
➢ Improved availability and realiability
➢ Easier expansion
➢ Improved performance
➢ Fast data processing

DISADVANTAGES OF DISTRIBUTED DATABASE:


➢ Complexity of management and control
➢ Deadlock handling
➢ It provides security
➢ Lack of standards
Concurrency Control
It is the process of managing Simultaneous execution of transactions in
a shared database.

Purpose of Concurrency Control


● To Enforce Isolation To preserve database consistency.
● To resolve read-write is write-write Conflicts.
● Thus for maintaining the concurrency of the database, the
Concurrency Control protocols are Used.

Concurrency Control Protocols


The concurrency control protocol ensure the atomicity, consistency,
isolation, durability and serializability of the Concurrent execution of the
database transactions.

Therefore these protocols are categorized as


▫️→Lock Based Concurrency Control Protocol.
▫️→Timestamp Concurrency Control Protocol.
▫️→ Validation Based Concurrency Control protocol.

Lock Based Protocol


Any transaction cannot read or write data until it acquires an appropriate
write Lock on it.

(i) Lock Acquire: To access a data item in the database LOCK(A).


(ii) Release Lock: After completion of Transaction UNLOCK(A).

TYPES OF LOCKS
There are two types of lock :

▫️Shared Lock
▫️Exclusive Lock
Shared Lock: (Lock-S):

● It's also known as a 'Read-only lock.


● In a shared lock, the data item can only read by the transaction.
● when the transaction holds a shared lock, then no one can update
the data item in the data base.

Exclusive Lock: (Lock-x)

● In Exclusive Lock, the data item can be both reads as well as


written by the transaction.
● In Exclusive Lock, Multiple transactions do not modify the same
data simultaneously.
▫️ Lock-Read data item value
▫️ Lock - X → Both read and write.

Compatibility between Lock Modes:


TXN S X
S ✓ x
X x x
Any transaction can hold shared Lock on an Item. But Exclusive Lock
can be hold only by one transaction at a time .

Conversion of Locks :

upgrading :
● Converting from shared Lock to Exclusive Lock.
● Read Lock → write Lock.

Downgrading :
● converting from Exclusive Lock to shared Lock.
● write Lock → Read Lock.
Example of shared lock

🔸T1—>LOCK_S(B)
R(B)

🔸
UNLOCK (B)
T2—>LOCK_S(B)
R(B)
UNLOCK(B)

Example of Exclusive lock

🔸LOCK_X(B,)
R(B)
B=B-50
W(B)
UNLOCK(B)

TYPES OF LOCK-BASED PROTOCOLS


There are basically four lock-based protocols in DBMS.

Simplistic Lock Protocol


● The simplistic method is defined as the most fundamental method
of securing data during a transaction.
● Simple lock-based protocols allow all transactions to lock the data
before inserting, deleting, or updating it.
● After the transaction is completed, the data item will be unlocked.

Pre-Claiming Lock Protocol


● Pre-claiming Lock Protocols are known to assess transactions to
determine which data elements require locks.
● Prior to actually starting the transaction, it asks the Database
management system for all of the locks on all of the data items.
● Whenever the transaction is finished, the lock is released.
● This protocol permits the transaction to roll back if all of the locks
are not granted and then waits until all of the locks are granted.

Two-phase Locking Protocol


● If Locking as well as Unlocking can be performed in 2 phases, a
transaction is considered to follow the Two-Phase Locking
protocol.
● The two phases are known as the growing and shrinking phases.

Growing Phase: In this phase, we can acquire new locks on data items,
but none of these locks can be released.

Shrinking Phase: In this phase, the existing locks can be released, but
no new locks can be obtained.
● Two-phase locking helps to reduce the amount of concurrency in a
schedule but just like the two sides of a coin two-phase locking has
a few cons too.
● The protocol raises transaction processing costs and may have
unintended consequences.
● The likelihood of establishing deadlocks is one bad result.

Strict Two-Phase Locking Protocol


● In DBMS, Cascaded rollbacks are avoided with the concept of a
Strict Two-Phase Locking Protocol.
● This protocol necessitates not only two-phase locking but also the
retention of all exclusive locks until the transaction commits or
aborts.

● It is responsible for assuring that if 1 transaction modifies data,


there can be no other transaction that will be able to read it until
the first transaction commits.
● The majority of database systems use a strict two-phase locking
protocol.

You might also like