Replication with Materialized Views

Established replication between two databases: DB1 and DB2

Source: PROD
Target :  TEST

1. Check the materialized view in database:

select * from dba_objects where object_type like 'MAT%'

2. Create an user on the TEST in which materialized view is created for replication

Create user username identified by password;

Grant connect ,resource to username;

grant  GRANT CREATE DATABASE LINK TO user;

3. Create DBLink on TEST Server

CREATE DATABASE LINK db1_prod CONNECT TO username IDENTIFIED BY password USING 'PROD';

4.  Select the table from production and created materialized view on Test database

CREATE MATERIALIZED VIEW schema.tablename_mv
BUILD IMMEDIATE
REFRESH FORCE
ON DEMAND
AS
SELECT * FROM schema.tablename@db1_prod;

5. Create the materialized view log with the owner of the schema

create materialized view log schema.tablename;

6. Scheduled the job for refresh the activity

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.