利用OGG进行数据库表的初始化

利用ogg进行数据库表的初始化

  前提是已经搭建好了ogg的运行环境和ogg程序的安装部署!!!

  若不知道如何安装ogg请查阅博客中相关安装部署文档。

 

         1、停止目标端re1进程

         2、配置ei进程(若目标端有ei进程之前投递的文件则先清空)

            ggsci (localhost) 1>add extract ei1, sourceistable

            ggsci (localhost) 2> edit params ei1

 

    extract ei1

    sourcedb db_pos, userid oggs, password oggs

    rmthost 127.0.0.1, mgrport 7909   //目标端的ip和mgr端口

    rmtfile ./dirdat/po, maxfiles 999999, megabytes 2000, append

    table oggs.table1,sqlpredicate “where 条件”;(sqlpredicate是为了选择初始化的部分数据,若初始化整张表则不需要添加)

        

         3、将源端数据以trail文件的形式发送到目标端

    start ei1

 

         4、若目标端表中有数据则先truncate

 

         5、配置ri进程

            ggsci (localhost) 1> add replicat ri1, sepcialrun

            ggsci (localhost) 2> edit params ri1

 

    specialrun

    end runtime

    replicat ri1

    userid oggt, password oggt

    extfile ./dirdat/po

    reportcount every 60 seconds, rate  //每隔60秒向终端发送数据同步记录数

    batchsql batchesperqueue 1000, opsperbatch 20000  //通过在replicat使用batchsql来把相同的语句作为一批处理,而不是像普通的处理方式,每行语句单独提交

    map oggs.table1, target oggt.table2,colmap(usedefaults, oggtime=@datenow());

        

         6、命令行进入oggt目录执行(ri1不在ggsci中执行)

    ./replicat paramfile dirprm/ri1.prm

 

         7、同步完成后 start re1

(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