Sie sind auf Seite 1von 18

Index 1. Two. Download Golden Gate utility ............................................. ................................. 3 Three. Golden Gate Installation .............................................. ............................................. 6 April.

Preparing the database ............................................ ........................................ 7 May. Process 5.1. C ETTING THE M Anager P Rocess .................................................. ............................................. 13 5.2. C REATING TO EXTRACT DATA GROUP .................................................. ................................. 15 5.3. C REATING TO REPLICATE DATA GROUP .................................................. ................................ 17 5.4. C OMIENZO OF MINING AND REPLICATION .................................................. .............................. 18 June. DDL Synchronization ............................................... ............................................... 20
Page 2

Oracle Golden Gate Page 2 of 20 1. Intro In this paper it is to give a very brief varnish to know it's Oracle Golden Gate, his installation and basic form of use for replication of two Oracle environments, although its spectrum is much higher, but in this document does not show their real effects nor the

architectures that can be generated. What s Oracle Golden Gate? As it is a data replication tool in real time, origins that can unite many different engine data and replicate in other environments Also different is an N: N (eg Oracle9i on Linux and made it a replicating data in Sql * Server Windows 64bit) Without further comment, to enter the field
Page 3

Oracle Golden Gate Page 3 of 20 February. Utility Download Golden Gate To download Oracle Golden Gate, we must go to the site http://edelivery.oracle.com In the Oracle Fusion Middleware must select and use the platform to our case Linux x86. When pressed Go, we see that we are a number of files to download, seek the following
Page 4

Oracle Golden Gate Page 4 of 20 Once admitted to the pack, select the version appropriate to base our data and operating system We proceed to download and copy to our Operating System The ideal is to create a working folder, imagine gg [Oracle @ oracle10ga oracle] $ mkdir gg [Oracle @ oracle10ga oracle] $ cd gg [Oracle @ oracle10ga gg] $ [Oracle @ oracle10ga gg] $ [Oracle @ oracle10ga gg] $ pwd / Home / oracle / gg [Oracle @ oracle10ga gg] $ This is repeated on both machines and copy the software on both machines We apply the command unzip [Oracle @ oracle10ga gg] $ unzip V18153-01.zip Archive: V18153-01.zip inflating: ggs_redhatAS30_x86_ora10g_32bit_v10.4.0.19_002.tar And after that, extract the tar, using the following command
Page 5

Oracle Golden Gate Page 5 of 20 [Oracle @ oracle10ga gg] $ tar xvf ggs_redhatAS30_x86_ora10g_32bit_v10.4.0.19_002.tar Oracle variables verified in our system [Oracle @ oracle10gb gg] $ env | grep ORACLE ORACLE_SID = orcl ORACLE_BASE = / u01/app/oracle ORACLE_HOME = / u01/app/oracle/product/10.2.0/db_1 It is mandatory setear ORACLE_SID, ORACLE_HOME and LD_LIBRARY_PATH, plus place them in the PATH [Oracle @ oracle10gb gg] $ export LD_LIBRARY_PATH = $ ORACLE_HOME / lib :/ home / oracle / gg This is recommended. Bash_profile or. Profile (according to the command shell), possesses more or less the following definitions ORACLE_BASE = / u01/app/oracle ORACLE_HOME = $ ORACLE_BASE/product/10.2.0/db_1 ORACLE_SID = orcl GOLDEN_GATE_HOME = / home / oracle / gg PATH = / bin :/ usr / bin :/ usr / local / bin :/ usr/X11R6/bin LD_LIBRARY_PATH = / usr / lib :/ usr/X11R6/lib: $ ORACLE_HOME / lib :/ home / oracle / gg PATH = $ ORACLE_HOME / bin: $ PATH GOLDEN_GATE_HOME PATH = $ $ PATH export PATH LD_LIBRARY_PATH export ORACLE_BASE ORACLE_HOME ORACLE_SID
Page 6

