Use GoldenGate to implement one-way data synchronization of OracleforOracle

Source: Internet
Author: User
Use GoldenGate to implement one-way data synchronization of OracleforOracle

Use GoldenGate to implement one-way Data Synchronization for Oracle

Lab Environment

Data Source end: host1 ip 192.168.199.163

Data destination: host2 ip 192.168.199.104

The installation of both machines describes that GoldenGate has been installed and configured.

To synchronize data, the Oracle source must meet the following requirements:

Oracle needs to run in archive Mode

SQL> startup mount
ORACLE instance started.

Total System Global Area 835104768 bytes
Fixed Size 2217952 bytes
Variable Size 574621728 bytes
Database Buffers 255852544 bytes
Redo Buffers 2412544 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

2. Enable log additional attributes

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

Database altered.

SQL> ALTER SYSTEM SWITCH LOGFILE;

System altered.

The ogg installation directory provides demo SQL

[Oracle @ localhost ogg] $ ls demo_ora _*
Demo_ora_create. SQL demo_ora_insert. SQL demo_ora_lob_create. SQL demo_ora_misc. SQL demo_ora_pk_befores_create. SQL demo_ora_pk_befores_updates. SQL

We use demo_ora_create. SQL to create two tables at both the source and destination, and use demo_ora_insert. SQL to insert data at the source.

Host1

SQL> alter user scott identified by tiger account unlock;

User altered.

SQL> grant resource to scott; # This permission is required when ggsci logs on to the database.
Grant succeeded.

SQL> grant select any dictionary to scott; # This permission is required when you add trandata.

Grant succeeded.
SQL> conn scott/tiger
Connected.
SQL> @ demo_ora_create. SQL
SQL> @ demo_ora_insert. SQL

Host2

SQL> alter user scott identified by tiger account unlock;

User altered.
SQL> grant resource to scott; # This permission is required when ggsci logs on to the database.
Grant succeeded.

SQL> grant select any dictionary to scott; # This permission is required when you add trandata.
SQL> conn scott/tiger
Connected.
SQL> @ demo_ora_create. SQL

Add additional logs for the table to be synchronized

GGSCI (localhost. localdomain) 1> dblogin userid scott, password tiger
Successfully logged into database.

GGSCI (localhost. localdomain) 2> add trandata scott. tcustmer

Logging of supplemental redo data enabled for table SCOTT. TCUSTMER.

GGSCI (localhost. localdomain) 3> add trandata scott. tcustord

Logging of supplemental redo data enabled for table SCOTT. TCUSTORD.

I. initialize and load data

Configure an initialize Extract in the source to synchronize existing data in the table.

1
2 GGSCI (localhost. localdomain) 7> add extract einiload, SOURCEISTABLE
EXTRACT added.

The add extract command is used to ADD an EXTRACT. EINILOAD is the group name of Extract. SOURCEISTABLE indicates that the data source is a table.

View Extract information

GGSCI (localhost. localdomain) 9> info extract *, TASKS

Extract einiload Initialized Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Not Available
First Record 0
Task SOURCEISTABLE

Configure capture parameters for initialization and Loading

GGSCI (localhost. localdomain) 10> edit params EINILOAD


--
-- GoldenGate Initial Data Capture
-- For TCUSTMER and TCUSTORD
--
EXTRACT EINILOAD
USERID system, PASSWORD "oracle"
RMTHOST 192.168.199.104, MGRPORT 7809
Rmttask replicat, GROUP RINILOAD
Table scott. TCUSTMER;
Table scott. TCUSTORD;

On the target end, configure a REPLICAT

1
2 GGSCI (localhost. localdomain) 2> add replicat riniload, SPECIALRUN
REPLICAT added.

View REPLICAT Information

GGSCI (localhost. localdomain) 4> info replicat *, tasks

Replicat riniload Initialized Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:02:50 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN

Configure Replicat Parameters

GGSCI (localhost. localdomain) 5> edit params riniload


--
-- GoldenGate Initial Load Delivery
--
REPLICAT RINILOAD
ASSUMETARGETDEFS
USERID system, PASSWORD "oracle"
DISCARDFILE./dirrpt/RINILOAD. dsc, PURGE
MAP scott. *, TARGET scott .*;

Start Extract

GGSCI (localhost. localdomain) 11> start extract einiload

Sending START request to MANAGER...
Extract einiload starting

View logs

GGSCI (localhost. localdomain) 21> view report einiload

If an error is reported, locate the cause and solve the problem.

Processing table SCOTT. TCUSTMER

Processing table SCOTT. TCUSTORD

**************************************** *******************************
* ** Run Time Statistics ***
**************************************** *******************************


Report at 16:23:40 (activity since 16:23:33)

Output to RINILOAD:

From Table SCOTT. TCUSTMER:
# Inserts: 2
# Updates: 0
# Deletes: 0
# Discards: 0
From Table SCOTT. TCUSTORD:
# Inserts: 2
# Updates: 0
# Deletes: 0
# Discards: 0


REDO Log Statistics
Bytes parsed 0
Bytes output 574

The log shows that data has been synchronized successfully.

Verify on the target database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.