日期:2014-05-16  浏览次数:20893 次

通过goldengate从ORACLE向mysql的单向复制
环境:我使用VBOX虚拟机,一台已经安装ORACLE数据库与GOLDENDGATE的主机。另一台只安装了ORACLE数据库。
配置数据库环境、goldengate用户,安装goldengate等操作参考:http://blog.csdn.net/q947817003/article/details/13293751

一.安装MYSQL

安装MYSQL数据库客户端:

[root@bys2 ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@bys2 ~]# rpm -qa mysql
[root@bys2 ~]# cd /mnt/cdrom/
[root@bys2 cdrom]# yum -y install mysql
安装服务器端
[root@bys2 cdrom]# yum -y install mysql-server         
[root@bys2 cdrom]# rpm -qa mysql*
mysql-5.0.77-4.el5_6.6
mysql-server-5.0.77-4.el5_6.6
##########################
启动MYSQL
[root@bys2 cdrom]# service mysqld status
mysqld is stopped
[root@bys2 cdrom]# service mysqld start
Starting MySQL:                                            [  OK  ]

创建用来做同步的用户和表

[oracle@bys2 ~]$ mysql -u root
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)
mysql> create database oggtest;
Query OK, 1 row affected (0.00 sec)
mysql> use oggtest;
Database changed
mysql>  grant all privileges on *.* to 'root'@'%' identified by '123456';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on *.* to 'ogg'@'%' identified by 'ogg';
Query OK, 0 rows affected (0.00 sec)
mysql>  flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> use oggtest
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> create table test5(aa int primary key) engine=innodb;
Query OK, 0 rows affected (0.02 sec)
mysql> show tables;
+-------------------+
| Tables_in_oggtest |
+-------------------+
| test5             |
+-------------------+
1 row in set (0.00 sec)
mysql> select * from test5;
Empty set (0.01 sec)
退出后使用[oracle@bys2 mysqlogg]$ mysql -u root -p  进行登陆测试,确认使用  root用户及密码可以登陆。
如不能登陆,可以参考:http://blog.csdn.net/q947817003/article/details/13295099
###########################################
二.安装OGG-FOR-MYSQL
[oracle@bys2 ~]$ tar -xvf  ggs_Linux_x86_MySQL_32bit.tar  -C /u01/mysqlogg/
[oracle@bys2 mysqlogg]$ pwd
/u01/mysqlogg
[oracle@bys2 mysqlogg]$ ./ggsci
Oracle GoldenGate Command Interpreter for MySQL
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
Linux, x86, 32bit (optimized), MySQL Enterprise on Apr 23 2012 04:29:30
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (bys2.oel.com) 1> create subdirs
Creating subdirectories under current directory /u01/mysqlogg
Parameter files                /u01/mysqlogg/dirprm: already exists
Report files                   /u01/mysqlogg/dirrpt: created
Checkpo