Distributed Database Management Systems

Slides:



Advertisements
Similar presentations
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Advertisements

Distributed Database Management Systems Lecture 15.
Time in Databases CSCI 6442 With thanks to Richard Snodgrass, 1985 ACM /85/005/0236.
Cs44321 CS4432: Database Systems II Lecture #19 Database Consistency and Transactions Professor Elke A. Rundensteiner.
Moving data using replication Anthony Brown
Transaction Processing Lecture ACID 2 phase commit.
Cs4432recovery1 CS4432: Database Systems II Lecture #19 Database Consistency and Violations? Professor Elke A. Rundensteiner.
Distributed Databases
AGENDA Tools used in SQL Server 2000 Graphical BOL Enterprise Manager Service Manager CLI Query Analyzer OSQL BCP.
Database Constraints. Database constraints are restrictions on the contents of the database or on database operations Database constraints provide a way.
IMS 4212: Distributed Databases 1 Dr. Lawrence West, Management Dept., University of Central Florida Distributed Databases Business needs.
Week 6 Lecture Normalization
Chapters 17 & 18 Physical Database Design Methodology.
DISTRIBUTED DATABASES IN ADBMS Shilpa Seth
Physical Database Design Chapter 6. Physical Design and implementation 1.Translate global logical data model for target DBMS  1.1Design base relations.
RDBMSSection Relational DBMS DATABASE DEVELOPMENT And Franchise Colleges By MANSHA NAWAZ.
Module 1: Exploring Replication. Overview Understanding SQL Server Replication Setting Up Replication Understanding Agents in Replication Securing Replication.
Overview – Chapter 11 SQL 710 Overview of Replication
PMIT-6102 Advanced Database Systems By- Jesmin Akhter Assistant Professor, IIT, Jahangirnagar University.
Module 6: Implementing SQL Server Replication in an Enterprise Environment.
Planning Server Deployments Lesson 20. Skills Matrix.
Module 11: Introducing Replication. Overview Introduction to Distributed Data Introduction to SQL Server Replication SQL Server Replication Agents SQL.
Triggers. Why Triggers ? Suppose a warehouse wishes to maintain a minimum inventory of each item. Number of items kept in items table Items(name, number,...)
Distributed Database. Introduction A major motivation behind the development of database systems is the desire to integrate the operational data of an.
 Replication is the process of copying database information  Replication is used for:  Backing up your database  Migrating to a new server  Mirroring.
SQL Server 2005 Implementation and Maintenance Chapter 12: Achieving High Availability Through Replication.
Introduction to Database System Adisak Intana Lecturer Chapter 7 : Data Integrity.
Module 5: Implementing Merge Replication. Overview Understanding Merge Replication Architecture Implementing Conflict Resolution Planning and Deploying.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Ch 12. Replication. Replication Place copies of data to a different location Use: Reduce locking conflict when multiple sites want to work on same set.
1 Information Retrieval and Use De-normalisation and Distributed database systems Geoff Leese September 2008, revised October 2009.
Constraints and Views Chap. 3-5 continued (7 th ed. 5-7)
Dr Gordon Russell, Napier University Normalisation 1 - V2.0 1 Normalisation 1 Unit 3.1.
1 Section 9 - Views, etc. u Part 1: Views u Part 2:Security Issues u Part 3:Transaction Management u Part 4:Set Operations u Part 5:Triggers and Stored.
April 20022/CS/3X1 Database Design Design method John Wordsworth Department of Computer Science The University of Reading Room.
Fundamentals of DBMS Notes-1.
Practical Database Design and Tuning
SQL Replication for RCSQL 4.5
Chapter 6: Integrity (and Security)
Transactional Replication Deep Dive
Distributed Database Management Systems
Chapter 6 - Database Implementation and Use
COP 4540 Database Management
Glasgow, SQL Server Meetup
Introduction to transactional replication
Instructor: Jason Carter
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
Introduction to Replication
Introduction to Database Systems, CS420
Rules in active databases and integrity constraints
Database Systems Instructor Name: Lecture-12.
Generalization.
Introduction lecture1.
From ER to Relational Model
What Is a View? EMPNO ENAME JOB EMP Table EMPVU10 View
Teaching slides Chapter 8.
Practical Database Design and Tuning
Chapter 4.1 V3.0 Napier University Dr Gordon Russell
Advanced SQL: Views & Triggers
Primary key Introduction Introduction: A primary key, also called a primary keyword, is a key in a relational database that is unique for each record.
CMSC-461 Database Management Systems
Relational Database Design
Distributed Database Management Systems
Chapter 4 The Relational Model and Normalization
SQL – Constraints & Triggers
So What are Views and Triggers anyway?
Structured Query Language Path from Unorganized to Organized….
Database Management System
Distributed Database Management Systems
Normalisation 1 Unit 3.1 Dr Gordon Russell, Napier University
Presentation transcript:

