Goldengate Implementing Oracle for Oracle One-way DDL operation synchronization

Source: Internet
Author: User
Tags truncated sqlplus

In the http://lqding.blog.51cto.com/9123978/1695162 article we implemented the DML operation synchronization of the table.

We do the following tests

Truncate on the source side of the execution table

sql> truncate TABLE Tcustmer; Table truncated.

On the destination, view the table data

Sql> Select COUNT (*) from Tcustmer; COUNT (*)----------2

Data is not synchronized

How do we get goldengate to synchronize DDL operations?

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/47/wKiom1X5El_gBw_RAAHAw9lr7eI581.jpg "title=" ogg07. PNG "alt=" Wkiom1x5el_gbw_raahaw9lr7ei581.jpg "/>


To support DDL synchronization, you need to make some settings on the source database so that DDL operations can be traced. Includes the following trigger, marker, and history table, a user role, and a variety of other database objects.


    1. First configure the Globals parameter to tell GG to use that schema to store DDL operations.

Ggsci (localhost.localdomain) 19> edit params./globals--GoldenGate GLOBALS parameter File--ggschema ggddl


2. Create a GGDDL user with Sqlplus and install DDL support

Sql> conn/as sysdbaconnected.sql> Create user ggddl identified by GGDDL; User created. Sql> Grant Connect,resource to GGDDL; Grant succeeded.


Turn off the data Recycle Bin feature

sql> ALTER SYSTEM SET recyclebin = OFF scope=spfile; System altered. Sql> Startup Forceoracle instance started. Total System Global area 835104768 bytesfixed size 2217952 bytesvariable size 574621728 bytesdatabase buffers 255852 544 Bytesredo buffers 2412544 bytesdatabase mounted. Database opened.

Run Marker_setup.sql (ogg's installation directory, enter Sqlplus)

[[email protected] ogg]$ sqlplus / as sysdbasql*plus: release  11.2.0.1.0 production on fri sep 11 19:58:40 2015copyright  (c)   1982, 2009, oracle.  all rights reserved. connected to:oracle database 11g enterprise edition release 11.2.0.1.0  - 64bit productionwith the partitioning, olap, data mining and  Real Application Testing optionsSQL>  @marker_setup .sqlmarker setup  Scriptyou will be prompted for the name of a schema for  the oracle goldengate database objects. note: the schema must be created prior to running this  Script. Note: stop all ddl replication before starting this installation. Enter oracle goldengate schema name:ggddlmarker setup table script complete,  Running verification script ... please enter the name of a schema for the goldengate  database objects:setting schema name to ggddlmarker  TABLE-------------------------------okmarker sequence-------------------------------okscript  Complete.

Enter the name of the Ggschema in the popup dialog box


Run Ddl_setup.sql

sql> @ddl_setup. sql


Run Role_setup.sql

sql>  @role_setup. Sqlggs role setup scriptthis script will drop and  recreate the role ggs_ggsuser_roleto 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:ggddlwrote file role_setup_set.txtpl/sql procedure  successfully completed. Role setup script completegrant 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.

After creating the role, it is not to give the role to the GGDDL user, but to give the role to the schema used by Extract,replicat.

We previously configured the system user

Sql> GRANT ggs_ggsuser_role to System; Grant succeeded.


Enabling DDL is actually making trigger enable

Sql> @ddl_enable. Sqltrigger altered.


Close Manager,extract,replicat

Source-side

Ggsci (localhost.localdomain) 1> stop Extract Eorakkggsci (localhost.localdomain) 5> stop MGR!

Destination End

Ggsci (localhost.localdomain) 1> stop Replicat rorakksending stop request to Replicat Rorakk ... Request processed. Ggsci (Localhost.localdomain) 2> stop Manager


Edit Extract Parameters

Ggsci (localhost.localdomain) 5> edit params eorakk----Change Capture parameter file to capture--Tcustmer and Tcustor D changes--extract eorakkuserid System, PASSWORD oraclermthost 192.168.199.104, Mgrport 7809EXTTRAIL./dirdat/kkddl INCLUDE alltable SCOTT. Tcustmer; TABLE SCOTT. Tcustord;

Add a line of DDL include all on the original basis


Edit Replicat Parameters

Ggsci (localhost.localdomain) 4> edit params rorakk----Change Delivery parameter file to apply--Tcustmer and Tcustor D changes--replicat rorakkuserid System, PASSWORD oraclehandlecollisionsassumetargetdefsdiscardfile./dirrpt/RORAKK. DSC, Purgeddl INCLUDE mappedmap scott.tcustmer, TARGET Scott.tcustmer; MAP Scott.tcustord, TARGET Scott.tcustord;

Add a line of DDL INCLUDE MAPPED on the original basis


Start manager, Extract, Replicat

Source-side

Ggsci (Localhost.localdomain) 6> start Managermanager started. Ggsci (Localhost.localdomain) 7> start extract eorakksending start request to MANAGER ... EXTRACT Eorakk Starting


Destination End

Ggsci (Localhost.localdomain) 5> start Mgrmanager started. Ggsci (Localhost.localdomain) 16> start Replicat rorakksending start request to MANAGER ... Replicat Rorakk Starting


Validating data

Source-side

sql> truncate TABLE Tcustmer; Table truncated.    sql> desc tcustmer Name Null? Type-----------------------------------------------------------------------------cust_code not NULL VARCHAR2 (4) NAME VARCHAR2 (VARCHAR2) state CHAR (2) sql> ALTER TABLE Tcustmer add STATE_DESC varchar2 (30); Table altered.

Destination End

Sql> SELECT * from tcustmer;no rows selectedsql> desc tcustmer Name Null? Type-----------------------------------------------------------------------------cust_code not NULL VARCHAR2 (4) NAME VARCHAR2 (VARCHAR2) state CHAR (2) State_desc VARCHAR2 (30)


The data is synchronized.



This article is from the "Ding Dong" blog, please be sure to keep this source http://lqding.blog.51cto.com/9123978/1695389

Goldengate Implementing Oracle for Oracle One-way DDL operation synchronization

Related Article

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.