欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

[达梦数据库]达梦数据实时同步DMHS新增同步表

程序员文章站 2022-06-03 12:29:45
...

1 源端操作

1.1 修改dmhs.hs配置文件

[[email protected] ~]$ cd /ogg/dmhs2_59903/

#备份配置文件

[[email protected] dmhs2_59903]$ cp dmhs.hs dmhs.hs.20210219

[[email protected] dmhs2_59903]$ vi dmhs.hs
<?xml version="1.0" encoding="GB18030"?>
<dmhs>
    <base>
        <lang>en</lang>
        <mgr_port>5903</mgr_port>		
        <chk_interval>45</chk_interval>
        <siteid>130</siteid>
	<cpt_check>0</cpt_check>
    </base>
    <cpt>
<name>all130</name>
        <db_type>oracle12c</db_type>
        <db_server>10.120.82.13/SIACHX</db_server>	
        <db_user>dmhs</db_user>		
        <db_pwd>**********</db_pwd>	
	<!--char_code>PG_UTF8</char_code-->
        <ddl_mask>TABLE:ALTER</ddl_mask>        
	<supplement_log>1</supplement_log>
	<cpt_check>0</cpt_check>
        <arch>
            <clear_interval>600</clear_interval>
            <clear_flag>0</clear_flag>
        </arch>
        <rac>
            <rac_type>1</rac_type>
            <db_server>ASM</db_server>
            <db_user>sys</db_user>
            <db_pwd>******</db_pwd>
            <nodes>2</nodes>
        </rac>	
        <send>
            <ip>10.120.109.22</ip>		
            <mgr_port>6003</mgr_port>
            <data_port>6004</data_port>
            <filter>
<disable>
</disable>
                <enable>
#添加表
<item>SIAP.HNSIA.AC62</item>

                </enable>
            </filter>
            <map>
            </map>
        </send>
    </cpt>
</dmhs>

1.2 初始化同步表

[[email protected] dmhs2_59903]$ ./dmhs_console 
CSL[INFO]: DMHS console tool: V3.1.3-Build(2020.08.06-92763trunc)_D64
DMHS >connect 127.0.0.1:5903
CSL[WARN]: [INPUT CMD: connect 127.0.0.1:5903]
CSL[INFO]: execute success
DMHS >cpt
CSL[WARN]: [INPUT CMD: cpt]
capture module information:                         log execute module information:                     
status                   :read log                  status                   :idle                      
database             name:10.120.82.131/SIACHX      database                 :normal                    
database               ID:130                       active        transaction:154                       
log                  mode:online                    waiting for execute count:0                         
ansys               queue:0                         exec                     :961153 (0/S)              
post                queue:0                         commit                   :826037 (0/S)              
log   page   sequence  no:0                         rollback                 :67844850 (0/S)            
waitting   for   analysis:0                         affect rows              :1822334 (0/S)             
waiting   for        post:0                         lob cached                :0                        
log      page      number:5956737598 page(3/S)      checkpoint               :2021-02-19 15:57:11       
post                times:1207685019 time(0/S)      cvt                 state:idle                      
file IO             times:0 time(0/S)               cvt      trx          num:0                         
log      cache      bytes:0 B(0B/S)                 
log      parse      bytes:0 B(0B/S)                 
log      total      bytes:2250562974080 B(1.36K/S)  
archive         directory:                          
log                  file:group_2.317.989930201     
log                  time:2021-02-19 16:08:34       

log sender information:                             log   reciver   information:                        
status                   :waiting for log           status                   :waiting recieve log       
filter              count:0                         total       log     count:920231295                 
queue              length:0 (0.00 percent)          recieve             times:93447192 time             
log      total      count:1208438945 time           exectute            times:920231295 time            
send                times:128479043 time            log                   LSN:17099645158180            
log                   LSN:17099645158183            message               LSN:93447192                  
message               LSN:93447192                  start                 LSN:17097545040911            
Start                 LSN:17097545040911            message             bytes:45430345247 B(28B/S)      
message             bytes:61757295064 B(38B/S)      
log                  time:2021-02-19 16:08:34       
Apply status:No data                                
CSL[INFO]: execute success

#停cpt进程

DMHS >stop cpt
CSL[WARN]: [INPUT CMD: stop cpt]
CSL[INFO]: execute success

#同步表