Oracle Golden Gate Page 6 of 20 Three. Installing Golden Gate After downloading the utility, seteado copied to disk and environmental variables, we proceed to use. To do this run the command ggsci [Oracle @ oracle10gb gg] $. / Ggsci Oracle GoldenGate Command Interpreter for Oracle Version 10.4.0.19 Build 002 Linux, x86, 32bit (optimized), Oracle 10 on Sep 23, 2009 13:54:17

Copyright (C) 1995, 2009, Oracle and / or its affiliates. All rights reserved. GGSCI (oracle10gb.inmotion.cl) 1> Already at the prompt, Oracle Golden Gate based structures need to work, these are generated with the CREATE SUBDIRS The output would be more or less the following GGSCI (oracle10gb.inmotion.cl) 1> create subdirs Creating subdirectories under current directory / home / oracle / gg Parameter files / home / oracle / gg / dirprm: created Report files / home / oracle / gg / dirrpt: created Checkpoint files / home / oracle / gg / dirchk: created Process status files / home / oracle / gg / dirpcs: created SQL script files / home / oracle / gg / dirsql: created Database definitions files / home / oracle / gg / dirdef: created Extract data files / home / oracle / gg / dirdat: created Temporary files / home / oracle / gg / dirtmp: created Veridata files / home / oracle / gg / dirver: created Veridata Lock files / home / oracle / gg / dirver / lock: created Veridata Out-Of-Sync files / home / oracle / gg / dirver / oos: created Veridata Out-Of-Sync XML files / home / oracle / gg / dirver / oosxml: created Veridata Parameter files / home / oracle / gg / dirver / params: created Veridata Report files / home / oracle / gg / dirver / report: created Status Veridata files / home / oracle / gg / dirver / status: created Veridata Trace files / home / oracle / gg / dirver / trace: created Stdout files / home / oracle / gg / dirout: created This should be done for both nodes, which will participate in the replication
Page 7

Oracle Golden Gate Page 7 of 20 4. Preparation database Once the above steps, you must verify certain points in our database Must be enabled archivelog mode Must be off the trash SQL> alter system set recyclebin = off scope = both; System altered. SQL> If the paper does not throw off errors when running the scripts later Working, please wait ... BEGIN *

ERROR at line 1: ORA-20783: GoldenGate DDL Replication setup: RECYCLEBIN *** must be turned off. *** For 10gR2 and up, Set RECYCLEBIN in parameter file to OFF. For 10gR1, September _RECYCLEBIN In parameter file to FALSE. Then restart database and installation. ORA-06512: at line 19 You must activate the Supplemental logging SQL> alter database add supplemental log data; Database altered. SQL> We create a framework to support the replication SQL> create user IDENTIFIED BY golden golden 2 default tablespace users 3 temporary tablespace temp; User created. SQL> grant connect, resource, unlimited tablespace, select any dictionary to golden; Grant succeeded. SQL> grant select any table, create any table, drop any table, insert any table, update any table, delete any table, create any view, flashback any table to golden; Grant succeeded. SQL> grant execute on dbms_flashback to golden; Grant succeeded. SQL> grant execute on utl_file to golden; Grant succeeded. OBS 1 This scheme should be created both in the environment of origin and destination
Page 8

Oracle Golden Gate Page 8 of 20 OBS 2 Ideally, this scheme possesses since Grant DBA will be responsible for generating all the objects in the target schema, the other is allocated the privileges that the schema origin. scripts are executed to support replication, only at the origin (marker_setup.sql) SQL> start marker_setup.sql Marker setup 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: golden Marker table setup script complete, running verification script ... Please enter the name of a schema for the GoldenGate database objects: Setting schema name to GOLDEN TABLE MARKER ------------------------------OK MARKER SEQUENCE ------------------------------OK Script complete. SQL> A point to note is that the script will prompt the scheme for replication They run the following script (ddl_setup.sql) SQL> start ddl_setup.sql GoldenGate DDL Replication setup script Verifying That current user has privileges to install DDL Replication ... 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: On Oracle 10g and up, recycle bin system must be disabled. NOTE: Stop all DDL replication before starting this installation. Enter GoldenGate schema name: golden You will be PRompted for the mode of installation. To install or reinstall DDL replication, enter InitialSetup To upgrade DDL replication, enter NORMAL Enter mode of installation: InitialSetup Working, please wait ... Spooling to file ddl_setup_spool.txt GOLDEN Using GoldenGate as a schema name, InitialSetup as a mode of installation.
Page 9

