GoldenGate configuration instance: one-way synchronization from Oracle10gRAC under RHEL4.7 to a single instance

Source: Internet
Author: User
The environment source end is a RACrac1rac2: RHEL4u7 + Oracle10.2.0.4 + ASMrac1 Internet IP address 192.168.47.241 virtual IP address 192.168.47.242 virtual IP address is a single machine ggdb: RHEL4u7 + ORACLE10.2.0.4 + ASMIP: 192.16 Environment
The source end is a RAC
Rac1 rac2: RHEL 4u7 + Oracle 10.2.0.4 + ASM
Rac1 Internet IP address 192.168.47.241 virtual IP address 192.168.47.243
Rac2 Internet IP address 192.168.47.242 virtual IP address 192.168.47.244

The target end is a single machine
Ggdb: RHEL 4u7 + ORACLE 10.2.0.4 + ASM
IP: 192.168.47.211

Databases have been created for both hosts. The sid is oradb and dyggdb respectively.

Configure Data Synchronization from oradb to dyggdb

Goldengate version 11.1.1.0


Time Synchronization
In RAC, time synchronization between nodes is very important. The official document explains that GoldenGate uses time to make some key decisions. Here we use NTP to configure time synchronization.
Configure rac1 as an NTP server

Rac1:

Modify the configuration file. Configure a server to direct to itself

Cat>/etc/ntp. conf < Restrict default nomodify notrap noquery
Restrict 127.0.0.1

Server 0.rhel.pool.ntp.org
Server 1.rhel.pool.ntp.org
Server 2.rhel.pool.ntp.org

Server 192.168.47.241
Server 127.127.1.0
Fudge 127.127.1.0 stratum 10

Driftfile/var/lib/ntp/drift
Broadcastdelay 0.008
Keys/etc/ntp/keys
EOF

Start ntpd service

Service ntpd restart
Chkconfig -- level 345 ntpd on

Rac2:

The operations on rac2 are similar to those on rac1. The difference is that the configured server points to rac1.

Cat>/etc/ntp. conf < Restrict default nomodify notrap noquery
Restrict 127.0.0.1

Server 0.rhel.pool.ntp.org
Server 1.rhel.pool.ntp.org
Server 2.rhel.pool.ntp.org

Server 192.168.47.241
Fudge 192.168.47.241Stratum 10

Driftfile/var/lib/ntp. drift
Broadcastdelay 0.008
Keys/etc/ntp/keys
EOF

Service ntpd restart
Chkconfig -- level 345 ntpd on

It should be noted that it takes about 5-10 minutes to start the Synchronization After configuring ntp. You can use the ntpq-p command to view

[Root @ rac1 ~] # Ntpq-p
Remote refid st t when poll reach delay offset jitter
========================================================== ==============================================
Rac1. INIT. 16 u-64 0 0.000 0.000
* LOCAL (0) LOCAL (0) 10 l 30 64 377 0.000 0.000

[Root @ rac2 ~] # Ntpq-p
Remote refid st t when poll reach delay offset jitter
========================================================== ==============================================
Rac1 LOCAL (0) 11 u 9 64 1 0.187 0.072 0.001



Time synchronization between the source and target is not that important. You can manually synchronize the time on the target end (the ntpd service on the target end is not started) and write the synchronized system time to the bios.
[Root @ ggdb ~] # Ntpdate 192.168.47.241
8 Dec 15:40:20 ntpdate [8311]: adjust time server 192.168.47.241 offset 0.003007 sec
[Root @ ggdb ~] # /Sbin/hwclock-w

If the problem persists, add the-d parameter to the ntpdate command to troubleshoot the problem.


Create a system user
Create users on the source (including rac1 and rac2) and target to manage GoldenGate:

Useradd-g oinstall-G dba goldengate
Passwd goldengate

Configure resource limits:
The official recommendation is to release the resource limit as much as possible. In fact, we can configure the resource according to the actual situation, but it cannot be too small.

Cat>/etc/security/limits. conf < Goldengate soft memlock 3145728
Goldengate hard memlock 3145728
Goldengate soft nproc 200
Goldengate hard nproc 1024
Goldengate soft stack-
Goldengate hard stack-
Goldengate soft fsize-
Goldengate hard fsize-
EOF


Prepare the GoldenGate installation environment
Source end
In the RAC environment, GoldenGate should be installed in a shared storage, so that when the node running the GoldenGate related process fails, you can mount the directory to another node to continue running.
You can do the following on rac1.

There is a partition/dev/sdg1 which can be accessed by rac1 and rac2. We format the ext3 file system and mount it to rac1 (normally, we start the extract process on rac1 ):

[Root @ rac1 ~] # Mkfs. ext3/dev/sdg1
Mke2fs 1.35 (28-Feb-2004)
Filesystem label =
OS type: Linux
Block size = 4096 (log = 2)
Fragment size = 4096 (log = 2)
12500992 inodes, 24993115 blocks
1249655 blocks (5.00%) reserved for the super user
First data block = 0
Maximum filesystem blocks = 4294967296
763 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208,
4096000,796 2624, 11239424,204 23887872

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs-c or-I to override.
[Root @ rac1 ~] #

