首页 > 技术文章 > Oracle GoldenGate for DB2

ak666666 2019-12-03 09:58 原文

--Enable log
db2 update db cfg using LOGARCHMETH1 DISK:/home/db2inst1/arclogs
--Reboot
db2 terminate
db2stop
db2start
db2 backup db sample to /dev/null

chown -R db2inst2 /u01/oggdb2
db2 -tf demo_db2_create.sql
--Add supplemental logging
dblogin sourcedb sample,userid db2inst2,password oracle
add trandata db2inst2.tcustmer
add trandata db2inst2.tcustord
info trandata db2inst2.*
sqlplus ogg@orcl/ogg
alter system set enable_goldengate_replication = true scope=both;

ADD RMTTRAIL ./dirdat/rd, EXTRACT EDB2
tar -xvf
---Initialize---
--
extract einit
--
add extract einit,sourceistable
info extract *,tasks
--
sourcedb SAMPLE, userid db2inst2, password oracle
rmthost 192.168.56.101,mgrport 7809
rmttask replicat,group rinit
table db2inst2.tcustmer;
table db2inst2.tcustord;

--target
PORT 7809
ACCESSRULE,PROG *,IPADDR 192.168.56.101,ALLOW
--
add replicat rinit,specialrun
info replicat *,tasks
--
replicat rinit
userid ogg@orcl,password ogg
--sourcedefs ./dirdef/source.def
map db2inst2.tcustmer, target ogg.tcustmer;
map db2inst2.tcustord, target ogg.tcustord;

start einit
view report einit

---CDC---

replicat rora
userid ogg,password ogg
handlecollisions
discardfile ./dirrpt/rora.dsc,purge
map db2inst1.tcustmer,target ogg.tcustmer;
map db2inst1.tcustord,target ogg.tcustord;

--Source
extract edb2
sourcedb sample,userid db2inst2,password oracle
tranlogoptions nouserexit
rmthost 192.168.56.101,mgrport 7809
rmttrail ./dirdat/rd
table db2inst2.tcustmer;
table db2inst2.tcustord;


---11g.env---
oracle profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
export PATH
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
export JAVA_HOME=/usr/java/jdk1.8.0_92
export JRE_HOME=/usr/java/jdk1.8.0_92/jre
PATH=/usr/sbin:$JAVA_HOME/bin:$JRE_HOME/bin:$ORACLE_HOME/bin:/u01/ibm/db2/V11.1/bin:$PATH; export PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$JAVA_HOME/lib:$JRE_HOME/lib; export CLASSPATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/u01/ibm/db2/V11.1/lib64; export LD_LIBRARY_PATH

db2inst1 profile
---db2.env---
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
PATH=/usr/sbin:$JAVA_HOME/bin:$JRE_HOME/bin:$ORACLE_HOME/bin:/opt/ibm/db2/V10.5/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/opt/ibm/db2/V10.5/lib64; export LD_LIBRARY_PATH

推荐阅读