Oracle Golden Gate Page 9 of 20 Working, please wait ... RECYCLEBIN must be empty. This will purge RECYCLEBIN installation for all users. To proceed, enter yes. To stop installation, enter no. Enter yes or no: yes DDL replication setup script complete, running verification script ...

Please enter the name of a schema for the GoldenGate database objects: Setting schema name to GOLDEN DDLORA_GETTABLESPACESIZE STATUS: Line / pos ---------------------------------------Error -------------------------------------------------- --------------No errors No errors CLEAR_TRACE STATUS: Line / pos ---------------------------------------Error -------------------------------------------------- --------------No errors No errors CREATE_TRACE STATUS: Line / pos ---------------------------------------Error -------------------------------------------------- --------------No errors No errors TRACE_PUT_LINE STATUS: Line / pos ---------------------------------------Error -------------------------------------------------- --------------No errors No errors Initial_setup STATUS: Line / pos ---------------------------------------Error -------------------------------------------------- --------------No errors No errors DDLVERSIONSPECIFIC PACKAGE STATUS: Line / pos ---------------------------------------Error

-------------------------------------------------- --------------No errors No errors DDLREPLICATION PACKAGE STATUS:


Page 10

Oracle Golden Gate Page 10 of 20 Line / pos ---------------------------------------Error -------------------------------------------------- --------------No errors No errors DDLREPLICATION PACKAGE BODY STATUS: Line / pos ---------------------------------------Error -------------------------------------------------- --------------No errors No errors HISTORY TABLE DDL ----------------------------------OK DDL HISTORY TABLE (1) ----------------------------------OK DDL DUMP TABLES ----------------------------------OK DDL DUMP COLUMNS ----------------------------------OK DDL DUMP LOG GROUPS ----------------------------------OK DDL DUMP PARTITIONS ----------------------------------OK DDL DUMP PRIMARY KEYS -----------------------------------

OK SEQUENCE DDL ----------------------------------OK GGS_TEMP_COLS ----------------------------------OK GGS_TEMP_UK ----------------------------------OK DDL TRIGGER STATUS CODE: Line / pos ---------------------------------------Error -------------------------------------------------- --------------No errors No errors DDL TRIGGER INSTALL STATUS ----------------------------------OK DDL TRIGGER RUNNING STATUS -------------------------------------------------- -----------------------------ENABLED
Page 11

Oracle Golden Gate Page 11 of 20 STAYMETADATA IN TRIGGER -------------------------------------------------- -----------------------------OFF TRACING SQL DDL TRIGGER -------------------------------------------------- -----------------------------0 DDL TRIGGER TRACE LEVEL -------------------------------------------------- -----------------------------0 LOCATION OF TRACE FILE DDL -------------------------------------------------- -----------------------------/ U01/app/oracle/admin/orcl/udump/ggs_ddl_trace.log Analyzing installation status ... STATUS OF DDL REPLICATION

-------------------------------------------------- -----------------------------SUCCESSFUL installation of DDL Replication software components Script complete. SQL> SQL> As an observation, it will ask the schema associated with replication Enter GoldenGate schema name: golden It will ask for the installation mode, which in our case is initial setup Enter mode of installation: InitialSetup And if we want to purge all items from the trash Enter yes or no: yes Run the following script (role_setup.sql) SQL> start role_setup.sql Role GGS setup script This script will drop and recreate the role GGS_GGSUSER_ROLE To use a different role name, quit this script and then edit the script params.sql gg_role to change the 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: golden Wrote file role_setup_set.txt PL / SQL procedure successfully completed. Role setup script complete Grant this role to each user Assigned to the Extract, GGSCI, and Manager Processes, by using the Following SQL command: GGS_GGSUSER_ROLE GRANT TO <loggedUser> <loggedUser> where the user is Assigned to the GoldenGate processes.
Page 12