Mount to/opt/gg of rac1:
[Root @ rac1 ~] # Mkdir/opt/gg
[Root @ rac1 ~] # Mount/dev/sdg1/opt/gg

Then configure automatic mounting on rac1 (do not do this on rac2 ):
Echo "mount/dev/sdg1/opt/gg">/etc/rc. local


Target end
The target end is a single machine, installed under/opt/gg
Mkdir/opt/gg


In Source and targetGrant goldengate user/opt/gg directory permission
Chown-R goldengate: oinstall/opt/gg
Chmod-R 775/opt/gg



Decompress the goldengate installation file to the installation directory.
Installing the GoldenGate software is simple. Extract the package and perform the following operations on the source and target ends:
Log On As A goldengate user
[Goldengate @ rac1 goldengateMedia] $ Mkdir/opt/gg/goldengate,
[Goldengate @ rac1 goldengateMedia] $ Cp ggs_linux_x64_ora10g_64bit_v11_1_0_0_078.tar/opt/gg/goldengate
[Goldengate @ rac1 goldengateMedia] $ Cd/opt/gg/goldengate
[Goldengate @ rac1 goldengate] $ Tar-xvf ggs_linux_x64_ora10g_64bit_v11_1_0_0_078.tar



Configure Environment Variables
Source (rac1 and rac2) and target:
Modify the environment variable configuration file of goldengate (ORACLE_SID is modified as needed)
Cat>/home/goldengate/. bashrc < ORACLE_HOME =/opt/app/oracle/product/10.2.0/db_1
Export ORACLE_HOME
ORACLE_SID = oradb1
Export ORACLE_SID
GG_HOME =/opt/gg/goldengate
Export GG_HOME
PATH =\$ ORACLE_HOME/bin: \ $ PATH
Export PATH
GG_HOME =/opt/gg/goldengate
Export GG_HOME
LD_LIBRARY_PATH =\$ ORACLE_HOME/lib: \ $ GG_HOME: \ $ LD_LIBRARY_PATH
Export LD_LIBRARY_PATH
EOF

Apply the modified environment variable, enter the GoldenGate installation directory, and run ldd ggsci to find the required library files. If the shared library file cannot be found, for example, libnnz10.so => not found, check the LD_LIBRARY_PATH environment variable settings.
[Goldengate @ ggdb goldengate] $ Source ~ /. Bashrc
[Goldengate @ ggdb goldengate] $ Cd $ GG_HOME
[Goldengate @ ggdb goldengate] $ Ldd ggsci
Libdl. so.2 =>/lib64/libdl. so.2 (0x00000037a3900000)
Libicui18n. so.38 =>/opt/gg/goldengate/libicui18n. so.38 (0x0000002a9558c000)
Libicuuc. so.38 =>/opt/gg/goldengate/libicuuc. so.38 (0x0000002a958ec000) libicudata. so.38 =>/opt/gg/goldengate/libicudata. so.38 (response)
Libpthread. so.0 =>/lib64/tls/libpthread. so.0 (0x00000037a3d00000)
Libxerces-c.so.28 =>/opt/gg/goldengate/libxerces-c.so.28 (0x0000002a968fc000)
Libnnz10.so =>/opt/app/oracle/product/10.2.0/db_1/lib/libnnz10.so (0x0000002a96e13000)
Libclntsh. so.10.1 =>/opt/app/oracle/product/10.2.0/db_1/lib/libclntsh. so.10.1 (0x0000002a972b4000)
Libstdc ++. so.6 =>/usr/lib64/libstdc ++. so.6 (0x00000037a5d00000)
Libm. so.6 =>/lib64/tls/libm. so.6 (0x00000037a3700000)
Libgcc_s.so.1 =>/lib64/libgcc_s.so.1 (0x00000037a5b00000)
Libc. so.6 =>/lib64/tls/libc. so.6 (0x00000037a3400000)
/Lib64/ld-linux-x86-64.so.2 (0x00000037a3000000)
Libnsl. so.1 =>/lib64/libnsl. so.1 (0x00000037a9100000)



Database preparation
Open archive mode in source database
SQL> Archive log list

Database log mode Archive Mode
Automatic archival Enabled
Archive destination + RECOVERY_DG
Oldest online log sequence 120
Next log sequence to archive 121
Current log sequence 121


If you are in non-archive mode, change to archive mode:
SQL>Shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>Startup mount;
ORACLE instance started.


SQL>Alter database archivelog;

Database altered.

SQL>Alter database open;

Database altered.

SQL>


Enable force logging in the source database
SQL> Select force_logging from v $ database;

FOR
---
NO

SQL> Alter database force logging;

Database altered.

SQL> select force_logging from v $ database;

FOR
---
YES



Enable supplemental log in the source database
SQL> Select supplemental_log_data_min from v $ database;

SUPPLEME
--------
NO

SQL> Alter database add supplemental log data;

Database altered.


Switch logs to make the changes take effect
SQL>Alter system switch logfile;

System altered.

SQL> select supplemental_log_data_min from v $ database;

SUPPLEME
--------
YES


