...
Code Block | ||
---|---|---|
| ||
RDSTGT = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = awsdb.cu1f3524nvj.us-east-1.rds.amazonaws.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RDSTGT) ) ) |
Testing Connection
Code Block | ||
---|---|---|
| ||
sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Mon Sep 30 12:11:14 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> connect dbvadmin@RDSTGT
Enter password:
Connected.
|
Creating Amazon EC2 Instances
...
Code Block | ||
---|---|---|
| ||
[oracle@dbvrds01 TEST_RDS]$
$ ./TEST_RDS-all.sh
Setting up Dbvisit Replicate configuration
Configure database SOURCEDB...
This check fails if the DBID is not the expected one...
Ok, check passed.
Configure database RDSTGT...
This check fails if the DBID is not the expected one...
Ok, check passed.
Object grants for database SOURCEDB...
Object grants for database RDSTGT...
Setting up the configuration
Initializing......done
WARN-1850: No DDC DB available, dictionary table does not exist.
DDC loaded from database (0 variables).
Dbvisit Replicate version 2.6.01.3900
Copyright (C) Dbvisit Software Limited. All rights reserved.
DDC file /home/oracle/TEST_RDS/config/TEST_RDS-onetime.ddc loaded.
MINE: Cannot determine Dbvisit Replicate dictionary version. (no dictionary exists)
APPLY: Cannot determine Dbvisit Replicate dictionary version. (no dictionary exists)
dbvrep> #clear the no-DDC-DB-available warning
dbvrep> engine clear previous warnings
dbvrep> set ON_WARNING SKIP
Variable ON_WARNING set to SKIP for process *.
dbvrep> set ON_ERROR EXIT
Variable ON_ERROR set to EXIT for process *.
dbvrep> ENGINE SWITCH_REDOLOG
dbvrep> ENGINE SETUP MINE DROP DICTIONARY
0 dictionary objects dropped.
dbvrep> ENGINE SETUP MINE CREATE DICTIONARY
dbvrep> ENGINE SETUP MINE LOAD DICTIONARY
Supplemental logging on database set.
Loading dictionary table DBRSCOL$
Loading dictionary table DBRSIND$
Loading dictionary table DBRSOBJ$
Loading dictionary table DBRSTAB$
Loading dictionary table DBRSUSER$
Loading dictionary table DBRSV_$DATABASE
ID of mine process is
2E363D28-AAD3-11E3-B759-C37E51CB262D. If not using
DDC in database, set MINE_UNIQUE_ID to this value.
dbvrep> ENGINE SETUP APPLY DROP DICTIONARY
0 dictionary objects dropped.
dbvrep> ENGINE SETUP APPLY CREATE DICTIONARY
dbvrep> ENGINE SETUP APPLY LOAD DICTIONARY
dbvrep> ENGINE PREPARE_DP SETUP CLEAR
dbvrep> ENGINE SETUP PAIR MINE AND APPLY
1 applier SCN set.
dbvrep> SET APPLY.INSTANTIATE_SCN NOW
Variable INSTANTIATE_SCN set to NOW for process APPLY.
dbvrep> ENGINE SUPPLEMENTAL LOGGING SCHEMA SCOTT ENABLE PRIMARY KEY
dbvrep> ENGINE SWITCH_REDOLOG
dbvrep> ENGINE WAIT_SCN_FLIP
Waited 2 seconds until scn_to_timestamp changed.
dbvrep> #single-scn instantiation: lock all tables and schemas
dbvrep> ENGINE LOCK SCHEMAS SCOTT
Locking all schemas.
Lock done.
dbvrep> #single-scn instantiation: unlock all tables and schemas, but
keep the SCN
dbvrep> ENGINE LOCK RELEASE LOCKS
dbvrep>
dbvrep> #prepare the tables (we use OFFLINE as neither MINE not APPLY is running; with OFFLINE we
won't wait on network timeout)
dbvrep> PREPARE OFFLINE SCHEMA SCOTT
Table SCOTT.BONUS instantiated at SCN 1034905
Table SCOTT.DEPT instantiated at SCN 1034905
Table SCOTT.EMP instantiated at SCN 1034905
Table SCOTT.LOADTEST instantiated at SCN 1034905
Table SCOTT.SALGRADE instantiated at SCN 1034905
dbvrep> #single-scn instantiation: unlock all tables and schemas,
forget the SCN (so it does not affect any further PREPARE statements)
dbvrep> ENGINE LOCK CLEAR SCN
dbvrep> ENGINE SWITCH_REDOLOG
dbvrep> #prepare script for instantiation
dbvrep> ENGINE PREPARE_DP WRITE DP_NETWORKLINK DIRECTORY DATA_PUMP_DIR
FILE /home/oracle/TEST_RDS/APPLY.sh DBLINK SOURCEDB USERID
rds_admin/dbvisit2014@RDSTGT
Created Data Pump script /home/oracle/TEST_RDS/APPLY.sh, using network import.
dbvrep> create ddcdb from ddcfile
DDC loaded into database (319 variables).
dbvrep> set ON_WARNING SKIP
Variable ON_WARNING set to SKIP for process *.
dbvrep> set ON_ERROR SKIP
Variable ON_ERROR set to SKIP for process *.
OK-0: Completed successfully.
These steps are required after the TEST_RDS-all.sh
script runs:
1) Create the necessary directory(ies) on the servers:
ec2-54-82-47-176.compute-1.amazonaws.com: /home/oracle/TEST_RDS
2) Copy the DDC files to the server(s) where the processes will run:
ec2-54-82-47-176.compute-1.amazonaws.com: /home/oracle/TEST_RDS/TEST_RDS-APPLY.ddc
dbvlin210.dbvisit.co.nz: /home/oracle/TEST_RDS/TEST_RDS-MINE.ddc
3) Review that path to dbvrep executable is correct in the run scripts:
/home/oracle/TEST_RDS/TEST_RDS-run-dbvlin210.dbvisit.co.nz.sh
/home/oracle/TEST_RDS/TEST_RDS-run-ec2-54-82-47-176.compute-1.amazonaws.com.sh
4) Copy the run script to the server(s) where the processes will run:
dbvlin210.dbvisit.co.nz: /home/oracle/TEST_RDS/TEST_RDS-run-dbvlin210.dbvisit.co.nz.sh
ec2-54-82-47-176.compute-1.amazonaws.com: /home/oracle/TEST_RDS/TEST_RDS-run-ec2-54-82-47-176.compute-1.amazonaws.com.sh
5) Ensure firewall is open for listen interfaces 0.0.0.0:7902, 0.0.0.0:7901 used by the processes.
6) Make sure the data on apply are in sync as of time when setup was run.
Scripts for Data Pump/export/DDL were created as requested:
/home/oracle/TEST_RDS/APPLY.sh
Create referenced database links (if any) before running the scripts.
7) Start the replication processes on all servers:
dbvlin210.dbvisit.co.nz: /home/oracle/TEST_RDS/TEST_RDS-run-dbvlin210.dbvisit.co.nz.sh
ec2-54-82-47-176.compute-1.amazonaws.com: /home/oracle/TEST_RDS/TEST_RDS-run-ec2-54-82-47-176.compute-1.amazonaws.com.sh
8) Start the console to monitor the progress:
/home/oracle/TEST_RDS/start-console.sh
The above list is stored in /home/oracle/TEST_RDS/Nextsteps.txt.
|
...
Once the above scripts are created, copy the RDSPOC-rundbvrds02.sh and RDSPOCTEST_RDS--run-ec2-54-82-47-176.compute-1.amazonaws.com.sh and TEST_RDS-APPLY.ddc to the dbvrds02 EC2 server, example:
Code Block | ||
---|---|---|
| ||
[oracle@dbvrds01 RDSPOC]$ scp -i /home/oracle/RDSPOCaws/RDSPOCdbv-runlab-dbvrds02keypair.shpem dbvrds02:/home/oracle/RDSPOC/ [oracle@dbvrds01 RDSPOC]$ scp TEST_RDS/TEST_RDS-APPLY.ddc root@ec2-54-82-47-176.compute-1.amazonaws.com:/home/oracle/RDSPOC/RDSPOCTEST_RDS/TEST_RDS-APPLY.ddc dbvrds02: $ scp -i /home/oracle/RDSPOC/aws/dbv-lab-keypair.pem /home/oracle/TEST_RDS/TEST_RDS-run-ec2-54-82-47-176.compute-1.amazonaws.com.sh root@ec2-54-82-47-176.compute-1.amazonaws.com: /home/oracle/TEST_RDS/TEST_RDS-run-ec2-54-82-47-176.compute-1.amazonaws.com.sh |
Instantiate Data (Import data into AWSDB)
The first step is to create the required database link. This link is required to pull the data from the AWSDB database into the XE database. The full network connection description is used for the connection detail, as we do not have access to the local system to modify the tnsnames.ora. For this database link the SYSTEM account is used.
Code Block | ||
---|---|---|
| ||
SQL> create public database link XE connect to system identified by manager using '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.85.90.146)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))';
Database link created.
SQL> select * from v$instance@xe;
INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
HOST_NAME
----------------------------------------------------------------
VERSION STARTUP_T STATUS PAR THREAD# ARCHIVE LOG_SWITCH_WAIT
----------------- --------- ------------ --- ---------- ------- ---------------
LOGINS SHU DATABASE_STATUS INSTANCE_ROLE ACTIVE_ST BLO EDITION
---------- --- ----------------- ------------------ --------- --- -------
1 XE
dbvrds01
11.2.0.2.0 30-SEP-13 OPEN NO 1 STARTED
ALLOWED NO ACTIVE PRIMARY_INSTANCE NORMAL NO XE
|
Start the import process
To import the data into the RDS database you will need to use Datapump using the database links.
The import script was created as part of the setup wizard process. You will have a file called APPLY.sh located in the /home/oracle/RDSPOC directory. Edit this file and add the option “exclude=statistics” at the end. This will ensure you do not get any errors at the end of the import process. Once you have updated the file and as per the above instructions you have your database links in place you can execute the script from the dbvrdsrep01 server.
...
language | text |
---|
...
Start the import process
To import the data into the RDS database you will need to use Datapump using the database links.
The import script was created as part of the setup wizard process. You will have a file called APPLY.sh located in the /home/oracle/TEST_RDS directory. Edit this file and add the option “exclude=statistics” at the end. This will ensure you do not get any errors at the end of the import process. Once you have updated the file and as per the above instructions you have your database links in place you can execute the script from the dbvrdsrep01 server.
Code Block | ||
---|---|---|
| ||
[oracle@dbvrds01 ]$ cat APPLY.sh impdp dbvadmin/xxxx@RDS_TGT table_exists_action=TRUNCATE network_link=XX directory=DATA_PUMP_DIR flashback_scn=1034905 tables=SCOTT. Table = SCOTT.BONUS, SCOTT.DEPT,SCOTT.EMP,SCOTT.LOADTEST,SCOTT.SALGRADE [oracle@dbvrds01 ]$ ./APPLY.sh Import: Release 11.2.0.2.0 - Production on Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Release 11.2.0.2.0 - 64bit Production Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 102.6 MB Processing object type TABLE_EXPORT/TABLE/TABLE . . imported "SCOTT"."BONUS" 1144031200672 rows . . imported "OESCOTT"."PRODUCT_DESCRIPTIONSDEPT" 1000 354141 rows . . imported "OESCOTT"."PRODUCT_INFORMATION"EMP" 1000 401688 rows . . imported "OESCOTT"."ORDERENTRY_METADATALOADTEST" 4 900441 rows . . imported "OE"."WAREHOUSESSALGRADE" 1000 114403 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 Job "DBVADMIN"."DP_RDSPOC_0001" successfully completed at 02:46:32 |
...
Code Block | ||
---|---|---|
| ||
[oracle@dbvrds01 RDSPOC]$ ./RDSPOC/home/oracle/TEST_RDS/TEST_RDS-run-dbvrds01dbvlin210.dbvisit.co.nz.sh Initializing......done [oracle@dbvrds01 RDSPOC]$ DDC loaded from database (266 variables). Dbvisit Replicate version 2.56.08.3341x Copyright (C) Dbvisit Software Limited. All rights reserved. DDC file /home/oracle/RDSPOC/RDSPOCTEST_RDS/TEST_RDS-MINE.ddc loaded. Starting process MINE...Created directory /home/oracle/RDSPOCTEST_RDS/ddc_backup Created directory /home/oracle/RDSPOCTEST_RDS/log/ Created directory /home/oracle/RDSPOCTEST_RDS/log/trace/ Created directory /home/oracle/RDSPOCTEST_RDS/mine/ started |
Apply (EC2) Server :
Code Block | ||
---|---|---|
| ||
[oracle@dbvrds02oracle@ RDSPOC]$ ./RDSPOC-run-dbvrds02/home/oracle/TEST_RDS/TEST_RDS-run-ec2-54-82-47-176.compute-1.amazonaws.com.sh Initializing......done DDC loaded from database (266 variables). Dbvisit Replicate version 2.56.08.3341x Copyright (C) Dbvisit Software Limited. All rights reserved. DDC file /home/oracle/RDSPOC/RDSPOCTEST_RDS/TEST_RDS-APPLY.ddc loaded. Starting process APPLY...Created directory /home/oracle/RDSPOCTEST_RDS/ddc_backup Created directory /home/oracle/RDSPOCTEST_RDS/log/ Created directory /home/oracle/RDSPOCTEST_RDS/log/trace/ Created directory /home/oracle/RDSPOCTEST_RDS/apply started |
Starting the Dbvisit Replicate console
...
The console can be started from the Mine server (source) using the “start-console.sh” script
[oracle@dbvrds01 oracle@ ]$ ./start-console.sh
Example output can be seen below. Note Note that the mine and apply process does take some time to initialize.
Once both Mine and Apply is initialized:.
Testing the replication
While the above is running you can open the Dbvisit Replicate console and you can see the progress of the replication:. Insert some rows into the source tables and then look in the target to see them appear there.