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

搭建IBM CDC环境的简单记录

一: 创建cdcuser用户,在这个用户下安装cdc for DB2的软件,
useradd -u 5000 -g db2iadm1 -m -d /home/cdcuser cdcuser
passwd cdcuser

cd /opt/IBM/ISWarehouse/db2/V9.7/instance/
./db2icrt -s client cdcuser

su - db2inst1
db2 connect to testdb
db2 grant dbadm on database to user cdcuser

将安装光盘里面的setup-cdc-linux-x86-db2luw.bin上传到testserver的/softinstall目录下,并更改文件权限
cd /softinstall
chmod 755 setup-cdc-linux-x86-db2luw.bin

创建cdc for DB2的安装路径
mkdir -p /opt/IBM/InfoSphereChangeDataCapture
cd /opt/IBM
chown cdcuser:db2iadm1 InfoSphereChangeDataCapture

安装cdc软件
配置好cdcuser下面的vncserver, 然后以cdcuser用户登录testserver的图形化界面进行安装
. $HOME/.bash_profile
cd /softinstall
./setup-cdc-linux-x86-db2luw.bin
按照提示内容开始安装,这里的安装路径使用默认的路径

安装完后,会自动开启cdc instance的配置页面
(也可以在后面自己手动打开配置页面进行配置,即执行/opt/IBM/InfoSphereChangeDataCapture/ReplicationEngineforIBMDB2/bin/dmconfigurets)
instance Name: cdcdev
instance Server Port: 10901
DB2 instance: db2inst1
Database Name: TESTDB
Database Username: cdcuser
Database Password: cdcuser
Metadata Schema: CDCUSER
Refresh Loader Path: /home/cdcuser/refresh

instance配置完成后,启动该instance, 然后就可以关闭这个图形化窗口



二: 创建cdcora用户,在这个用户下安装cdc for oracle的软件,
useradd -u 5001 -g oinstall -m -d /home/cdcora cdcora
passwd cdcora

创建对ORCL数据库具有dba权限的数据库用户cdcora
su - oracle
sqlplus sys/sys@orcl as sysdba
create user cdcora identified by "cdcora";
grant create session to cdcora;
grant create table to cdcora;
grant create view to cdcora;
grant create sequence to cdcora;
grant create procedure to cdcora;
grant execute procedure to cdcora;
grant alter session to cdcora;
grant select any table to cdcora;
grant select any view to cdcora;
grant resource to cdcora;
grant dba to cdcora;

打开数据库的归档日志
sqlplus sys/sys@orcl as sysdba
shutdown immedate;
quit
export ORACLE_SID=orcl
sqlplus /nolog
connect sys/sys as sysdba
startup mount;
alter database archivelog;
archive log start;
alter database open;
quit
mkdir -p /home/oracle/archlog
sqlplus sys/sys@orcl as sysdba
alter system set log_archive_dest_1='location=/home/oracle/archlog';
alter system set log_archive_format='%s_%t_%r.log' scope=spfile;
alter system set log_archive_start=true scope=spfile;

再重启数据库即完成打开数据库归档日志

将数据库附加日志打开
sqlplus sys/sys@orcl as sysdba
alter databse add supplemental log data;

再以cdcora用户登录ORCL数据库以创建用于测试的表,以及打开该表的附加日志
sqlplus cdcora/cdcora@orcl
create table kevin(a varchar(10));
alter table kevin add supplemental log data(all,primary key,unique,foreign key) columns;

将安装光盘里面的setup-cdc-linux-x86-oracleredo.bin上传到sjzxdbdev的/softinstall目录下,并更改文件权限
cd /softinstall
chmod 755 setup-cdc-linux-x86-oracleredo.bin

安装cdc软件
配置好cdcora下面的vncserver, 然后以cdcora用户登录testserver的图形化界面进行安装
. $HOME/.bash_profile
cd /softinstall
./setup-cdc-linux-x86-db2luw.bin
按照提示内容开始安装,这里的安装路径使用/home/cdcora/InfoSphereChangeDataCapture/ReplicationEngineforOracle/

安装完后,会自动开启cdc instance的配置页面
(也可以在后面自己手动打开配置页面进行配置,即执行/home/cdcora/InfoSphereChangeDataCapture/ReplicationEngineforOracle/bin/dmconfigurets)
"Use read-only connection to database" 这里打勾
instance Name: cdcora
instance Server Port: 11001
ORACLE_HOME: /u01/app/oracle/oracle/product/10.2.0/db_1
TNS Name: ORCL
Database Username: cdcora
Database Password: cdcora

instance配置完成后,启动该instance, 然后就可以关闭这个图形化窗口


三: 在windows服务器上安装management console和Access Server
从光盘中将cdcmc-6.5.1502.0-setup.exe和cdcaccess-6.5.1502.0-setup.exe拷贝到windows服务器上分别安装这两个程序
其中安装cdcaccess-6.5.1502.0-setup.exe时,在完成安装后会提示创建用户以登录management console, 这里我的用户名密码是Admin/Admin01

安装完后,可以打开management console完成接下里的配置
输入登录的用户名密码,服务器名称这里输入 127.0.0.1 端口这里使用默认的10101

首先进入Access Manager这里进行配置
新建数据存储