Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ Using Oracle for Oracle GoldenGate to achieve a one-way data synchronization     - Fedora 22 Server how to upgrade to Fedora 23 Beta Server (Linux)

- Linux-du and df command (Linux)

- Ubuntu 15.04 and Ubuntu 14.04 installed Cinnamon 2.6 (Linux)

- Linux System Getting Started Learning: From VirtualBox from the client host access NAT (Linux)

- Preps - Print within the specified range of IP addresses (Linux)

- How to create a cloud encrypted file system in Linux systems (Linux)

- RHEL5 multipath configuration (Linux)

- Compile Android libwebcore.so error occurs when solving (Programming)

- Setting CentOS firewall open port (Linux)

- CentOS7 installation performance monitoring system (Server)

- MySQL various log summary (Database)

- Oracle 11g on Linux system boot from the startup settings (Database)

- Using IE can also be easily remotely control the computer (Linux)

- Ubuntu 14.04 to install Blender 2.71 (Linux)

- pkg-config to use (Linux)

- An Example of GoldenGate Extract Process Hang Problem Solving (Database)

- iOS persistence of data archiving NSKeyedArchiver (Programming)

- The direct insertion sort algorithm (Programming)

- How to extend / remove swap partitions (Linux)

- Nginx server load balancing dual-system availability (Server)

 
         
  Using Oracle for Oracle GoldenGate to achieve a one-way data synchronization
     
  Add Date : 2017-04-13      
         
       
         
  lab environment

Data source: host1 ip 192.168.199.163

Data sink: host2 ip 192.168.199.104

To achieve synchronization of data, Oracle source must meet the following set

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. Open the Log additional properties

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
 
Database altered.
 
SQL> ALTER SYSTEM SWITCH LOGFILE;
 
System altered.

Under ogg installation directory provides some demo of 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_insert.sql demo_ora_pk_befores_updates.sql

We use demo_ora_create.sql source and destination creates two tables in the data source using demo_ora_insert.sql insert.

host1

SQL> alter user scott identified by tiger account unlock;
 
User altered.
 
The permissions required to log #ggsci database; SQL> grant resource to scott
Grant succeeded.
 
SQL> grant select any dictionary to scott; requires the permissions # 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.
The permissions required to log #ggsci database; SQL> grant resource to scott
Grant succeeded.
 
SQL> grant select any dictionary to scott; requires the permissions # add trandata
SQL> conn scott / tiger
Connected.
SQL> @ demo_ora_create.sql

The need to synchronize the table, add an additional log

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.

First, load the data initialization

In a source-side configuration initialization Extract, used to synchronize the existing data in the table

1
2 GGSCI (localhost.localdomain) 7> ADD EXTRACT EINILOAD, SOURCEISTABLE
EXTRACT added.

ADD EXTRACT command to add an EXTRACT, EINILOAD to Extract the group name. SOURCEISTABLE indicates that the data source for the table.

See Extract information

GGSCI (localhost.localdomain) 9> INFO EXTRACT *, TASKS
 
EXTRACT EINILOAD Initialized 2015-09-11 15:25 Status STOPPED
Checkpoint Lag Not Available
Log Read Checkpoint Not Available
                    First Record Record 0
Task SOURCEISTABLE

Configure the capture parameters for initial 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;

The target side, a configuration 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 2015-08-22 14:18 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:02:50 ago)
Log Read Checkpoint Not Available
Task SPECIALRUN

Configuration parameters Replicat

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 Log

GGSCI (localhost.localdomain) 21> view report einiload

If there is an error, find out the reasons and solve

Processing table SCOTT.TCUSTMER
 
Processing table SCOTT.TCUSTORD
 
************************************************** *********************
* ** Run Time Statistics ** *
************************************************** *********************
 
 
Report at 2015-09-11 16:23:40 (activity since 2015-09-11 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

Log display has been successfully synchronized data.

To verify the destination library

SQL> select count (*) from tcustmer;
 
  COUNT (*)
----------
    2
 
SQL> select count (*) from tcustord;
 
  COUNT (*)
----------
    2

Second, real-time synchronization of configuration data

Source, configure a real-time Extract

GGSCI (localhost.localdomain) 22> ADD EXTRACT EORAKK, TRANLOG, BEGIN NOW, THREADS 1
EXTRACT added.

Edit Extract parameter file

GGSCI (localhost.localdomain) 23> EDIT PARAMS EORAKK
 
 
-
- Change Capture parameter file to capture
- TCUSTMER and TCUSTORD Changes
-
EXTRACT EORAKK
USERID system, PASSWORD oracle
RMTHOST 192.168.199.104, MGRPORT 7809
RMTTRAIL ./dirdat/KK
TABLE SCOTT.TCUSTMER;
TABLE SCOTT.TCUSTORD;

Add to Extract distal tail file, that is to say the tail file is generated at the destination.

GGSCI (localhost.localdomain) 24> ADD RMTTRAIL ./dirdat/KK, EXTRACT EORAKK, MEGABYTES 5
RMTTRAIL added.

Validation results

GGSCI (localhost.localdomain) 28> INFO RMTTRAIL *
 
      Extract Trail: ./dirdat/KK
            Extract: EORAKK
              Seqno: 0
                RBA: 0
          File Size: 5M

Start Extract Process

GGSCI (localhost.localdomain) 29> start extract eorakk
 
Sending START request to MANAGER ...
EXTRACT EORAKK starting

Validation results

GGSCI (localhost.localdomain) 30> INFO EXTRACT EORAKK, DETAIL
 
EXTRACT EORAKK Last Started 2015-09-11 17:07 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:01 ago)
Log Read Checkpoint Oracle Redo Logs
                    2015-09-11 17:07:47 Thread 1, Seqno 25, RBA 36139008
                    SCN 0.1174781 (1174781)
 
  Target Extract Trails:
 
  Remote Trail Name Seqno RBA Max MB
 
  ./dirdat/KK 0 1050 5
 
  Extract Source Begin End
 
  /u01/app/oracle/oradata/orcl/redo01.log 2015-09-11 16:58 2015-09-11 17:07
  Not Available * Initialized * 2015-09-11 16:58
 
 
