Install GG for Oracle on Linux:
1. unzip
2. mv to /u01/app/ggs
3. vi ~/.bash_profile
export PATH=$PATH:/u01/app/ggs
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/u01/app/ggs
export GG_HOME=/u01/app/ggs
4. Prep in Database
create tablespace ggadmin datafile '/u01/oradata/centos62/ggadmin01.dbf' size 200m;
create user ggadmin identified by ggadmin default tablespace ggadmin temporary tablespace temp;
alter user ggadmin default tablespace ggadmin;
grant DBA to ggadmin;
-- grant connect,resource to ggadmin;
-- grant select any dictionary, select any table to ggadmin;
-- grant create table to ggadmin;
-- grant flashback any table to ggadmin;
-- grant execute on dbms_flashback to ggadmin;
-- grant execute on utl_file to ggadmin;
SQL> SELECT supplemental_log_data_min, force_logging FROM v$database;
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
SQL> ALTER DATABASE FORCE LOGGING;
ALTER SYSTEM SET ENABLE_GOLDENGATE_REPLICATION=true;
5. GGSCI 1> DBLOGIN USERID ggadmin, PASSWORD ggadmin
6. EDIT PARAMS MGR
PORT 7809
USERID ggadmin, PASSWORD ggadmin
PURGEOLDEXTRACTS /u01/app/ggs/dirdat/ex, USECHECKPOINTS
7. checkpoint table
GGSCI (devu007) 2> EDIT PARAMS ./GLOBALS
GGSCHEMA GGADMIN
CHECKPOINTTABLE GGADMIN.CHKPTAB
GGSCI (devu007) 4> DBLOGIN USERID ggadmin, PASSWORD ggadmin
Successfully logged into database.
GGSCI (devu007) 6> ADD CHECKPOINTTABLE GGADMIN.CHKPTAB
8. Use user scott/scott as test schema:
alter user scott identified by scott account unlock;
9.CREATE TABLE cust
( customer_id number(10) NOT NULL,
customer_name varchar2(50),
city varchar2(50),
CONSTRAINT customers_pk PRIMARY KEY (customer_id)
);
10. Extract EXT_1
ADD EXTRACT ext_1, INTEGRATED TRANLOG, BEGIN now
ADD EXTTRAIL dirdat/e1, EXTRACT ext_1
REGISTER EXTRACT ext_1, DATABASE
-- Identify the Extract group:
EXTRACT ext_1
-- Specify database login information as needed for the database:
USERID ggadmin, PASSWORD ggadmin
-- Specify the local trail that this Extract writes to
-- and the encryption algorithm:
-- ENCRYPTTRAIL algorithm
EXTTRAIL dirdat/e1
-- Exclude Replicat transactions. Uncomment ONE of the following:
-- DB2 z/OS, DB2 LUW, DB2 IBM i, Oracle (classic capture), and
-- Sybase:
-- TRANLOGOPTIONS EXCLUDEUSER Replicat_user
-- Oracle (classic capture) alternative to EXCLUDEUSER:
-- EXCLUDEUSERID Oracle_uid
-- Oracle integrated capture:
TRANLOGOPTIONS EXCLUDETAG 02
-- SQL Server and Sybase:
-- TRANLOGOPTIONS EXCLUDETRANS transaction_name
-- SQL/MX:
-- TRANLOGOPTIONS FILTERTABLE checkpoint_table_name
-- Teradata:
-- SQLEXEC 'SET SESSION OVERRIDE REPLICATION ON;'
-- SQLEXEC 'COMMIT;'
-- Specify API commands if Teradata:
-- VAM library name, PARAMS ('param' [, 'param'] [, ...])
-- Capture before images for conflict resolution:
-- ------------------Improtant FOR CDR
-- GETBEFORECOLS(ON UPDATE ALL)
-- GETBEFORECOLS(ON DELETE ALL)
-- Log all scheduling columns for CDR and if using integrated Replicat
LOGALLSUPCOLS
-- Specify tables to be captured and (optional) columns to fetch:
TABLE scott.cust;
11. Pump Pump_1
ADD EXTRACT pump_1, EXTTRAILSOURCE dirdat/e1, BEGIN now
ADD RMTTRAIL dirdat/r1, EXTRACT pump_1
-- Identify the data pump group:
EXTRACT pump_1
-- Specify database login information as needed for the database:
USERID ggadmin, PASSWORD ggadmin
-- Decrypt the data only if the data pump must process it.
-- DECRYPTTRAIL
-- Specify the name or IP address of the secondary system
-- and optional encryption of data over TCP/IP:
RMTHOST 192.168.137.63, MGRPORT 7809
-- Specify remote trail and encryption algorithm on secondary system:
-- ENCRYPTTRAIL algorithm
RMTTRAIL dirdat/r1
-- Pass data through without mapping, filtering, conversion:
PASSTHRU
-- Specify tables to be captured:
TABLE scott.cust;
12. Replicat 1
ADD REPLICAT rep_1, INTEGRATED , EXTTRAIL dirdat/r1, BEGIN now
-- Identify the Replicat group:
REPLICAT rep_1
-- State that source and target definitions are identical:
ASSUMETARGETDEFS
-- Specify database login information as needed for the database:
USERID ggadmin, PASSWORD ggadmin
-- Specify error handling rules:
-- REPERROR (error, response)
-- Set redo tag for Oracle only replicat via settag
-- Default is 00.
DBOPTIONS SETTAG 01
-- Specify tables for delivery, threads if coordinated Replicat
-- and conflict-resolution:
MAP scott.cust, TARGET scott.cust;
-- Specify mapping of exceptions to exceptions table:
-- MAP [container.|catalog.]owner.*, TARGET owner.exceptions, EXCEPTIONSONLY;
13. Extract EXT_2
ADD EXTRACT ext_2, INTEGRATED TRANLOG, BEGIN now
ADD EXTTRAIL dirdat/e2, EXTRACT ext_2
REGISTER EXTRACT ext_2, DATABASE
-- Identify the Extract group:
EXTRACT ext_2
-- Specify database login information as needed for the database:
USERID ggadmin, PASSWORD ggadmin
-- Specify the local trail that this Extract writes to
-- and the encryption algorithm:
-- ENCRYPTTRAIL algorithm
EXTTRAIL dirdat/e2
-- Exclude Replicat transactions. Uncomment ONE of the following:
-- DB2 z/OS, DB2 LUW, DB2 IBM i, Oracle, and Sybase:
-- TRANLOGOPTIONS EXCLUDEUSER Replicat_user
-- Oracle alternative to EXCLUDEUSER:
-- EXCLUDEUSERID Oracle_uid
-- Oracle integrated capture:
TRANLOGOPTIONS EXCLUDETAG 01
-- SQL Server and Sybase:
-- TRANLOGOPTIONS EXCLUDETRANS transaction_name
-- SQL/MX:
-- TRANLOGOPTIONS FILTERTABLE checkpoint_table_name
-- Teradata:
-- SQLEXEC 'SET SESSION OVERRIDE REPLICATION ON;'
-- SQLEXEC 'COMMIT;'
-- Oracle:
-- TRACETABLE trace_table_name
-- Log all scheduling columns for CDR and if using integrated Replicat
LOGALLSUPCOLS
-- Capture before images for conflict resolution:
-- GETBEFORECOLS(ON UPDATE ALL, ON DELETE ALL)
-- Specify tables to be captured and (optional) columns to fetch:
TABLE scott.cust;
14. Pump pump_2
ADD EXTRACT pump_2, EXTTRAILSOURCE dirdat/e2, BEGIN now
ADD RMTTRAIL dirdat/r2, EXTRACT pump_2
-- Identify the data pump group:
EXTRACT pump_2
-- Specify database login information as needed for the database:
USERID ggadmin, PASSWORD ggadmin
-- Decrypt the data only if the data pump must process it.
-- DECRYPTTRAIL
-- Specify the name or IP address of the primary system
-- and optional encryption of data over TCP/IP:
RMTHOST 192.168.137.62, MGRPORT 7809
-- Specify the remote trail and encryption algorithm on the primary system:
-- ENCRYPTTRAIL algorithm
RMTTRAIL dirdat/r2
-- Pass data through without mapping, filtering, conversion:
PASSTHRU
-- Specify tables to be captured:
TABLE scott.cust;
15. Replicat rep_2
ADD REPLICAT rep_2, INTEGRATED , EXTTRAIL dirdat/r2, BEGIN now
-- Identify the Replicat group:
REPLICAT rep_2
-- State that source and target definitions are identical:
ASSUMETARGETDEFS
-- Specify database login information as needed for the database:
USERID ggadmin, PASSWORD ggadmin
-- Specify error handling rules:
-- REPERROR (error, response)
DBOPTIONS SETTAG 02
-- Specify tables for delivery, threads if coordinated Replicat
-- and conflict-resolution:
MAP scott.cust, TARGET scott.cust;
-- Specify mapping of exceptions to exceptions table:
-- MAP [container.|catalog.]owner.*, TARGET owner.exceptions, EXCEPTIONSONLY;
16. Test: select * from cust;
insert into cust values (1, 'test1', 'city1');
insert into cust values (2, 'test2', 'city2');
insert into cust values (3, 'test3', 'insert on Primary, not commit');
insert into cust values (4, 'test4', 'insert on Secondary, not commit');