Distributed Database Management Systems Lecture 25

Distributed Database Management Systems Virtual University of Pakistan

In Previous Lectures: time 1:40-230 Reasons for Fragmentation Maximizes local access Reduces table size, etc. PHF using the SQL Server on same machine

In Previous Lectures--2:00 DDBS design is a team effort Involves Domain Experts DDBS Experts Network Experts

In Previous Lectures Implemented PHF in a Banking Environment (around 3: 40) DDBS layer is superimposed on the client sites (4:00) Actual Data resides with the local sites (4:35)

Today’s Lecture Derived Horizontal Fragmentation

Derived Horizontal Fragmentation Fragmenting/ Partitioning a table based on the constraints defined on another table. Both tables are linked with each other through Owner-Member relation

Time: 5:36 a, b, c, d p, q, r, s, a TABLE1 TABLE2 Link Owner Member

Scenario (around 7:25) Link Owner titleId, titleName, sal Member TITLE empId, empName, empAdres, titleId titleId, titleName, sal EMP TITLE Link Owner Member

Why DHF Here (8: 50) Employee and salary record is split in two tables due to Normalization Storing all data in EMP table introduces Transitive Dependency That causes Anomalies

PHF of TITLE table, around 11:00 Predicates defined on the sal attribute of TITLE table p1 = sal > 10000 and sal <= 20000 p2 = sal > 20000 and sal <= 50000 p3 = sal > 50000

Conditions for the TITLE Table (11:58) TITLE1 =  (sal > 10000 and SAL ≤30000) (SAL) TITLE2 =  (sal > 20000 and SAL ≤50000) (SAL) TITLE3 =  (sal > 50000) (SAL)

Tables created with constraints: 12:20 create table TITLE1 (titleID char(3) primary key, titleName char (15), sal int check (SAL between 10000 and 20000)) create table TITLE2 (titleID char(3) primary key, titleName char (15), sal int check (SAL between 20001 and 50000)) create table TITLE3 (titleID char(3) primary key, titleName char (15), sal int check (SAL > 50000))

TITLE TITLE3 TITLE1 TITLE2 titleID titleName Sal T01 Elect. Eng 42000 Sys Analyst 64000 T03 Mech. Eng 27000 T04 Programmer 19000 TITLE3 TITLE1 titleID titleName Sal T02 Sys Analyst 64000 titleID titleName Sal T04 Programmer 19000 TITLE2 titleID titleName Sal T01 Elect. Eng 42000 T03 Mech. Eng 27000

EMP table at local sites (14:45) create table EMP1 (empId char(5) primary key, empName char(25), empAdres char (30), titleId char(3) foreign key references TITLE1(titleID))

Natural Join with Owner Fragments Time 15:40 PHF on Owner titleId, titleName, sal TITLE Link empId, empName, empAdres, titleId EMP Member Natural Join with Owner Fragments

Referential Integrity Constraint (18:30) Null value in the EMP1.titleId is allowed This violates the correctness requirement of the Fragmentation, i.e., it will violating the completeness critetion

Tighten Up the Constraint Around 20:00 Further we need to impose the “NOT NULL” constraint on the EMP1.titleID Now the records in EMP1 will strictly adhere to the DHF