Current directory / u01 / app / ogg
 
Report file /u01/app/ogg/dirrpt/EORAKK.rpt
Parameter file /u01/app/ogg/dirprm/eorakk.prm
Checkpoint file /u01/app/ogg/dirchk/EORAKK.cpe
Process file /u01/app/ogg/dirpcs/EORAKK.pce
Stdout file /u01/app/ogg/dirout/EORAKK.out
Error log /u01/app/ogg/ggserr.log

GGSCI (localhost.localdomain) 31> VIEW REPORT EORAKK

GGSCI (localhost.localdomain) 32> INFO ALL
 
Program Status Group Lag at Chkpt Time Since Chkpt
 
MANAGER RUNNING
EXTRACT RUNNING EORAKK 00:00:00 00:00:06

Target end configuration REPLICAT

Installation checkpoint table

Configuration name checkpoint table

GGSCI (localhost.localdomain) 33> EDIT PARAMS ./GLOBALS
 
 
HECKPOINTTABLE system.ggschkpt

Table generation checkpoint

GGSCI (localhost.localdomain) 1> DBLOGIN USERID system, PASSWORD oracle
Successfully logged into database.
 
GGSCI (localhost.localdomain) 2> ADD CHECKPOINTTABLE
 
No checkpoint table specified, using GLOBALS specification (system.ggschkpt) ...
 
Successfully created checkpoint table system.ggschkpt.
 
GGSCI (localhost.localdomain) 3>

Add Replicat

GGSCI (localhost.localdomain) 3> ADD REPLICAT RORAKK, EXTTRAIL ./dirdat/KK
REPLICAT added.

Create Replicat parameter file

GGSCI (localhost.localdomain) 4> EDIT PARAMS RORAKK
 
 
-
- Change Delivery parameter file to apply
- TCUSTMER and TCUSTORD Changes
-
REPLICAT RORAKK
USERID system, PASSWORD oracle
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/RORAKK.DSC, PURGE
MAP scott.tcustmer, TARGET scott.tcustmer;
MAP scott.tcustord, TARGET scott.tcustord;

Start Replicat

GGSCI (localhost.localdomain) 5> start replicat rorakk
 
Sending START request to MANAGER ...
REPLICAT RORAKK starting

Validation results

GGSCI (localhost.localdomain) 6> info replicat rorakk
 
REPLICAT RORAKK Last Started 2015-08-22 15:49 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:08 ago)
Log Read Checkpoint File ./dirdat/KK000000
                    First Record RBA 1050

Verification data synchronization

In the source database, run the following script, two tables insert, update, delete operations

[Oracle @ localhost ogg] $ sqlplus scott / tiger
 
SQL * Plus: Release 11.2.0.1.0 Production on Fri Sep 11 17:58:17 2015
 
Copyright (c) 1982, 2009, Oracle. All rights reserved.
 
 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
SQL> @ / u01 / app / ogg / demo_ora_misc.sql

View the source table

SQL> select count (*) from tcustmer;
 
  COUNT (*)
----------
    5
 
SQL> select count (*) from tcustord;
 
  COUNT (*)
----------
    3

View destination table

SQL> select count (*) from tcustmer;
 
  COUNT (*)
----------
    5
 
SQL> select count (*) from tcustord;
 
  COUNT (*)
----------
    3

Data synced
     
         
       
         
  More:      
 
- Nginx Proxy timeout Troubleshooting (Server)
- How to understand the difference between synchronous and asynchronous non-blocking blocking (Programming)
- MongoDB 2.6 deployment replica set + partitions (Database)
- RHEL6.4 one key installation Redmine (Linux)
- Linux operation and maintenance of the automated installation and deployment RHEL7.0 Cobbler (Linux)
- Python2.7.7 source code analysis (Programming)
- Figlet use (Linux)
- 4 lvcreate example commonly used commands (Linux)
- Attic-- delete duplicate data backup program (Linux)
- How to install Unbound and DNSCrypt in Archlinux (Server)
- To install the Ubuntu Touch emulator on Ubuntu (Linux)
- Linux kernel log --dmesg (Linux)
- Timeout control related to Python threads and a simple application (Programming)
- Go powerful development server simple example (Server)
- Linux cut Command Study Notes (Linux)
- Using IE can also be easily remotely control the computer (Linux)
- Linux Getting Started tutorial: Borrow Windows fonts in Ubuntu 14.10 (Linux)
- Java is simple to read and write HDFS Demo (Programming)
- Install Gnome Flashback Classic Desktop on Ubuntu 14.10 / Mint 7 (Linux)
- Linux to achieve a simple cp command (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.