Oracle GoldenGate (OGG), Configuration & Simple Test in our Test ENV
Oracle GoldenGate (OGG), Configuration & Simple Test in our Test ENV
Step by Step Procedure to Setup of the OGG Configuration & Tested with simple table in our test ENV, I Have used the below two machine in single instance Oracle DB 11g (11.2.0.4)
In the following configuration I have used the following Hosts and Databases Server:
Source DB:
SID: oggtest1
Hostname: ogg-test1
Target DB
SID: oggtest2
Hostname: ogg-test2
Forced
logging should be enabled on the source database to ensure that all
changes are written to the redo logs. By default database is not
configuration with enable logging.
To check if FORCE_LOGGING is enabled in the source database use the below query:
[oracle@ogg-test1]$ !sq
SQL> SELECT force_logging FROM v$database;
FORCE_LOGGING
-------------
NO
If not enabled, then enable FORCE_LOGGING using:
[oracle@ogg-test1]$ !sq
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
Verify that FORCE_LOGGING has been enabled successfully using:
[oracle@ogg-test1]$ !sq
SQL> SELECT force_logging FROM v$database;
FORCE_LOGGING
-------------
YES
The documentation recommends performing a redo log switch to ensure that the change is applied in all subsequent redo.
[oracle@ogg-test1]$ !sq
SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.
OGG require enabling the minimal supplemental logging as the extract process will process to start, If not enabled, and then extract process will fails to start. By default the Oracle DB does not enable minimal supplemental during the creation of DB.
Therefore the Minimal supplemental logging only needs to be configured on the Source DB. It may be prudent to enable it on the Target DB as well.
Check if minimal supplemental logging is currently enabled:
[oracle@ogg-test1]$ !sq
SQL> SELECT supplemental_log_data_min FROM v$database;
SUPPLEMENTAL_LOG_DATA_MIN
-------------------------
NO
If not enabled then configure minimal supplemental logging:
[oracle@ogg-test1]$ !sq
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Database altered.
Verify that minimal supplemental logging is now enabled:
[oracle@ogg-test1]$ !sq
SQL> SELECT supplemental_log_data_min FROM v$database;
SUPPLEMENTAL_LOG_DATA_MIN
-------------------------
YES
Switch the log file again to ensure that all subsequent redo contains minimal supplemental logging:
[oracle@ogg-test1]$ !sq
SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.
Create Test User
In order to test the OGG Configuration created a new schema “mir” containing a new table “test” as follows.
The table is derived from DBA_OBJECTS.
In both databases (Source &Target DB) create a user (schema) called “mir”. For example:
[oracle@ogg-test1]$ !sq
SQL> CREATE USER mir IDENTIFIED BY mir;
User created.
In both databases grant the following permissions to the new user. For example:
[oracle@ogg-test1]$ !sq
SQL> grant connect, resource, dba to mir;
Grant succeeded.
It’s the test DB, security is not concern and therefore DBA privilege has been granted to the new user.
Create Test Table
In the source database (OGGTEST1) create the “test” table using a subset of rows from DBA_OBJECTS
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> create table test as select object_id, owner, object_name, object_type from dba_objects where object_id <= 10000;
Table created.
In the source database (OGGTEST1), add a primary key constraint and index to table “test”:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> ALTER TABLE test ADD CONSTRAINT test_id PRIMARY KEY (object_id);
Table altered.
Listener should be started before attempting to configure the network, ensure that the listener processes are running on both servers (ogg-test1 & ogg-test2)
[oracle@ogg-test1$ lsnrctl start
[oracle@ogg-test2]$ lsnrctl start
Configure Network
For network configuration, an entry is required in the “TNSNAMES.ORA” file on both the server describing the database on the other server.
On the source database (ogg-test1), added the following entry for the Target DB (OGGTEST2).
$ vi $ORACLE_HOME/network/admin/tnsnames.ora
# Source DB Config
OGGTEST1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ogg-test1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oggtest1)
(UR = A)
)
)
# Target DB Added to Sync
OGGTEST2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ogg-test2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oggtest2)
)
)
Verify the connection using SQL*Plus. For example:
[oracle@ogg-test1]$ sqlplus mir/mir@oggtest2
SQL> SELECT name FROM v$database;
NAME
---------
oggtest2
On the target DB (ogg-test2), I added the following entry for the Source DB (OGGTEST1).
$ vi $ORACLE_HOME/network/admin/tnsnames.ora
# Target DB
OGGTEST2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ogg-test2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oggtest2)
)
)
#Source DB Added to Sync
OGGTEST1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ogg-test1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oggtest1)
(UR = A)
)
)
Verify the connection using SQL*Plus. For example:
[oracle@ogg-test2]$ sqlplus mir/mir@oggtest1
SQL> SELECT name FROM v$database;
NAME
---------
OGGTEST1
On each server create a database link to the other database
On the source server (ogg-test1) as the “mir” user, create the following database link:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> Create database LINK oggtest2 connect to mir identified by mir using ‘OGGTEST2’;
On the target server (ogg-test2) as the mir user, create the following database link:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> Create database LINK oggtest1 connect to mir identified by mir using 'OGGTEST1';
Copy Test Data to Target DB; create an initial copy of the test data on the target database
In the target database (OGGTEST2), add a primary key constraint and index to table “test”:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> ALTER TABLE test ADD CONSTRAINT test_id PRIMARY KEY (object_id);
In the source database (OGGTEST1), verify the number of rows in the original table:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
--------
9830
In the target database, verify that there is the same number of rows in the new table:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
--------
9830
Note: The actual number of rows in table “TEST” should be identical for databases OGGTEST1 and OGGTEST2. However, it may vary in other databases
===================================
OGG (Oracle Goldengate Configuration)
===================================
Download the OGG Software & Copy to the linux machine
$ mkdir OGG_HOME
[oracle@ogg-test1 ~]$ cd /backup/OGG_HOME/
[oracle@ogg-test1 OGG_HOME]$ pwd
/backup/OGG_HOME
[oracle@ogg-test1 OGG_HOME]$ ls
fbo_ggs_Linux_x64_shiphome.zip
[oracle@ogg-test1 OGG_HOME]$ unzip fbo_ggs_Linux_x64_shiphome.zip
[oracle@ogg-test1 OGG_HOME]$ ls
fbo_ggs_Linux_x64_shiphome OGG-12.2.0.1.1-ReleaseNotes.pdf
fbo_ggs_Linux_x64_shiphome.zip OGG-12.2.0.1-README.txt
[oracle@ogg-test1 OGG_HOME]$ cd fbo_ggs_Linux_x64_shiphome/Disk1/
[oracle@ogg-test1 Disk1]$ ls
install response runInstaller stage
[oracle@ogg-test1 Disk1]$ ./runInstaller
(Select the Oracle Goldengate for Oracle Database 11g & Fallow the Instruction)
Note: Install this OGG into the New Location
[oracle@ogg-test1 ~]$ cd /u01/app/oracle/product/11.2.0/
[oracle@ogg-test1 11.2.0]$ pwd
/u01/app/oracle/product/11.2.0
[oracle@ogg-test1 11.2.0]$ mkdir ogg_home/
(After completion of the Installation, You can view the below OGG Files)
[oracle@ogg-test1 11.2.0]$ cd ogg_home/
[oracle@ogg-test1 ogg_home]$ ls
bcpfmt.tpl ddl_trace_on.sql freeBSD.txt marker_setup.sql
bcrypt.txt defgen ggcmd marker_status.sql
cachefiledump deinstall ggMessage.dat mgr
cfgtoollogs demo_more_ora_create.sql ggparam.dat notices.txt
checkprm demo_more_ora_insert.sql ggsci oggerr
chkpt_ora_create.sql demo_ora_create.sql ggserr.log OPatch
convchk demo_ora_insert.sql help.txt oraInst.loc
convprm demo_ora_lob_create.sql install oui
db2cntl.tpl demo_ora_misc.sql inventory params.sql
ddl_cleartrace.sql demo_ora_pk_befores_create.sql jdk prvtclkm.plb
ddl_create.sql demo_ora_pk_befores_insert.sql keygen prvtlmpg.plb
ddl_ddl2file.sql demo_ora_pk_befores_updates.sql label.sql prvtlmpg_uninstall.sql
ddl_disable.sql diagnostics libantlr3c.so remove_seq.sql
ddl_enable.sql dirbdb libdb-6.1.so replicat
ddl_filter.sql dirchk libgglog.so retrace
ddl_ora10.sql dircrd libggnnzitp.so reverse
ddl_ora10upCommon.sql dirdat libggparam.so role_setup.sql
ddl_ora11.sql dirdef libggperf.so sequence.sql
ddl_ora9.sql dirdmp libggrepo.so server
ddl_pin.sql dirout libicudata.so.48 sqlldr.tpl
ddl_remove.sql dirpcs libicudata.so.48.1 srvm
ddl_session1.sql dirprm libicui18n.so.48 tcperrs
ddl_session.sql dirrpt libicui18n.so.48.1 ucharset.h
ddl_setup.sql dirsql libicuuc.so.48 ulg.sql
ddl_status.sql dirtmp libicuuc.so.48.1 UserExitExamples
ddl_staymetadata_off.sql dirwlt libxerces-c.so.28 usrdecs.h
ddl_staymetadata_on.sql dirwww libxml2.txt zlib.txt
ddl_tracelevel.sql emsclnt logdump
ddl_trace_off.sql extract marker_remove.sql
Now Verify the GGSCI
[oracle@ogg-test1 ogg_home]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Dec 12 2015 00:54:38
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
GGSCI (ogg-test1) 1> create subdirs
Creating subdirectories under current directory /u01/app/oracle/product/11.2.0/ogg_home
Parameter files /u01/app/oracle/product/11.2.0/ogg_home/dirprm: already exists
Report files /u01/app/oracle/product/11.2.0/ogg_home/dirrpt: already exists
Checkpoint files /u01/app/oracle/product/11.2.0/ogg_home/dirchk: already exists
Process status files /u01/app/oracle/product/11.2.0/ogg_home/dirpcs: already exists
SQL script files /u01/app/oracle/product/11.2.0/ogg_home/dirsql: already exists
Database definitions files /u01/app/oracle/product/11.2.0/ogg_home/dirdef: already exists
Extract data files /u01/app/oracle/product/11.2.0/ogg_home/dirdat: already exists
Temporary files /u01/app/oracle/product/11.2.0/ogg_home/dirtmp: already exists
Credential store files /u01/app/oracle/product/11.2.0/ogg_home/dircrd: already exists
Masterkey wallet files /u01/app/oracle/product/11.2.0/ogg_home/dirwlt: already exists
Dump files /u01/app/oracle/product/11.2.0/ogg_home/dirdmp: already exists
GGSCI (ogg-test1) 1> show all
Parameter settings:
SET SUBDIRS ON
SET DEBUG OFF
Current directory: /u01/app/oracle/product/11.2.0/ogg_home
Using subdirectories for all process files
Editor: vi
Reports (.rpt) /u01/app/oracle/product/11.2.0/ogg_home/dirrpt
Parameters (.prm) /u01/app/oracle/product/11.2.0/ogg_home/dirprm
Replicat Checkpoints (.cpr) /u01/app/oracle/product/11.2.0/ogg_home/dirchk
Extract Checkpoints (.cpe) /u01/app/oracle/product/11.2.0/ogg_home/dirchk
Process Status (.pcs) /u01/app/oracle/product/11.2.0/ogg_home/dirpcs
SQL Scripts (.sql) /u01/app/oracle/product/11.2.0/ogg_home/dirsql
Database Definitions (.def) /u01/app/oracle/product/11.2.0/ogg_home/dirdef
Dump files (.dmp) /u01/app/oracle/product/11.2.0/ogg_home/dirdmp
Masterkey wallet files (.wlt) /u01/app/oracle/product/11.2.0/ogg_home/dirwlt
Credential store files (.crd) /u01/app/oracle/product/11.2.0/ogg_home/dircrd
GGSCI (ogg-test1) 2> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING ---- Default the Manager Port is assign as 7809 & it will be in running state
GGSCI (ogg-test1) 2> exit
[oracle@ogg-test1 ogg_home]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Jun 17 15:37:19 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SELECT log_mode FROM v$database;
LOG_MODE
------------
ARCHIVELOG
SQL> SELECT force_logging, supplemental_log_data_min FROM v$database;
FOR SUPPLEME
--- --------
YES IMPLICIT
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Database altered.
SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.
SQL> SELECT force_logging, f_min FROM v$database;
FOR SUPPLEME
--- --------
YES YES
SQL> alter system set ENABLE_GOLDENGATE_REPLICATION=true scope=both;
System altered.
[oracle@ogg-test1 ogg_home]$ ./ggsci
GGSCI (ogg-test1) 1> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
[oracle@ogg-test1 ogg_home]$ !sq
SQL> @role_setup.sql;
GGS Role setup script
This script will drop and recreate the role GGS_GGSUSER_ROLE
To use a different role name, quit this script and then edit the params.sql script to change the gg_role parameter to the preferred name. (Do not run the script.)
You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
Enter GoldenGate schema name:mir
Wrote file role_setup_set.txt
PL/SQL procedure successfully completed.
Role setup script complete
Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:
GRANT GGS_GGSUSER_ROLE TO <loggedUser>
where <loggedUser> is the user assigned to the GoldenGate processes.
Successfully logged into database
-----------------------------------------------Hence the Setup is done --------------------------------------
[oracle@ogg-test1$ !sq
SQL> CREATE USER mir IDENTIFIED BY mir;
User created.
On each server grant DBA role to the GoldenGate schema owner
[oracle@ogg-test1]$ !sq
SQL> grant connect, resource, dba to mir;
Grant succeeded.
On each server set the GGSCHEMA in the global parameter file.
[oracle@ogg-test1]$ cd /u01/app/oracle/product/11.2.0/ogg_home/
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> EDIT PARAMS ./GLOBALS
GGSCHEMA mir
:wq!
Create GoldenGate Tablespace
On the source server create a new tablespace for the GoldenGate objects. Ensure that AUTOEXTEND is enabled
[oracle@ogg-test1]$ !sq
SQL> CREATE TABLESPACE goldengate datafile '/u01/app/oracle/oradata/oggtest1/goldengate01.dbf' size 100m autoextend on;
Tablespace created
Set the new tablespace as the default for the GoldenGate user:
[oracle@ogg-test1]$ !sq
SQL> ALTER USER mir DEFAULT TABLESPACE goldengate;
User altered
On the target server create a new tablespace for the Goldengate objects. Again ensure that AUTOEXTEND is enabled.
[oracle@ogg-test2]$ !sq
SQL> CREATE TABLESPACE goldengate datafile '/oradata/datafiles/goldengate01.dbf' size
100m autoextend on;
Tablespace created.
Set the new tablespace as the default for the GoldenGate user:
[oracle@ogg-test2]$ !sq
SQL> ALTER USER mir DEFAULT TABLESPACE goldengate;
User altered.
Run Role Setup script
On the source server run the Role setup script. Specify the GoldenGate schema name when prompted.
[oracle@ogg-test1]$ !sq
SQL> @role_setup;
GGS Role setup script
This script will drop and recreate the role GGS_GGSUSER_ROLE
To use a different role name, quit this script and then edit the params.sql script to change the gg_role parameter to the preferred name. (Do not run the script.)
You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
Enter GoldenGate schema name: mir
Wrote file role_setup_set.txt
PL/SQL procedure successfully completed.
Role setup script complete
Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:
GRANT GGS_GGSUSER_ROLE TO where is the user assigned to the GoldenGate processes, On the source server grant GGS_GGSUSER_ROLE to the GoldenGate user:
[oracle@ogg-test1]$ !sq
SQL> grant GGS_GGSUSER_ROLE to mir;
Grant succeeded.
Configure Manager Parameters; on both servers configure the MGR parameters:
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> edit params mgr
PORT 7809
DYNAMICPORTLIST 7810-7820
:wq!
Configure Extract Parameters
In this example the extract process will be called "ex1", on the source server, create the parameter file for Extract ex1:
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> EDIT PARAMS ex1
EXTRACT ex1
USERID mir, PASSWORD mir
EXTTRAIL /u01/app/oracle/product/11.2.0/ogg_home/dirdat/ex
TABLE test.*;
Configure Data Pump Parameters; in this example the Data Pump process will be called dp1
On the source server create the parameter file for Data Pump process dp1:
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> EDIT PARAMS dp1
EXTRACT dp1
USERID mir, PASSWORD mir
RMTHOST ogg-test2, MGRPORT 7809
RMTTRAIL /u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt
TABLE test.*;
Create Check Point Table
The check point table should be created in the target database, on the target server login as the “mir” user and add the check point table:
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 1> dblogin userid mir, password mir
Successfully logged into database
GGSCI (ogg-test2) 2> ADD CHECKPOINTTABLE mir.checkpointtable
Successfully created checkpoint table mir.checkpointtable, the name of the check point table must be added to the GLOBALS file on the target server.
On the target server edit the GLOBALS file
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 1> EDIT PARAMS ./GLOBALS
GGSCHEMA gg01
CHECKPOINTTABLE gg01.checkpointtable
:wq!
Configure Replication Parameters
On the target server create the parameter file for replication process rep1:
[oracle@ogg-test2]$ ggsci
GGSCI (ogg-test2) 1> EDIT PARAMS rep1
REPLICAT rep1
USERID gg01, PASSWORD gg01
ASSUMETARGETDEFS
DISCARDFILE /u01/app/oracle/product/11.2.0/ogg_home/discards, PURGE
MAP test.*, TARGET test.*;
The above command created the file /u01/app/oracle/product/11.2.0/ogg_home/dirprm/rep1.prm
Add the following parameters to the new file:
Note that the DISCARDFILE parameter includes the PURGE keyword. If PURGE is not specified them the replication process will fail the second time it is started. Alternatively use the APPEND keyword to append output to the existing file.
Configure Supplemental Logging for Replicated Tables
On the source server configure supplemental logging for all tables that will be replicated. In this example there is only one table (Test)
Supplemental logging can be configured by any user that has privileges to modify the underlying database table.
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> dblogin userid mir, password mir
Successfully logged into database
GGSCI (vm4) 2> ADD TRANDATA mir.test
Logging of supplemental redo data enabled for table mir.test.
Add the Extract Process
On the source server add the Extract process (ex1)
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> ADD EXTRACT ex1,
EXTRACT added.
Add the Extract Trail
On the source server add the Extract trail (//u01/app/oracle/product/11.2.0/ogg_home/goldengate/dirdat/ex)
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> ADD EXTTRAIL /u01/app/oracle/product/11.2.0/ogg_home/dirdat/ex, EXTRACT ex1
EXTTRAIL added.
Add the Data Pump Process; on the source server add the Data Pump process (dp1)
[oracle@ogg-test]$ ./ggsci
GGSCI (ogg-test1) 1> ADD EXTRACT dp1 EXTTRAILSOURCE
/u01/app/oracle/product/11.2.0/ogg_home/dirdat/ex
EXTRACT added.
Add the Data Pump Trail
On the source server add the Data Pump trail (/u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt). This trail is created on the target server. However, the name is required in order to set up the Data Pump process on the source server.
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> ADD RMTTRAIL /u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt,
EXTRACT dp1
RMTTRAIL added.
Add the Replication Process; On the target server add the Replication process (rep1)
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 1> ADD REPLICAT rep1, EXTTRAIL
/u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt
REPLICAT added.
Start GoldenGate Process
Start Manager
On the source server, start the GoldenGate manager:
[oracle@ogg-test1]$ ggsci
GGSCI (ogg-test1) 1> start mgr/manager
Manager started.
On the target server, start the GoldenGate manager:
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 1> start mgr/manager
Manager started.
Start Extract Process
On the source server start the Extract (ex1)
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> START EXTRACT ex1
Sending START request to MANAGER
EXTRACT EX1 starting
Verify that the Extract has started successfully using INFO EXTRACT:
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 10> INFO EXTRACT ex1
EXTRACT EX1 Last Started 2013-02-27 12:57 Status RUNNING
Checkpoint Lag 00:00:24 (updated 00:00:05 ago)
Log Read Checkpoint Oracle Redo Logs
2013-02-27 12:57:01 Seqno 6, RBA 30736
SCN 0.0 (0)
The status should be RUNNING.
Start Data Pump Process, On the source server, start the Data Pump (dp1):
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 3> START EXTRACT dp1
Sending START request to MANAGER
EXTRACT DP1 starting
Verify that the Data Pump has started successfully using INFO EXTRACT:
[oracle@ogg-test1]$./ggsci
GGSCI (ogg-test1) 2> INFO EXTRACT dp1
EXTRACT DP1 Last Started 2013-02-27 11:57 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Log Read Checkpoint File /u01/app/oracle/product/11.2.0/ogg_home/dirdat/ex000000
First Record RBA 0
The status should be RUNNING.
Start Replication Process, on the target server, start the Replicat process (rep1):
[oracle@ogg-test2]$./ggsci
GGSCI (ogg-test2) 1> START REPLICAT rep1
Sending START request to MANAGER
REPLICAT REP1 starting
Verify that the Replicat process has started successfully using INFO EXTRACT:
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 2> INFO REPLICAT rep1
REPLICAT REP1 Last Started 2013-02-27 11:58 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:04 ago)
Log Read Checkpoint File /u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt000000
First Record RBA 0
The status should be RUNNING.
Test Replication
On the source server, check the number of rows in table “test”:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
----------
9548
On the target server, check the number of rows in table “test”:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
----------
9548
On the source server, add some rows to table “test”. For example:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> insert into test(object_id,owner,object_name,object_type) select object_id,owner,object_name,object_type
from dba_objects where object_id between 10001 and 11000;
1000 rows created
SQL> commit;
Commit complete
On the source server check the number of rows in table Test:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
----------
10830
On the target server check the number of rows in table Test:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
----------
10830
The number of rows should be identical in both tables
Step by Step Procedure to Setup of the OGG Configuration & Tested with simple table in our test ENV, I Have used the below two machine in single instance Oracle DB 11g (11.2.0.4)
In the following configuration I have used the following Hosts and Databases Server:
Source DB:
SID: oggtest1
Hostname: ogg-test1
Target DB
SID: oggtest2
Hostname: ogg-test2
DB Setup - Enable Forced Logging
To check if FORCE_LOGGING is enabled in the source database use the below query:
[oracle@ogg-test1]$ !sq
SQL> SELECT force_logging FROM v$database;
FORCE_LOGGING
-------------
NO
If not enabled, then enable FORCE_LOGGING using:
[oracle@ogg-test1]$ !sq
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
Verify that FORCE_LOGGING has been enabled successfully using:
[oracle@ogg-test1]$ !sq
SQL> SELECT force_logging FROM v$database;
FORCE_LOGGING
-------------
YES
The documentation recommends performing a redo log switch to ensure that the change is applied in all subsequent redo.
[oracle@ogg-test1]$ !sq
SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.
Enable Minimal Supplemental Logging
OGG require enabling the minimal supplemental logging as the extract process will process to start, If not enabled, and then extract process will fails to start. By default the Oracle DB does not enable minimal supplemental during the creation of DB.
Therefore the Minimal supplemental logging only needs to be configured on the Source DB. It may be prudent to enable it on the Target DB as well.
Check if minimal supplemental logging is currently enabled:
[oracle@ogg-test1]$ !sq
SQL> SELECT supplemental_log_data_min FROM v$database;
SUPPLEMENTAL_LOG_DATA_MIN
-------------------------
NO
If not enabled then configure minimal supplemental logging:
[oracle@ogg-test1]$ !sq
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Database altered.
Verify that minimal supplemental logging is now enabled:
[oracle@ogg-test1]$ !sq
SQL> SELECT supplemental_log_data_min FROM v$database;
SUPPLEMENTAL_LOG_DATA_MIN
-------------------------
YES
Switch the log file again to ensure that all subsequent redo contains minimal supplemental logging:
[oracle@ogg-test1]$ !sq
SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.
Prepare Test Environment
Create Test User
In order to test the OGG Configuration created a new schema “mir” containing a new table “test” as follows.
The table is derived from DBA_OBJECTS.
In both databases (Source &Target DB) create a user (schema) called “mir”. For example:
[oracle@ogg-test1]$ !sq
SQL> CREATE USER mir IDENTIFIED BY mir;
User created.
In both databases grant the following permissions to the new user. For example:
[oracle@ogg-test1]$ !sq
SQL> grant connect, resource, dba to mir;
Grant succeeded.
It’s the test DB, security is not concern and therefore DBA privilege has been granted to the new user.
Create Test Table
In the source database (OGGTEST1) create the “test” table using a subset of rows from DBA_OBJECTS
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> create table test as select object_id, owner, object_name, object_type from dba_objects where object_id <= 10000;
Table created.
In the source database (OGGTEST1), add a primary key constraint and index to table “test”:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> ALTER TABLE test ADD CONSTRAINT test_id PRIMARY KEY (object_id);
Table altered.
Listener should be started before attempting to configure the network, ensure that the listener processes are running on both servers (ogg-test1 & ogg-test2)
[oracle@ogg-test1$ lsnrctl start
[oracle@ogg-test2]$ lsnrctl start
Configure Network
For network configuration, an entry is required in the “TNSNAMES.ORA” file on both the server describing the database on the other server.
On the source database (ogg-test1), added the following entry for the Target DB (OGGTEST2).
$ vi $ORACLE_HOME/network/admin/tnsnames.ora
# Source DB Config
OGGTEST1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ogg-test1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oggtest1)
(UR = A)
)
)
# Target DB Added to Sync
OGGTEST2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ogg-test2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oggtest2)
)
)
Verify the connection using SQL*Plus. For example:
[oracle@ogg-test1]$ sqlplus mir/mir@oggtest2
SQL> SELECT name FROM v$database;
NAME
---------
oggtest2
On the target DB (ogg-test2), I added the following entry for the Source DB (OGGTEST1).
$ vi $ORACLE_HOME/network/admin/tnsnames.ora
# Target DB
OGGTEST2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ogg-test2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oggtest2)
)
)
#Source DB Added to Sync
OGGTEST1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ogg-test1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oggtest1)
(UR = A)
)
)
Verify the connection using SQL*Plus. For example:
[oracle@ogg-test2]$ sqlplus mir/mir@oggtest1
SQL> SELECT name FROM v$database;
NAME
---------
OGGTEST1
Create Database Links
Note: DB Link it’s not require for OGG Setup, This is just to test the network functionality
On each server create a database link to the other database
On the source server (ogg-test1) as the “mir” user, create the following database link:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> Create database LINK oggtest2 connect to mir identified by mir using ‘OGGTEST2’;
On the target server (ogg-test2) as the mir user, create the following database link:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> Create database LINK oggtest1 connect to mir identified by mir using 'OGGTEST1';
Copy Test Data to Target DB; create an initial copy of the test data on the target database
In the target database (OGGTEST2), add a primary key constraint and index to table “test”:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> ALTER TABLE test ADD CONSTRAINT test_id PRIMARY KEY (object_id);
In the source database (OGGTEST1), verify the number of rows in the original table:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
--------
9830
In the target database, verify that there is the same number of rows in the new table:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
--------
9830
Note: The actual number of rows in table “TEST” should be identical for databases OGGTEST1 and OGGTEST2. However, it may vary in other databases
===================================
OGG (Oracle Goldengate Configuration)
===================================
Download the OGG Software & Copy to the linux machine
$ mkdir OGG_HOME
[oracle@ogg-test1 ~]$ cd /backup/OGG_HOME/
[oracle@ogg-test1 OGG_HOME]$ pwd
/backup/OGG_HOME
[oracle@ogg-test1 OGG_HOME]$ ls
fbo_ggs_Linux_x64_shiphome.zip
[oracle@ogg-test1 OGG_HOME]$ unzip fbo_ggs_Linux_x64_shiphome.zip
[oracle@ogg-test1 OGG_HOME]$ ls
fbo_ggs_Linux_x64_shiphome OGG-12.2.0.1.1-ReleaseNotes.pdf
fbo_ggs_Linux_x64_shiphome.zip OGG-12.2.0.1-README.txt
[oracle@ogg-test1 OGG_HOME]$ cd fbo_ggs_Linux_x64_shiphome/Disk1/
[oracle@ogg-test1 Disk1]$ ls
install response runInstaller stage
[oracle@ogg-test1 Disk1]$ ./runInstaller
(Select the Oracle Goldengate for Oracle Database 11g & Fallow the Instruction)
Note: Install this OGG into the New Location
[oracle@ogg-test1 ~]$ cd /u01/app/oracle/product/11.2.0/
[oracle@ogg-test1 11.2.0]$ pwd
/u01/app/oracle/product/11.2.0
[oracle@ogg-test1 11.2.0]$ mkdir ogg_home/
(After completion of the Installation, You can view the below OGG Files)
[oracle@ogg-test1 11.2.0]$ cd ogg_home/
[oracle@ogg-test1 ogg_home]$ ls
bcpfmt.tpl ddl_trace_on.sql freeBSD.txt marker_setup.sql
bcrypt.txt defgen ggcmd marker_status.sql
cachefiledump deinstall ggMessage.dat mgr
cfgtoollogs demo_more_ora_create.sql ggparam.dat notices.txt
checkprm demo_more_ora_insert.sql ggsci oggerr
chkpt_ora_create.sql demo_ora_create.sql ggserr.log OPatch
convchk demo_ora_insert.sql help.txt oraInst.loc
convprm demo_ora_lob_create.sql install oui
db2cntl.tpl demo_ora_misc.sql inventory params.sql
ddl_cleartrace.sql demo_ora_pk_befores_create.sql jdk prvtclkm.plb
ddl_create.sql demo_ora_pk_befores_insert.sql keygen prvtlmpg.plb
ddl_ddl2file.sql demo_ora_pk_befores_updates.sql label.sql prvtlmpg_uninstall.sql
ddl_disable.sql diagnostics libantlr3c.so remove_seq.sql
ddl_enable.sql dirbdb libdb-6.1.so replicat
ddl_filter.sql dirchk libgglog.so retrace
ddl_ora10.sql dircrd libggnnzitp.so reverse
ddl_ora10upCommon.sql dirdat libggparam.so role_setup.sql
ddl_ora11.sql dirdef libggperf.so sequence.sql
ddl_ora9.sql dirdmp libggrepo.so server
ddl_pin.sql dirout libicudata.so.48 sqlldr.tpl
ddl_remove.sql dirpcs libicudata.so.48.1 srvm
ddl_session1.sql dirprm libicui18n.so.48 tcperrs
ddl_session.sql dirrpt libicui18n.so.48.1 ucharset.h
ddl_setup.sql dirsql libicuuc.so.48 ulg.sql
ddl_status.sql dirtmp libicuuc.so.48.1 UserExitExamples
ddl_staymetadata_off.sql dirwlt libxerces-c.so.28 usrdecs.h
ddl_staymetadata_on.sql dirwww libxml2.txt zlib.txt
ddl_tracelevel.sql emsclnt logdump
ddl_trace_off.sql extract marker_remove.sql
Now Verify the GGSCI
[oracle@ogg-test1 ogg_home]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Dec 12 2015 00:54:38
Operating system character set identified as UTF-8.
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
GGSCI (ogg-test1) 1> create subdirs
Creating subdirectories under current directory /u01/app/oracle/product/11.2.0/ogg_home
Parameter files /u01/app/oracle/product/11.2.0/ogg_home/dirprm: already exists
Report files /u01/app/oracle/product/11.2.0/ogg_home/dirrpt: already exists
Checkpoint files /u01/app/oracle/product/11.2.0/ogg_home/dirchk: already exists
Process status files /u01/app/oracle/product/11.2.0/ogg_home/dirpcs: already exists
SQL script files /u01/app/oracle/product/11.2.0/ogg_home/dirsql: already exists
Database definitions files /u01/app/oracle/product/11.2.0/ogg_home/dirdef: already exists
Extract data files /u01/app/oracle/product/11.2.0/ogg_home/dirdat: already exists
Temporary files /u01/app/oracle/product/11.2.0/ogg_home/dirtmp: already exists
Credential store files /u01/app/oracle/product/11.2.0/ogg_home/dircrd: already exists
Masterkey wallet files /u01/app/oracle/product/11.2.0/ogg_home/dirwlt: already exists
Dump files /u01/app/oracle/product/11.2.0/ogg_home/dirdmp: already exists
GGSCI (ogg-test1) 1> show all
Parameter settings:
SET SUBDIRS ON
SET DEBUG OFF
Current directory: /u01/app/oracle/product/11.2.0/ogg_home
Using subdirectories for all process files
Editor: vi
Reports (.rpt) /u01/app/oracle/product/11.2.0/ogg_home/dirrpt
Parameters (.prm) /u01/app/oracle/product/11.2.0/ogg_home/dirprm
Replicat Checkpoints (.cpr) /u01/app/oracle/product/11.2.0/ogg_home/dirchk
Extract Checkpoints (.cpe) /u01/app/oracle/product/11.2.0/ogg_home/dirchk
Process Status (.pcs) /u01/app/oracle/product/11.2.0/ogg_home/dirpcs
SQL Scripts (.sql) /u01/app/oracle/product/11.2.0/ogg_home/dirsql
Database Definitions (.def) /u01/app/oracle/product/11.2.0/ogg_home/dirdef
Dump files (.dmp) /u01/app/oracle/product/11.2.0/ogg_home/dirdmp
Masterkey wallet files (.wlt) /u01/app/oracle/product/11.2.0/ogg_home/dirwlt
Credential store files (.crd) /u01/app/oracle/product/11.2.0/ogg_home/dircrd
GGSCI (ogg-test1) 2> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING ---- Default the Manager Port is assign as 7809 & it will be in running state
GGSCI (ogg-test1) 2> exit
[oracle@ogg-test1 ogg_home]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Jun 17 15:37:19 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SELECT log_mode FROM v$database;
LOG_MODE
------------
ARCHIVELOG
SQL> SELECT force_logging, supplemental_log_data_min FROM v$database;
FOR SUPPLEME
--- --------
YES IMPLICIT
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
Database altered.
SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.
SQL> SELECT force_logging, f_min FROM v$database;
FOR SUPPLEME
--- --------
YES YES
SQL> alter system set ENABLE_GOLDENGATE_REPLICATION=true scope=both;
System altered.
[oracle@ogg-test1 ogg_home]$ ./ggsci
GGSCI (ogg-test1) 1> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
[oracle@ogg-test1 ogg_home]$ !sq
SQL> @role_setup.sql;
GGS Role setup script
This script will drop and recreate the role GGS_GGSUSER_ROLE
To use a different role name, quit this script and then edit the params.sql script to change the gg_role parameter to the preferred name. (Do not run the script.)
You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
Enter GoldenGate schema name:mir
Wrote file role_setup_set.txt
PL/SQL procedure successfully completed.
Role setup script complete
Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:
GRANT GGS_GGSUSER_ROLE TO <loggedUser>
where <loggedUser> is the user assigned to the GoldenGate processes.
Successfully logged into database
-----------------------------------------------Hence the Setup is done --------------------------------------
[oracle@ogg-test1$ !sq
SQL> CREATE USER mir IDENTIFIED BY mir;
User created.
On each server grant DBA role to the GoldenGate schema owner
[oracle@ogg-test1]$ !sq
SQL> grant connect, resource, dba to mir;
Grant succeeded.
On each server set the GGSCHEMA in the global parameter file.
[oracle@ogg-test1]$ cd /u01/app/oracle/product/11.2.0/ogg_home/
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> EDIT PARAMS ./GLOBALS
GGSCHEMA mir
:wq!
Create GoldenGate Tablespace
On the source server create a new tablespace for the GoldenGate objects. Ensure that AUTOEXTEND is enabled
[oracle@ogg-test1]$ !sq
SQL> CREATE TABLESPACE goldengate datafile '/u01/app/oracle/oradata/oggtest1/goldengate01.dbf' size 100m autoextend on;
Tablespace created
Set the new tablespace as the default for the GoldenGate user:
[oracle@ogg-test1]$ !sq
SQL> ALTER USER mir DEFAULT TABLESPACE goldengate;
User altered
On the target server create a new tablespace for the Goldengate objects. Again ensure that AUTOEXTEND is enabled.
[oracle@ogg-test2]$ !sq
SQL> CREATE TABLESPACE goldengate datafile '/oradata/datafiles/goldengate01.dbf' size
100m autoextend on;
Tablespace created.
Set the new tablespace as the default for the GoldenGate user:
[oracle@ogg-test2]$ !sq
SQL> ALTER USER mir DEFAULT TABLESPACE goldengate;
User altered.
Run Role Setup script
On the source server run the Role setup script. Specify the GoldenGate schema name when prompted.
[oracle@ogg-test1]$ !sq
SQL> @role_setup;
GGS Role setup script
This script will drop and recreate the role GGS_GGSUSER_ROLE
To use a different role name, quit this script and then edit the params.sql script to change the gg_role parameter to the preferred name. (Do not run the script.)
You will be prompted for the name of a schema for the GoldenGate database objects.
NOTE: The schema must be created prior to running this script.
NOTE: Stop all DDL replication before starting this installation.
Enter GoldenGate schema name: mir
Wrote file role_setup_set.txt
PL/SQL procedure successfully completed.
Role setup script complete
Grant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:
GRANT GGS_GGSUSER_ROLE TO where is the user assigned to the GoldenGate processes, On the source server grant GGS_GGSUSER_ROLE to the GoldenGate user:
[oracle@ogg-test1]$ !sq
SQL> grant GGS_GGSUSER_ROLE to mir;
Grant succeeded.
Configure Manager Parameters; on both servers configure the MGR parameters:
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> edit params mgr
PORT 7809
DYNAMICPORTLIST 7810-7820
:wq!
Configure Extract Parameters
In this example the extract process will be called "ex1", on the source server, create the parameter file for Extract ex1:
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> EDIT PARAMS ex1
EXTRACT ex1
USERID mir, PASSWORD mir
EXTTRAIL /u01/app/oracle/product/11.2.0/ogg_home/dirdat/ex
TABLE test.*;
Configure Data Pump Parameters; in this example the Data Pump process will be called dp1
On the source server create the parameter file for Data Pump process dp1:
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> EDIT PARAMS dp1
EXTRACT dp1
USERID mir, PASSWORD mir
RMTHOST ogg-test2, MGRPORT 7809
RMTTRAIL /u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt
TABLE test.*;
Create Check Point Table
The check point table should be created in the target database, on the target server login as the “mir” user and add the check point table:
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 1> dblogin userid mir, password mir
Successfully logged into database
GGSCI (ogg-test2) 2> ADD CHECKPOINTTABLE mir.checkpointtable
Successfully created checkpoint table mir.checkpointtable, the name of the check point table must be added to the GLOBALS file on the target server.
On the target server edit the GLOBALS file
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 1> EDIT PARAMS ./GLOBALS
GGSCHEMA gg01
CHECKPOINTTABLE gg01.checkpointtable
:wq!
Configure Replication Parameters
On the target server create the parameter file for replication process rep1:
[oracle@ogg-test2]$ ggsci
GGSCI (ogg-test2) 1> EDIT PARAMS rep1
REPLICAT rep1
USERID gg01, PASSWORD gg01
ASSUMETARGETDEFS
DISCARDFILE /u01/app/oracle/product/11.2.0/ogg_home/discards, PURGE
MAP test.*, TARGET test.*;
The above command created the file /u01/app/oracle/product/11.2.0/ogg_home/dirprm/rep1.prm
Add the following parameters to the new file:
Note that the DISCARDFILE parameter includes the PURGE keyword. If PURGE is not specified them the replication process will fail the second time it is started. Alternatively use the APPEND keyword to append output to the existing file.
Configure Supplemental Logging for Replicated Tables
On the source server configure supplemental logging for all tables that will be replicated. In this example there is only one table (Test)
Supplemental logging can be configured by any user that has privileges to modify the underlying database table.
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> dblogin userid mir, password mir
Successfully logged into database
GGSCI (vm4) 2> ADD TRANDATA mir.test
Logging of supplemental redo data enabled for table mir.test.
Add the Extract Process
On the source server add the Extract process (ex1)
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> ADD EXTRACT ex1,
EXTRACT added.
Add the Extract Trail
On the source server add the Extract trail (//u01/app/oracle/product/11.2.0/ogg_home/goldengate/dirdat/ex)
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> ADD EXTTRAIL /u01/app/oracle/product/11.2.0/ogg_home/dirdat/ex, EXTRACT ex1
EXTTRAIL added.
Add the Data Pump Process; on the source server add the Data Pump process (dp1)
[oracle@ogg-test]$ ./ggsci
GGSCI (ogg-test1) 1> ADD EXTRACT dp1 EXTTRAILSOURCE
/u01/app/oracle/product/11.2.0/ogg_home/dirdat/ex
EXTRACT added.
Add the Data Pump Trail
On the source server add the Data Pump trail (/u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt). This trail is created on the target server. However, the name is required in order to set up the Data Pump process on the source server.
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> ADD RMTTRAIL /u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt,
EXTRACT dp1
RMTTRAIL added.
Add the Replication Process; On the target server add the Replication process (rep1)
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 1> ADD REPLICAT rep1, EXTTRAIL
/u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt
REPLICAT added.
Start GoldenGate Process
Start Manager
On the source server, start the GoldenGate manager:
[oracle@ogg-test1]$ ggsci
GGSCI (ogg-test1) 1> start mgr/manager
Manager started.
On the target server, start the GoldenGate manager:
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 1> start mgr/manager
Manager started.
Start Extract Process
On the source server start the Extract (ex1)
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 1> START EXTRACT ex1
Sending START request to MANAGER
EXTRACT EX1 starting
Verify that the Extract has started successfully using INFO EXTRACT:
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 10> INFO EXTRACT ex1
EXTRACT EX1 Last Started 2013-02-27 12:57 Status RUNNING
Checkpoint Lag 00:00:24 (updated 00:00:05 ago)
Log Read Checkpoint Oracle Redo Logs
2013-02-27 12:57:01 Seqno 6, RBA 30736
SCN 0.0 (0)
The status should be RUNNING.
Start Data Pump Process, On the source server, start the Data Pump (dp1):
[oracle@ogg-test1]$ ./ggsci
GGSCI (ogg-test1) 3> START EXTRACT dp1
Sending START request to MANAGER
EXTRACT DP1 starting
Verify that the Data Pump has started successfully using INFO EXTRACT:
[oracle@ogg-test1]$./ggsci
GGSCI (ogg-test1) 2> INFO EXTRACT dp1
EXTRACT DP1 Last Started 2013-02-27 11:57 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Log Read Checkpoint File /u01/app/oracle/product/11.2.0/ogg_home/dirdat/ex000000
First Record RBA 0
The status should be RUNNING.
Start Replication Process, on the target server, start the Replicat process (rep1):
[oracle@ogg-test2]$./ggsci
GGSCI (ogg-test2) 1> START REPLICAT rep1
Sending START request to MANAGER
REPLICAT REP1 starting
Verify that the Replicat process has started successfully using INFO EXTRACT:
[oracle@ogg-test2]$ ./ggsci
GGSCI (ogg-test2) 2> INFO REPLICAT rep1
REPLICAT REP1 Last Started 2013-02-27 11:58 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:04 ago)
Log Read Checkpoint File /u01/app/oracle/product/11.2.0/ogg_home/dirdat/rt000000
First Record RBA 0
The status should be RUNNING.
Test Replication
On the source server, check the number of rows in table “test”:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
----------
9548
On the target server, check the number of rows in table “test”:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
----------
9548
On the source server, add some rows to table “test”. For example:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> insert into test(object_id,owner,object_name,object_type) select object_id,owner,object_name,object_type
from dba_objects where object_id between 10001 and 11000;
1000 rows created
SQL> commit;
Commit complete
On the source server check the number of rows in table Test:
[oracle@ogg-test1]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
----------
10830
On the target server check the number of rows in table Test:
[oracle@ogg-test2]$ sqlplus mir/mir
SQL> select count(*) from test;
COUNT(*)
----------
10830
The number of rows should be identical in both tables
Hence completes the OGG configuration with Simple Test
Comments
Post a Comment