Golden Gate配置实例:RHEL 4.7下的Oracle 10g RAC到单实例的单向同步
程序员文章站
2022-05-30 13:42:41
...
Golden Gate配置实例:RHEL 4.7下的Oracle 10g RAC到单实例的单向同步
环境
rac1 rac2: RHEL 4u7 + Oracle 10.2.0.4 + ASM
rac1 外网IP 192.168.47.241 虚拟IP 192.168.47.243
rac2 外网IP 192.168.47.242 虚拟IP 192.168.47.244
目标端是一个单机
ggdb: RHEL 4u7 + ORACLE 10.2.0.4 + ASM
IP: 192.168.47.211
两台主机均已创建数据库,sid分别为oradb 和 dyggdb
配置oradb 到 dyggdb的数据同步
goldengate版本11.1.1.0
将rac1配置为NTP服务器
rac1:
修改配置文件。配置一个server指向自己
cat>/etc/ntp.confrestrict 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
启动ntpd服务
service ntpd restart
chkconfig --level 345 ntpd on
rac2:
rac2上的操作与rac1类似,不同的是配置的server指向rac1
cat>/etc/ntp.confrestrict 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.241 stratum 10
driftfile /var/lib/ntp/ntp.drift
broadcastdelay 0.008
keys /etc/ntp/keys
EOF
service ntpd restart
chkconfig --level 345 ntpd on
需要注意的是,配置完ntp后大概需要5-10分钟的时候,才会开始进行同步。可以通过ntpq -p 命令来查看
[root@rac1 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
rac1 .INIT. 16 u - 64 0 0.000 0.000 4000.00
*LOCAL(0) LOCAL(0) 10 l 30 64 377 0.000 0.000 0.001
[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
源端和目标端之间的时间同步则不是那么重要。可以在目标端手动对时间进行一次同步(目标端的ntpd服务没有启动),并将同步后的系统时间写入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
如果不能成功,可以在ntpdate命令中加上-d参数来排查具体原因
useradd -g oinstall -G dba goldengate
passwd goldengate
配置资源限制:
官方建议尽可能将资源限制放开,其实我们可以根据具体情况进行配置,但不能设得太小
cat >>/etc/security/limits.confgoldengate 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
以下的在rac1上做就可以了
这里有一个分区/dev/sdg1,可以被rac1和rac2访问。我们将其格式化ext3文件系统,并挂载到rac1上(在正常情况下,我们在rac1上启动extract进程):
[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, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 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 ~]#
挂载到rac1的/opt/gg下:
[root@rac1 ~]# mkdir /opt/gg
[root@rac1 ~]# mount /dev/sdg1 /opt/gg
然后在rac1中配置开机自动挂载(这一步不要在rac2上做):
echo "mount /dev/sdg1 /opt/gg" >> /etc/rc.local
目标端
mkdir /opt/gg
在源端和目标端上,赋予goldengate用户/opt/gg目录的使用权限
chown -R goldengate:oinstall /opt/gg
chmod -R 775 /opt/gg