ing. erick lópez ch. m.r.i. replicación oracle. what is replication replication is the process of...

37
Ing. Erick López Ch. M.R.I. Replicación Oracle

Upload: garry-sherman

Post on 20-Jan-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Ing. Erick López Ch. M.R.I.

ReplicaciónReplicaciónOracle

Page 2: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

What is Replication

Replication is the process of copying and maintaining schema objects in multiple databases that make up a distributed database system.

Replication can improve the performance and protect the availability of applications because alternate data access options exist.

Page 3: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Basic Replication

Data replicas provide read-only access to the table data that originates from a primary or “master” site.

Applications can query data from local data replicas to avoid network access regardless of network availability.

Applications throughout the system must access data at the primary site when updates are necessary.

Page 4: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Basic Replication

Page 5: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advance Replication

Extend the capabilities of basic read-only replication by allowing applications to update table replicas throughout a replicated database system.

With advanced replication, data replicas anywhere in the system can provide both read and update access to a table’s data.

Participating Oracle database servers automatically work to converge the data of all table replicas, and ensure global transaction consistency and data integrity.

Page 6: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advance Replication

Page 7: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Basic Replication Concepts

Support applications requiring read-only access to table data originating from a primary site.

Uses of Basic Replication.Read-Only Table Snapshots.Snapshot Refreshes.

Page 8: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Uses of Basic Replication

Basic replication is useful for information distribution.

Information Off-Loading

Information Transport

Page 9: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Read-Only Table Snapshots

A read-only table snapshot is a local copy of table data originating from one or moreremote master tables.

An application can query the data in a read-only table snapshot, but cannot insert, update, or delete rows in the snapshot.

Page 10: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Read-Only Table Snapshots

Page 11: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Read-Only Table Snapshots

A Snapshot’s Defining Query The logical data structure of table snapshots is defined by a query that references data in one or more remote master tables. A snapshot's defining query determines what data the snapshot will contain.

Should be such that each row in the snapshot corresponds directly to a row or a part of a row in a single master table.

Page 12: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Read-Only Table Snapshots

A Snapshot’s Defining Query The logical data structure of table snapshots is defined by a query that references data in one or more remote master tables. A snapshot's defining query determines what data the snapshot will contain.

Should be such that each row in the snapshot corresponds directly to a row or a part of a row in a single master table.

Page 13: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Read-Only Table Snapshots

Should not contain a distinct or aggregatefunction, a GROUP BY or CONNECT BY clause, join, restricted types ofsubqueries, or a set operation.

CREATE SNAPSHOT sales.customers AS SELECT * FROM [email protected]

Page 14: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Read-Only Table Snapshots

CREATE SNAPSHOT sales.orders AS SELECT * FROM

[email protected] oWHERE EXISTS( SELECT c_id FROM [email protected] cWHERE o.c_id = c.c_id AND zip = 19555);

SNAP$_snapshotname

Page 15: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Snapshot Refreshes

You must decide how and when to refresh each snapshot to make it a more current.

Analyze application characteristics and requirements to determine appropriate snapshot refresh intervals.

To refresh snapshots, Oracle supports different types of refreshes, “complete” and“fast” snapshot refresh groups, as well as “manual” and “automatic” refreshes.

Page 16: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Complete and Fast Refreshes

Complete Refreshes The server that manages the snapshot

executes the snapshot's defining query. The result set of the query replaces the

existing snapshot data to refresh the snapshot.

Oracle can perform a complete refresh for any snapshot.

Page 17: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Complete and Fast Refreshes

Fast Refreshes The server that manages the snapshot first

identifies the changes that occurred in the master since the most recent refresh of the snapshot and then applies them to the snapshot.

Fast refreshes are more efficient than complete refreshes when there are few changes to the master because participating servers and networks replicate less data.

Fast refreshes are available for snapshots only when the master table has a snapshot log.

Page 18: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Complete and Fast Refreshes

Complete Refreshes The server that manages the snapshot

executes the snapshot's defining query. The result set of the query replaces the

existing snapshot data to refresh the snapshot.

Oracle can perform a complete refresh for any snapshot.

Page 19: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Concepts

Disconnected Environments Advanced replication is useful for the

deployment of transaction processing applications that operate using disconnected components.

Failover Site protect the availability of a mission

critical database.

Page 20: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Concepts

Distributing Application Loads Transaction processing applications that

