I'm learning the replication concept in oracle database. I have a confusion of these two terms - master site and materialized view site. Please help on this...
3 Answers
Let's say I have two databases, DB1
and DB2
. I want to replicate data from DB1
to DB2
. I created materialized views on DB2
and these materialized views gets data (periodically) from tables stored on DB1
.
So which is master site here?
The database from which replicated sites(DB2
which has materialized views) gets data. In other words the database which stores master tables , which is DB1
in our case.
then materialized view site?
The database which stores the materialized views, which is DB2
.
Documentation: About Master Sites, Master Tables, and Materialized View Sites
As per Oracle Documentation
Here Oracle uses materialized views
(also known as snapshots
in prior releases) to replicate data to non-master sites in a replication environment and to cache expensive queries in a data warehouse environment.
A materialized view is a replica of a target master from a single point in time
. The master
can be either a master table
at a master site
or a master materialized view
at a materialized view site
. Whereas in multimaster replication tables are continuously updated by other master sites, materialized views are updated from one or more masters through individual batch updates, known as a refreshes, from a single master site or master materialized view site.
For Example the Materialized View Connected to a Single Master Site
Here a materialized view site
communicating with one of three master sites
( That is (orc1.world,orc2.world,orc3.world
) using a database link at the materialized view site
( That is mv1.world
), while the master sites communicate with each other using database links.
When a materialized view is fast refreshed, Oracle must examine all of the changes to the master table
or master materialized view
since the last refresh to see if any apply to the materialized view. Therefore, if any changes where made to the master since the last refresh, then a materialized view
refresh takes some time to apply the changes to the materialized view
. If, however, no changes at all were made to the master since the last refresh of a materialized view
, then the materialized view
refresh should be very quick.
Why Use Materialized Views?
1. Ease Network Loads
2. Create a Mass Deployment Environment
3. Enable Data Subsetting
4. Enable Disconnected Computing
https://docs.oracle.com/cd/B28359_01/server.111/b28326/repmview.htm#i34980 Oracle uses materialized views (also known as snapshots in prior releases) to replicate data to nonmaster sites in a replication environment and to cache expensive queries in a data warehouse environment.
https://docs.oracle.com/cd/B28359_01/server.111/b28326/img/repln072.gif
So the materialized view site is used to avoid workload in the master site