Sunteți pe pagina 1din 13

Configuring an Oracle GoldenGate Downstream Integrated Extract/Replicat

This note describes the steps involved in configuring an Oracle GoldenGate replication environment using a Downstream Capture database.

Environment

 Source database: SOURCEDB (Oracle 12.1.0.2 two-node RAC database)


 Downstream Capture database: OGGDB (Oracle 12.1.0.2 single instance database)
 Target database: PRODDB (Oracle 12.1.0.2 single instance database)

In this example we will be deploying Integrated Extract in a downstream mining database using real-time mining.

For this we need to create standby redo logs so that the source database can use Oracle Data Guard redo transport to send redo to the
downstream mining database as it is written to the online redo log at the source.

 On the source database obtain the size and number of online redo log files

SQL> select group#,thread#,bytes/1048576 from v$log;

GROUP# THREAD# BYTES/1048576


---------- ---------- -------------
11 1 1000
12 1 1000
13 1 1000
14 1 1000
15 1 1000
16 1 1000
17 1 1000
18 1 1000
21 2 1000

How to configure a Downstream Capture database for Oracle GoldenGate Page 1


22 2 1000
23 2 1000
24 2 1000
25 2 1000
26 2 1000
27 2 1000
28 2 1000

16 rows selected.

On the Downstream Capture database, we will create standby redo log file groups. The size of the standby redo log file groups should be same as
the online redo log file and the number of standby redo log file groups needs to be one more in number than the number of online redo log file
groups.

So in this case we will create the Redo log files also of size 1000 MB and create 2 groups of Standby Redo log files with 9 members in each group
(8+1) and of size 1000 MB.

 On the source database enable supplemental logging as well as force logging if not already enabled.

SQL> SELECT supplemental_log_data_min, force_logging FROM v$database;

SUPPLEME FORCE_LOGGING
-------- ---------------------------------------
NO YES

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

Database altered.

 Create the Downstream Capture database via DBCA

Important – Redo log file size should be the same as the size of the Standby Redo Log file size

How to configure a Downstream Capture database for Oracle GoldenGate Page 2


Set the following parameters:

SGA_TARGET and SGA_MAX_SIZE – 8192M


Processes - 800
Streams_pool_size – 2048M

 Create the GoldenGate user in both the source as well as Downstream database

create user oggsuser identified by Oggsuser1


default tablespace users
temporary tablespace temp;

grant dba to oggsuser;

SQL> exec dbms_goldengate_auth.grant_admin_privilege ('OGGSUSER');

PL/SQL procedure successfully completed.

 On both the Source as well as Downstream Capture database add the following parameters

SQL> alter system set enable_goldengate_replication=TRUE scope=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(SOURCEDB,oggdb)' scope=both;

System altered.

Note - This should be the value of the parameter DB_UNIQUE_NAME

How to configure a Downstream Capture database for Oracle GoldenGate Page 3


 On the Source database set the LOG_ARCHIVE_DEST_2 parameter

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=oggdb ASYNC NOREGISTER


VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=oggdb' scope=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=enable scope=both;

System altered.

 Create the Standby Redo Log Files on the Downstream Capture database

Note since the Source database is a two node RAC cluster, we need to create two threads of Standby Log files

SQL>
alter database add standby logfile thread 1
group 29 size 1000m,
group 30 size 1000m,
group 31 size 1000m,
group 32 size 1000m,
group 33 size 1000m,
group 34 size 1000m,
group 35 size 1000m,
group 36 size 1000m,
group 37 size 1000m;

Database altered.

SQL> alter database add standby logfile thread 2


group 38 size 1000m,
group 39 size 1000m,
group 40 size 1000m,
group 41 size 1000m,

How to configure a Downstream Capture database for Oracle GoldenGate Page 4


group 42 size 1000m,
group 43 size 1000m,
group 44 size 1000m,
group 45 size 1000m,
group 46 size 1000m;

Database altered.

 Copy the password file from Source database $ORACLE_HOME/dbs to the $ORACLE_HOME/dbs directory on the server hosting the
OGGDB Downstream Capture database

 Create a separate directory which will hold the archive log files received from the Source database. The Downstream Capture database
will also generate some archive log files which are stored in the location specified by the parameter DB_RECOVERY_FILE_DEST

SQL> show parameter db_reco

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
db_recovery_file_dest string +BSCS_AUX_FRA
db_recovery_file_dest_size big integer 20G

ASMCMD> pwd
+BSCS_AUX_FRA/OGGDB/ARCHIVELOG

