[go: up one dir, main page]

CN116955369A - Database-based data fusion method, device, electronic equipment and storage medium - Google Patents

Database-based data fusion method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116955369A
CN116955369A CN202210397603.4A CN202210397603A CN116955369A CN 116955369 A CN116955369 A CN 116955369A CN 202210397603 A CN202210397603 A CN 202210397603A CN 116955369 A CN116955369 A CN 116955369A
Authority
CN
China
Prior art keywords
database
data
fused
fusion
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210397603.4A
Other languages
Chinese (zh)
Inventor
陈诗忠
林佳烨
曾文俊
蔡金桐
郑敏欢
杨文彬
刘少云
章建赛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Group Guangdong Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Guangdong Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Group Guangdong Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202210397603.4A priority Critical patent/CN116955369A/en
Publication of CN116955369A publication Critical patent/CN116955369A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • G06F16/2386Bulk updating operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/278Data partitioning, e.g. horizontal or vertical partitioning
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请涉及数据处理技术领域,提供一种基于数据库的数据融合方法、装置、电子设备及存储介质,所述方法包括:基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中;执行针对中间数据库中的待融合数据融合至目标数据库的融合操作;其中,中间数据库用于表征待融合数据的属性信息和目标数据库中融合待融合数据的库表的属性信息。本申请通过使用中间数据库作为中转缓存区的方式实现针对待融合数据的相关处理操作,确保源数据库和目标数据库的实际生产不受影响,并且也支持非同源的多个数据库的数据融合,保持源数据库和目标数据库的同时可访问性,从而也能够在不影响实际生产的前提下实现大规模复杂数据融合的目的。

This application relates to the field of data processing technology and provides a database-based data fusion method, device, electronic device and storage medium. The method includes: synchronizing the data to be fused in the source database to the intermediate database based on the data fusion request; A fusion operation is performed to fuse the data to be fused in the intermediate database to the target database; the intermediate database is used to represent the attribute information of the data to be fused and the attribute information of the database table in the target database that fuses the data to be fused. This application implements related processing operations for the data to be fused by using an intermediate database as a transfer cache area, ensuring that the actual production of the source database and target database is not affected, and also supports data fusion of multiple non-homogeneous databases, maintaining Simultaneous accessibility of source and target databases enables large-scale complex data fusion to be achieved without affecting actual production.

Description

基于数据库的数据融合方法、装置、电子设备及存储介质Database-based data fusion method, device, electronic equipment and storage medium

技术领域Technical field

本申请涉及数据处理技术领域,尤其涉及一种基于数据库的数据融合方法、装置、电子设备及存储介质。The present application relates to the field of data processing technology, and in particular to a database-based data fusion method, device, electronic equipment and storage medium.

背景技术Background technique

目前,大部分数据库均具有对应的数据备份和复制机制,但通常支持导出导入文件形式的数据备份与复制,用于解决数据备份、容灾和恢复等问题,因此,数据库之间传递数据越来越普遍。At present, most databases have corresponding data backup and replication mechanisms, but they usually support data backup and replication in the form of export and import files to solve problems such as data backup, disaster recovery, and recovery. Therefore, it is increasingly necessary to transfer data between databases. more common.

相关技术中,基于GoldenGate软件能够提供数据容灾和数据复制功能,支持零宕机的数据库升级和迁移,以及实现亚秒级的数据实时同步,通常使用GoldenGate软件对同源数据库或相同业务的不同地域数据库进行数据复制,从而将源端和目标端中名称和内容比较相似的部分库表进行融合。Among related technologies, GoldenGate software can provide data disaster recovery and data replication functions, support zero-downtime database upgrades and migrations, and achieve sub-second real-time data synchronization. GoldenGate software is usually used to synchronize data between the same source database or the same business. The regional database performs data replication, thereby merging some database tables with similar names and contents in the source and target ends.

然而,当源端和目标端中库表名称不同、结构不同时,需要在源端对库表进行处理,以此导致影响实际生产,并且也不适用大规模的复杂数据融合。However, when the names and structures of the database tables in the source and target ends are different, the database tables need to be processed at the source end, which affects actual production and is not suitable for large-scale complex data fusion.

发明内容Contents of the invention

本申请提供一种基于数据库的数据融合方法、装置、电子设备及存储介质,用以解决现有技术中需要在源端处理库表所导致的影响实际生产且不适用大规模的复杂数据融合的缺陷,实现在不影响实际生产的前提下适用于大规模复杂数据融合的目的。This application provides a database-based data fusion method, device, electronic equipment and storage medium to solve the problem in the existing technology of needing to process database tables at the source end, which affects actual production and is not suitable for large-scale complex data fusion. Defects, to achieve the purpose of being suitable for large-scale complex data fusion without affecting actual production.

本申请提供一种基于数据库的数据融合方法,包括:This application provides a database-based data fusion method, including:

基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中;Based on the data fusion request, synchronize the data to be fused in the source database to the intermediate database;

执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作;Execute a fusion operation for merging the data to be fused in the intermediate database to the target database;

其中,所述中间数据库用于表征所述待融合数据的属性信息和所述目标数据库中融合所述待融合数据的库表的属性信息。Wherein, the intermediate database is used to characterize the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused.

根据本申请提供的一种基于数据库的数据融合方法,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:According to a database-based data fusion method provided by this application, the execution of a fusion operation for merging the data to be fused in the intermediate database to the target database includes:

确定目标数据库没有所述待融合数据时,将所述中间数据库中的所述待融合数据同步至所述目标数据库中。When it is determined that the target database does not have the data to be fused, the data to be fused in the intermediate database is synchronized to the target database.

根据本申请提供的一种基于数据库的数据融合方法,所述目标数据库的数量为多个时,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:According to a database-based data fusion method provided by this application, when the number of the target databases is multiple, the fusion operation is performed to fuse the data to be fused in the intermediate database to the target database, include:

确定目标数据库没有所述待融合数据时,将所述待融合数据同步至所述中间数据库的临时源库中进行拆分操作,得到多个待融合数据;When it is determined that the target database does not have the data to be fused, synchronize the data to be fused to the temporary source database of the intermediate database and perform a split operation to obtain multiple data to be fused;

将所述多个待融合数据转移至所述中间数据库的临时目标库中;Transfer the plurality of data to be fused to the temporary target database of the intermediate database;

执行针对所述临时目标库中每个所述待融合数据融合至对应所述目标数据库中的融合操作。Perform a fusion operation for each data to be fused in the temporary target database into the corresponding target database.

根据本申请提供的一种基于数据库的数据融合方法,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:According to a database-based data fusion method provided by this application, the execution of a fusion operation for merging the data to be fused in the intermediate database to the target database includes:

确定目标数据库中存在与所述待融合数据对应的第一库表时,基于所述待融合数据和所述第一库表的差异,执行针对所述中间数据库中所述待融合数据的数据转换操作;When it is determined that there is a first database table corresponding to the data to be fused in the target database, based on the difference between the data to be fused and the first database table, perform data conversion for the data to be fused in the intermediate database operate;

将所述数据转换操作所得的目标待融合数据同步至所述目标数据库的所述第一库表中。Synchronize the target data to be fused obtained by the data conversion operation to the first database table of the target database.

根据本申请提供的一种基于数据库的数据融合方法,所述待融合数据的数量为多个且多个所述待融合数据之间具备预设关系时,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:According to a database-based data fusion method provided by this application, when the number of data to be fused is multiple and there is a preset relationship between the multiple data to be fused, the execution is directed to the data in the intermediate database. The fusion operation of merging the data to be fused to the target database includes:

确定目标数据库中存在与多个所述待融合数据对应的第二库表时,执行针对所述中间数据库中多个所述待融合数据的合并操作,得到中间库表;When it is determined that there is a second database table corresponding to multiple data to be fused in the target database, perform a merge operation on multiple data to be fused in the intermediate database to obtain an intermediate database table;

基于所述中间库表和所述第二库表的差异,执行针对所述中间数据库中所述中间库表的数据转换操作;Based on the difference between the intermediate database table and the second database table, perform a data conversion operation on the intermediate database table in the intermediate database;

将所述数据转换操作所得的目标待融合数据同步至所述目标数据库的所述第二库表中。Synchronize the target data to be fused obtained by the data conversion operation to the second database table of the target database.

根据本申请提供的一种基于数据库的数据融合方法,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:According to a database-based data fusion method provided by this application, the execution of a fusion operation for merging the data to be fused in the intermediate database to the target database includes:

确定触发器收集到表征源数据库中库表数据发生变化的变更数据时,触发生成增量数据融合请求;When the determination trigger collects change data that represents changes in the database table data in the source database, it triggers the generation of an incremental data fusion request;

获取所述变更数据对应的待融合增量数据,并基于所述增量数据融合请求,执行针对所述待融合增量数据融合至所述目标数据库的增量融合操作。Acquire the incremental data to be fused corresponding to the changed data, and perform an incremental fusion operation for merging the incremental data to be fused to the target database based on the incremental data fusion request.

根据本申请提供的一种基于数据库的数据融合方法,所述执行针对所述待融合增量数据融合至所述目标数据库的增量融合操作,包括:According to a database-based data fusion method provided by this application, performing an incremental fusion operation for merging the incremental data to be fused to the target database includes:

获取所述待融合增量数据的实时性需求,并在预设的增量同步接口中选取与所述实时性需求匹配的目标增量同步接口;Obtain the real-time requirements of the incremental data to be fused, and select a target incremental synchronization interface that matches the real-time requirements from the preset incremental synchronization interfaces;

基于所述目标增量同步接口,执行针对所述待融合增量数据融合至所述目标数据库的增量融合操作。Based on the target incremental synchronization interface, an incremental fusion operation is performed for merging the incremental data to be fused to the target database.

根据本申请提供的一种基于数据库的数据融合方法,在所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作之后,所述方法还包括:According to a database-based data fusion method provided by this application, after performing the fusion operation of merging the data to be fused in the intermediate database to the target database, the method further includes:

获取所述融合操作结束时记录的当前融合任务及所述当前融合任务的任务明细数据;Obtain the current fusion task recorded at the end of the fusion operation and the task detail data of the current fusion task;