Oracle Golden Gate Page 12 of 20 As an observation, it will ask the schema associated with replication Enter GoldenGate schema name: golden Y asks GGS_GGUSER_ROLE role assign it to our replication user, ie, the User golden. We carry out the execution SQL> grant GGS_GGSUSER_ROLE to golden; Grant succeeded. SQL>

Finally run the scrip ddl_enable.sql SQL> start ddl_enable.sql Trigger altered. SQL>
Page 13

Oracle Golden Gate Page 13 of 20 May. Replication Process Already being seteada home base, the only thing left is to define the replication process, the above must be expressed in the source tables that we want to replicate to the destination, not to make an example too complex, what we will generate two schemes, one for the source and one at the destination. They give different names with which we know not for replication by the schema name. DATA will use the scheme in the source and the destination DATA_REPLICADO scheme and they corresponding privileges otorgarmos In the source database SQL> Create user data Identified by data temporary tablespace temp; 2 User created. SQL> grant connect, resource, unlimited tablespace to data; Grant succeeded. SQL> In the target database SQL> Create user IDENTIFIED BY data_replicado data_replicado temporary tablespace temp; 2 User created. SQL> SQL> grant connect, resource, unlimited tablespace to data_replicado; Grant succeeded. SQL> To start replication, we must follow the following steps 5.1. Configuring the Process Manager For the replication process begins, we must set the Process Manager

Check process manager To do this run the command INFO ALL, ALL PROCESSES (this process should be done in both nodes)
Page 14

Oracle Golden Gate Page 14 of 20 GGSCI (oracle10ga.inmotion.cl) 1> info all, all Processes Program Status Group Lag Time Since chkpt MANAGER STOPPED GGSCI (oracle10ga.inmotion.cl) 2> OBS You should always work in the Home directory of the Golden Gate, but will not appear information Or we can use the command INFO MANAGER GGSCI (oracle10ga.inmotion.cl) 16> info manager Manager is running (IP port oracle10ga.inmotion.cl.7809). GGSCI (oracle10ga.inmotion.cl) 17> Process Manager parametersVerified To do this run the command EDIT PARAMS MGR OBS You can give the following error GGSCI (oracle10ga.inmotion.cl) 2> edit params mgr Can not load ICU resource bundle 'ggMessage', error code 2 - No such file or directory Can not load ICU resource bundle 'ggMessage', error code 2 - No such file or directory Aborted But this is a result of that we are not positioned in the Home directory of the Golden Gate When you run the EDIT PARAMS MGR command opens a file in editing, there proceed to set the next instruction PORT 7809 The former is the default port, but the ideal is to be a port that not in use The above information is entered in a file called mgr.prm on route $ GOLDEN_GATE_HOME / dirprm [Oracle @ oracle10ga dirprm] $ more mgr.prm PORT 7809

[Oracle @ oracle10ga dirprm] $ pwd / Home / oracle / gg / dirprm [Oracle @ oracle10ga dirprm] $
Page 15

