Replication with Materialized Views in Oracle

Replication with Materialized views in Oracle

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

Leave a Reply