基于所述当前融合任务及所述任务明细数据,更新预设的融合任务历史表和任务数据明细历史表。Based on the current fusion task and the task detail data, the preset fusion task history table and task data detail history table are updated.

根据本申请提供的一种基于数据库的数据融合方法,在所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作之后,所述方法还包括:According to a database-based data fusion method provided by this application, after performing the fusion operation of merging the data to be fused in the intermediate database to the target database, the method further includes:

确定监控到表征触发器异常的第一异常信息时,记录所述第一异常信息并进行告警提示。When it is determined that the first abnormal information indicating the abnormality of the trigger is monitored, the first abnormal information is recorded and an alarm is provided.

根据本申请提供的一种基于数据库的数据融合方法,在所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作之后,所述方法还包括:According to a database-based data fusion method provided by this application, after performing the fusion operation of merging the data to be fused in the intermediate database to the target database, the method further includes:

确定监控到表征融合操作异常的第二异常信息时,输出告警指示信息,所述告警指示信息用于指示人工干预处理异常且针对所述第二异常信息对应的待融合数据支持重新融合操作。When it is determined that the second abnormal information indicating the abnormality of the fusion operation is monitored, alarm indication information is output, and the alarm indication information is used to indicate the manual intervention processing abnormality and supports the re-fusion operation for the data to be fused corresponding to the second abnormal information.

根据本申请提供的一种基于数据库的数据融合方法,所述方法还包括:According to a database-based data fusion method provided by this application, the method further includes:

确定所述源数据库和所述目标数据库存在相同库表和相同主键时,执行针对所述相同库表新增预设字段的增加操作;When it is determined that the source database and the target database have the same library table and the same primary key, perform an operation of adding a new preset field for the same library table;

基于所述相同主键和所述增加操作所得的所述预设字段,确定联合主键。A joint primary key is determined based on the same primary key and the preset field obtained by the adding operation.

本申请还提供一种基于数据库的数据融合装置,包括:This application also provides a database-based data fusion device, including:

同步模块,用于基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中;The synchronization module is used to synchronize the data to be fused in the source database to the intermediate database based on the data fusion request;

融合模块,用于执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作;A fusion module, configured to perform a fusion operation for merging the data to be fused in the intermediate database to the target database;

其中,所述中间数据库用于表征所述待融合数据的属性信息和所述目标数据库中融合所述待融合数据的库表的属性信息。Wherein, the intermediate database is used to characterize the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused.

本申请还提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上述任一种所述基于数据库的数据融合方法。This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements any one of the above database-based operations. Data fusion methods.

本申请还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一种所述基于数据库的数据融合方法。The present application also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the database-based data fusion method as described above is implemented.

本申请还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述任一种所述基于数据库的数据融合方法。The present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the computer program implements any of the above-mentioned database-based data fusion methods.

本申请提供的基于数据库的数据融合方法、装置、电子设备及存储介质,其中基于数据库的数据融合方法,基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中,再执行针对中间数据库中的待融合数据融合至目标数据库的融合操作,以此通过使用中间数据库作为中转缓存区的方式实现针对待融合数据的相关处理操作,确保源数据库和目标数据库的实际生产不受影响;进一步的,由于中间数据库用于表征待融合数据的属性信息和目标数据库中融合待融合数据的库表的属性信息,因此使用中间数据库能够处理源数据库和目标数据库中库表名称不同、结构不同、字段不同、库表不同等各种情况下的数据融合操作,支持非同源的多个数据库的数据融合,也能保持源数据库和目标数据库的同时可访问性,实现数据在线融合,从而也能够在不影响实际生产的前提下实现大规模复杂数据融合的目的。This application provides a database-based data fusion method, device, electronic equipment and storage medium. The database-based data fusion method synchronizes the data to be fused in the source database to the intermediate database based on the data fusion request, and then executes the intermediate database. The fusion operation of merging the data to be fused in the database to the target database uses the intermediate database as a transfer buffer to implement the relevant processing operations for the data to be fused, ensuring that the actual production of the source database and the target database is not affected; further Since the intermediate database is used to represent the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused, the use of the intermediate database can handle the different names, structures, and fields of the library tables in the source database and the target database. Data fusion operations under various circumstances such as different databases and different database tables support data fusion of multiple non-homogeneous databases. It can also maintain the simultaneous accessibility of the source database and the target database to achieve online data fusion, so that it can also be used in The purpose of achieving large-scale complex data fusion without affecting actual production.

附图说明Description of the drawings

为了更清楚地说明本申请或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions in this application or the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are of the present invention. For some embodiments of the application, those of ordinary skill in the art can also obtain other drawings based on these drawings without exerting creative efforts.

图1是本申请提供的基于数据库的数据融合方法的流程示意图之一;Figure 1 is one of the flow diagrams of the database-based data fusion method provided by this application;

图2是本申请提供的基于数据库的数据融合方法的数据流向逻辑图;Figure 2 is a data flow logic diagram of the database-based data fusion method provided by this application;

图3是本申请提供的基于数据库的数据融合装置的结构示意图;Figure 3 is a schematic structural diagram of the database-based data fusion device provided by this application;

图4是本申请提供的电子设备的结构示意图。Figure 4 is a schematic structural diagram of an electronic device provided by this application.

具体实施方式Detailed ways

为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请中的附图,对本申请中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application. , not all examples. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.

目前大部分数据库产品都有对应的备份和复制机制,但是提供的都是标准化的产品,对数据复制、数据备份等场景提供了通用化的解决方案,但是在实际生产过程中,除了数据复制、数据备份场景之外,还需要处理多个数据库渐进式融合的情况。At present, most database products have corresponding backup and replication mechanisms, but they provide standardized products and provide universal solutions for data replication, data backup and other scenarios. However, in the actual production process, in addition to data replication, In addition to data backup scenarios, it is also necessary to deal with the progressive fusion of multiple databases.

由于市场上最典型和成熟的产品是甲骨文(Oracle)公司的GoldenGate软件,虽然能够提供数据容灾和数据复制的功能,支持零宕机的数据库升级和迁移,以及实现亚秒级的数据实时同步,但是GoldenGate软件主要用于同源数据库或同业务不同的地域数据库之间的数据复制操作。对于原本两个不同业务的数据库,当其大部分库表的名称和内容比较相似时,无法处理以下问题:(1)当源端和目标端存在完全不同的库表时,需要删除或者新增某些库表,无法自动处理;(2)当源端库表和目标端库表字段不同时,需要新增或删除某些字段,无法自动处理;(3)当源端库表和目标端库表存在主键冲突且数据不同时,只能选择覆盖或丢弃,不能完整保存对应两份数据,也不能记录数据来源;(4)不支持对数据同步的历史日志的回溯;(5)缺乏对多个非同源数据库融合的复杂场景的支持。The most typical and mature product on the market is Oracle's GoldenGate software, which can provide data disaster recovery and data replication functions, support zero-downtime database upgrades and migrations, and achieve sub-second real-time data synchronization. , but GoldenGate software is mainly used for data replication operations between homologous databases or databases in different regions with the same business. For two originally different business databases, when the names and contents of most of the database tables are similar, the following problems cannot be solved: (1) When there are completely different database tables on the source end and the target end, they need to be deleted or added Some library tables cannot be processed automatically; (2) When the fields of the source library table and the target library table are different, some fields need to be added or deleted and cannot be processed automatically; (3) When the source library table and the target library table When there is a primary key conflict in the database table and the data is different, you can only choose to overwrite or discard it. The two corresponding data cannot be completely saved, and the data source cannot be recorded; (4) Backtracking of historical logs for data synchronization is not supported; (5) There is a lack of support for data synchronization. Supports complex scenarios of merging multiple non-homogeneous databases.