require multiple points of access to database information

Information Transport data warehouse or data mart.

Page 21: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Configurations

Multimaster Replication Allows multiple sites, acting as equal

peers, to manage groups of replicated database objects.

Applications can update any replicated table at any site in a multimaster configuration.

Page 22: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Configurations

Page 23: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Configurations

Snapshot Sites and Updatable Snapshots Master sites in an advanced replication

system can consolidate information that applications update at remote snapshot sites.

Facility allows applications to insert, update, and delete table rows through updatable snapshots.

Page 24: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Configurations

Page 25: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Configurations

Updatable snapshots have the following properties: Updatable snapshots are always simple, fast-

refreshable table snapshots. Oracle propagates the changes made through an

updatable snapshot to the snapshot’s remote master table.

If necessary, the updates then cascade to all

other master sites. Oracle refreshes an updatable snapshot as part of

a refresh group identical to read-only snapshots.

Page 26: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Configurations

Hybrid Configurations Multimaster replication and updatable

snapshots can be combined in hybrid or “mixed” configurations to meet different application requirements.

Can have any number of master sites and multiple snapshot sites for each master.

Page 27: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Configurations

Page 28: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Advanced Replication Configurations

Differences between updatable snapshots and replicated masters: Replicated masters must contain data for the full

table being replicated, whereas snapshots can replicate subsets of master table data.

Multimaster replication allows you to replicate changes for each transaction as the changes occur.

If conflicts occur from changes made to multiple copies of the same data, master sites detect and resolve the conflicts.

Page 29: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Replication Conflicts

Uniqueness Conflicts A uniqueness conflict occurs when the

replication of a row attempts to violate entity integrity (a PRIMARY KEY or UNIQUE constraint).

Update Conflicts Occurs when the replication of an update to a

row conflicts with another update to the same row. Update conflicts occur when two different transactions originating from different sites update the same row at nearly the same time.

Page 30: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Replication Conflicts

Delete Conflicts Occurs when two transactions originate from

different sites, with one transaction deleting a row that the other transaction updates or deletes.

Page 31: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Using Basic ReplicationUsing Basic Replication

1. Design the basic replication environment. Decide which master tables you want to replicate using read-only table snapshots, and which databases require such snapshots.

2. At each snapshot site, create the schemas and database links necessary to support snapshots.

3. At the master site, create the snapshot logs necessary to support fast refreshes of all snapshots.

Page 32: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Using Basic ReplicationUsing Basic Replication

4. Create the snapshots at each snapshot site.

5. At each snapshot site, create the refresh groups that the snapshots will use to refresh, and assign each snapshot to a refresh group.

6. Grant privileges necessary for application users to access snapshots.

Page 33: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Step 2:

Create Snapshot Site Schemas and Create Snapshot Site Schemas and Database LinksDatabase Links

CONNECT system/manager@dbs2;CREATE USER scott IDENTIFIED BY tiger

QUOTA UNLIMITED ON data;GRANT CONNECT TO scott;CONNECT scott/tiger@dbs2;CREATE DATABASE LINK dbs1 CONNECT TO

scott IDENTIFIED BY tiger USING ‘dbs1’;

Page 34: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Step 3:

Create Necessary Master Site Create Necessary Master Site Snapshot LogsSnapshot Logs

CONNECT system/manager@dbs1;CREATE SNAPSHOT LOG ON scott.emp;CREATE SNAPSHOT LOG ON scott.dept;

Page 35: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Step 4:

Create SnapshotsCreate Snapshots

CONNECT system/manager@dbs2;CREATE SNAPSHOT scott.emp AS

SELECT * FROM [email protected];

CREATE SNAPSHOT scott.dept AS SELECT * FROM [email protected];

Page 36: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Step 5:

Create Snapshot Site Refresh GroupsCreate Snapshot Site Refresh Groups

CONNECT system/manager@dbs2;DBMS_REFRESH.MAKE(

name => ’scott.refgrp1’,list => ’scott.dept,scott.emp’,next_date => SYSDATE,interval => ’SYSDATE+1/24’);

(1/1440) COMMIT;

Page 37: Ing. Erick López Ch. M.R.I. Replicación Oracle. What is Replication  Replication is the process of copying and maintaining schema objects in multiple

Step 6:

Grant Access to SnapshotsGrant Access to Snapshots

GRANT SELECT ON scott.emp TO ... ;