Revised EMP1 Definition(21::00) create table EMP1 (empId char(5) primary key, empName char(25), empAdres char (30), titleId char(3) foreign key references TITLE1(titleID) not NULL)

Defining all three EMP tables:21:20 create table EMP1 (empId char(5) primary key, empName char(25), empAdres char (30), titleId char(3) foreign key references TITLE1(titleID) not NULL) create table EMP2 (empId char(5) primary key, empName char(25), empAdres char (30), titleId char(3) foreign key references TITLE2(titleID) not NULL) create table EMP3 (empId char(5) primary key, empName char(25), empAdres char (30), titleId char(3) foreign key references TITLE3(titleID) not NULL)

Implementing same scenario as PHF 22:10

PHF of EMP at different sites (22:30) create table EMP1 (empId char(5) primary key check (empId in ('Programmer')), empName char(25), empAdres char (30), titleId char(3))

create table EMP2 (empId char(5) primary key check (empId in (‘Elect create table EMP2 (empId char(5) primary key check (empId in (‘Elect. Engr’,’Mech. Engr’)), empName char(25), empAdres char (30), titleId char(3)) create table EMP3 (empId char(5) primary key check (empId in (' Sys Analyst ')), empName char(25), empAdres char (30), titleId char(3))

Adding a new record in TITLE (23:10) TITLE TITLE titleID titleName Sal T01 Elect. Eng 42000 T02 Sys Analyst 64000 T03 Mech. Eng 27000 T04 Programmer 19000 titleID titleName Sal T01 Elect. Eng 42000 T02 Sys Analyst 64000 T03 Mech. Eng 27000 T04 Programmer 19000 T05 Assist Supr 16000 New Record

Time 24:00 All three predicates of PHF defined in the two slide a couple of slides ago

May be: 24:40 create table EMP1 (empId char(5) primary key check (empId in ('Programmer‘, ‘Assist Supr’)), empName char(25), empAdres char (30), titleId char(3))

Original EMP Table EMP empId empName empAdres titleId E1 T Khan Multan W Shah Islamabad T02 E3 R Dar T03 E4 K Muhammad Lahore T04 E5 F Sahbai E6 A Haq E7 S Farhana E8 M Daud Jhelum EMP

DHFs of EMP Table

EMP1 EMP3 EMP2 empId empName empAdres titleId E4 K Muhammad Lahore T04 W Shah Islamabad T02 E5 F Sahbai Lahore E8 M Daud Jhelum EMP2 empId empName empAdres titleId E1 T Khan Multan T01 E3 R Dar Islamabad T03 E6 A Haq E7 S Farhana Lahore

Transactional Replication (30:30)

Data replicated as the transaction executes Preferred in higher bandwidth and lower latency Transaction is replicated as it is executed

Begins with a snapshot, changes sent at subscribers as they occur or at timed intervals A special Type allows changes at subscribers

Lets do it From the Enterprise Manager, select Replication, after a couple of nexts, we get this screen

Publication has been created that can be viewed from Replication Monitor or from Replication, like this

It has also created snapshot and log reader agents, which won’t work until we create a subscription. For this, we select the publication from replication monitor, right click it, then select Push new subscription

You select the particular database where you want to subscribe, we have created a new one

On next slide is asks the schedule for Distributor

A couple of more nexts and then

After this we run the snapshot agent, that creates a snapshot, you can verify this from snapshot agent history, or you can go to subscriber database and have a look, like this

We delete a record from our publication and we see that it is expressed in

This will be automatically be transferred to Subscription. If this activity could not be performed on subscriber, then the replication monitor will generate an error. You have to trap it and tune your application

Merge Replication

From replication, start a new publication, a few nexts, and once again our old familiar screen

After a few nexts, the merge publication will be created

Now you execute the snapshot agent of this replication It will create the snapshot, then you subscribe a database We find the original data in the subscriber After this if we make any change on either side, it will be reflected on the other side

In case of merge replication, we have to be careful about the constraints, like Primary Key, or other constraints