ASMCMD> ls
2015_12_08/

ASMCMD> mkdir REMOTE

ASMCMD> cd REMOTE

ASMCMD> pwd
+BSCS_AUX_FRA/OGGDB/ARCHIVELOG/REMOTE

How to configure a Downstream Capture database for Oracle GoldenGate Page 5


 On the Downstream Capture database set the parameters LOG_ARCHIVE_DEST_n

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=USE_RECOVERY_FILE_DEST


VALID_FOR=(ONLINE_LOGFILE,PRIMARY_ROLE)' scope=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='LOCATION=+BSCS_AUX_FRA/OGGDB/ARCHIVELOG/REMOTE


VALID_FOR=(STANDBY_LOGFILE,PRIMARY_ROLE)' scope=both;

System altered.

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_state_2=enable scope=both;

System altered.

 On the server hosting the Source database, $ORACLE_HOME/network/admin add the entries to the tnsnames.ora

SOURCEDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host01-scan)(PORT = 1524))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SOURCEDB)
)
)

OGGDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host02-scan)(PORT = 20070))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oggdb)
)

How to configure a Downstream Capture database for Oracle GoldenGate Page 6


)

 On the server hosting the Downstream database, $ORACLE_HOME/network/admin add the entries to the tnsnames.ora

OGGDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host02-scan)(PORT = 20070))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oggdb)
)
)

PRODDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host02-scan)(PORT = 20070))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = srv_PRODDB)
)
)

SOURCEDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host01-scan)(PORT = 1524))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SOURCEDB)
)
)

 Ensure that we are able to connect as the user OGGSUSER to both the source database as well as the Downstream Capture database on
server host01 and as user OGGSUSER to the Downstream Capture database, Target PRODDB database as well as the source SOURCEDB
database on server host02.

How to configure a Downstream Capture database for Oracle GoldenGate Page 7


 Query the V$ARCHIVE_DEST_STATUS view to check the status

SQL> select destination,status,error from v$archive_dest_status where rownum < 3;

DESTINATION
--------------------------------------------------------------------------------
STATUS ERROR
--------- -----------------------------------------------------------------

VALID

oggdb
VALID

 Configure the Oracle GoldenGate Credential Store

GGSCI (host02) 1> info credentialstore

Reading from ./dircrd/:

Default domain: OracleGoldenGate

Alias: oggsuser_PRODDB
Userid: oggsuser@PRODDB

GGSCI (host02) 2> alter credentialstore add user oggsuser@sourcedb alias oggsuser_sourcedb
Password:

Credential store in ./dircrd/ altered.

GGSCI (host02) 3> alter credentialstore add user oggsuser@oggdb alias oggsuser_oggdb
Password:

Credential store in ./dircrd/ altered.

How to configure a Downstream Capture database for Oracle GoldenGate Page 8


 Add schema level supplemental logging at the GoldenGate level

GGSCI (host02) 4> dblogin useridalias oggsuser_sourcedb


Successfully logged into database.

GGSCI (host02 as oggsuser@SOURCEDB) 6> add schematrandata SAPCD3

2015-12-08 04:33:54 INFO OGG-01788 SCHEMATRANDATA has been added on schema SAPCD3.

2015-12-08 04:35:45 INFO OGG-01976 SCHEMATRANDATA for scheduling columns has been added on schema
SAPCD3.

 Create the Extract, Pump and Replicat

GGSCI (host02) 1> dblogin useridalias oggsuser_sourcedb


Successfully logged into database.

GGSCI (host02 as oggsuser@SOURCEDB) 2> miningdblogin useridalias oggsuser_oggdb


Successfully logged into mining database.

GGSCI (host02 as oggsuser@SOURCEDB) 3> add extract eSOURCEDB integrated tranlog begin now
EXTRACT added.

GGSCI (host02 as oggsuser@SOURCEDB) 4> add exttrail ./dirdat/SOURCEDB/lt extract eSOURCEDB


EXTTRAIL added.

GGSCI (host02 as oggsuser@SOURCEDB) 5> add extract pSOURCEDB exttrailsource ./dirdat/SOURCEDB/lt


EXTRACT added.

GGSCI (host02 as oggsuser@SOURCEDB) 6> add rmttrail ./dirdat/SOURCEDB/rt extract pSOURCEDB


RMTTRAIL added.

How to configure a Downstream Capture database for Oracle GoldenGate Page 9


GGSCI (host02 as oggsuser@SOURCEDB) 7> register extract eSOURCEDB database
Extract ESOURCEDB successfully registered with database at SCN 261106958.

