Use goldengate for Linux Installation

Source: Internet
Author: User

How to install and use goldengate

I. Environment: OS: Linux centos_final_5.5 (64bit) DB: oracle11gr2 (standalone mode) goldengate: Lan, source IP address 192.168.128.100 image IP address 192.168.128.101 II. Purpose:

Data Synchronization from the source end to the image end (one-way)

3. Implementation of the source database: 1. Database preparation: 1.1 enable database archive logs

View the current log mode of the database

Archive log list;

Change to archive Mode

Shutdown immediate;

Start Mount;

Alter database archivelog;

Alter database open;

 

 

Enable the second archive path (optional)

Alter system set log_archive_dest_2 = 'location =/archive_2optional' scope = spfile;

Alter system archive log start tolog_archive_dest_2;

Check whether the second archive log takes effect (restart the database)

Show parameter archive;

 

1.2 enable supplemental logging and force Logging

Check whether supplementallogging is enabled for the current database

Select supplemental_log_data_min fromv $ database;

Enable minimum database-level supplementallogging

Alter database add Supplemental log data;

 

View the status of the current database forcelogging

Select force_logging from V $ database;

Enable forcelogging

Alter database force logging;

1.3 create goldengate management users and grant related Permissions

Create and manage user tablespaces

Create tablespace tbs_ggmgr datafiel '/u01/APP/Oracle/goldengate/ggmgr. dbf' size 50 m autoextend on;

Create a goldengate Management User

Create user ggmgr identified by oracledefault tablespace tbs_ggmgr temporary tablespace temp quota unlimited ontbs_ggmgr;

Grant permissions to ggmgr (you can grant DBA permissions if you want to simplify it)

Grant connect, resource to ggmgr;

Grant create session, alter session toggmgr;

Grant select any dictionary, select anytable to ggmgr;

Grant create table, alter any table to ggmgr;

 

1.4 create test users and tables

Create user test identified by test;

Conn test/test;

Create Table Test (

Stuid number (8 ),

Stuname varchar2 (20 ),

Stupasswd varchar2 (20)

);

Insert into test values (1, 'test1', 'test1 );

Insert into test values (2, 'test2', 'test2 ');

Commit;

2goldengate installation and parameter settings 2.1 set the environment variables required for goldengate operation

Edit the. bash_profile file in the Oracle Home Directory

Vi. bash_profile

Add the following content:

Exportld_library_path = $ oracle_base/goldengate: $ ORACLE_HOME/lib

2.2 create the goldengate installation directory

Usually install goldengate in the oracle_base directory.

Mkdir-P/u01/APP/Oracle/goldengate/

2.3 decompress and initialize goldengate

Decompress the goldengate compressed file to the installation directory of goldengate.

Tar vxf ggs_linux_x64_ora11g_64bit_v11_1_0_0_078.tar

Run./ggsci to enter ggsci

Create directory structure

Create subdirs -- run only at the first startup

2.4 Add trandata

In ggsci

Dbloign userid ggmgr, password Oracle

Add Table-level supplemental logging to the table to be copied

Add trandata test .*

View

Info trandata test .*

2.5 add and configure the Mgr Process

Edit Param Mgr

Add the following content:

Port 7809

Purgeoldextracts./dirdat/*, usecheckpoints, minkeepfiles 20

2.6 Add and configure the extract process

Add an extract process

Add extract exts100, tranlog, begin now

Specify a trail file for the extract process

Add exttrail./dirdat/S1, extract exts100, megabytes 100

Configure extract Parameters

Edit Param exts100

Add the following content (when the second archive is enabled)

Extract exts100

Userid ggmgr, password Oracle

Tranlogoptions archivedlogonly

Tranlogoptions altarchivelogdest instanceorcl/archive_2

Tranlogoptions altarchivedlogformat % T _ % S _ % R. DBF

Gettruncates

Reportcount every 30 minutes, Rate

Discardfile./dirrpt/exts100.dsc, append, megabytes 100

Exttail./dirdat/S1

Table Test. Test;

 

2.7 add and configure the pump Process

Add extract dps100 exttrailsource./dirdat/S1

Add rmttrail./dirdat/T1, extract dps100

Configure pump Process Parameters

Edit Param dps100

Extract dps100

Userid ggmgr, password Oracle

Rmthost 192.168.128.101, mgrport7809, compress

Numfiles 5000

Dynamicresolution

Rmttrail./dirdat/T1

Table Test. Test;

2.8 check whether the process can be started successfully

Start <process name>

Start Mgr

Start exts100

Start dps100

 

View Process status

Info all

 

Iv. initialization of the image database 1. Export relevant data and table structures from the source database (users with DBA permissions are required)

Exp username/password file = test_1203013.dmpowner = test triggers = n indexes = n log = test_120313.log;

2. Upload the exported data file to the image end.

You can use ftp

3. Create the user and tablespace corresponding to the source on the image end, and keep the tablespace name consistent.

Create user test identified by test;

4. import data files on the image end (users with DBA permissions are required)

IMP username/password file = test_120313.dmpfromuser = test touser = test log = test_120313.log;

 

Check whether the data is imported successfully.

V. Mirror database implementation 1 Database preparation

Create and manage user tablespaces

Create tablespace tbs_ggmgr datafiel '/u01/APP/Oracle/goldengate/ggmgr. dbf' size 50 m autoextend on;

Create a goldengate Management User

Create user ggmgr identified by oracledefault tablespace tbs_ggmgr temporary tablespace temp quota unlimited ontbs_ggmgr;

Grant permissions to ggmgr (you can grant DBA permissions if you want to simplify it)

Grant connect, resource to ggmgr;

Grant create session, alter session toggmgr;

Grant select any dictionary, select anytable to ggmgr;

Grant create table to ggmgr;

2goldengate installation and parameter settings

 

2. 1. Set the environment variables required for goldengate operation

 

Edit the. bash_profile file in the Oracle Home Directory

Vi. bash_profile

Add the following content:

Exportld_library_path = $ oracle_base/goldengate: $ ORACLE_HOME/lib

2. Create the goldengate installation directory

Usually install goldengate in the oracle_base directory.

Mkdir-P/u01/APP/Oracle/goldengate/

2. 3. decompress and initialize goldengate

Decompress the goldengate compressed file to the installation directory of goldengate.

Tar vxf ggs_linux_x64_ora11g_64bit_v11_1_0_0_078.tar

Run./ggsci to enter ggsci

Create directory structure

Create subdirs -- run only at the first startup

2.4 edit the global parameter file

Dblogin userid ggmgr, password Oracle

Edit Params./globals

Add the following content:

Checkpointtable ggmgr.ogg _ checkpointtable

Add checkpoint table

Add checkpointtableggmgr.ogg _ checkpointtable

2. 5. Add and configure the Mgr Process

Edit Param Mgr

Add the following content:

Port 7809

(The settings for clearing the trail file are not added here)

2. 6. Add and configure the replicat Process

Add replicat rept101, exttrail./dirdat/T1

Edit the parameter file of the replicat Process

Edit Param rept101

Add the following content:

Replicat rept101

Userid ggmgr, password Oracle

Assumetargetdefs

Discardfile./dirrpt/rept101.dsc, purge

Map Test. Test, target Test. Test;

2.7 check whether the process can be started successfully

Start <process name>

Start Mgr

Start rept101

 

View Process status

Info all

Vi. Test 1. Insert data into the source database

Insert into test values (3, 'test3, 'test3 ');

Commit;

2. Generate archive logs

Alter system switch logfile;

3. view the Image Database

Select * from test;

 

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.