Lecture08 Replication and Mobile Databases Ch26
Lecture08 Replication and Mobile Databases Ch26
Lecture08 Replication and Mobile Databases Ch26
Chapter 26 - Objectives
How
a replicated database differs from a distributed database. The benefits of database replication. Distributed deadlock detection. Examples of applications that use database replication. Basic components of a replication system.
Chapter 26 - Objectives
How
synchronous replication differs from asynchronous replication. The main types of data ownership are master/salve, workflow, and update-anywhere. The functionality of a database replication server. Main implementation issues associated with database replication.
Chapter 26 - Objectives
How
mobile computing supports the mobile worker. Functionality of a mobile DBMS. How Oracle DBMS supports database replication.
Functionality of DDBMS is attractive. However, implementations of required protocols and algorithms are complex and can cause problems that may outweigh advantages.
Alternative and more simplify approach to data distribution is provided by a replication server. Every major database vendor has replication solution.
Pearson Education 2009
Database Replication is the process of copying and maintaining database objects, such as relations, in multiple databases that make up a distributed database system.
Replication object is a database object such as a relation, index, view, procedure, or function existing on multiple servers in a distributed database system.
In a replication environment, any updates made to a replication object at one site are applied to the copies at all other sites.
Replication objects are managed using replication groups. replication group is a collection of replication objects that are logically related.
A replication group can exist at multiple replication sites.
Replication environments support two basic types of sites: master sites and slave sites. replication group can be associated with one or more master sites and with one or more slave sites.
10
One site can be both master site for one replication group and slave site for different replication group.
However, one site cannot be both the master site and slave site for same replication group.
11
A master site controls a replication group and the objects in that group. is achieved by maintaining a complete copy of all objects in a replication group and by propagating any changes to a replication group to any slave sites.
This
12
A slave site can contain all or a subset of objects from a replication group. However, slave sites only contain a snapshot of a replication group.
Typically, a snapshot site is refreshed periodically to synchronize it with its master site.
13
For a replication environment with many master sites, all of those sites communicate directly with one another to continually propagate data changes in the replication group.
14
Synchronous updates to replicated data are part of enclosing transaction. If one or more sites that hold replicas are unavailable transaction cannot complete. Large number of messages required to coordinate synchronization.
Asynchronous - target database updated after source database modified. Delay in regaining consistency may range from few seconds to several hours or even days.
Pearson Education 2009
15
Data Ownership
Ownership
relates to which site has privilege to update the data. types of ownership are: Master/slave (or asymmetric replication), Workflow, Update-anywhere (or peer-to-peer or symmetric replication).
16
Main
Master/Slave Ownership
Asynchronously
replicated data is owned by one (master) site, and can be updated by only that site. Using publish-and-subscribe metaphor, master site makes data available. Other sites subscribe to data owned by master site, receiving read-only copies. Potentially, each site can be master site for nonoverlapping data sets, but update conflicts cannot occur.
Pearson Education 2009
17
18
19
Workflow Ownership
Avoids
update conflicts, while providing more dynamic ownership model. Allows right to update replicated data to move from site to site. However, at any one moment, only ever one site that may update that particular data set. Example is order processing system, which follows series of steps, such as order entry, credit approval, invoicing, shipping, and so on.
Pearson Education 2009
20
Workflow Ownership
21
Update-Anywhere Ownership
Creates
peer-to-peer environment where multiple sites have equal rights to update replicated data. Allows local sites to function autonomously, even when other sites are not available. Shared ownership can lead to conflict scenarios and have to employ methodology for conflict detection and resolution.
22
Update-Anywhere Ownership
23
function is copy data from one database to another (using synch. or asynch. replication). Other functions include: Scalability Mapping and Transformation Object Replication Specification of Replication Schema Subscription mechanism Initialization mechanism Easy Administration
Pearson Education 2009
24
Implementation Issues
Issues
associated with the provision of data replication by the replication server include: transactional updates; snapshots and database triggers; conflict detection and resolution.
25
replication mechanisms were nontransactional. was copied without maintaining atomicity of transaction. transactional-based mechanism, structure of original transaction on source database is also maintained at target site.
26
Data
With
27
Snapshots
Allow
asynchronous distribution of changes to individual tables, collections of tables, views, or partitions of tables according to pre-defined schedule.
Common approach for snapshots uses the recovery log, minimizing the extra overhead to the system.
28
Snapshots
In
some DBMSs, process is part of server, while in others it runs as separate external server. event of network or site failure, need queue to hold updates until connection is restored.
ensure integrity, order of updates must be maintained during delivery.
In
To
29
Database Triggers
Could
allow users to build their own replication applications using database triggers. responsibility to create code within trigger that will execute whenever appropriate event occurs.
Users
30
Database Triggers
CREATE TRIGGER StaffAfterInsRow BEFORE INSERT ON Staff FOR EACH ROW BEGIN INSERT INTO [email protected] VALUES (:new.staffNo, :new:fName, :new:lName, :new.position, :new:sex, :new.DOB, :new:salary, :new:branchNo); END;
Pearson Education 2009
31
and execution of triggers have a performance overhead. Burden on application/network if master table updated frequently. Triggers cannot be scheduled. Difficult to synchronize replication of multiple related tables. Activation of triggers cannot be easily undone in event of abort or rollback.
32
multiple sites are allowed to update replicated data, need to detect conflicting updates and restore data consistency. For a single table, source site could send both old and new values for any rows updated since last refresh. At target site, replication server can check each row in target database that has also been updated against these values.
Pearson Education 2009
33
want to detect other types of conflict such as violation of referential integrity. Some of most common mechanisms are:
Earliest and latest timestamps. Site Priority. Additive and average updates. Minimum and maximum values. User-defined. Hold for manual resolution.
34
Mobile Databases
Increasing
demands on mobile computing to provide types of support required by growing number of mobile workers. Work as if in the office but in reality working from remote locations. Office may accompany remote worker in form of laptop, PDA (Personal Digital Assistant), or other Internet access device.
35
Mobile Database
Cau True/False
Database
that is portable and physically separate from a centralized database server but is capable of communicating with server from remote sites allowing the sharing of corporate data.
36
Mobile DBMS
37
Mobile DBMS
Functionality
38