GGSCI (host02 as oggsuser@SOURCEDB) 12> add replicat rSOURCEDB integrated exttrail ./dirdat/SOURCEDB/rt
REPLICAT (Integrated) added.

Parameter files

EXTRACT eSOURCEDB

USERIDALIAS oggsuser_sourcedb

TRANLOGOPTIONS MININGUSERALIAS oggsuser_oggdb

TRANLOGOPTIONS INTEGRATEDPARAMS (downstream_real_time_mine Y)

EXTTRAIL ./dirdat/SOURCEDB/lt

TABLE SAPCD3.*;

EXTRACT pSOURCEDB

USERIDALIAS oggsuser_sourcedb

RMTHOST host02, MGRPORT 7809 TCPBUFSIZE 200000000, TCPFLUSHBYTES 200000000

RMTTRAIL ./dirdat/SOURCEDB/rt

PASSTHRU

TABLE SAPCD3.*;

REPLICAT rSOURCEDB
ASSUMETARGETDEFS

How to configure a Downstream Capture database for Oracle GoldenGate Page 10


USERIDALIAS oggsuser_PRODDB

MAP SAPCD3.*, TARGET SAPCD3.*;

 Check that the Capture process has been created in the Downstream database and not the Source database

SQL> conn oggsuser/Oggsuser1@SOURCEDB


Connected.

SQL> select capture_name from dba_capture;

no rows selected

SQL> conn oggsuser/Oggsuser1@oggdb


Connected.

SQL> select capture_name from dba_capture;

CAPTURE_NAME
--------------------------------------------------------------------------------
OGG$CAP_ESOURCEDB

 Start the Extract and Pump

GGSCI (host02 as oggsuser@SOURCEDB) 7> start extract eSOURCEDB

Sending START request to MANAGER ...


EXTRACT ESOURCEDB starting

GGSCI (host02 as oggsuser@SOURCEDB) 8> info eSOURCEDB

EXTRACT ESOURCEDB Last Started 2016-01-14 05:39 Status RUNNING


Checkpoint Lag 00:01:27 (updated 00:00:06 ago)

How to configure a Downstream Capture database for Oracle GoldenGate Page 11


Process ID 13840
Log Read Checkpoint Oracle Integrated Redo Logs
2016-01-14 05:38:34
SCN 0.315303022 (315303022)

GGSCI (host02 as oggsuser@sourcedb) 9> start pSOURCEDB

Sending START request to MANAGER ...


EXTRACT PSOURCEDB starting

GGSCI (host02 as oggsuser@SOURCEDB) 14> info pSOURCEDB

EXTRACT PSOURCEDB Last Started 2016-01-14 05:41 Status RUNNING


Checkpoint Lag 00:00:00 (updated 00:38:50 ago)
Process ID 16068
Log Read Checkpoint File ./dirdat/SOURCEDB/lt000000000
First Record RBA 0

 Take the Export from Source and Import into the Target database. Obtain the CURRENT_SCN from V$DATABASE.

[oracle@host01 ~]$ expdp directory=DATA_PUMP_DIR dumpfile=sapcd3.%U.dmp schemas=sapcd3 exclude=statistics


logfile=DATA_PUMP_DIR:exp_sapcd3.log flashback_scn=315304843 parallel=8

impdp directory=data_pump_dir dumpfile=sapcd3.%U.dmp parallel=8 full=y logfile=data_pump_dir:imp_sapcd3.log


remap_tablespace=PSAPSR3USR:PSAPSR3 remap_tablespace=PSAPSR3740:PSAPSR3
remap_tablespace=PSAPSR3740X:PSAPSR3

 After the Import is completed, start the Replicat process

GGSCI (host02 as oggsuser@SOURCEDB) 14> start rSOURCEDB aftercsn 315304843

Sending START request to MANAGER ...

How to configure a Downstream Capture database for Oracle GoldenGate Page 12


REPLICAT RSOURCEDB starting

GGSCI (host02 as oggsuser@SOURCEDB) 15> info rSOURCEDB

REPLICAT RSOURCEDB Last Started 2015-12-08 05:13 Status RUNNING


INTEGRATED
Checkpoint Lag 00:00:00 (updated 00:00:06 ago)
Process ID 37127
Log Read Checkpoint File ./dirdat/SOURCEDB/rt000000
First Record RBA 0

How to configure a Downstream Capture database for Oracle GoldenGate Page 13

S-ar putea să vă placă și