Oracle Golden Gate Page 15 of 20 We start the Process Manager (on both nodes) Manager To begin the process, run the command START MANAGER and verify your operation GGSCI (oracle10ga.inmotion.cl) 5> start manager Manager started. GGSCI (oracle10ga.inmotion.cl) 6> GGSCI (oracle10ga.inmotion.cl) 6> info all, all tasks or all info you can use, all Processes Program Status Group Lag Time Since chkpt MANAGER RUNNING GGSCI (oracle10ga.inmotion.cl) 7> OBS This is both the origin and destination, should be started on both the Process Manager Golden Gate facilities 5.2. Group established to extract data To differentiate multiple extraction or data replication, Oracle Golden Gate is that the which groups already defined as GROUPS An example of this is that we can generate data extraction processes and replication using parallel, from the above, we could generate two sets of data and extraction of data replication in the base data origin and the destination respectively. Create the group source extraction To create the extraction group run the following commands (on the source node) add extract <username> extraccin> group, tranlog, begin now GGSCI (oracle10ga.inmotion.cl) 1> add extract extraer1, tranlog, begin now EXTRACT added. GGSCI (oracle10ga.inmotion.cl) 2> This implies the following

add extract <username> extraccin> group: Command to generate a set of extraction


Page 16

Oracle Golden Gate Page 16 of 20 tranlog: Indicates that the transaction log will be the source of the data. begin now: It is the position of the first record that fits with the start time of extraction from the transaction log generate the log file (trail) of the extraction To create the log file where the activity will of the extraction run the command <filename> exttrail add, extract group> extraccion>, megabytes xxx GGSCI (oracle10ga.inmotion.cl) 5> add exttrail / home / oracle / gg / dirdat / hu, extract extraer1 EXTTRAIL added. GGSCI (oracle10ga.inmotion.cl) 6> The file should contain only 2 characters, Golden Gate since then it increases with a correlative This implies the following <logfile> exttrail add: This file will record transactions extraccin> group> extract: extraction quye Group will write to the trail file, only one extraction group can write to a trail extract megabytes xxxx: You can specify the maximum size for the file that is generated, which Oracle Golden Gate only generate up to that size and then increase the sequential file, eg hu0001, hu0002, etc. You edit the parameters of the extraction we have generated (in the source node) GGSCI (oracle10ga.inmotion.cl) 6> edit params extraer1 And within that edition insert the following data - Group of extraction extraer1 extract - Connection to the database userid golden, golden password - Name or IP of the remote host, where they replicate information - Addition of the port where the Manager is running on the target Process rmthost 192.168.239.11, mgrport 7809 - File is specified in the destination trail rmttrail / home / oracle / gg / dirdat / hu - The entry to include all DDL to be made

- About schema objects origenmente the ddl include mapped objname DATA. * - It specifies the tables to be captured if it appears * is because it captures all - State the name of the schema of the source DATA table. *;
Page 17

Oracle Golden Gate Page 17 of 20 After that, we can proceed to look at all of the information from our replicator GGSCI (oracle10ga.inmotion.cl) 6> info all, all Processes or you can use info all, all tasks Program Status Group Lag Time Since chkpt MANAGER RUNNING 8:54:46 00:00:00 EXTRACT STOPPED EXTRAER1 GGSCI (oracle10ga.inmotion.cl) 7> 5.3. Group established to replicate data Once generated the groups (one or more) to remove the data, it proceeds to generate the group to replicate data (the latter only in the destination node) To this we must add a checkpoint for point target database GGSCI (oracle10gb.inmotion.cl) 1> edit params. / GLOBALS And add the following information GGSCHEMA golden CHECKPOINTTABLE golden.checkpoint The GLOBALS file is a parameter file is read each time you invoke the utility GGSCI or when running the PROCESS MANAGER is like a GLOBAL parameter file that passes the PROCESS MANAGER declaradasos the parameters. The Checkpointtable is a command to generate a checkpoint table in the target database, the replication process uses this table to keep track of the position to be read in the "trail" that is for recovery purposes. The use of this table is optional, since the replication process also leaves point checkpoint to disk (In a file) We connect the previous point generated schema in the target database

GGSCI (oracle10gb.inmotion.cl) 1> dblogin password userid golden golden Successfully logged into database. GGSCI (oracle10gb.inmotion.cl) 2> And proceed to generate the checkpoint table GGSCI (oracle10gb.inmotion.cl) 2> add checkpointtable golden.checkpoint
Page 18