基于上述问题,本申请提供一种基于数据库的数据融合方法、装置、电子设备及存储介质,其中基于数据库的数据融合方法的执行主体可以为含有源数据库的终端设备,终端设备可以为个人计算机(Personal Computer,PC)、便携式设备、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备等其它电子设备,且该客户端至少具备数据包接收播放功能、数据包抓取功能、存储功能、解析功能及统计分析功能。本申请对客户端的具体形式不做限定。Based on the above problems, this application provides a database-based data fusion method, device, electronic device and storage medium. The execution subject of the database-based data fusion method can be a terminal device containing a source database, and the terminal device can be a personal computer ( Personal Computer (PC), portable devices, laptops, smartphones, tablets, portable wearable devices and other electronic devices, and the client has at least the data packet reception and playback function, data packet capture function, storage function, and analysis function and statistical analysis functions. This application does not limit the specific form of the client.

需要说明的是,下述方法实施例均以执行主体为终端设备为例进行说明,且下述方法实施例以从集团客户业务综合运营平台(Enterprise Service Operation Platform,ESOP)库这一源数据库融入客户关系管理(Customer Relationship Management,CRM)库这一目标数据库为例详细描述融合方法。下面结合图1-图4描述本申请的基于数据库的数据融合方法、装置、电子设备及存储介质。It should be noted that the following method embodiments are explained by taking the execution subject as a terminal device as an example, and the following method embodiments are integrated from the source database of the Group Customer Business Integrated Operation Platform (Enterprise Service Operation Platform, ESOP) library. The fusion method is described in detail using the target database of Customer Relationship Management (CRM) library as an example. The database-based data fusion method, device, electronic device and storage medium of the present application will be described below with reference to Figures 1-4.

参照图1,为本申请提供的基于数据库的数据融合方法的流程示意图,如图1所示,该基于数据库的数据融合方法,包括以下步骤:Referring to Figure 1, a schematic flow chart of the database-based data fusion method provided by this application is shown. As shown in Figure 1, the database-based data fusion method includes the following steps:

步骤110、基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中。Step 110: Based on the data fusion request, synchronize the data to be fused in the source database to the intermediate database.

其中,所述中间数据库用于表征所述待融合数据的属性信息和所述目标数据库中融合所述待融合数据的库表的属性信息。Wherein, the intermediate database is used to characterize the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused.

具体的,当待融合数据为源数据库中至少一个库表的数据时,待融合数据的属性信息可以包括该至少一个库表的库表结构和表内数据,此时数据融合请求为针对该至少一个库表的全量数据融合请求;并且,目标数据库中融合所述待融合数据的库表的属性信息可以包括该库表的库表结构,也即,当中间数据库包括临时源库和临时目标库时,临时源库保持与待融合数据所在库表的结构和表内数据一致,临时目标库则保持与目标数据库中对应库表的库表结构一致。基于此,基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中,可以是使用可靠、高效的GoldenGate技术将待融合数据同步转移至中间数据库的临时源库。Specifically, when the data to be fused is data from at least one database table in the source database, the attribute information of the data to be fused may include the database table structure and data in the table of the at least one database table. At this time, the data fusion request is for the at least one database table. A full data fusion request for a database table; and, the attribute information of the database table that fuses the data to be fused in the target database may include the database table structure of the database table, that is, when the intermediate database includes a temporary source database and a temporary target database At this time, the temporary source database remains consistent with the structure of the database table where the data to be fused is located and the data in the table, and the temporary target database remains consistent with the database table structure of the corresponding database table in the target database. Based on this, based on the data fusion request, the data to be fused in the source database is synchronized to the intermediate database. The reliable and efficient GoldenGate technology can be used to synchronize the data to be fused to the temporary source database of the intermediate database.

步骤120、执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作。Step 120: Perform a fusion operation for merging the data to be fused in the intermediate database to the target database.

具体的,当源数据库中的待融合数据被同步转移至中间数据库的临时源库中时,也可以基于可靠、高效的GoldenGate技术执行针对待融合数据的融合至目标数据库的融合操作。如图2所示,源数据库中的库表TABLE1、TABLE2、TABLE3和TABLE4可以先同步转移至临时源库中,临时源库中的库表库表TABLE1、TABLE2、TABLE3和TABLE4再同步转移至临时目标库中,并且两次同步转移均使用GoldenGate技术,如果需要对待融合数据进行数据拆分、数据转换等操作,也可在中间数据库中完成,以此确保对源数据库和目标数据库的影响达到最小,因此也能够保证数据的平滑对接同步。Specifically, when the data to be fused in the source database is synchronously transferred to the temporary source database of the intermediate database, the fusion operation of the data to be fused to the target database can also be performed based on the reliable and efficient GoldenGate technology. As shown in Figure 2, the database tables TABLE1, TABLE2, TABLE3 and TABLE4 in the source database can be synchronously transferred to the temporary source database first, and the database tables TABLE1, TABLE2, TABLE3 and TABLE4 in the temporary source database can then be synchronously transferred to the temporary source database. In the target database, GoldenGate technology is used for both synchronization transfers. If data splitting, data conversion and other operations need to be performed on the fused data, it can also be completed in the intermediate database to ensure that the impact on the source database and target database is minimized. , so it can also ensure smooth docking and synchronization of data.

本申请提供的基于数据库的数据融合方法,基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中,再执行针对中间数据库中的待融合数据融合至目标数据库的融合操作,以此通过使用中间数据库作为中转缓存区的方式实现针对待融合数据的相关处理操作,确保源数据库和目标数据库的实际生产不受影响;进一步的,由于中间数据库用于表征待融合数据的属性信息和目标数据库中融合待融合数据的库表的属性信息,因此使用中间数据库能够处理源数据库和目标数据库中库表名称不同、结构不同、字段不同、库表不同等各种情况下的数据融合操作,支持非同源的多个数据库的数据融合,也能保持源数据库和目标数据库的同时可访问性,实现数据在线融合,从而也能够在不影响实际生产的前提下实现大规模复杂数据融合的目的。The database-based data fusion method provided by this application synchronizes the data to be fused in the source database to the intermediate database based on the data fusion request, and then performs the fusion operation of merging the data to be fused in the intermediate database to the target database. By using the intermediate database as a transfer cache area, the relevant processing operations for the data to be fused are implemented to ensure that the actual production of the source database and the target database is not affected; further, because the intermediate database is used to represent the attribute information and targets of the data to be fused The database combines the attribute information of the database tables of the data to be fused. Therefore, the use of the intermediate database can handle data fusion operations in various situations such as different database table names, different structures, different fields, and different database tables in the source database and the target database. Support The data fusion of multiple non-homogeneous databases can also maintain the simultaneous accessibility of the source database and the target database, and achieve online data fusion, thus achieving the purpose of large-scale complex data fusion without affecting actual production.

可选的,步骤120的实现过程可以包括:Optionally, the implementation process of step 120 may include:

确定目标数据库没有所述待融合数据时,将所述中间数据库中的所述待融合数据同步至所述目标数据库中。When it is determined that the target database does not have the data to be fused, the data to be fused in the intermediate database is synchronized to the target database.

具体的,当确定目标数据库没有待融合数据所在库表且目标数据库不需要按照预设标识进行库表拆分时,此时无需对待融合数据进行转换迁移,而是在目标数据库中新建库表以导入待融合数据,也即可以采用GoldenGate技术直接将中间数据库的临时源库中的待融合数据同步转移至目标数据库中,此时源数据库、中间数据库及目标数据库中存放的待融合数据所在库表的名称、结构、字段含义均一致。其中,预设标识包括但不限定区域标识。Specifically, when it is determined that the target database does not have a database table containing the data to be fused and the target database does not need to split the database tables according to the preset identifier, there is no need to convert and migrate the data to be fused. Instead, a new database table is created in the target database to Import the data to be fused, that is, you can use GoldenGate technology to directly transfer the data to be fused in the temporary source database of the intermediate database to the target database synchronously. At this time, the database tables where the data to be fused stored in the source database, intermediate database, and target database are located The names, structures, and field meanings are all consistent. Among them, the preset identification includes but is not limited to the regional identification.

本申请提供的基于数据库的数据融合方法,当目标数据库中无待融合数据所在库表时,通过直接将中间数据库中的待融合数据直接同步转移至目标数据库的方式提高数据融合的可操作性,实现利用中间数据库确保源数据库和目标数据库的实际生产不受影响。The database-based data fusion method provided by this application improves the operability of data fusion by directly synchronously transferring the data to be fused in the intermediate database to the target database when there is no database table containing the data to be fused in the target database. The implementation utilizes an intermediate database to ensure that actual production of the source and target databases is not affected.

可选的,所述目标数据库的数量为多个时,步骤120的实现过程可以包括:Optionally, when there are multiple target databases, the implementation process of step 120 may include:

首先,确定目标数据库没有所述待融合数据时,将所述待融合数据同步至所述中间数据库的临时源库中进行拆分操作,得到多个待融合数据;然后,将所述多个待融合数据转移至所述中间数据库的临时目标库中;最后,执行针对所述临时目标库中每个所述待融合数据融合至对应所述目标数据库中的融合操作。First, when it is determined that the target database does not have the data to be fused, the data to be fused is synchronized to the temporary source database of the intermediate database for splitting operations to obtain multiple data to be fused; then, the multiple data to be fused are The fused data is transferred to the temporary target database of the intermediate database; finally, a fusion operation is performed for each data to be fused in the temporary target database to be merged into the corresponding target database.

具体的,当确定目标数据库没有待融合数据所在库表且目标数据库需要按照预设标识进行库表拆分时,此时则需要对待融合数据进行拆分迁移,也即先对中间数据库的临时源库中的待融合数据进行数据拆分,以将待融合数据所在库表拆分为多个库表,再进一步采用转储(DUMP)结合插入(INSERT)的方式,将临时源库拆分的多个库表导出至临时目标库中,最后再使用GoldenGate技术将临时目标库中的多个库表分别同步转移至对应的目标数据库中。Specifically, when it is determined that the target database does not have the database table where the data to be fused is located and the target database needs to split the database tables according to the preset identifier, then the data to be fused needs to be split and migrated, that is, the temporary source of the intermediate database must be first The data to be fused in the database is split into multiple database tables, and then the temporary source database is split using DUMP and INSERT. Export multiple database tables to the temporary target database, and finally use GoldenGate technology to synchronously transfer multiple database tables in the temporary target database to the corresponding target database.

本申请提供的基于数据库的数据融合方法,当目标数据库中无待融合数据所在库表且其数量为多个时,将待融合数据所在库表先在中间数据库进行拆分、后向对应目标数据库进行同步转移,以此通过在中间数据库临时源库和临时目标库之间预置各种数据转换操作和映射关系,提高数据融合的灵活性和可靠性,因此不需要修改现有业务逻辑即可实现数据在线融合目的,克服了传统数据同步和融合场景无法解决个性化需求的困难,也能实现利用中间数据库确保源数据库和目标数据库的实际生产不受影响。The database-based data fusion method provided by this application, when there is no database table containing the data to be fused in the target database and the number of the database tables is multiple, the database table containing the data to be fused is first split in the intermediate database and then corresponding to the target database. Perform synchronous transfer to improve the flexibility and reliability of data fusion by presetting various data conversion operations and mapping relationships between the temporary source database and the temporary target database of the intermediate database, so there is no need to modify the existing business logic. Achieving the purpose of online data fusion overcomes the difficulty of traditional data synchronization and fusion scenarios that cannot meet personalized needs. It can also use intermediate databases to ensure that the actual production of the source database and target database is not affected.

可选的,步骤120的实现过程还可以包括Optionally, the implementation process of step 120 may also include

首先,确定目标数据库中存在与所述待融合数据对应的第一库表时,基于所述待融合数据和所述第一库表的差异,执行针对所述中间数据库中所述待融合数据的数据转换操作;然后,将所述数据转换操作所得的目标待融合数据同步至所述目标数据库的所述第一库表中。First, when it is determined that there is a first database table corresponding to the data to be fused in the target database, based on the difference between the data to be fused and the first database table, perform a search for the data to be fused in the intermediate database. Data conversion operation; then, synchronize the target to-be-fused data obtained by the data conversion operation to the first database table of the target database.

具体的,当确定目标数据库中存在与待融合数据所在库表对应的第一库表时,待融合数据所在库表与第一库表至少存在字段不一致和/或库表结构不一致等差异,此时可以先将中间数据库的临时源库中的待融合数据所在库表先同步转移至临时目标库中,再指示临时目标数据库对同步转移的待融合数据所在库表统一进行字段修改、字段增加和/或库表结构转换等数据转换操作,以使得数据转换操作所得的目标待融合数据所在库表的库表结构,比如将字段“name”同一修改为“姓名”。然后采用GoldenGate技术将数据转换操作所得的目标待融合数据同步转移至目标数据库的第一库表中。Specifically, when it is determined that the first database table corresponding to the database table where the data to be fused exists in the target database, the database table where the data to be fused and the first database table have at least differences such as field inconsistency and/or database table structure inconsistency. You can first synchronously transfer the database table where the data to be fused in the temporary source database of the intermediate database is located to the temporary target database, and then instruct the temporary target database to uniformly modify the fields, add fields, and / Or data conversion operations such as database table structure conversion, so that the target obtained by the data conversion operation is to be integrated with the database table structure of the database table where the data is located, such as changing the field "name" to "name". Then GoldenGate technology is used to synchronously transfer the target data to be fused obtained from the data conversion operation to the first database table of the target database.

本申请提供的基于数据库的数据融合操作,当目标数据库中存在与待融合数据所在库表对应的第一库表时,通过先将待融合数据同步转移至临时目标库、再对临时目标库中对待融合数据进行数据转换操作的方式,实现将数据转换操作所得的目标融合数据同步转移至目标数据库的目的,以此通过中间数据库处理源数据库和目标数据库中库表名称不同、结构不同、字段不同、库表不同等各种场景情况下的数据融合操作,也能实现大规模复杂数据融合的目的。The database-based data fusion operation provided by this application, when there is a first database table corresponding to the database table where the data to be fused exists in the target database, the data to be fused is first synchronously transferred to the temporary target database, and then the temporary target database is The method of data conversion operation on the data to be fused is to achieve the purpose of synchronously transferring the target fusion data obtained by the data conversion operation to the target database, so as to process the different table names, structures and fields in the source database and the target database through the intermediate database. Data fusion operations in various scenarios such as databases and different database tables can also achieve the purpose of large-scale complex data fusion.

可选的,所述待融合数据的数量为多个且多个所述待融合数据之间具备预设关系时,步骤120的实现过程还可以包括:Optionally, when the number of data to be fused is multiple and there is a preset relationship between the multiple data to be fused, the implementation process of step 120 may also include:

首先,确定目标数据库中存在与多个所述待融合数据对应的第二库表时,执行针对所述中间数据库中多个所述待融合数据的合并操作,得到中间库表;其次,基于所述中间库表和所述第二库表的差异,执行针对所述中间数据库中所述中间库表的数据转换操作;最后,将所述数据转换操作所得的目标待融合数据同步至所述目标数据库的所述第二库表中。First, when it is determined that there is a second database table corresponding to multiple data to be fused in the target database, a merge operation is performed on multiple data to be fused in the intermediate database to obtain an intermediate database table; secondly, based on the The difference between the intermediate database table and the second database table is determined, and a data conversion operation is performed on the intermediate database table in the intermediate database; finally, the target to-be-fused data obtained by the data conversion operation is synchronized to the target in the second database table of the database.

其中,预设关系可以表征多个待融合数据所在库表实质相同且存在细微差别,比如待融合所在库表为两个时可以为“女生详情信息表”和“男生详情信息表”。Among them, the preset relationship can represent that the database tables where multiple data to be fused are essentially the same but have subtle differences. For example, when there are two database tables to be fused, they can be "girls' detailed information table" and "boys' detailed information table".

具体的,当源数据库中存在表征多个不同用户数据的待融合数据所在库表时,也即待融合数据所在库表的数量为多个时,若目标数据库中存在与多个待融合数据所在库表对应的一个第二库表时,比如第二库表可以为“人员详情信息表”,此时可以通过GoldenGate技术将多个待融合数据所在库表同步转移至临时源库,并指示临时源库对多个待融合数据所在库表进行合并,当目标数据库的数量为一个时,可以再指示临时目标库针对合并所得的中间库表执行数据转换操作;当目标数据库的数量为多个时,可以指示临时源库针对合并所得的中间库表先执行拆分操作、后指示临时目标库执行数据转换操作,最后将数据转换操作所得的目标融合数据同步转移至目标数据库的第二库表中。其中,拆分操作与数据转换操作可以参照前述方法实施例,此处不再赘述。Specifically, when there are database tables in the source database that represent multiple different user data to be fused, that is, when the number of database tables where the data to be fused is multiple, if there are multiple database tables in the target database that are located in the data to be fused When the database table corresponds to a second database table, for example, the second database table can be a "personnel details information table", in this case, GoldenGate technology can be used to synchronously transfer the database tables where the multiple data to be integrated are located to the temporary source database, and instruct the temporary The source database merges the database tables containing multiple data to be merged. When the number of target databases is one, it can instruct the temporary target database to perform data conversion operations on the merged intermediate database tables; when the number of target databases is multiple , you can instruct the temporary source database to first perform a split operation on the intermediate database table obtained by merging, and then instruct the temporary target database to perform a data conversion operation, and finally synchronously transfer the target fusion data obtained from the data conversion operation to the second database table of the target database. . For the splitting operation and data conversion operation, reference may be made to the foregoing method embodiments and will not be described again here.

本申请提供的基于数据库的数据融合方法,当目标数据库中存在与多个待融合数据所在库表对应的第二库表时,通过在中间数据库中先将多个待融合数据所在库表进行合并操作、后执行数据转换操作的方式,以此利用中间数据库实现数据融合过程中涉及的库表的拆分操作、数据转换、字段新增及字段修改等操作,从而解决复杂数据融合较难实现的问题。The database-based data fusion method provided by this application, when there is a second database table corresponding to the database table where multiple data to be fused is located in the target database, the multiple database tables where the data to be fused are located are first merged in the intermediate database By operating and then performing data conversion operations, the intermediate database is used to implement operations such as splitting operations of database tables, data conversion, adding fields, and modifying fields involved in the data fusion process, thereby solving the difficult problem of complex data fusion. question.

在实际处理过程中,除了全量数据融合之外,还存在增量数据融合,也即在全量数据融合完成之后,可以基于源数据库中发生变化的数据获取待融合增量数据并进行增量数据融合,也即,本申请支持全量数据融合过程中也能进行增量数据融合。基于此,步骤120的实现过程可以包括:In the actual processing process, in addition to full data fusion, there is also incremental data fusion. That is, after the full data fusion is completed, the incremental data to be fused can be obtained based on the changed data in the source database and incremental data fusion can be performed. , that is, this application supports incremental data fusion during the full data fusion process. Based on this, the implementation process of step 120 may include:

首先,确定触发器收集到表征源数据库中库表数据发生变化的变更数据时,触发生成增量数据融合请求;然后,获取所述变更数据对应的待融合增量数据,并基于所述增量数据融合请求,执行针对所述待融合增量数据融合至所述目标数据库的增量融合操作。First, it is determined that when the trigger collects change data that represents changes in the database table data in the source database, it triggers the generation of an incremental data fusion request; then, obtains the incremental data to be fused corresponding to the change data, and based on the increment Data fusion request: perform an incremental fusion operation for merging the incremental data to be fused to the target database.

具体的,由于源数据库和目标数据库可以同时运行且在其同时运行器件,源数据库会不停产生新的业务数据,以此使得源数据库中对应库表中的数据发生变化,因此,为了保证发生变化的数据也能够准确且及时融合至目标数据库的对应库表中,可以针对源数据库中每个库表分别设置触发器,每个触发器用于收集源数据库中对应库表发生变化的变更数据,变更数据表征源数据库中对应库表数据由于业务处理发生变化或者由于人工修改数据发生变化,当确定触发器收集到表征源数据库中库表数据发生变化的变更数据时,可以自动触发生成增量数据融合请求。并且,在源数据库预先分别新增融合任务表、任务数据明细表、融合任务历史表、任务数据明细历史表,基于变更数据对应修改融合任务表和任务数据明细表,以使其达到当前最新版。Specifically, since the source database and the target database can run at the same time and run devices at the same time, the source database will continue to generate new business data, thereby causing the data in the corresponding database tables in the source database to change. Therefore, in order to ensure that The changed data can also be accurately and timely integrated into the corresponding database table of the target database. Triggers can be set for each database table in the source database. Each trigger is used to collect change data of the corresponding database table in the source database. Change data represents changes in the corresponding database table data in the source database due to changes in business processing or manual modification of data. When the trigger is determined to collect change data representing changes in the database table data in the source database, it can automatically trigger the generation of incremental data. Fusion request. In addition, the fusion task table, task data detail table, fusion task history table, and task data detail history table are added in the source database in advance, and the fusion task table and task data detail table are correspondingly modified based on the changed data to make them reach the latest version. .

进一步的,从当前最新版的融合任务表和任务数据明细表中读取待融合增量数据,待融合增量数据包括变更数据对应的待融合任务及该待融合任务的任务明细数据,并基于增量数据融合请求,执行针对待融合增量数据融合至目标数据库的增量融合操作。Further, the incremental data to be fused is read from the latest version of the fusion task table and the task data detail table. The incremental data to be fused includes the tasks to be fused corresponding to the changed data and the task details of the tasks to be fused, and based on Incremental data fusion request: perform an incremental fusion operation on the incremental data to be fused to the target database.

需要说明的是,针对源数据库中每个库表分别设置的触发器,可以均为新增/更新/删除(INSERT/UPDATE/DELETE,DML)触发器,通过使用DML触发器触发数据融合操作,并建立融合任务表和任务数据明细表的稽核比对机制,确保数据一致性。如果发现数据异常,可以通过融合任务历史表和任务数据明细历史表进行回溯查证。It should be noted that the triggers set for each database table in the source database can all be new/updated/delete (INSERT/UPDATE/DELETE, DML) triggers. By using DML triggers to trigger the data fusion operation, And establish an audit and comparison mechanism that integrates task tables and task data details to ensure data consistency. If data anomalies are found, retrospective verification can be performed by fusing the task history table and the task data detail history table.

本申请提供的基于数据库的数据融合方法,针对全量数据融合完成后生成的增量数据融合请求及获取的待融合增量数据,执行针对待融合增量数据融合至目标数据库的增量融合操作,以此实现全量数据融合完成后针对变更数据实时保存增量数据融合任务及其任务明细数据的目的,从而确保目标数据库及时且有效融合源数据库中的变化数据,提供同步日志记录功能以及数据同步回溯功能。The database-based data fusion method provided by this application performs an incremental fusion operation on the incremental data to be fused to the target database based on the incremental data fusion request generated after the full data fusion is completed and the acquired incremental data to be fused. This achieves the purpose of real-time saving of incremental data fusion tasks and task details for changed data after full data fusion is completed, thereby ensuring that the target database integrates the changed data in the source database in a timely and effective manner, and provides synchronization logging functions and data synchronization backtracking. Function.

可选的,当生成增量数据融合请求时,步骤120的实现过程还可以包括:Optionally, when generating an incremental data fusion request, the implementation process of step 120 may also include:

首先,获取所述待融合增量数据的实时性需求,并在预设的增量同步接口中选取与所述实时性需求匹配的目标增量同步接口;然后,基于所述目标增量同步接口,执行针对所述中间数据库中的所述待融合增量数据融合至所述目标数据库的增量融合操作。First, obtain the real-time requirements of the incremental data to be fused, and select a target incremental synchronization interface that matches the real-time requirements from the preset incremental synchronization interfaces; then, based on the target incremental synchronization interface , perform an incremental fusion operation for merging the to-be-fused incremental data in the intermediate database to the target database.

具体的,针对源数据库中存在不允许出错的关键信息,比如欠费状态、余额、账号等,这类关键信息对实时性要求很高,因此针对待融合增量数据进行融合时,先判断待融合增量数据是否为实时性需求较高的数据,若待融合增量数据对实时性要求不高,可以采用文件接口作为目标增量同步接口;若待融合增量数据对实时性要求高,可以采用实时接口作为目标增量同步接口。然后,再基于目标增量同步接口,执行针对待融合增量数据融合至目标数据库的增量融合操作。Specifically, there is key information in the source database that does not allow errors, such as arrears status, balance, account number, etc. This type of key information requires high real-time performance. Therefore, when merging the incremental data to be fused, first determine the data to be fused. Whether the incremental data to be fused is data with high real-time requirements. If the incremental data to be fused does not have high real-time requirements, the file interface can be used as the target incremental synchronization interface; if the incremental data to be fused has high real-time requirements, A real-time interface can be used as the target incremental synchronization interface. Then, based on the target incremental synchronization interface, an incremental fusion operation is performed to fuse the incremental data to be fused to the target database.

需要说明的是,源数据库中可以预先设置针对增量融合操作的增量同步接口,比如文件接口和实时接口,文件接口用于同步转移实用性要求不高的数据,实时接口用于同步转移实时性要求高的数据,也即,待融合增量数据所在库表对应的原应用未下线,该原应用还是方位源数据库,融合到目标数据库的数据也只是原应用的数据副本,对实时性要求不高,此时可选择文件接口进行增量数据同步;新应用逐步上线过程中,待融合增量数据所在库表对应的原应用在下线过程中仍会产生部分数据,为了确保新应用在逐步上线过程中数据的准确性,需要进行增量数据融合,针对部分实时性要求高的查询业务,需要使用实时接口进行增量数据融合。此时,由于源数据库和目标数据库中库表数据不一致,则需要在当前最新版的融合任务表和任务数据明细表中读取待融合增量数据之后,根据源数据库中库表与目标源数据库中库表之间的映射关系,可以对待融合增量数据进行拆分操作和/或数据转换处理后再同步转移至目标数据库中。It should be noted that the source database can be pre-set with incremental synchronization interfaces for incremental fusion operations, such as file interfaces and real-time interfaces. The file interface is used to synchronously transfer data with low practical requirements, and the real-time interface is used to synchronously transfer real-time data. Data with high performance requirements, that is, the original application corresponding to the database table where the incremental data to be fused has not been offline. The original application is still the source database, and the data merged into the target database is only a copy of the data of the original application, which has no impact on real-time performance. The requirements are not high. At this time, you can choose the file interface for incremental data synchronization; during the gradual online process of new applications, the original application corresponding to the database table where the incremental data to be integrated will still generate some data during the offline process. In order to ensure that the new application is The accuracy of data during the gradual online process requires incremental data fusion. For some query services with high real-time requirements, real-time interfaces need to be used for incremental data fusion. At this time, since the database table data in the source database and the target database are inconsistent, it is necessary to read the incremental data to be fused from the latest version of the fusion task table and task data detail table, and then read the database table in the source database and the target source database according to the The mapping relationship between the tables in the database can be split and/or converted to the incremental data to be fused and then synchronously transferred to the target database.

本申请提供的基于数据库的数据融合方法,通过选取与待融合增量数据的实时性需求匹配的目标增量同步接口,使得待融合增量数据能够准确且及时的同步转移至目标数据库中,从而提高了增量数据融合的可靠性和稳定性。The database-based data fusion method provided by this application selects a target incremental synchronization interface that matches the real-time requirements of the incremental data to be fused, so that the incremental data to be fused can be accurately and timely synchronously transferred to the target database, thereby Improved the reliability and stability of incremental data fusion.

可选的,针对增量数据融合,步骤120的实现过程可以包括:Optionally, for incremental data fusion, the implementation process of step 120 may include:

首先,获取所述融合操作结束时记录的当前融合任务及所述当前融合任务的任务明细数据;其次,基于所述当前融合任务及所述任务明细数据,更新预设的融合任务历史表和任务数据明细历史表。First, obtain the current fusion task recorded at the end of the fusion operation and the task detailed data of the current fusion task; secondly, based on the current fusion task and the task detailed data, update the preset fusion task history table and task Data detail history table.

具体的,不论当前融合任务针对全量数据融合还是增量数据融合,每次融合操作结束,都会在预先设置的融合任务表和任务数据明细表中记录当前融合任务及其任务明细数据,并将所记录的当前融合任务及其任务明细数据移入对应的融合任务历史表和任务数据明细历史表,以此实现对融合任务历史表和任务数据明细历史表的实时更新。其中,融合任务表、任务数据明细表、融合任务历史表和任务数据明细历史表的具体结构如下所示:Specifically, regardless of whether the current fusion task is for full data fusion or incremental data fusion, at the end of each fusion operation, the current fusion task and its task details will be recorded in the preset fusion task table and task data details table, and all the data will be recorded. The recorded current fusion task and its task detail data are moved into the corresponding fusion task history table and task data detail history table, thereby achieving real-time updates to the fusion task history table and task data detail history table. Among them, the specific structures of the fusion task table, task data detail table, fusion task history table and task data detail history table are as follows:

表1融合任务表Table 1 Fusion task list

表2任务数据明细表Table 2 Task data details

表3融合任务历史表Table 3 Fusion task history table

表4任务数据明细历史表Table 4 Task data details history table

本申请提供的基于数据库的数据融合方法,通过在每次融合操作结束时将记录的当前融合任务及其任务明细数据移入对应的融合任务历史表和任务数据明细历史表的方式,实时更新融合任务历史表和任务数据明细历史表,从而为后续稽核和回溯提供充分数据支持。The database-based data fusion method provided by this application updates the fusion task in real time by moving the recorded current fusion task and its task detail data into the corresponding fusion task history table and task data detail history table at the end of each fusion operation. History table and task data detail history table, thus providing sufficient data support for subsequent auditing and backtracking.

在实际处理过程中,当源数据库、中间数据库或者目标数据库内的数据发生变化时,都会对应生成数据库日志并进行保存,基于此,在步骤110之前,可以在源数据库、中间数据库或者目标数据库设置定时任务,并且预先设置需要全量数据融合的各个库表,也即割接范围的全量表,以使当任务明细数据表和任务数据明细历史表内数量经由统计比对发现异常时,可以通过查找各个数据库日志的方式进行修复,以及当确定同步转移至目标数据库中的待融合数据出现数据缺失问题时,比如待融合数据对应库表在源数据库和目标数据库中的结构一致时,待融合数据在源数据库中有100万条,同步转移至目标数据库中少了1万多条,此时可认为存在数据缺失问题;亦比如,针对源数据库中待融合数据所在库表中“姓名”的字段同步转移至目标数据库中后是否发生字段丢失或字段意思错误,针对数据缺失问题可以进行字段抽检比对,数据缺失问题可以由于触发器异常引起或者同步转移异常导致,并且也可以通过查找各个数据库日志的方式进行人工干预修复;此外,针对生产过程中的重要数据,比如号码的余额、客户基本信息及用户属性信息等其它不能出错的核心数据可以作为核心表数据设置于核心库中,并且采用每天新产生的业务获取日增量数据进行稽核对账,针对生产过程中的非重要数据,比如工单、日志记录的中间驱动过程中的数据及业务流程上的数据,其数据量通常较大,可以不做对账;对于源数据库中每一库表对应设置的触发器,当某一触发器失效时,可以根据各个数据库日志文件获取变更数据进行人工比对和人工修复,各个数据库日志文件可由管理员设置其保留时长及其配置,当某一触发器异常时也可以手动触发融合操作,触发器也可以基于数据库日志文件进行灵活配置。比如,当触发器a在时刻A异常时,触发器a在时刻A之后的更新数据可以通过查找各数据库日志文件获取,使得触发器a从失效到修复好的时间段内产生的更新数据也能在后续参与稽核对账。During the actual processing, when the data in the source database, intermediate database or target database changes, the database log will be generated and saved accordingly. Based on this, before step 110, you can set the settings in the source database, intermediate database or target database. Schedule tasks, and pre-set each database table that requires full data fusion, that is, the full table in the cutover range, so that when anomalies are found through statistical comparison of the quantities in the task detail data table and the task data detail history table, you can search through Repair each database log, and when it is determined that the data to be fused to be synchronously transferred to the target database has data missing problems, such as when the structure of the database table corresponding to the data to be fused is consistent in the source database and the target database, the data to be fused is There are 1 million entries in the source database, but more than 10,000 entries are missing when synchronized to the target database. At this time, it can be considered that there is a data missing problem; for example, for the "name" field synchronization in the database table where the data to be fused is located in the source database Check whether fields are missing or have wrong meanings after being transferred to the target database. For data missing problems, field spot checks can be performed and compared. Data missing problems can be caused by trigger exceptions or synchronization transfer exceptions, and can also be found by searching the logs of each database. manual intervention and repair; in addition, important data in the production process, such as the balance of the number, basic customer information, user attribute information and other core data that cannot make mistakes can be set as core table data in the core database, and use daily updates The generated business obtains daily incremental data for auditing and reconciliation. For non-important data in the production process, such as work orders, data in the intermediate driving process of log records and data on business processes, the data volume is usually large and can be No reconciliation is performed; for the triggers set corresponding to each database table in the source database, when a trigger fails, the change data can be obtained from each database log file for manual comparison and manual repair. Each database log file can be managed by The administrator can set the retention period and its configuration. When a trigger is abnormal, the fusion operation can also be manually triggered. The trigger can also be flexibly configured based on the database log file. For example, when trigger a is abnormal at time A, the updated data of trigger a after time A can be obtained by searching the log files of each database, so that the updated data generated from the failure of trigger a to the time when it is repaired can also be obtained. Participate in subsequent audits and reconciliations.

可选的,在步骤120之后,所述方法还可以包括:Optionally, after step 120, the method may also include:

确定监控到表征触发器异常的第一异常信息时,记录所述第一异常信息并进行告警提示。When it is determined that the first abnormal information indicating the abnormality of the trigger is monitored, the first abnormal information is recorded and an alarm is provided.

具体的,源数据库中每个库表所对应设置的触发器不仅具备监听机制,还具备恢复机制,因此,为了确保触发器的监听机制异常时不影响融合操作,可以预先设置触发器实时监控的守护进程,以此实现触发器的状态实时监控目的,守护进程为独立程序且可在终端设备上设置,其可以访问各个数据库,比如源数据库、中间数据库和目标数据库。当该守护进程监测到某一触发器出现异常,则针对该触发器记录发生异常的第一异常信息,并及时发出告警,同时,该发生异常的触发器可以启动自身的恢复机制自动恢复监听机制,也可以通过人为修改程序设置的方式恢复监听机制,此处不作具体限定。Specifically, the triggers set corresponding to each database table in the source database not only have a monitoring mechanism, but also a recovery mechanism. Therefore, in order to ensure that the fusion operation is not affected when the trigger's monitoring mechanism is abnormal, real-time monitoring of triggers can be set in advance. Daemon process, in order to achieve real-time monitoring of the status of triggers. The daemon process is an independent program and can be set up on the terminal device. It can access various databases, such as source database, intermediate database and target database. When the daemon detects an exception in a trigger, it records the first exception information for the trigger and issues an alarm in a timely manner. At the same time, the abnormal trigger can start its own recovery mechanism to automatically restore the listening mechanism. , the monitoring mechanism can also be restored by manually modifying the program settings, and there are no specific limitations here.

本申请提供的基于数据库的数据融合方法,通过设置守护进程监控触发器是否发生异常的方式及时发现异常的触发器,不仅能够保存融合任务的日志明细,便于回溯,也能确保数据一致性,从而实现触发器由于失效或其它原因导致异常时也能确保数据融合操作的正常执行及新业务数据的有效记录,保障在线数据融合正常运行,有效提高了数据一致性及数据回溯的准确性。The database-based data fusion method provided by this application can promptly detect abnormal triggers by setting up a daemon process to monitor whether the triggers are abnormal. It can not only save the log details of the fusion task for easy backtracking, but also ensure data consistency, thus When the trigger is abnormal due to failure or other reasons, it can also ensure the normal execution of data fusion operations and the effective recording of new business data, ensure the normal operation of online data fusion, and effectively improve the data consistency and the accuracy of data backtracking.

可选的,在步骤120之后,所述方法还可以包括:Optionally, after step 120, the method may also include:

确定监控到表征融合操作异常的第二异常信息时,输出告警指示信息,所述告警指示信息用于指示人工干预处理异常且针对所述第二异常信息对应的待融合数据支持重新融合操作。When it is determined that the second abnormal information indicating the abnormality of the fusion operation is monitored, alarm indication information is output, and the alarm indication information is used to indicate the manual intervention processing abnormality and supports the re-fusion operation for the data to be fused corresponding to the second abnormal information.

其中,融合操作异常可以为向目标数据库中同步转移待融合数据的操作失败而导致排队的待融合数据积压,排队的待融合数据积压可以为排队的待融合数据的数量超过预设数量阈值。Among them, the fusion operation anomaly can be caused by the failure of synchronously transferring the data to be fused to the target database, resulting in a backlog of queued data to be fused, and the backlog of queued data to be fused can be that the number of queued data to be fused exceeds a preset quantity threshold.

具体的,针对预先设置的融合任务表或融合任务历史表,可以设置监控进程,该监控进程用于监控融合任务是否积压,也即监控排队的待融合数据是否积压,比如短时间内待融合数据过于多时,则有可能导致融合操作失败直至发生积压。基于此,当监控进程监控到表征排队的待融合数据积压的第二异常信息时,可以认为针对某一待融合数据的融合操作失败导致后续的待融合数据逐一排队直至积压或者大量的融合操作失败,比如排队的待融合数据超过一千或者一万时认为排队的待融合数据积压,融合操作失败可以包括非正常失败和正常失败,正常失败不需要告警及人工干预处理,非正常失败(比如系统超时)次数过多时则需要告警及人工干预处理。也即,针对第二异常信息,可以在记录第二异常信息的同时输出告警指示信息,该告警指示信息用于指示人工干预处理异常且针对第二异常信息对应的待融合数据支持重新融合操作,以使得人工干预处理异常完成时针对排队的待融合数据重新执行融合操作。Specifically, a monitoring process can be set for the preset fusion task table or fusion task history table. The monitoring process is used to monitor whether the fusion tasks are backlogged, that is, to monitor whether the queued data to be fused is backlogged, such as the data to be fused in a short period of time. If there are too many, it may cause the fusion operation to fail until a backlog occurs. Based on this, when the monitoring process monitors the second abnormal information indicating the backlog of queued data to be fused, it can be considered that the failure of the fusion operation on a certain data to be fused causes subsequent data to be fused to be queued one by one until the backlog or a large number of fusion operations fail. , for example, when the queued data to be fused exceeds 1,000 or 10,000, the queued data to be fused is considered to be backlogged. Fusion operation failures can include abnormal failures and normal failures. Normal failures do not require alarms and manual intervention, and abnormal failures (such as system If there are too many times (timeouts), alarms and manual intervention are required. That is, for the second abnormal information, alarm indication information can be output while recording the second abnormal information. The alarm indication information is used to indicate manual intervention to handle the abnormality and supports the re-fusion operation for the data to be fused corresponding to the second abnormal information. This allows the fusion operation to be re-executed on the queued data to be fused when the manual intervention process is completed abnormally.

本申请提供的基于数据库的数据融合方法,通过设置监控进程监控融合操作是否积压的方式建立数据融合任务积压监控机制,确保每一数据融合任务都能够被正常执行且不会影响实际生产,从而也进一步提高了数据融合操作的稳定性和可靠性。The database-based data fusion method provided by this application establishes a data fusion task backlog monitoring mechanism by setting up a monitoring process to monitor whether the fusion operation is backlogged, ensuring that each data fusion task can be executed normally without affecting actual production, thereby also The stability and reliability of data fusion operations are further improved.

可选的,所述方法还可以包括:Optionally, the method may also include:

首先,确定所述源数据库和所述目标数据库存在相同库表和相同主键时,执行针对所述相同库表新增预设字段的增加操作;然后,基于所述相同主键和所述增加操作所得的所述预设字段,确定联合主键。First, when it is determined that the source database and the target database have the same library table and the same primary key, perform an adding operation of adding a preset field for the same library table; then, based on the same primary key and the result of the adding operation The preset field determines the joint primary key.

具体的,当不同的源数据库和目标数据库融合时,如果源数据库和目标数据库存在相同库表和相同主键,可以针对相同库表分别新增预设字段,比如新增的预设字段可以包括但不限定“数据来源”字段,并使用原来的相同主键和该预设字段重新建立联合主键,联合主键为使用2个或者是2个以上的字段组成的主键,当使用联合主键包含的字段作为主键时其在源数据库和目标数据库中都是唯一的,且可以附加联合主键索引,以此实现将源数据库和目标数据库的数据都保存下来的目的。Specifically, when different source databases and target databases are merged, if the source database and the target database have the same database table and the same primary key, preset fields can be added separately for the same database table. For example, the new preset fields can include but Do not limit the "data source" field, and use the same original primary key and the preset field to re-establish the joint primary key. The joint primary key is a primary key composed of 2 or more fields. When using the fields included in the joint primary key as the primary key At that time, it is unique in both the source database and the target database, and a joint primary key index can be attached to achieve the purpose of saving the data of both the source database and the target database.

本申请提供的基于数据库的数据融合方法,通过针对源数据库和目标数据库中相同库表重建联合主键的方式,解决主键冲突问题,同时也能完整保存源数据库和目标数据库的数据,减少对业务系统运营的影响,从而实现在源数据库和目标数据库存在主键冲突且数据不同时也能够保证数据完整性及记录数据来源的目的。The database-based data fusion method provided by this application solves the primary key conflict problem by rebuilding the joint primary key for the same database table in the source database and the target database. At the same time, it can also completely save the data of the source database and the target database, reducing the impact on the business system. Operational impact, thereby achieving the purpose of ensuring data integrity and recording the source of data even when there is a primary key conflict between the source database and the target database and the data is different.

下面对本申请提供的基于数据库的数据融合装置进行描述,下文描述的基于数据库的数据融合装置与上文描述的基于数据库的数据融合方法可相互对应参照。The database-based data fusion device provided by this application is described below. The database-based data fusion device described below and the database-based data fusion method described above can be mutually referenced.

图3为本申请提供的基于数据库的数据融合装置的结构示意图,如图3所示,该基于数据库的数据融合装置300,包括:Figure 3 is a schematic structural diagram of a database-based data fusion device provided by this application. As shown in Figure 3, the database-based data fusion device 300 includes:

同步模块310,用于基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中;融合模块320,用于执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作;The synchronization module 310 is used to synchronize the data to be fused in the source database to the intermediate database based on the data fusion request; the fusion module 320 is used to perform the fusion of the data to be fused in the intermediate database to the target database. fusion operation;

其中,所述中间数据库用于表征所述待融合数据的属性信息和所述目标数据库中融合所述待融合数据的库表的属性信息。Wherein, the intermediate database is used to characterize the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused.

可选的,融合模块320,具体可以用于确定目标数据库没有所述待融合数据时,将所述中间数据库中的所述待融合数据同步至所述目标数据库中。Optionally, the fusion module 320 may be configured to synchronize the data to be fused in the intermediate database to the target database when it is determined that the target database does not have the data to be fused.

可选的,融合模块320,具体还可以用于确定目标数据库没有所述待融合数据时,将所述待融合数据同步至所述中间数据库的临时源库中进行拆分操作,得到多个待融合数据;将所述多个待融合数据转移至所述中间数据库的临时目标库中;执行针对所述临时目标库中每个所述待融合数据融合至对应所述目标数据库中的融合操作。Optionally, the fusion module 320 can also be used to determine that the target database does not have the data to be fused, synchronize the data to be fused to the temporary source database of the intermediate database, and perform a split operation to obtain multiple data to be fused. Fusion data; transfer the plurality of data to be fused to a temporary target database of the intermediate database; and perform a fusion operation for each data to be fused in the temporary target database into the corresponding target database.

可选的,融合模块320,具体还可以用于确定目标数据库中存在与所述待融合数据对应的第一库表时,基于所述待融合数据和所述第一库表的差异,执行针对所述中间数据库中所述待融合数据的数据转换操作;将所述数据转换操作所得的目标待融合数据同步至所述目标数据库的所述第一库表中。Optionally, the fusion module 320 may also be used to determine that there is a first library table corresponding to the data to be fused in the target database, based on the difference between the data to be fused and the first library table, execute the Data conversion operation of the data to be fused in the intermediate database; synchronizing the target data to be fused obtained by the data conversion operation to the first database table of the target database.

可选的,融合模块320,具体还可以用于确定目标数据库中存在与多个所述待融合数据对应的第二库表时,执行针对所述中间数据库中多个所述待融合数据的合并操作,得到中间库表;基于所述中间库表和所述第二库表的差异,执行针对所述中间数据库中所述中间库表的数据转换操作;将所述数据转换操作所得的目标待融合数据同步至所述目标数据库的所述第二库表中。Optionally, the fusion module 320 may also be configured to perform a merge of multiple data to be fused in the intermediate database when it is determined that there is a second database table corresponding to multiple data to be fused in the target database. Operation to obtain an intermediate database table; based on the difference between the intermediate database table and the second database table, perform a data conversion operation for the intermediate database table in the intermediate database; and convert the target obtained by the data conversion operation to The fusion data is synchronized to the second database table of the target database.

可选的,融合模块320,具体还可以用于确定触发器收集到表征源数据库中库表数据发生变化的变更数据时,触发生成增量数据融合请求;获取所述变更数据对应的待融合增量数据,并基于所述增量数据融合请求,执行针对所述待融合增量数据融合至所述目标数据库的增量融合操作。Optionally, the fusion module 320 can also be used to trigger the generation of an incremental data fusion request when the trigger collects change data representing changes in the database table data in the source database; and obtain the incremental data to be fused corresponding to the change data. amount of data, and based on the incremental data fusion request, perform an incremental fusion operation for merging the incremental data to be fused to the target database.

可选的,融合模块320,具体还可以用于获取所述待融合增量数据的实时性需求,并在预设的增量同步接口中选取与所述实时性需求匹配的目标增量同步接口;基于所述目标增量同步接口,执行针对所述待融合增量数据融合至所述目标数据库的增量融合操作。Optionally, the fusion module 320 can also be used to obtain the real-time requirements of the incremental data to be fused, and select a target incremental synchronization interface that matches the real-time requirements from the preset incremental synchronization interfaces. ; Based on the target incremental synchronization interface, perform an incremental fusion operation for merging the incremental data to be fused to the target database.

可选的,所述装置还包括更新模块,用于获取所述融合操作结束时记录的当前融合任务及所述当前融合任务的任务明细数据;基于所述当前融合任务及所述任务明细数据,更新预设的融合任务历史表和任务数据明细历史表。Optionally, the device further includes an update module for obtaining the current fusion task recorded at the end of the fusion operation and the task detail data of the current fusion task; based on the current fusion task and the task detail data, Update the preset fusion task history table and task data detail history table.

可选的,所述装置还包括异常告警模块,用于确定监控到表征触发器异常的第一异常信息时,记录所述第一异常信息并进行告警提示。Optionally, the device further includes an abnormality alarm module, configured to record the first abnormal information and issue an alarm when it is determined that the first abnormal information indicating an abnormality of the trigger is monitored.

可选的,异常告警模块,具体还可以用于确定监控到表征融合操作异常的第二异常信息时,输出告警指示信息,所述告警指示信息用于指示人工干预处理异常且针对所述第二异常信息对应的待融合数据支持重新融合操作。Optionally, the abnormality alarm module can also be used to output alarm indication information when it is determined that the second abnormality information representing an abnormality in the fusion operation is monitored, and the alarm indication information is used to indicate manual intervention to handle the abnormality and for the second abnormality. The data to be fused corresponding to the abnormal information supports re-fusion operations.

可选的,所述装置还包括确定模块,用于确定所述源数据库和所述目标数据库存在相同库表和相同主键时,执行针对所述相同库表新增预设字段的增加操作;基于所述相同主键和所述增加操作所得的所述预设字段,确定联合主键。Optionally, the device further includes a determination module configured to perform an adding operation of adding a preset field for the same library table when it is determined that the source database and the target database have the same library table and the same primary key; based on The same primary key and the preset field obtained by the adding operation determine a joint primary key.

图4示例了一种电子设备的实体结构示意图,如图4所示,该电子设备400可以包括:处理器(processor)410、通信接口(CommunicationsInterface)420、存储器(memory)430和通信总线440,其中,处理器410,通信接口420,存储器430通过通信总线440完成相互间的通信。处理器410可以调用存储器430中的逻辑指令,以执行基于数据库的数据融合方法,该方法包括:Figure 4 illustrates a schematic diagram of the physical structure of an electronic device. As shown in Figure 4, the electronic device 400 may include: a processor (processor) 410, a communication interface (CommunicationsInterface) 420, a memory (memory) 430 and a communication bus 440. Among them, the processor 410, the communication interface 420, and the memory 430 complete communication with each other through the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a database-based data fusion method, which method includes:

基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中;Based on the data fusion request, synchronize the data to be fused in the source database to the intermediate database;

执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作;Execute a fusion operation for merging the data to be fused in the intermediate database to the target database;

其中,所述中间数据库用于表征所述待融合数据的属性信息和所述目标数据库中融合所述待融合数据的库表的属性信息。Wherein, the intermediate database is used to characterize the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused.

此外,上述的存储器430中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,RandomAccessMemory)、磁碟或者光盘等各种可以存储程序代码的介质。In addition, the above-mentioned logical instructions in the memory 430 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code.

另一方面,本申请还提供一种计算机程序产品,所述计算机程序产品包括计算机程序,计算机程序可存储在非暂态计算机可读存储介质上,所述计算机程序被处理器执行时,计算机能够执行上述各方法所提供的基于数据库的数据融合方法,该方法包括:On the other hand, the present application also provides a computer program product. The computer program product includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can Execute the database-based data fusion method provided by each of the above methods, which includes:

基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中;Based on the data fusion request, synchronize the data to be fused in the source database to the intermediate database;

执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作;Execute a fusion operation for merging the data to be fused in the intermediate database to the target database;

其中,所述中间数据库用于表征所述待融合数据的属性信息和所述目标数据库中融合所述待融合数据的库表的属性信息。Wherein, the intermediate database is used to characterize the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused.

又一方面,本申请还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现以执行上述各方法提供的基于数据库的数据融合方法,该方法包括:On the other hand, the present application also provides a non-transitory computer-readable storage medium on which a computer program is stored. The computer program is implemented when executed by the processor to execute the database-based data fusion method provided by the above methods. Methods include:

基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中;Based on the data fusion request, synchronize the data to be fused in the source database to the intermediate database;

执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作;Execute a fusion operation for merging the data to be fused in the intermediate database to the target database;

其中,所述中间数据库用于表征所述待融合数据的属性信息和所述目标数据库中融合所述待融合数据的库表的属性信息。Wherein, the intermediate database is used to characterize the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused.

以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in One location, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Persons of ordinary skill in the art can understand and implement the method without any creative effort.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the part of the above technical solution that essentially contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., including a number of instructions to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments.

最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application, but not to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that it can still be Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent substitutions are made to some of the technical features; however, these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions in the embodiments of the present application.

Claims (15)

1.一种基于数据库的数据融合方法,其特征在于,包括:1. A database-based data fusion method, characterized by including: 基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中;Based on the data fusion request, synchronize the data to be fused in the source database to the intermediate database; 执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作;Execute a fusion operation for merging the data to be fused in the intermediate database to the target database; 其中,所述中间数据库用于表征所述待融合数据的属性信息和所述目标数据库中融合所述待融合数据的库表的属性信息。Wherein, the intermediate database is used to characterize the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused. 2.根据权利要求1所述的基于数据库的数据融合方法,其特征在于,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:2. The database-based data fusion method according to claim 1, characterized in that said performing a fusion operation for merging the data to be fused in the intermediate database to the target database includes: 确定目标数据库没有所述待融合数据时,将所述中间数据库中的所述待融合数据同步至所述目标数据库中。When it is determined that the target database does not have the data to be fused, the data to be fused in the intermediate database is synchronized to the target database. 3.根据权利要求1所述的基于数据库的数据融合方法,其特征在于,所述目标数据库的数量为多个时,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:3. The database-based data fusion method according to claim 1, characterized in that when the number of the target databases is multiple, the execution is to fuse the data to be fused in the intermediate database to the Fusion operations on the target database, including: 确定目标数据库没有所述待融合数据时,将所述待融合数据同步至所述中间数据库的临时源库中进行拆分操作,得到多个待融合数据;When it is determined that the target database does not have the data to be fused, synchronize the data to be fused to the temporary source database of the intermediate database and perform a split operation to obtain multiple data to be fused; 将所述多个待融合数据转移至所述中间数据库的临时目标库中;Transfer the plurality of data to be fused to the temporary target database of the intermediate database; 执行针对所述临时目标库中每个所述待融合数据融合至对应所述目标数据库中的融合操作。Perform a fusion operation for each data to be fused in the temporary target database into the corresponding target database. 4.根据权利要求1所述的基于数据库的数据融合方法,其特征在于,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:4. The database-based data fusion method according to claim 1, characterized in that said performing a fusion operation for merging the data to be fused in the intermediate database to the target database includes: 确定目标数据库中存在与所述待融合数据对应的第一库表时,基于所述待融合数据和所述第一库表的差异,执行针对所述中间数据库中所述待融合数据的数据转换操作;When it is determined that there is a first database table corresponding to the data to be fused in the target database, based on the difference between the data to be fused and the first database table, perform data conversion for the data to be fused in the intermediate database operate; 将所述数据转换操作所得的目标待融合数据同步至所述目标数据库的所述第一库表中。Synchronize the target data to be fused obtained by the data conversion operation to the first database table of the target database. 5.根据权利要求1所述的基于数据库的数据融合方法,其特征在于,所述待融合数据的数量为多个且多个所述待融合数据之间具备预设关系时,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:5. The database-based data fusion method according to claim 1, characterized in that when the number of the data to be fused is multiple and there is a preset relationship between the multiple data to be fused, the execution is for The fusion operation of merging the data to be fused in the intermediate database to the target database includes: 确定目标数据库中存在与多个所述待融合数据对应的第二库表时,执行针对所述中间数据库中多个所述待融合数据的合并操作,得到中间库表;When it is determined that there is a second database table corresponding to multiple data to be fused in the target database, perform a merge operation on multiple data to be fused in the intermediate database to obtain an intermediate database table; 基于所述中间库表和所述第二库表的差异,执行针对所述中间数据库中所述中间库表的数据转换操作;Based on the difference between the intermediate database table and the second database table, perform a data conversion operation on the intermediate database table in the intermediate database; 将所述数据转换操作所得的目标待融合数据同步至所述目标数据库的所述第二库表中。Synchronize the target data to be fused obtained by the data conversion operation to the second database table of the target database. 6.根据权利要求1所述的基于数据库的数据融合方法,其特征在于,所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作,包括:6. The database-based data fusion method according to claim 1, characterized in that said performing a fusion operation for merging the data to be fused in the intermediate database to the target database includes: 确定触发器收集到表征源数据库中库表数据发生变化的变更数据时,触发生成增量数据融合请求;When the determination trigger collects change data that represents changes in the database table data in the source database, it triggers the generation of an incremental data fusion request; 获取所述变更数据对应的待融合增量数据,并基于所述增量数据融合请求,执行针对所述待融合增量数据融合至所述目标数据库的增量融合操作。Acquire the incremental data to be fused corresponding to the changed data, and perform an incremental fusion operation for merging the incremental data to be fused to the target database based on the incremental data fusion request. 7.根据权利要求6所述的基于数据库的数据融合方法,其特征在于,所述执行针对所述待融合增量数据融合至所述目标数据库的增量融合操作,包括:7. The database-based data fusion method according to claim 6, wherein said performing an incremental fusion operation for merging the incremental data to be fused to the target database includes: 获取所述待融合增量数据的实时性需求,并在预设的增量同步接口中选取与所述实时性需求匹配的目标增量同步接口;Obtain the real-time requirements of the incremental data to be fused, and select a target incremental synchronization interface that matches the real-time requirements from the preset incremental synchronization interfaces; 基于所述目标增量同步接口,执行针对所述待融合增量数据融合至所述目标数据库的增量融合操作。Based on the target incremental synchronization interface, an incremental fusion operation is performed for merging the incremental data to be fused to the target database. 8.根据权利要求1所述的基于数据库的数据融合方法,其特征在于,在所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作之后,所述方法还包括:8. The database-based data fusion method according to claim 1, characterized in that, after the execution of the fusion operation for the data to be fused in the intermediate database to the target database, the method Also includes: 获取所述融合操作结束时记录的当前融合任务及所述当前融合任务的任务明细数据;Obtain the current fusion task recorded at the end of the fusion operation and the task detail data of the current fusion task; 基于所述当前融合任务及所述任务明细数据,更新预设的融合任务历史表和任务数据明细历史表。Based on the current fusion task and the task detail data, the preset fusion task history table and task data detail history table are updated. 9.根据权利要求1所述的基于数据库的数据融合方法,其特征在于,在所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作之后,所述方法还包括:9. The database-based data fusion method according to claim 1, characterized in that, after the execution of the fusion operation for the data to be fused in the intermediate database to the target database, the method Also includes: 确定监控到表征触发器异常的第一异常信息时,记录所述第一异常信息并进行告警提示。When it is determined that the first abnormal information indicating the abnormality of the trigger is monitored, the first abnormal information is recorded and an alarm is provided. 10.根据权利要求1所述的基于数据库的数据融合方法,其特征在于,在所述执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作之后,所述方法还包括:10. The database-based data fusion method according to claim 1, characterized in that, after the execution of the fusion operation for the data to be fused in the intermediate database to the target database, the method Also includes: 确定监控到表征融合操作异常的第二异常信息时,输出告警指示信息,所述告警指示信息用于指示人工干预处理异常且针对所述第二异常信息对应的待融合数据支持重新融合操作。When it is determined that the second abnormal information indicating the abnormality of the fusion operation is monitored, alarm indication information is output, and the alarm indication information is used to indicate the manual intervention processing abnormality and supports the re-fusion operation for the data to be fused corresponding to the second abnormal information. 11.根据权利要求1所述的基于数据库的数据融合方法,其特征在于,所述方法还包括:11. The database-based data fusion method according to claim 1, characterized in that the method further includes: 确定所述源数据库和所述目标数据库存在相同库表和相同主键时,执行针对所述相同库表新增预设字段的增加操作;When it is determined that the source database and the target database have the same library table and the same primary key, perform an operation of adding a new preset field for the same library table; 基于所述相同主键和所述增加操作所得的所述预设字段,确定联合主键。A joint primary key is determined based on the same primary key and the preset field obtained by the adding operation. 12.一种基于数据库的数据融合装置,其特征在于,包括:12. A database-based data fusion device, characterized by including: 同步模块,用于基于数据融合请求,将源数据库中的待融合数据同步至中间数据库中;The synchronization module is used to synchronize the data to be fused in the source database to the intermediate database based on the data fusion request; 融合模块,用于执行针对所述中间数据库中的所述待融合数据融合至所述目标数据库的融合操作;A fusion module, configured to perform a fusion operation for merging the data to be fused in the intermediate database to the target database; 其中,所述中间数据库用于表征所述待融合数据的属性信息和所述目标数据库中融合所述待融合数据的库表的属性信息。Wherein, the intermediate database is used to characterize the attribute information of the data to be fused and the attribute information of the library table in the target database that fuses the data to be fused. 13.一种电子设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现如权利要求1至11任一项所述基于数据库的数据融合方法。13. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that when the processor executes the program, it implements claim 1 The database-based data fusion method described in any one of to 11. 14.一种非暂态计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至11任一项所述基于数据库的数据融合方法。14. A non-transitory computer-readable storage medium with a computer program stored thereon, characterized in that when the computer program is executed by a processor, the database-based data fusion as claimed in any one of claims 1 to 11 is achieved. method. 15.一种计算机程序产品,包括计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至11任一项所述基于数据库的数据融合方法。15. A computer program product, comprising a computer program, characterized in that when the computer program is executed by a processor, the database-based data fusion method according to any one of claims 1 to 11 is implemented.
CN202210397603.4A 2022-04-15 2022-04-15 Database-based data fusion method, device, electronic equipment and storage medium Pending CN116955369A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210397603.4A CN116955369A (en) 2022-04-15 2022-04-15 Database-based data fusion method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210397603.4A CN116955369A (en) 2022-04-15 2022-04-15 Database-based data fusion method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116955369A true CN116955369A (en) 2023-10-27

Family

ID=88441411

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210397603.4A Pending CN116955369A (en) 2022-04-15 2022-04-15 Database-based data fusion method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116955369A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118885333A (en) * 2024-09-30 2024-11-01 蒲惠智造科技股份有限公司 Database replication method and system for SaaS software
CN119202093A (en) * 2024-11-22 2024-12-27 杭州海康威视数字技术股份有限公司 A method, device, electronic device and medium for synchronizing incremental data of a database

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118885333A (en) * 2024-09-30 2024-11-01 蒲惠智造科技股份有限公司 Database replication method and system for SaaS software
CN119202093A (en) * 2024-11-22 2024-12-27 杭州海康威视数字技术股份有限公司 A method, device, electronic device and medium for synchronizing incremental data of a database

Similar Documents

Publication Publication Date Title
WO2019154394A1 (en) Distributed database cluster system, data synchronization method and storage medium
EP3435235B1 (en) Method and device for executing data recovery operation
US10353918B2 (en) High availability and disaster recovery in large-scale data warehouse
US8126848B2 (en) Automated method for identifying and repairing logical data discrepancies between database replicas in a database cluster
CN107368388A (en) A kind of database real time backup method for monitoring file system change
CN112199356B (en) Fault processing method, device, server and storage medium
CN111078667B (en) Data migration method and related device
CN111427898A (en) Continuous data protection system and method based on analysis of Oracle log
CN110019138B (en) Automatic transfer table space migration method and system based on Zabbix
CN110569142A (en) A system and method for incremental synchronization of ORACLE data
US10318387B1 (en) Automated charge backup modelling
CN114048217A (en) Incremental data synchronization method and device, electronic equipment and storage medium
CN108874611A (en) A kind of construction method and device of test data
CN113190531A (en) Database migration method, device, equipment and storage medium
CN116955369A (en) Database-based data fusion method, device, electronic equipment and storage medium
US11042454B1 (en) Restoration of a data source
CN118410106B (en) Cross-data source real-time synchronization method based on time line mapping
JP2006185108A (en) Management computer for managing data of storage system, and data management method
CN117971984B (en) Method and system for synchronizing table data between distributed database clusters
CN111404737B (en) Disaster recovery processing method and related device
US11113311B2 (en) Technology agnostic system and method for achieving eventually-consistent data replication
WO2021082925A1 (en) Transaction processing method and apparatus
CN117851514A (en) Method and system for realizing disaster recovery of data and tasks across multiple Hive clusters
CN116540942A (en) Migration method and system of data storage object, electronic equipment and storage medium
CN114238324A (en) Checking method and device for host station, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination