Distributed Database and Replication

Download Report

Transcript Distributed Database and Replication

Distributed Database and
Replication
Distributed Database
• A logically interrelated collection of shared
data and a description of this data
physically distributed over a computer
network.
• Homogeneous
– All sites use the same DBMS product.
• Heterogeneous
– Sites may run different DBMS products.
Data Allocation
• Fragmented allocation:
– Partition the database into disjoint fragments, with
each fragment assigned to one site where they are
used most frequently.
• Horizontal fragment
• Vertical fragment
• Complete replication
– Maintain a complete copy of the database at each
site.
• Selective replication
– Mixed of fragmentation and replication
Extending ANSI-SPARC Model to
Distributed DBMS
•
•
•
•
Global External view at each site
Global Conceptual schema
Fragmentation and Allocation schemas
Local schemas
Advantages and Disadvantages of
Distributed Database
• Advantages:
– Improved availability
– Improved reliability
• Replication
• Disadvantages
– Complexity
• Distributed query processing, concurrency control, recovery
– Security
– Integrity control more difficult
Synchronous versus Asynchronous
Replication
• Synchronous replication:
– Replicated data is updated immediately.
• Asynchronous replication:
– Replicated data is updated after the source
database has been modified.
– Data ownership:
• which site has the privilege to update the data.
Master/Slave Ownership
• Asynchronous replicated data is owned by one
site, the master site, and can be updated only by
that site.
• Publish-and-subscribe
• Applications
– Decision support system analysis
– Distribution and dissemination of centralized
information
– Consolidation of remote information
• Replicated copy can be update locally and then brought
together in one location.
– Mobile computing
Database Snapshots
• It is a complete or selective part of a
database that is consistent with the
database at a specific point in time.
– Create Snapshot
– Refresh Snapshot
• Complete refresh
• Differential refresh
Replication in ADO.Net
.NET Applications
Data Set
Adapter Data Reader
Command Object
Connection Object
Database
DataReader Object
• It is read-only and forward-only cursor.
DataSet Object
• A DataSet object can hold several tables
and relationships between tables.
• A DataSet is a set of disconnedted data.
Data is extracted from the database and
stored in the DataSet object. Updates to
the DataSet must copy back to the
database to make the changes
permanent.
• Example: