1.truncate操作要单独处理,在EXTRACT和REPLICAT配置文件中添加GETTRUNCATES;
2.主键的解决办法:一个生成奇数,一个生成偶数
Database-generated values
Do not replicate database-generated sequential values in a bi-directional configuration.
The range of values must be different on each system, with no chance of overlap. For
example, in a two-database environment, you can have one server generate even values,
and the other odd. For an n-server environment, start each key at a different value and
increment the values by the number of servers in the environment. This method may not
be available to all types of applications or databases. If the application permits, you can
add a location identifier to the value to enforce uniqueness.
阻止数据循环
1.阻止抽取复制的操作:
1.GETAPPLOPS|IGNOREAPPLOPS
2.GETREPLICATES|IGNOREREPLICATES
2.标识复制的事务:
TRANLOGOPTIONS EXCLUDEUSER
TRANLOGOPTIONS EXCLUDEUSERID
中间主键冲突了怎么办;
主库宕机了,剩余数据是否会同步到备机;
mgr
PURGEOLDEXTRACTS /opt/gg/trails/w1*, USECHECKPOINTS, MINKEEPFILES 10
PURGEOLDEXTRACTS /opt/gg/trails/w2*, USECHECKPOINTS, MINKEEPFILES 10
AUTORESTART ER *, RETRIES 3, WAITMINUTES 5
PURGEDDLHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
PURGEMARKERHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 30
init data on soruce
1.add extract eintss, soruceistable
2.edit params eintss
EXTRACT eintss
userid system, password “oracle”
rmthost xxx, mgrport 7809
rmttask replicat, group riniss
table gg.*;
init data on target
3. add replicat riniss, specialrun
info replicat *, tasks;
4.edit params riniss
replicat riniss
assumetargetdefs
userid system, password oracle
discardfile ./dirrpt/RINISS.dsc, purge
map gg.*, target gg.*;
on source
5.start extract einiss;
view report einitss;
6.view report riniss
source 2 target on source
1.ADD EXTRACT ext_s2t, TRANLOG, BEGIN NOW, THREADS 1
EXTRACT ext_s2t
USERID system, PASSWORD oracle
EXTTRAIL ./dirdat/st
DLL INCLUDE MAPPED
TABLE gg.*;
2.ADD EXTTRAIL ./dirdat/st, EXTRACT ext_s2t
3.ADD EXTRACT pump_sr, EXTTRAILSOURCE ./dirdat/st, BEGIN NOW
EXTRACT pump_sr
USERID system, PASSWORD oracle
RMTHOST 192.168.10.12, MGRPORT 7809
RMTTRAIL ./dirdat/tt
PASSTHRU
TABLE gg.*;
4.ADD RMTTRAIL ./dirdat/tt, EXTRACT pump_sr
source 2 target on target
5.ADD REPLICAT repl_tt, EXTTRAIL ./dirdat/tt, BEGIN NOW
REPLICAT repl_tt
ASSUMETARGETDEFS
DLL INCLUDE MAPPED
USERID system, PASSWORD oracle
DISCARDFILE ./dirrpt/repl_tt.dsc, PURGE
MAP gg.*, TARGET gg.*;
————————————————————-
target 2 source on target
1.ADD EXTRACT ext_t2s, TRANLOG, BEGIN NOW, THREADS 1
EXTRACT ext_t2s
USERID system, PASSWORD oracle
EXTTRAIL ./dirdat/ts
DLL INCLUDE MAPPED
TABLE gg.*;
2.ADD EXTTRAIL ./dirdat/ts, EXTRACT ext_t2s
3.ADD EXTRACT pump_tt, EXTTRAILSOURCE ./dirdat/ts, BEGIN NOW
EXTRACT pump_tt
USERID system, PASSWORD oracle
RMTHOST 192.168.10.11, MGRPORT 7809
RMTTRAIL ./dirdat/ss
PASSTHRU
TABLE gg.*;
4.ADD RMTTRAIL ./dirdat/ss, EXTRACT pump_tt
target 2 source on srouce
5.ADD REPLICAT repl_ss, EXTTRAIL ./dirdat/ss, BEGIN NOW
REPLICAT repl_ss
ASSUMETARGETDEFS
DLL INCLUDE MAPPED
USERID system, PASSWORD oracle
DISCARDFILE ./dirrpt/repl_ss.dsc, PURGE
MAP gg.*, TARGET gg.*;
冲突的现象
1.插入时主键冲突
2.更新/删除冲突
解决的办法:
1.读写分离
2.设置很小的延迟,A操作的更改在B操作的更改完成之前反应到B的话就避免了冲突;
使用gg的CDR(Conflict Detection and Resolution)特性
1.解决插入时主键冲突
2.更新/删除时找不到数据;
约束:数据库必须在同类的OS平台上,只支持可以比较而且是没有显式转换的数据类型