Disable the recycle bin in the source database
The official note is that, due to a known issue, the recycle bin will have an impact on the DDL trigger, so you need to disable it. Therefore, we only need to disable the recycle bin in the source database.

SQL> Show parameter recyclebin

NAME TYPE VALUE
-----------------------------------------------------------------------------
Recyclebin string on


SQL>Alter system set recyclebin = off;

System altered.

SQL> show parameter recyclebin

NAME TYPE
--------------------------------------------------------------------
VALUE
------------------------------
Recyclebin string
OFF



Ensure that goldengate can connect to the database's ASM instance
All nodes in RAC must be configured.


Configure ASM instance information in source TNSNAMES. ORA
Vi $ ORACLE_HOME/network/admin/tnsnames. ora

ORADB_ASM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = rac1-vip) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = TCP) (HOST = rac2-vip) (PORT = 1521 ))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = + ASM)
)
)


Configure information about the ASM instance in the source LISTENER. ORA.
Vi $ ORACLE_HOME/network/admin/listener. ora

SID_LIST_LISTENER_RAC1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = oradb)
(ORACLE_HOME =/opt/app/oracle/product/10.2.0/db_1)
(SID_NAME = oradb1)
)
(SID_DESC =
(GLOBAL_DBNAME = + ASM)
(ORACLE_HOME =/opt/app/oracle/product/10.2.0/db_1)
(SID_NAME = + ASM1)
)
)

The above is the configuration in rac1, and SID_LIST_LISTENER_xxx and SID_NAME in rac2 must be modified accordingly.


Restart listener
Lsnrctl reload


Use sqlplus sys/xxx @ oradb_asm as sysdba to connect to the asm instance. If it can be connected, the configuration is successful.


Character Set
1. the character set of the target database must be a superset of the source database character set.
2. The database character set must be a superset of the client application Character Set

SQL> Show parameter NLS_LANGUAGE

NAME TYPE VALUE
-----------------------------------------------------------------------------
Nls_language string SIMPLIFIED CHINESE


SQL>Show parameter NLS_TERRITORY

NAME TYPE VALUE
-----------------------------------------------------------------------------
Nls_territory string CHINA


SQL>SELECT name, value $ from SYS. PROPS $ WHERE name = 'nls _ CHARACTERSET ';

NAME
------------------------------
VALUE $
--------------------------------------------------------------------------------
NLS_CHARACTERSET
ZHS16GBK


SQL>Show parameter NLS_LENGTH_SEMANTICS

NAME TYPE VALUE
-----------------------------------------------------------------------------
Nls_length_semantics string BYTE


SQL>

Set the character set of the terminal:
Root User Login, source (rac1 and rac2) and target
Cat>/etc/bashrc < NLS_LANG = "SIMPLIFIED CHINESE_CHINA". ZHS16GBK
Export NLS_LANG
EOF



Create a goldengate Database User
Both source and target

[Oracle @ gg1 ~] $ Sqlplus/as sysdba

SQL * Plus: Release 10.2.0.4.0-Production on Mon Aug 1 22:31:42 2011

Copyright (c) 1982,200 7, Oracle. All Rights Reserved.


Connected:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> Create tablespace goldengate;

Tablespace created.

SQL> Create user goldengate identified by goldengate default tablespace goldengate;

User created.

SQL> Grant connect, resource to goldengate;

Grant succeeded.

SQL> Grant execute on utl_file to goldengate;

Grant succeeded.

SQL>


The database user used by the extraction process requires additional permissions. We also grant these permissions to the Database User goldengate (executed in the source database)

SQL> Exec dbms_streams_auth.grant_admin_privilege ('goldengat ');

PL/SQL procedure successfully completed.

SQL> Grant insert on system. logmnr_restart_ckpt $ to goldengate;

Grant succeeded.

SQL> Grant update on sys. streams $ _ capture_process to goldengate;

Grant succeeded.

SQL> Grant become user to goldengate;

Grant succeeded.

SQL>

To ensure the normal operation of GoldenGate, especially on the target end, grant the DBA permission to the goldengate User:
SQL> Grant dba to goldengate;



UNDO settings
Goldengate uses the flashback query to read undo tablespace data from the source database to recreate read consistency based on scn or time points.


The Recommended settings are as follows:
UNDO_MANAGEMENT = AUTO
UNDO_RETENTION = 86400
The undo tablespace size is estimated based on the following formula:
= * +
Bytes Is the number of undo blocks.
Bytes Is the value of the UNDO_RETENTION parameter (in seconds ).
Bytes Is the number of undo blocks for each second.
Bytes Is the minimal overhead for metadata (transaction tables, etc .).
Use the system view V $ UNDOSTAT to estimate And .


This step can be performed in the source database.


SQL> Show parameter undo


NAME TYPE VALUE
-----------------------------------------------------------------------------
Undo_management string AUTO
Undo_retention integer 900
Undo_tablespace string UNDOTBS1


SQL> Alter system set undo_retention = 86400;


System altered.


Grant the flashback any table permission to the extract user.


SQL> Grant flashback any table to goldengate;


Grant succeeded.


SQL>

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.