Oracle Golden Gate Page 18 of 20 Successfully created table GOLDEN.CHECKPOINT checkpoint. GGSCI (oracle10gb.inmotion.cl) 3> then generate the replication group GGSCI (oracle10gb.inmotion.cl) 4> add Replicat replic1, exttrail / home / oracle / gg / dirdat / hu, checkpointtable golden.checkpoint Replicat added. GGSCI (oracle10gb.inmotion.cl) 5> This implies the following add Replicat group replicacin> <username>: Command to generate a replication group exttrail: Indicates that the transaction log to be written checkpointtable: checkpoint table will be used to keep track of transactions applied generate a parameter file to our replicator process (on site) We insert the data, edit it run the command params replic1 - Group of replication Replicat replic1 - DEFINITIONS at origin and destination, this command will indicate that they are equal ASSUMETARGETDEFS - Connection to the target database userid golden, golden password - Here we define a file where records are left that have not been inserted, by example by - Level error database is optional, but recommended for use discardfile / home/oracle/gg/discard/rep1_discard.txt, append, megabytes 10 - Here we specify the mapping in terms of source and destination schema DATA map. * DATA_REPLICADO target. *; 5.4. Top pull and replication

To start the extraction to run the command START EXTRACT <username> extractor> GGSCI (oracle10ga.inmotion.cl) 3> info all, all Processes or you can use info all, all tasks Program Status Group Lag Time Since chkpt MANAGER RUNNING EXTRACT STOPPED EXTRAER1 1665:57:00 00:00:00
Page 19

Oracle Golden Gate Page 19 of 20 GGSCI (oracle10ga.inmotion.cl) 4> start extract extraer1 Sending START request to MANAGER ... EXTRACT EXTRAER1 starting GGSCI (oracle10ga.inmotion.cl) 5> OBS If the removal process does not begin to give implies that EXTRACT START EXTRACT process parameters are generated abnormality And we started with replication with START command <username> RepliCat replicador> GGSCI (oracle10gb.inmotion.cl) 3> info all, all Processes or you can use info all, all tasks Program Status Group Lag Time Since chkpt MANAGER RUNNING STOPPED RepliCat REPLIC1 1655:32:22 00:00:00 GGSCI (oracle10gb.inmotion.cl) 4> start Replicat replic1 Sending START request to MANAGER ... REPLIC1 RepliCat starting OBS If the replication process does not begin to give a Replicat START implies that process parameters are generated abnormality RepliCat
Page 20

Oracle Golden Gate Page 20 of 20 June. DDL synchronization

Oracle Golden Gate is able to synchronize DML and DDL statements from the source toward the destination not vice versa. Whether only the DDL, DML only or both the DDL synchronization only is supported from Oracle9i onwards When carrying out the synchronization of DDL statements, Golden Gate leaves out certain amount of patterns that are internal to Oracle, for example, include: AURORA CTXSYS ODM ORDSYS SYS SYSMAN SYSTEM OUTLN PERFSTAT Etc .... The recycle bin must be inactive while conducting the replication DDL statements, as there DDL implied when an object is renamed and converted to a RECYCLE BIN format. Oracle Golden Gate DDL can leave out, but there is a way to store those judgments for future reference, this is done by running the script with ddl_ddl2file.sql SYS user, as it is done with other scripts listed in point 4, the information of the DDL statements are ignored in the machine USER_DUMP_DEST. The objects to which they will apply the DDL statement must match the source and destination, but the replicator remain in a state called BENDING, to support the DDL replication must be used in parameter settings ASSUMETARGETDEFS replication. Each time the source is carried out a movement of a table by the command ALTER TABLE MOVE TABLESPACE, you must disable motion extraction and replication, this forms the movement of the table is transparent to Golden Gate. All commands ALTER DATABASE and ALTER SYSTEM are not considered by Golden Gate as replicate DDL

Das könnte Ihnen auch gefallen