Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

What is Data instantiation

Before data replication can start, the target database must have a copy of the database objects that are going to be replicated. It is also necessary that the data for the objects to be replicated are completely in sync at the point at which the replication starts. Replication can only keep data in sync from a certain point in time, all the data before that point in time must be replicated manually as a one off task.

This is called Data Instantiation and the Oracle SCN plays a key part in this. 

The Oracle SCN is captured at the point at which the replication starts to enable a snapshot of the data at a point in time. This Oracle SCN is then used in two ways:

  1. Everything before the SCN must be copied manually. This is the Data Instantiation and is done in this example through Oracle DataPump, but other methods are also available such as using a standby database.
  2. Everything after the SCN is replicated by the logical replication tool (in this case Dbvisit Replicate, but can also be Golden Gate)

Running DataPump

1. On the target server, ensure that the REPOE schema is clean. Run the following drop script to ensure that there are no OE objects. If there are then the DataPump script will fail.

sqlplus oe/oe@ttorcl_trg
SQL> @/u01/oracle/swingbench/sql/soedgdrop2.sql

The APPLY.sh script created by the Setup Wizard for instantiating the target schema using DataPump export/import over a database link. This database link must be created for the script to work. 

2. On the target server (dbv02), setup the database link as user SYSTEM pointing to the source database.

sqlplus system/oracle@source
SQL> CREATE public DATABASE LINK source CONNECT TO system IDENTIFIED BY manager USING 'source';

This database link is needed for the Datapump script that is created as APPLY.sh. The content of datapump script APPLY.sh is similar to the following. DO NOT COPY THE CONTENT. This is just an example. 

impdp SYSTEM/manager@target table_exists_action=TRUNCATE network_link=source directory=DATA_PUMP_DIR flashback_scn=3046186 tables=REPOE.ADDRESSES, REPOE.CARD_DETAILS, REPOE.CUSTOMERS, REPOE.INVENTORIES, REPOE.LOGON, REPOE.ORDERENTRY_METADATA, REPOE.ORDERS, REPOE.ORDER_ITEMS, REPOE.PRODUCT_DESCRIPTIONS, REPOE.PRODUCT_INFORMATION, REPOE.WAREHOUSES logfile=REPOE_WAREHOUSES.log JOB_NAME=DP_dbvrep_XE_0001

The flashback_scn number (in this example 3046186) determines the consistency point as to where the data will be loaded to. All data prior to this SCN will be loaded using the above DataPump script. All data past this SCN will be replicated using Dbvisit Replicate.

3. On the source server, start the APPLY.sh script. This script will take approximately 3 - 9 minutes to complete depending on your host machine.

cd ~oracle/dbvrep_XE

a. Run the script

./APPLY.sh 

The output will be similar to:

Import: Release 11.2.0.2.0 - Production on Tue Aug 12 15:31:34 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
Starting "SYSTEM"."DP_DBVREP_XE_0001":  SYSTEM/********@target table_exists_action=TRUNCATE network_link=source directory=DATA_PUMP_DIR flashback_scn=515210 tables=REPOE.ADDRESSES,REPOE.CARD_DETAILS,REPOE.CUSTOMERS,REPOE.INVENTORIES,REPOE.LOGON,REPOE.ORDERENTRY_METADATA,REPOE.ORDERS,REPOE.ORDER_ITEMS,REPOE.PRODUCT_DESCRIPTIONS,REPOE.PRODUCT_INFORMATION,REPOE.WAREHOUSES logfile=REPOE_WAREHOUSES.log JOB_NAME=DP_dbvrep_XE_0001
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 616.6 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . imported "REPOE"."INVENTORIES"                       900131 rows
. . imported "REPOE"."ORDER_ITEMS"                      2143687 rows
. . imported "REPOE"."ORDERS"                            714895 rows
. . imported "REPOE"."ADDRESSES"                         750000 rows
. . imported "REPOE"."CUSTOMERS"                         500000 rows
. . imported "REPOE"."CARD_DETAILS"                      750000 rows
. . imported "REPOE"."LOGON"                            1191492 rows
. . imported "REPOE"."PRODUCT_DESCRIPTIONS"                1000 rows
. . imported "REPOE"."PRODUCT_INFORMATION"                 1000 rows
. . imported "REPOE"."ORDERENTRY_METADATA"                    4 rows
. . imported "REPOE"."WAREHOUSES"                          1000 rows
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/FUNCTIONAL_AND_BITMAP/INDEX
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_AND_BITMAP/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."DP_DBVREP_XE_0001" successfully completed at 15:34:44

 

 

  • No labels