DMHS >COPY 0 "SCH.NAME='HNSIA_JZSI' AND TAB.NAME='AC62'" CREATE|INSERT|PDB|"SIAP_JZ"
CSL[WARN]: [INPUT CMD: COPY 0 "SCH.NAME='HNSIA_JZSI' AND TAB.NAME='AC62'" CREATE|INSERT|PDB|"SIAP_JZ"]
CSL[INFO]: copy mask is : |CREATE|INSERT|TABLE|OBJID|REP
CSL[UNKNOW]: execute finish, please look up log file of exec module to check data load result
DMHS >COPY 0 "SCH.NAME='HNSIA_NYSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_NY"
CSL[WARN]: [INPUT CMD: COPY 0 "SCH.NAME='HNSIA_NYSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_NY"]
CSL[INFO]: copy mask is : |INSERT|TABLE|OBJID|REP
CSL[UNKNOW]: execute finish, please look up log file of exec module to check data load result
DMHS >COPY 0 "SCH.NAME='HNSIA_PDSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_PD"
CSL[WARN]: [INPUT CMD: COPY 0 "SCH.NAME='HNSIA_PDSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_PD"]
CSL[INFO]: copy mask is : |INSERT|TABLE|OBJID|REP
CSL[UNKNOW]: execute finish, please look up log file of exec module to check data load result
DMHS >COPY 0 "SCH.NAME='HNSIA_SMSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_SM"
CSL[WARN]: [INPUT CMD: COPY 0 "SCH.NAME='HNSIA_SMSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_SM"]
CSL[INFO]: copy mask is : |INSERT|TABLE|OBJID|REP
CSL[UNKNOW]: execute finish, please look up log file of exec module to check data load result
DMHS >COPY 0 "SCH.NAME='HNSIA_SZSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_SZ"
CSL[WARN]: [INPUT CMD: COPY 0 "SCH.NAME='HNSIA_SZSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_SZ"]
CSL[INFO]: copy mask is : |INSERT|TABLE|OBJID|REP
CSL[UNKNOW]: execute finish, please look up log file of exec module to check data load result
DMHS >COPY 0 "SCH.NAME='HNSIA_YCSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_YC"
CSL[WARN]: [INPUT CMD: COPY 0 "SCH.NAME='HNSIA_YCSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_YC"]
CSL[INFO]: copy mask is : |INSERT|TABLE|OBJID|REP
CSL[ERROR]: initial loader failure
DMHS >COPY 0 "SCH.NAME='HNSIA_YCSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_YC"
CSL[WARN]: [INPUT CMD: COPY 0 "SCH.NAME='HNSIA_YCSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_YC"]
CSL[INFO]: copy mask is : |INSERT|TABLE|OBJID|REP
CSL[ERROR]: initial loader failure
DMHS >COPY 0 "SCH.NAME='HNSIA_ZZSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_ZZ"
CSL[WARN]: [INPUT CMD: COPY 0 "SCH.NAME='HNSIA_ZZSI' AND TAB.NAME='AC62'" INSERT|PDB|"SIAP_ZZ"]
CSL[INFO]: copy mask is : |INSERT|TABLE|OBJID|REP
CSL[UNKNOW]: execute finish, please look up log file of exec module to check data load result

#启动cpt

DMHS >start cpt
CSL[WARN]: [INPUT CMD: start cpt]
CSL[INFO]: execute success
DMHS >cpt
CSL[WARN]: [INPUT CMD: cpt]
capture module information:                         log execute module information:                     
status                   :read log                  status                   :idle                      
database             name:10.120.82.131/SIACHX      database                 :normal                    
database               ID:130                       active        transaction:158                       
log                  mode:archive                   waiting for execute count:0                         
ansys               queue:0                         exec                     :966978 (0/S)              
post                queue:0                         commit                   :831240 (0/S)              
log   page   sequence  no:0                         rollback                 :67986041 (0/S)            
waitting   for   analysis:0                         affect rows              :1932794 (0/S)             
waiting   for        post:0                         lob cached                :0                        
log      page      number:16020151 page(0/S)        checkpoint               :2021-02-19 16:08:42       
post                times:1777585 time(0/S)         cvt                 state:idle                      
file IO             times:0 time(0/S)               cvt      trx          num:0                         
log      cache      bytes:0 B(0B/S)                 
log      parse      bytes:0 B(0B/S)                 
log      total      bytes:4053244036 B(2B/S)        
archive         directory:                          
log                  file:thread_1_seq_42687.671.1064940689
log                  time:2021-02-19 16:25:43       

log sender information:                             log   reciver   information:                        
status                   :waiting for log           status                   :waiting recieve log       
filter              count:0                         total       log     count:922029023                 
queue              length:0 (0.00 percent)          recieve             times:93578229 time             
log      total      count:1777859 time              exectute            times:922029023 time            
send                times:126963 time               log                   LSN:17099648578854            
log                   LSN:17099648578857            message               LSN:126963                    
message               LSN:126963                    start                 LSN:17099642553492            
Start                 LSN:17099642553492            message             bytes:45522199456 B(28B/S)      
message             bytes:78477763 B(0B/S)          
log                  time:2021-02-19 16:25:43       
Apply status:No data                                
CSL[INFO]: execute success

2 目标端日志

2021-02-19 16:49:18 EXE[WARN]: set table .HNSIA_STAT2.AC62 start LSN: 17099654144304 LFS: 0 load rows:6621, source database:SIAP_PD

显示同步数据量,同时可以通过数据库确认数据量是否相符。