1 / 84

DSG RealSync 培训手册

DSG RealSync 培训手册. 迪思杰(北京)数码技术有限公司. 你将学习到 …. Understand realsync Install realsync Config realsync Initialize &start Replication 日常维护说明. Understand realsync. RealSync 工作原理. 通过 oracle redo log 分析交易指令,并将交易指令传输到目标 oracle 上重作指令。 实时跟踪源 oracle 产生的 redo log ,分析生成 xf1 交易指令,并缓存到源系统的本地队列

Download Presentation

DSG RealSync 培训手册

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DSG RealSync 培训手册 迪思杰(北京)数码技术有限公司

  2. 你将学习到… • Understand realsync • Install realsync • Config realsync • Initialize &start Replication • 日常维护说明

  3. Understand realsync

  4. RealSync工作原理 • 通过oracle redo log分析交易指令,并将交易指令传输到目标oracle上重作指令。 • 实时跟踪源oracle产生的redo log,分析生成xf1交易指令,并缓存到源系统的本地队列 • 传输系统从本地队列读取数据传到目标系统 • 目标系统收到xf1指令后保存到目标系统的缓存队列 • 目标系统的loader进程从本地队列中读取数据装载到目标端oracle系统上

  5. 工作原理图 XEXP Communication Module QUEUE Redo Log analyze Transactions XF1 Format Archived log ROWID Mapping Table OCI Communication Module loader QUEUE

  6. RealSync系统特点 • 目标数据库处于open状态,可用于数据查询、报表、数据抽取等 • 按需复制,指定需要复制的表,而不一定是必需整个数据库复制 • 源系统和目标系统可异构操作系统和oracle版本

  7. RealSync支持的table操作类型 • DML • Insert • Update • Delete

  8. RealSync支持的DDL操作类型

  9. RealSync新增支持的DDL操作类型 grant/revoke alter database create tablespace create/alter/drop user create/alter/drop role create type body create/drop directory create/drop database link create/drop/alter profile

  10. RealSync支持的DATATYPE • CHAR • VARCHAR2 • NUMBER • FLOAT • INTEGER • DATE • Long raw • Raw • Long • Blob • Clob • rowid

  11. 会影响到数据复制的常见操作 • 凡是会导致记录的rowid发生变化的操作都会造成复制错误 • Alter table move tablespace • Alter table split partition (即将支持) • Alter table merge partition (即将支持) • Alter table move • Nologging模式的数据装载都不会复制 • Nologging table+ noarchivelog • Nologging table+sqlldr nolog=y • Nologging table+insert /*+append*/

  12. Realsync不支持的系统级操作 • Alter database • Alter system • Tablespace的操作 • Alter tablespace add datafile • Add tablespace

  13. Install realsync

  14. Realsync进程部署 vman 控制信息流 dbpsd vagentd sender vagentd loader 复制数据流 Redo log Oracle

  15. Realsync安装步骤 • DS安装 • DT安装 *DS – DataSource:数据源系统 *DT – DataTarget:数据目标系统

  16. DS安装 • 环境准备 • 软件安装 • 脚本配置

  17. DS安装-环境准备 • 创建realsync系统用户 • 创建安装目录 • 在oracle上创建realsync用户 • 在oracle上创建view

  18. Realsync用户创建与授权 $sqlplus “/as sysdba” create user dsg identified by dsg; Grant connect to dsg; Grant select any table to dsg; Grant select any dictionary to dsg; 以下权限在首次全同步时使用: Grant alter system to dsg; Grant exp_full_database to dsg;

  19. 创建view $sqlplus “/as sysdba” create or replace view DBPS_XKCCLE as select * from sys.x$kccle; create or replace view DBPS_XKCCLH as select * from sys.x$kcclh; create or replace view DBPS_XKCCCF as select * from sys.x$kcccf; create or replace view DBPS_XKCCCP as select * from sys.x$kcccp; create or replace view DBPS_XKCCDI as select * from sys.x$kccdi; create or replace view DBPS_XKCRMF as select * from sys.x$kcrmf; create or replace view DBPS_XKTUXE as select * from sys.x$ktuxe; create or replace view DBPS_XLE as select * from sys.x$le; create or replace view DBPS_XBH as select * from sys.x$bh;

  20. DS端realsync安装 • 执行setup.sh程序 1. Please choice setup Directory, default is Current Directory [/realsync]: 软件安装目录,默认为当前目录 2. Please choice the Agent Type [ 1-Source , 2-Target ]: 安装的类型 1为源端,2为目标端 3. Please input Source Vagentd port,default port is [50002]: 源端Vagentd的端口号 4. Please input Archive log interval,default is 12<hours>: realsync日志归档的间隔时间 5. Are you want to install elib and bin program[y/n]: 安装bin软件,也可手工操作此步骤

  21. DS安装后的目录结构 $DBPS_HOME scripts log bin $VCFS_HOME (default:vcfsa) $XLDR_HOME (default:rmp)

  22. DS端:目录用途说明 • Scripts目录:所有脚本所在目录 • $VCFS_HOME:该环境变量一般设为vcfsa,用以保存系统运行状态,如log读取的位置,uncommitted交易、统计信息 • $XLDR_HOME:该环境变量一般设为rmp,用以保存数据传输之前的缓存队列和传输控制信息 • bin目录:执行文件所在目录 • Vcfsd目录:系统配置信息,由dbpsd进程使用

  23. Scripts目录的重要脚本说明 • start_vagentd:启动脚本 • stop_vagentd:停止脚本 • clean_vagentd :删除realsync的所有工作信息 注:clean_vagentd脚本只有在必须作重新全同步的时候才能使用,否则将造成很大的破坏性。

  24. 理解start脚本 $vi start_vagentd export DBPS_HOME=/realsync cd $DBPS_HOME export XLDR_HOME=$DBPS_HOME /rmp export VCFS_HOME=$DBPS_HOME /vcfsa $DBPS_HOME/bin/vagentd 4445 1>>$DBPS_HOME/ log/log 2>>&1 & $DBPS_HOME/bin/sender -tseq 1 1>>$DBPS_HOME/ log/log.sender 2>>&1 & export VCFS_HOME=$DBPS_HOME/vcfsd $DBPS_HOME/bin/dbpsd 4444 >$DBPS_HOME/log/logd 2>&1 & 注: 1:黑斜体标注部分需要根据实际参数修改 2:如果该脚本不是由oracle用户执行,则需要在该脚本之前添加oracle环境变量

  25. DT安装 • 环境准备 • 软件安装 • 脚本配置

  26. DT安装-环境准备 • 创建realsync系统用户 • 创建安装目录 • 在oracle上创建realsync用户

  27. Realsync用户创建与授权 $sqlplus “/as sysdba” create user dsg identified by dsg; Grant connect ,resource to dsg; Grant DBA to dsg;

  28. DT端realsync安装 • 执行setup.sh程序 1、 Please choice setup Directory, default is Current Directory [/realsync]: 2、 Please choice the Agent Type [ 1-Source , 2-Target ]: 注: 这里是进行源端安装选择 2 4、 Please input Target Vagentd port,default port is [50002]: 5、 Please Please input Archive log interval,default is 12<hours>: 6、 Please input the number of parallel loader process:<1-10> 首次全同步时目标端的最大并发装载线程数 7、 Are you want to install elib and bin program[y/n]:

  29. DS安装后的目录结构 $DBPS_HOME scripts log bin $VCFS_HOME (default:vcfsa) $XLDR_HOME (default:rmp)

  30. DT端:目录和文件用途说明 • scripts目标:所有脚本所在目录 • $VCFS_HOME:保存系统进程信息 • $XLDR_HOME: • 数据装载之前的缓存队列和装载控制信息 • Rowid mapping文件 • 源数据库的数据字典文件 • bin目录:执行文件所在目录

  31. Scripts目录的重要脚本说明 • start_vagentd:启动脚本 • stop_vagentd:停止脚本 • clean_vagentd :删除realsync的所有工作信息 注:clean_vagentd脚本只有在必须作重新全同步的时候才能使用,否则将造成很大的破坏性。

  32. 理解start脚本 export DBPS_HOME=/realsync cd $DBPS_HOME export XLDR_HOME=$DBPS_HOME /rmp export VCFS_HOME=$DBPS_HOME /vcfsa $DBPS_HOME/bin/vagentd 4445 1>>$DBPS_HOME/ log/log 2>>&1 & $DBPS_HOME/bin/loader -s –qno 0 1>$DBPS_HOME/ log/log.s0 2>>&1 & $DBPS_HOME/bin/loader -s –qno 1 1>$DBPS_HOME/ log/log.s1 2>>&1 & $DBPS_HOME/bin/loader -s –qno 2 1>$DBPS_HOME/ log/log.s2 2>>&1 & $DBPS_HOME/bin/loader -r –qno 0 1>>$DBPS_HOME/ log/log.r0 2>>&1 &

  33. config realsync

  34. 配置内容 • Host注册: • 注册系统中参与复制的vagent进程所在的IP地址和PORT号 • DATABASE注册: • 注册参与复制的oracle系统的参数信息

  35. 启动进程 • DS端: $cd $DBPS_HOME $./start_vagentd • DT端: $cd $DBPS_HOME $./start_vagentd

  36. 如何判断进程启动是否正常 • 通过ps –ef判断源端进程是否启动正常或通过执行scripts下的check脚本 $ ps -ef|grep zk dsg 3019006 1 0 Dec 11 - 0:58 /realsync/zk/bin/dbpsd 6600 dsg 5595264 1 0 Dec 11 - 0:00 /realsync/zk/bin/sender -tseq 1 dsg 5804140 5595264 0 Dec 13 - 55:34 /realsync/zk/bin/sender -tseq 1 dsg 8347802 1 0 Dec 11 - 0:00 /realsync/zk/bin/vagentd 6601 dsg 2416796 8347802 4 Dec 11 - 472:41 /realsync/zk/bin/vagentd 6601

  37. 如何判断进程启动是否正常 • 通过ps –ef判断目标端进程是否启动正常通过执行scripts下的check脚本 $ ps -ef|grep zk dsg 2560172 1 0 Dec 11 - 0:00 /realsync/zk/bin/vagentd 6601 dsg 1093716 2560172 3 Dec 11 - 126:56 /realsync/zk/bin/vagentd 6601 dsg 2400296 1 0 Dec 11 - 0:00 /realsync/zk/bin/loader -s -qno 8 1 dsg 2568444 2400296 0 Dec 11 - 22:57 /realsync/zk/bin/loader -s -qno 8 1 dsg 1921080 1 0 Dec 11 - 0:00 /realsync/zk/bin/loader -s -qno 3 1 dsg 2613438 1921080 0 Dec 11 - 25:24 /realsync/zk/bin/loader -s -qno 3 1 dsg 2367648 1 0 Dec 11 - 0:00 /realsync/zk/bin/loader -s -qno 7 1 dsg 2662430 2367648 0 Dec 11 - 22:12 /realsync/zk/bin/loader -s -qno 7 1 dsg 2408582 1 0 Dec 11 - 0:00 /realsync/zk/bin/loader -r -qno 1 1 dsg 2723980 2408582 2 Dec 13 - 437:33 /realsync/zk/bin/loader -r -qno 1 1

  38. 如何判断启动正常 • 通过realsync log察看 • 察看log.vagentd IPC_KEY=0x63000809 DBPS agent running on 44P270 (Listening any:6601) DBIInit multi-dedicated mode Data Capture service enabled • 察看log.s0,log.r0 IPC_KEY=0x63000809 DBPS agent running on 44P270 (Listening any:6601)

  39. 进入vman界面和配置菜单 $ cd $DBPS_HOME/bin $ ./vman VMAN> connect :4444 Connected. DBPS> user root/dbps Authenticated SYNC:/>menu

  40. Host注册 选择menu->system->host->Add HID: 1 ――― 输入一个HOST ID,不能重复 Host Name: 192.168.1.160 ――― 服务器地址 Agent Port: [2688] 4445 ――― vagentd启动所用端口号 Enabled: [Y] 注:需要重复为每个vagent进程增加一个host配置

  41. DataBase注册 选择menu->system->database->Add: Data Source Type: 1 ―――数据库类型:目前只支持oracle Host Name: 192.168.1.160 ―――HOST NAME DB Name: rac_db1 ―――数据库名称,一般取SID DB User: dsg ――― 数据库中的用户 DB Password: realsync ―――数据库中用户的密码 OS Owner: ――― 取空 OS Group: ――― 取空 SID: rac_db1 ―――数据库SID TNS Name: ORACLE_HOME: /oracle8i/product/8.1.7 ――― 数据库Home目录 TNS Admin: 注:需要重复为每个database增加一个配置

  42. Check configuration SYNC:/>cd dbs SYNC:/dbs> ls db09.1 db09.2 ―――列出系统中配置过的所有数据库 SYNC:/dbs> cd db09.1 ―――进入查看第1个数据库 SYNC:/dbs/db09.1> cd schemas SYNC:/dbs/db09.1/schemas> ls MDSYS OUTLN REALSYNC SH SYS SYSTEM WKPROX ―――显示该数据库中的所有schemas • 注:如果不能正确显示schemas,则几个原因: • vagentd未启动 • oracle未启动 • host和database参数配置错误

  43. Initialize &start Replication

  44. 初始化的步骤 • 首先进入vman $./vman • 执行vm文件 Vman>@vm 注:vm为一个文件名,该文件名可起成任何一个名字,该文件通常被放在bin目录下

  45. vm文件的主要内容 $vi vm connect :50000 user root/dbps set ds 1 –ctf … set dt 1.1 … set dict 1.1… *创建初始化对象 set dm 1.1 …

  46. 设置ds Sync>set ds 1 -itvl 5 -state start set ds DBID –itvl INTERVAL –state START DBID : 源数据库注册的ID编号 -itvl INTERVAL:异步间隔时间,单位秒(s) -state STATE:设置注册的源数据库是否可用,可以选择start|stop|reload

  47. 设置dt Sync>set dt 1.1 -tgt db 2 -xf1 y -state start Sync>set dt 1.2 -tgt db 3 -xf1 y -state start set dt DBID.SLOTID –tgt DBTYPE DBID –xf1 Y|N –state START DBID : 源数据库注册的ID编号 SLOTID :源数据库数据导出通道编号 -tgt DBTYPE DBID:目标数据库类型和ID编号 -xf1 Y|N:是否使用xf1格式进行数据传输,可以选择Y|N -state :目标数据库上代理状态,可以选择start|stop|reload

  48. Set dict • set dict 1.1 -owner trade -triggers n -indexes n -constraints y/n -statistics none -map "trade trade" -file trade

  49. 设置dm Sync>set dm 1.1 -cfg -sync ftcIqM8 set dm DBID.SLOTID –cfg –sync ftIqcM8 DBID :源数据库注册的ID编号 -cfg : 会自动去找源端scripts目录下的mapping.ini文件得到源端什么用户对应复制到目标端什么用户,源端什么用户下的什么表复制到目标端的配置信息

  50. Mapping.ini文件内容 bill bill real_where= u.name=’BILL’ and o.name in(select table_name from dsg.sync_bill1) full_where= u.name=’BILL’ and o.name in(select table_name from dsg.sync_bill1) 说明: bill bill (用户映射关系 源端bill用户复制到目标端bill用户) real_where= (实时同步 分析那些用户的那些表。u.name=是指那些用户,o.name是指那些表,而这些表的表名从dsg.sync_bill1的表查询得到) full_where=(首次同步 同步那些用户的那些表 u.name=是指那些用户,o.name是指那些表,而这些表的表名从dsg.sync_bill1的表查询得到)

More Related