[go: up one dir, main page]

WO2019237574A1 - Method and device for identifying database differences - Google Patents

Method and device for identifying database differences Download PDF

Info

Publication number
WO2019237574A1
WO2019237574A1 PCT/CN2018/108242 CN2018108242W WO2019237574A1 WO 2019237574 A1 WO2019237574 A1 WO 2019237574A1 CN 2018108242 W CN2018108242 W CN 2018108242W WO 2019237574 A1 WO2019237574 A1 WO 2019237574A1
Authority
WO
WIPO (PCT)
Prior art keywords
record
information
different environments
identification information
records
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.)
Ceased
Application number
PCT/CN2018/108242
Other languages
French (fr)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2019237574A1 publication Critical patent/WO2019237574A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present application relates to the field of computer technology, and in particular, to a method and an apparatus for verifying database differences, an electronic device, and a computer-readable storage medium.
  • the database structure In order to ensure the consistency of the database in different environments (such as production environment, test environment, pre-release environment, development environment), the database structure needs to be compared before release production.
  • the database fields In the cloud environment, the database fields are usually compared one by one to find the differences between the databases in different environments.
  • this method is inefficient and needs to adopt the polling method. For each field of the database, it is necessary to find the existence of each field in another environment database. After all comparisons are completed, the database can be judged Whether the table structure is consistent and the time complexity is extremely high.
  • this method has a long working cycle and the process is not intelligent enough.
  • the comparison process it is usually directly connected to the database to obtain database information in real time, which also takes a certain amount of time.
  • this application provides a method for identifying database differences.
  • the present application provides a method for identifying differences in a database.
  • the method includes:
  • the information summary values of the records corresponding to the same identification information in different environments are compared to obtain a record having a difference.
  • the present application also provides a device for identifying differences in a database.
  • the device includes:
  • a file configuration module configured to configure the business database information stored in the system library in different environments into independent files
  • An information reading module configured to obtain business database information recorded in said independent files in different environments
  • the digest generating module is configured to perform a hash processing on each record in the service database information by using an information digest algorithm to generate an information digest value corresponding to each record;
  • the difference comparison module is configured to compare the information summary values of the records corresponding to the same identification information in different environments according to the identification information of each record to obtain a record having a difference.
  • the present application also provides an electronic device.
  • the electronic device includes:
  • Memory configured to store processor-executable instructions
  • the processor is configured to execute any one of the above-mentioned methods for identifying database differences.
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program, and the computer program can be executed by a processor by any one of the foregoing methods for identifying differences in databases.
  • the technical solution provided in this application configures the business database information recorded in the system library under different environments into files, so that each record can be directly read from the file for comparison, so there is no need to record one by one in the record comparison process.
  • Visiting the system library saves data acquisition time and improves the efficiency of discerning differences.
  • FIG. 1 is a schematic diagram of an implementation environment involved in this application
  • Fig. 2 is a block diagram of a server according to an exemplary embodiment
  • Fig. 3 is a flow chart showing a method for identifying database differences according to an exemplary embodiment
  • step 330 is a detailed flowchart of step 330 in the embodiment corresponding to FIG. 3;
  • step 340 is a detailed flowchart of step 340 in the embodiment corresponding to FIG. 3;
  • Fig. 6 is a block diagram of a device for identifying a database difference according to an exemplary embodiment
  • FIG. 7 is a detailed block diagram of the digest generating module in the embodiment corresponding to FIG. 6.
  • FIG. 1 is a schematic diagram of an implementation environment according to the present application.
  • the implementation environment includes: multiple servers 110, each of which performs database development, testing, production, and pre-release.
  • the server 110 for database development can be considered as a development environment and the server 110 for database testing can be considered as a test environment.
  • the server 110 that officially provides database services to the outside can be considered as a production environment.
  • a server that does not provide external services but is configured in the same way as the production environment 110 can be considered a pre-release environment.
  • the databases designed in the development environment may be different in other environments.
  • the server 110 can use the database difference comparison method provided in this application to determine whether the developed database is in different environments based on the business database information stored in the system library in different environments (development environment, test environment, production environment, and pre-release environment) There will be discrepancies and find the information that is different.
  • FIG. 2 is a schematic structural diagram of a server 110 according to an embodiment of the present application.
  • the server 110 may have a large difference due to different configurations or performance, and may include one or more central processing units (central processing units (CPU) 222 (for example, one or more processors) and memory 232, one or more storage media 230 (for example, one or more storage devices) storing application programs 242 or data 244.
  • the memory 232 and the storage medium 230 may be temporary storage or persistent storage.
  • the program stored in the storage medium 230 may include one or more modules (not shown), and each module may include a series of instruction operations on the server 110.
  • the central processing unit 222 may be configured to communicate with the storage medium 230 and execute a series of instruction operations in the storage medium 230 on the server 110.
  • the server 110 may also include one or more power sources 226, one or more wired or wireless network interfaces 250, one or more input / output interfaces 258, and / or, one or more operating systems 241, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM and more.
  • the steps performed by the server 110 in the embodiments shown in FIG. 3, FIG. 4, and FIG. 5 described below may be based on the server structure shown in FIG. 2.
  • the program may be stored in a computer-readable storage medium.
  • the aforementioned storage medium may be a read-only memory, a magnetic disk, or an optical disk.
  • Fig. 3 is a flow chart showing a method for identifying database differences according to an exemplary embodiment.
  • the application scope and execution subject of the database difference identification method (for example, the method is configured as the server 110 of the implementation environment shown in FIG. 1). As shown in FIG. 3, the method may be executed by the server 110 and may include the following steps.
  • step 310 the business database information stored in the system library in different environments is configured as an independent file.
  • information_schema information summary
  • information_schema is a system library that stores business database information in the current environment. Getting the business database information directly from the system library can save the time of reading information from each business database.
  • MySQL Relational Database Management System
  • information_schema is considered as a database, or information database. It holds information about all other databases (that is, business databases) maintained by MySQL. Such as database name, database table, table column data type and access permissions.
  • This application reads the business database information from the system library in the environment where the business database is located, and stores it separately as a file, that is, an independent file. Therefore, in the subsequent comparison process, there is no need to access the system library to read the business database information. Read each record from the file for comparison, which saves data acquisition time and improves the efficiency of discerning differences.
  • step 320 business database information recorded in the independent files in different environments is obtained.
  • a certain server can obtain independent files configured by servers in other environments through network transmission, and then read the business data database information recorded in independent files in different environments.
  • step 330 an information digest algorithm is used to hash each record in the business database information to generate an information digest value corresponding to each record.
  • TABLES table provisioning table information
  • COLUMNS table providing column information
  • VIEWS table providing view information
  • TRIGGERS table providing Trigger information
  • the server reads the business database information recorded in independent files in different environments, that is, it obtains the records of the above tables in the system library in different environments.
  • the server uses the message digest algorithm to calculate the content of each record and converts each record into a string.
  • the message digest algorithm can be MD5 algorithm, SHA-1 algorithm, etc.
  • the above step 330 specifically includes: using an MD5 encryption algorithm to calculate an MD5 value of each record in the service database information under different environments, and obtaining an information summary value of each record. Therefore, when performing a database difference comparison, the MD5 value of each record in different environments is compared, so that inconsistent records can be quickly found without the need to compare all the fields one by one.
  • step 340 according to the identification information of each record, the information summary values of the records corresponding to the same identification information in different environments are compared to obtain a record having a difference.
  • the identification information can be an index, a field, or a combination of multiple fields, mainly to uniquely identify this record.
  • the identification information may be the serial number, name, etc. of the record.
  • the identification information corresponding to the records in different environments is the same.
  • the first record is called record AA in different environments, but the record AA may be different in different environments, so the record AA in different environments may calculate different information summary values.
  • the record AA in different environments may calculate different information summary values.
  • the record AA in the production environment calculates the MD5 value to be 512345, and the test environment calculates the MD5 value to be 123456. From this, it can be obtained that the record AA is different in different environments.
  • the business database information recorded in the system library under different environments is configured as a file, so that each record can be directly read from the file for comparison, and thus during the record comparison process There is no need to access the system library one by one, which saves data acquisition time and improves the efficiency of discerning differences. Further, by calculating the MD5 value of each record and comparing the MD5 value of each record in different environments, it is possible to quickly find inconsistent records and further improve the efficiency of identifying database differences.
  • the technical solution provided in this application further includes the following steps:
  • Field-by-field comparison is performed on the records with differences, and the fields with differences are located.
  • the fields in the discrepant records can be further compared one by one, so as to accurately locate the fields in which the business database information differs in different environments.
  • This application first filters out the records that have differences, and then further compares the fields in the difference records one by one, so as to quickly locate the fields that have differences, and overcomes the existing time-consuming comparison of the fields in all records one by one. defect.
  • the developer adjusts the developed business database based on the found difference fields to improve the compatibility of the business database in different environments.
  • the above step 330 specifically includes:
  • step 331 for each record in the service database information in a different environment, a dynamic update field in the record is removed;
  • each record contains a lot of fields, and the fields that need to be consistent are extracted. There is no need to maintain consistency, such as creation time and update time, and it can be eliminated. Dynamic update fields are fields that do not need to be consistent in the record, such as creation time, update time, and so on.
  • step 332 an information digest algorithm is used to hash the remaining fields of each record to generate an information digest value corresponding to each record.
  • the remaining fields refer to the remaining fields in the record after excluding dynamic update fields. After removing the fields that do not need to be consistent for each record, the remaining fields are hashed using an information digest algorithm to generate the information digest value for each record. Then compare whether the information summary values of the records corresponding to the same identification information in different environments are consistent, so as to determine the records that have differences.
  • step 340 specifically includes:
  • step 341 the identification information of each record is correspondingly stored with the information summary value corresponding to the record, to obtain the information summary value of the record corresponding to the identification information in different environments;
  • the identification information and the information summary value of the record are correspondingly stored in the form of key-value pairs.
  • the corresponding information summary of the identification information AA in the production environment The value is 123678
  • the corresponding information digest value of the identification information AA in the test environment is 234545
  • the information digest value of the identification information AA in the development environment is 127898, so that the information summary value corresponding to the same identification information in different environments can be obtained.
  • step 342 the information summary values of the records corresponding to the same identification information in different environments are compared to obtain records with differences.
  • the corresponding information summary value of the identification information AA in the production environment is 123678
  • the corresponding information summary value of the identification information AA in the test environment is 234545
  • the information summary value of the identification information AA in the development environment is 127898.
  • Information AA Compare the information summary values (123678, 234545, 127898) of the identification information AA in different environments (development environment, test environment, production environment). After comparison, it is found that the information digest value of the identification information AA in different environments is inconsistent, and thus the records corresponding to the identification information AA are different in different environments. On the contrary, if the information digest values of the identification information AA in different environments are consistent, it can be considered that there is no difference in the records corresponding to the identification information AA in different environments.
  • the following is a device embodiment of the present application, which can be configured to execute a method embodiment for identifying a database difference performed by the above-mentioned server 110 of the present application.
  • a method embodiment for identifying a database difference performed by the above-mentioned server 110 of the present application.
  • the embodiment of the method for identifying differences in the database of this application please refer to the embodiment of the method for identifying differences in the database of this application.
  • Fig. 6 is a block diagram of a device for identifying differences in a database according to an exemplary embodiment.
  • the device for identifying differences in a database may be configured as a server 110 in the implementation environment shown in Fig. 1 to execute any one of Figs. 3 to 5 All or part of the steps of the method for identifying database differences shown below.
  • the device includes, but is not limited to, a file configuration module 610, an information reading module 620, a digest generating module 630, and a difference comparison module 640.
  • File configuration module 610 configured to configure business database information stored in system libraries in different environments into independent files
  • the information reading module 620 is configured to obtain service database information recorded in the independent files in different environments;
  • the digest generating module 630 is configured to use an information digest algorithm to hash each record in the service database information to generate an information digest value corresponding to each record;
  • the difference comparison module 640 is configured to compare the information summary values of the records corresponding to the same identification information in different environments according to the identification information of each record to obtain a record having a difference.
  • the file configuration module 610, the information reading module 620, the summary generating module 630, and the difference comparison module 640 may be functional modules configured to execute corresponding steps in the above-mentioned method for identifying database differences. It can be understood that these modules can be implemented by hardware, software, or a combination of both. When implemented in hardware, these modules may be implemented as one or more hardware modules, such as one or more application specific integrated circuits. When implemented in software, these modules may be implemented as one or more computer programs executing on one or more processors, such as programs stored in the memory 232 executed by the central processor 222 of FIG. 2.
  • the apparatus for identifying database differences further includes, but is not limited to:
  • the field locating module is configured to perform field-by-field comparison on the records having differences, and locate the fields having differences.
  • the digest generating module 630 includes, but is not limited to:
  • the encryption calculation unit is configured to use the MD5 encryption algorithm to calculate the MD5 value of each record in the business database information under different environments, and obtain the information summary value of each record.
  • the digest generating module 630 includes, but is not limited to:
  • a field removing unit 631 is configured to remove dynamically updated fields in the records for each record in the service database information under different environments
  • the encryption processing unit 632 is configured to perform hash processing on the remaining fields of each record using an information digest algorithm to generate an information digest value corresponding to each record.
  • the difference comparison module 640 includes, but is not limited to:
  • the corresponding storage unit is configured to store the identification information of each record and the information summary value corresponding to the record, to obtain the information summary value of the record corresponding to the identification information in different environments;
  • the digest comparison unit is configured to compare the information digest values of the records corresponding to the same identification information in different environments, and obtain a record with a difference.
  • the present application further provides an electronic device configured to execute all or part of the database difference identification method shown in any of FIGS. 3-5 in the server 110 configured as the implementation environment shown in FIG. 1. step.
  • the electronic device includes:
  • Memory configured to store processor-executable instructions
  • the processor is configured to execute the method for identifying a database difference according to the above exemplary embodiment.
  • a storage medium is also provided, and the storage medium is a computer-readable storage medium, and may be, for example, temporary and non-transitory computer-readable storage media including instructions.
  • a computer program is stored in the storage medium, and the computer program can be executed by the central processing unit 222 of the server 110 to complete the foregoing method for identifying database differences.

Landscapes

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

Abstract

A method and device for identifying database differences, an electronic device and a computer-readable storage medium, the method comprising: configuring service database information stored in system libraries in different environments into independent files (S310); obtaining service database information recorded in the independent files in different environments (S320); using an information summarization algorithm to hash process each record in the service database information so as to generate an information summarization value corresponding to each record (S330); and according to the identification information of the each record, comparing the information summarization values of the same identification information correspondingly recorded in different environments, so as to obtain records having differences (S340). The present method may improve the efficiency of identifying database differences.

Description

一种数据库差异的识别方法及装置Method and device for identifying database differences 技术领域Technical field

本申请要求2018年6月13日递交、发明名称为“一种数据库差异的识别方法及装置”的中国专利申请201810605199.9的优先权,在此通过引用将其全部内容合并于此。This application claims priority from Chinese patent application 201810605199.9, filed on June 13, 2018, with the invention name "A Method and Device for Identifying Database Differences", the entire contents of which are hereby incorporated by reference.

本申请涉及计算机技术领域,特别涉及一种数据库差异的校验方法及装置、电子设备、计算机可读存储介质。The present application relates to the field of computer technology, and in particular, to a method and an apparatus for verifying database differences, an electronic device, and a computer-readable storage medium.

背景技术Background technique

为了保证不同环境(例如生产环境、测试环境、预发布环境、开发环境)下数据库的一致性,在发版生产前,需要对数据库结构进行比对。在云环境中,一般采用对数据库字段逐个进行比对来找出不同环境下数据库之间的差异性。但是,发明人意识到这种方式效率较低,需要采用轮询的方式,针对数据库的每个字段,需要查找每个字段在另一环境数据库中的存在性,全部比对结束,才能判断数据库表结构是否一致,时间复杂度极高。In order to ensure the consistency of the database in different environments (such as production environment, test environment, pre-release environment, development environment), the database structure needs to be compared before release production. In the cloud environment, the database fields are usually compared one by one to find the differences between the databases in different environments. However, the inventors realized that this method is inefficient and needs to adopt the polling method. For each field of the database, it is necessary to find the existence of each field in another environment database. After all comparisons are completed, the database can be judged Whether the table structure is consistent and the time complexity is extremely high.

而且,当数据库需要校验的表较多时,这种方式工作周期长,过程不够智能化。另外,在比对过程中,通常都是直接连接数据库实时获取数据库信息,也会耗费一定的时间。Moreover, when the database needs to check more tables, this method has a long working cycle and the process is not intelligent enough. In addition, in the comparison process, it is usually directly connected to the database to obtain database information in real time, which also takes a certain amount of time.

技术问题technical problem

为了解决相关技术中存在的数据库差异比对效率较低、耗费时间长的问题,本申请提供了一种数据库差异的识别方法。In order to solve the problems of low efficiency and long time consuming of comparing database differences in related technologies, this application provides a method for identifying database differences.

技术解决方案Technical solutions

一方面,本申请提供了一种数据库差异的识别方法,所述方法包括:In one aspect, the present application provides a method for identifying differences in a database. The method includes:

将不同环境下系统库中存储的业务数据库信息配置成独立文件;Configure the business database information stored in the system library in different environments into independent files;

获取不同环境下所述独立文件中记载的业务数据库信息;Obtaining business database information recorded in said independent files in different environments;

采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值;Hashing each record in the business database information with an information digest algorithm to generate an information digest value corresponding to each record;

根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。According to the identification information of each record, the information summary values of the records corresponding to the same identification information in different environments are compared to obtain a record having a difference.

另一方面,本申请还提供了一种数据库差异的识别装置,所述装置包括:On the other hand, the present application also provides a device for identifying differences in a database. The device includes:

文件配置模块,配置为将不同环境下系统库中存储的业务数据库信息配置成独立文件;A file configuration module configured to configure the business database information stored in the system library in different environments into independent files;

信息读取模块,配置为获取不同环境下所述独立文件中记载的业务数据库信息;An information reading module configured to obtain business database information recorded in said independent files in different environments;

摘要生成模块,配置为采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值;The digest generating module is configured to perform a hash processing on each record in the service database information by using an information digest algorithm to generate an information digest value corresponding to each record;

差异比对模块,配置为根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。The difference comparison module is configured to compare the information summary values of the records corresponding to the same identification information in different environments according to the identification information of each record to obtain a record having a difference.

另一方面,本申请还提供了一种电子设备,所述电子设备包括:On the other hand, the present application also provides an electronic device. The electronic device includes:

处理器;processor;

配置为存储处理器可执行指令的存储器;Memory configured to store processor-executable instructions;

其中,所述处理器被配置为执行上述任意一种数据库差异的识别方法。Wherein, the processor is configured to execute any one of the above-mentioned methods for identifying database differences.

另一方面,本申请还提供了一种计算机可读存储介质所述计算机可读存储介质存储有计算机程序,所述计算机程序可由处理器执行上述任意一种数据库差异的识别方法。On the other hand, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and the computer program can be executed by a processor by any one of the foregoing methods for identifying differences in databases.

有益效果Beneficial effect

本申请的实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of the present application may include the following beneficial effects:

本申请提供的技术方案,将不同环境下系统库中记载的业数据库信息配置成文件,从而可以直接从文件中读取每条记录进行比对,由此在记录比对过程中无需逐条记录再去访问系统库,节省了数据获取时间,提高了差异识别效率。进一步的,通过计算每条记录的新信息摘要值,比较每条记录在不同环境下的信息摘要值,从而可以快速找出不一致的记录,进一步提高了数据库差异的识别效率。The technical solution provided in this application configures the business database information recorded in the system library under different environments into files, so that each record can be directly read from the file for comparison, so there is no need to record one by one in the record comparison process. Visiting the system library saves data acquisition time and improves the efficiency of discerning differences. Further, by calculating the new information summary value of each record and comparing the information summary value of each record in different environments, it is possible to quickly find inconsistent records and further improve the efficiency of identifying database differences.

应当理解的是,以上的一般描述和后文的细节描述仅是示例性的,并不能限制本申请。It should be understood that the above general description and the following detailed description are merely exemplary, and should not limit the present application.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并于说明书一起配置为解释本申请的原理。The drawings herein are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application, and are configured together with the description to explain the principles of the application.

图1是根据本申请所涉及的实施环境的示意图;FIG. 1 is a schematic diagram of an implementation environment involved in this application;

图2是根据一示例性实施例示出的一种服务器的框图;Fig. 2 is a block diagram of a server according to an exemplary embodiment;

图3是根据一示例性实施例示出的一种数据库差异的识别方法的流程图;Fig. 3 is a flow chart showing a method for identifying database differences according to an exemplary embodiment;

图4是图3对应实施例中步骤330的细节流程图;4 is a detailed flowchart of step 330 in the embodiment corresponding to FIG. 3;

图5是图3对应实施例中步骤340的细节流程图;5 is a detailed flowchart of step 340 in the embodiment corresponding to FIG. 3;

图6是根据一示例性实施例示出的一种数据库差异的识别装置的框图;Fig. 6 is a block diagram of a device for identifying a database difference according to an exemplary embodiment;

图7是图6对应实施例中摘要生成模块的细节框图。FIG. 7 is a detailed block diagram of the digest generating module in the embodiment corresponding to FIG. 6.

本发明的实施方式Embodiments of the invention

这里将详细地对示例性实施例执行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this application. Rather, they are merely examples of devices and methods consistent with certain aspects of the application as detailed in the appended claims.

图1是根据本申请所涉及的实施环境的示意图。该实施环境包括:多个服务器110,多个服务器110分别进行数据库的开发、测试、生产、预发布。进行数据库开发的服务器110可以认为是开发环境、进行数据库测试的服务器110可以认为是测试环境、正式对外提供数据库服务的服务器110可以认为是生产环境,不对外提供服务但配置与生产环境一致的服务器110可以认为是预发布环境。FIG. 1 is a schematic diagram of an implementation environment according to the present application. The implementation environment includes: multiple servers 110, each of which performs database development, testing, production, and pre-release. The server 110 for database development can be considered as a development environment and the server 110 for database testing can be considered as a test environment. The server 110 that officially provides database services to the outside can be considered as a production environment. A server that does not provide external services but is configured in the same way as the production environment 110 can be considered a pre-release environment.

因为不同环境下服务器110的配置(例如操作系统、存储系统)不同,因此在开发环境下设计的数据库可能在其他环境中存在差异,为了验证所设计的数据库在不同环境下是否存在差异。服务器110可以根据不同环境(开发环境、测试环境、生产环境、预发布环境)下系统库中存储的业务数据库信息,采用本申请提供的数据库差异对比方法,判断所开发的数据库在不同环境下是否会存在差异,找出存在差异的信息。Because the configuration of the server 110 (eg, operating system, storage system) is different in different environments, the databases designed in the development environment may be different in other environments. In order to verify whether the designed databases are different in different environments. The server 110 can use the database difference comparison method provided in this application to determine whether the developed database is in different environments based on the business database information stored in the system library in different environments (development environment, test environment, production environment, and pre-release environment) There will be discrepancies and find the information that is different.

参见图2,图2是本申请实施例提供的一种服务器110结构示意图。该服务器110可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)222(例如,一个或一个以上处理器)和存储器232,一个或一个以上存储应用程序242或数据244的存储介质230(例如一个或一个以上海量存储设备)。其中,存储器232和存储介质230可以是短暂存储或持久存储。存储在存储介质230的程序可以包括一个或一个以上模块(图示未示出),每个模块可以包括对服务器110中的一系列指令操作。更进一步地,中央处理器222可以设置为与存储介质230通信,在服务器110上执行存储介质230中的一系列指令操作。服务器110还可以包括一个或一个以上电源226,一个或一个以上有线或无线网络接口250,一个或一个以上输入输出接口258,和/或,一个或一个以上操作系统241,例如Windows ServerTM,Mac OS XTM,UnixTM, LinuxTM,FreeBSDTM等等。下述图3、图4、图5所示实施例中所述的由服务器110所执行的步骤可以基于该图2所示的服务器结构。Referring to FIG. 2, FIG. 2 is a schematic structural diagram of a server 110 according to an embodiment of the present application. The server 110 may have a large difference due to different configurations or performance, and may include one or more central processing units (central processing units (CPU) 222 (for example, one or more processors) and memory 232, one or more storage media 230 (for example, one or more storage devices) storing application programs 242 or data 244. The memory 232 and the storage medium 230 may be temporary storage or persistent storage. The program stored in the storage medium 230 may include one or more modules (not shown), and each module may include a series of instruction operations on the server 110. Furthermore, the central processing unit 222 may be configured to communicate with the storage medium 230 and execute a series of instruction operations in the storage medium 230 on the server 110. The server 110 may also include one or more power sources 226, one or more wired or wireless network interfaces 250, one or more input / output interfaces 258, and / or, one or more operating systems 241, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM and more. The steps performed by the server 110 in the embodiments shown in FIG. 3, FIG. 4, and FIG. 5 described below may be based on the server structure shown in FIG. 2.

本领域普通技术人员可以理解实现下述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art may understand that all or part of the steps of implementing the following embodiments may be completed by hardware, or related hardware may be instructed by a program. The program may be stored in a computer-readable storage medium. The aforementioned storage medium may be a read-only memory, a magnetic disk, or an optical disk.

图3是根据一示例性实施例示出的一种数据库差异的识别方法的流程图。该数据库差异的识别方法的适用范围和执行主体(例如,该方法配置为图1所示实施环境的服务器110)。如图3所示,该方法可以由服务器端110执行,可以包括以下步骤。Fig. 3 is a flow chart showing a method for identifying database differences according to an exemplary embodiment. The application scope and execution subject of the database difference identification method (for example, the method is configured as the server 110 of the implementation environment shown in FIG. 1). As shown in FIG. 3, the method may be executed by the server 110 and may include the following steps.

在步骤310中,将不同环境下系统库中存储的业务数据库信息配置成独立文件。In step 310, the business database information stored in the system library in different environments is configured as an independent file.

其中,不同环境是指生产环境、测试环境、预发布环境、开发环境。各个环境下的服务器由于配置不同因而所运行的数据库可能存在差异。不同环境下的业务数据库信息可以提前从当前环境下的information_schema(信息概要)库中读取。information_schema是一个系统库,存储当前环境下的业务数据库信息,直接从系统库获取业务数据库信息,可以节省去每个业务数据库读取信息的时间。在MySQL(关系型数据库管理系统)中,把 information_schema 看作是一个数据库,确切说是信息数据库。其中保存着关于MySQL所维护的所有其他数据库(即业务数据库)的信息。如数据库名,数据库的表,表栏的数据类型与访问权限等。Among them, different environments refer to production environment, test environment, pre-release environment, and development environment. The servers running in different environments may have different databases running due to different configurations. Business database information in different environments can be read in advance from the information_schema (information summary) library in the current environment. information_schema is a system library that stores business database information in the current environment. Getting the business database information directly from the system library can save the time of reading information from each business database. In MySQL (Relational Database Management System), information_schema is considered as a database, or information database. It holds information about all other databases (that is, business databases) maintained by MySQL. Such as database name, database table, table column data type and access permissions.

本申请从业务数据库所在环境的系统库中读取业务数据库信息,并单独存储成一个文件,即独立文件,从而后续在差异比对过程中无需再访问系统库去读取业务数据库信息,可以直接从文件中读取每条记录进行比对,节省了数据获取时间,提高了差异识别效率。This application reads the business database information from the system library in the environment where the business database is located, and stores it separately as a file, that is, an independent file. Therefore, in the subsequent comparison process, there is no need to access the system library to read the business database information. Read each record from the file for comparison, which saves data acquisition time and improves the efficiency of discerning differences.

在步骤320中,获取不同环境下所述独立文件中记载的业务数据库信息。In step 320, business database information recorded in the independent files in different environments is obtained.

在差异比对过程中,某一服务器可以通过网络传输方式获取其他环境下服务器配置而成的独立文件,进而读取不同环境下独立文件中记载的业务数据数据库信息。During the difference comparison process, a certain server can obtain independent files configured by servers in other environments through network transmission, and then read the business data database information recorded in independent files in different environments.

在步骤330中,采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值。In step 330, an information digest algorithm is used to hash each record in the business database information to generate an information digest value corresponding to each record.

需要说明的是,系统库中存在多个只读表,记载着业务数据库信息,包括TABLES表(提供表信息)、COLUMNS表(提供列信息)、VIEWS表(提供视图信息)、TRIGGERS表(提供触发程序信息)等。通过比较不同环境下这些表的记录是否存在差异,就可以判断出不同环境下的业务数据库是否存在一致。It should be noted that there are multiple read-only tables in the system library, which record business database information, including TABLES table (providing table information), COLUMNS table (providing column information), VIEWS table (providing view information), TRIGGERS table (providing Trigger information) and so on. By comparing whether the records of these tables are different in different environments, it can be determined whether the business databases in different environments are consistent.

具体的,服务器读取不同环境下独立文件中记载的业务数据库信息 ,也就是得到了不同环境下系统库中上述表的记录。服务器采用信息摘要算法对每条记录的内容进行计算,将每条记录转换成一个字符串。信息摘要算法可以是MD5算法、SHA-1算法等。在一种实施例中,上述步骤330具体包括:采用MD5加密算法计算不同环境下业务数据库信息中每条记录的MD5值,得到每条记录的信息摘要值。由此,在进行数据库差异比对时,比较每条记录在不同环境下的MD5值,从而可以快速找出不一致的记录,而无需对所有字段一一进行比对。Specifically, the server reads the business database information recorded in independent files in different environments, that is, it obtains the records of the above tables in the system library in different environments. The server uses the message digest algorithm to calculate the content of each record and converts each record into a string. The message digest algorithm can be MD5 algorithm, SHA-1 algorithm, etc. In one embodiment, the above step 330 specifically includes: using an MD5 encryption algorithm to calculate an MD5 value of each record in the service database information under different environments, and obtaining an information summary value of each record. Therefore, when performing a database difference comparison, the MD5 value of each record in different environments is compared, so that inconsistent records can be quickly found without the need to compare all the fields one by one.

在步骤340中,根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。In step 340, according to the identification information of each record, the information summary values of the records corresponding to the same identification information in different environments are compared to obtain a record having a difference.

标识信息可以是一个索引,可以是一个字段,也可以是多个字段组合,主要是为了能唯一识别出这条记录。标识信息可以是该条记录的序号、名称等。对每条记录采用信息摘要算法进行计算后,会将信息摘要值和该记录的标识信息组成一个键值对。The identification information can be an index, a field, or a combination of multiple fields, mainly to uniquely identify this record. The identification information may be the serial number, name, etc. of the record. After each record is calculated using the information digest algorithm, the information digest value and the record's identification information are combined into a key-value pair.

其中,不同环境下对应记录的标识信息是一样的。举例来说,第一条记录在不同环境下都叫记录AA,但是记录AA在不同环境下可能存在差异,从而不同环境下的记录AA可能计算得到不同的信息摘要值。通过比较不同环境下同一标识信息对应的记录的信息摘要值是否一致,就可以判断出该标识信息对应的记录在不同环境下是否存在差异。如果在信息摘要值不一致时即可认为该标识信息对应的记录在不同环境下存在差异。The identification information corresponding to the records in different environments is the same. For example, the first record is called record AA in different environments, but the record AA may be different in different environments, so the record AA in different environments may calculate different information summary values. By comparing whether the information summary values of the records corresponding to the same identification information in different environments are consistent, it can be determined whether the records corresponding to the identification information are different in different environments. If the information summary values are inconsistent, the records corresponding to the identification information may be considered to be different in different environments.

举例来说,记录AA在生产环境中计算得到MD5值为512345,在测试环境中计算得到MD5为123456,由此可以得到记录AA在不同环境下存在差异。For example, the record AA in the production environment calculates the MD5 value to be 512345, and the test environment calculates the MD5 value to be 123456. From this, it can be obtained that the record AA is different in different environments.

本申请上述示例性实施例提供的技术方案,将不同环境下系统库中记载的业数据库信息配置成文件,从而可以直接从文件中读取每条记录进行比对,由此在记录比对过程中无需逐条记录再去访问系统库,节省了数据获取时间,提高了差异识别效率。进一步的,通过计算每条记录的MD5值,比较每条记录在不同环境下的MD5值,从而可以快速找出不一致的记录,进一步提高了数据库差异的识别效率。In the technical solution provided by the foregoing exemplary embodiment of the present application, the business database information recorded in the system library under different environments is configured as a file, so that each record can be directly read from the file for comparison, and thus during the record comparison process There is no need to access the system library one by one, which saves data acquisition time and improves the efficiency of discerning differences. Further, by calculating the MD5 value of each record and comparing the MD5 value of each record in different environments, it is possible to quickly find inconsistent records and further improve the efficiency of identifying database differences.

在一种示例性实施例中,在上述步骤340之后,本申请提供的技术方案还包括以下步骤:In an exemplary embodiment, after the above step 340, the technical solution provided in this application further includes the following steps:

对所述存在差异的记录进行字段逐个比对,定位存在差异的字段。Field-by-field comparison is performed on the records with differences, and the fields with differences are located.

在上述步骤340找出存在差异的记录后,可以进一步对差异记录中的字段进行逐个比对,从而准确定位业务数据库信息在不同环境下存在差异的字段。本申请通过先筛选出存在差异的记录,再进一步对差异记录中的字段进行逐个比对,从而快速定位存在差异的字段,克服了现有对所有记录中的字段进行逐个比对耗费时间长的缺陷。在找出不同环境下存在差异的字段后,开发人员就根据找出的差异字段,调整开发的业务数据库,提高业务数据库在不同环境下的兼容性。After the discrepant records are found in the above step 340, the fields in the discrepant records can be further compared one by one, so as to accurately locate the fields in which the business database information differs in different environments. This application first filters out the records that have differences, and then further compares the fields in the difference records one by one, so as to quickly locate the fields that have differences, and overcomes the existing time-consuming comparison of the fields in all records one by one. defect. After finding out the fields that are different in different environments, the developer adjusts the developed business database based on the found difference fields to improve the compatibility of the business database in different environments.

在一种示例性实施例中,如图4所示,在上述步骤330具体包括:In an exemplary embodiment, as shown in FIG. 4, the above step 330 specifically includes:

在步骤331中,针对不同环境下所述业务数据库信息中的每条记录,剔除所述记录中的动态更新字段;In step 331, for each record in the service database information in a different environment, a dynamic update field in the record is removed;

需要说明的是,每条记录都包含很多字段,把需要保持一致的字段提取出来,像创建时间、更新时间这些就没必要保持一致,就可以剔除掉。动态更新字段就是指记录中不需要保持一致的字段,例如创建时间、更新时间等。It should be noted that each record contains a lot of fields, and the fields that need to be consistent are extracted. There is no need to maintain consistency, such as creation time and update time, and it can be eliminated. Dynamic update fields are fields that do not need to be consistent in the record, such as creation time, update time, and so on.

在步骤332中,采用信息摘要算法对每条记录的剩余字段进行散列处理,生成每条记录对应的信息摘要值。In step 332, an information digest algorithm is used to hash the remaining fields of each record to generate an information digest value corresponding to each record.

其中,剩余字段是指记录中剔除了动态更新字段后剩余的字段。对每条记录剔除无需保持一致的字段后,对剩余字段采用信息摘要算法进行散列处理,生成每条记录的信息摘要值。进而比较不同环境下同一标识信息对应的记录的信息摘要值是否一致,以此确定存在差异的记录。Among them, the remaining fields refer to the remaining fields in the record after excluding dynamic update fields. After removing the fields that do not need to be consistent for each record, the remaining fields are hashed using an information digest algorithm to generate the information digest value for each record. Then compare whether the information summary values of the records corresponding to the same identification information in different environments are consistent, so as to determine the records that have differences.

在一种示例性实施例中,如图5所示,在上述步骤340具体包括:In an exemplary embodiment, as shown in FIG. 5, the above step 340 specifically includes:

在步骤341中,将每条记录的标识信息与所述记录对应的信息摘要值进行对应存储,得到所述标识信息所对应记录在不同环境下的信息摘要值;In step 341, the identification information of each record is correspondingly stored with the information summary value corresponding to the record, to obtain the information summary value of the record corresponding to the identification information in different environments;

具体的,在计算得到每条记录的信息摘要值之后,将该记录的标识信息和信息摘要值以键值对的形式进行对应存储,举例来说,标识信息AA在生产环境下对应的信息摘要值为123678,标识信息AA在测试环境下对应的信息摘要值为234545,标识信息AA在开发环境下的信息摘要值为127898,从而可以得到在不同环境下同一标识信息所对应记录的信息摘要值。Specifically, after the information summary value of each record is calculated, the identification information and the information summary value of the record are correspondingly stored in the form of key-value pairs. For example, the corresponding information summary of the identification information AA in the production environment The value is 123678, the corresponding information digest value of the identification information AA in the test environment is 234545, and the information digest value of the identification information AA in the development environment is 127898, so that the information summary value corresponding to the same identification information in different environments can be obtained. .

在步骤342中,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。In step 342, the information summary values of the records corresponding to the same identification information in different environments are compared to obtain records with differences.

举例来说,标识信息AA在生产环境下对应的信息摘要值为123678,标识信息AA在测试环境下对应的信息摘要值为234545,标识信息AA在开发环境下的信息摘要值为127898,针对标识信息AA,比对标识信息AA在不同环境(开发环境、测试环境、生产环境)下的信息摘要值(123678、234545、127898)。经过比对发现,标识信息AA在不同环境下的信息摘要值不一致,由此得到标识信息AA对应的记录在不同环境下存在差异。相反的,如果标识信息AA在不同环境下的信息摘要值一致,可以认为标识信息AA对应的记录在不同环境下不存在差异。For example, the corresponding information summary value of the identification information AA in the production environment is 123678, the corresponding information summary value of the identification information AA in the test environment is 234545, and the information summary value of the identification information AA in the development environment is 127898. Information AA: Compare the information summary values (123678, 234545, 127898) of the identification information AA in different environments (development environment, test environment, production environment). After comparison, it is found that the information digest value of the identification information AA in different environments is inconsistent, and thus the records corresponding to the identification information AA are different in different environments. On the contrary, if the information digest values of the identification information AA in different environments are consistent, it can be considered that there is no difference in the records corresponding to the identification information AA in different environments.

下述为本申请装置实施例,可以配置为执行本申请上述服务器110执行的数据库差异的识别方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请数据库差异的识别方法实施例。The following is a device embodiment of the present application, which can be configured to execute a method embodiment for identifying a database difference performed by the above-mentioned server 110 of the present application. For details not disclosed in the device embodiments of this application, please refer to the embodiment of the method for identifying differences in the database of this application.

图6是根据一示例性实施例示出的一种数据库差异的识别装置的框图,该数据库差异的识别装置可以配置为图1所示实施环境的服务器110中,执行图3-图5任一所示的数据库差异的识别方法的全部或者部分步骤。如图6所示,该装置包括但不限于:文件配置模块610、信息读取模块620、摘要生成模块630以及差异比对模块640。Fig. 6 is a block diagram of a device for identifying differences in a database according to an exemplary embodiment. The device for identifying differences in a database may be configured as a server 110 in the implementation environment shown in Fig. 1 to execute any one of Figs. 3 to 5 All or part of the steps of the method for identifying database differences shown below. As shown in FIG. 6, the device includes, but is not limited to, a file configuration module 610, an information reading module 620, a digest generating module 630, and a difference comparison module 640.

文件配置模块610,配置为将不同环境下系统库中存储的业务数据库信息配置成独立文件File configuration module 610, configured to configure business database information stored in system libraries in different environments into independent files

信息读取模块620,配置为获取不同环境下所述独立文件中记载的业务数据库信息;The information reading module 620 is configured to obtain service database information recorded in the independent files in different environments;

摘要生成模块630,配置为采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值;The digest generating module 630 is configured to use an information digest algorithm to hash each record in the service database information to generate an information digest value corresponding to each record;

差异比对模块640,配置为根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。The difference comparison module 640 is configured to compare the information summary values of the records corresponding to the same identification information in different environments according to the identification information of each record to obtain a record having a difference.

上述装置中各个模块的功能和作用的实现过程具体详见上述数据库差异的识别方法中对应步骤的实现过程,在此不再赘述。The implementation process of the functions and functions of each module in the above device is described in detail in the implementation process of the corresponding steps in the above method for identifying differences in databases, and is not repeated here.

文件配置模块610、信息读取模块620、摘要生成模块630以及差异比对模块640可以是功能模块,配置为执行上述数据库差异的识别方法中的对应步骤。可以理解,这些模块可以通过硬件、软件、或二者结合来实现。当以硬件方式实现时,这些模块可以实施为一个或多个硬件模块,例如一个或多个专用集成电路。当以软件方式实现时,这些模块可以实施为在一个或多个处理器上执行的一个或多个计算机程序,例如图2的中央处理器222所执行的存储在存储器232中的程序。The file configuration module 610, the information reading module 620, the summary generating module 630, and the difference comparison module 640 may be functional modules configured to execute corresponding steps in the above-mentioned method for identifying database differences. It can be understood that these modules can be implemented by hardware, software, or a combination of both. When implemented in hardware, these modules may be implemented as one or more hardware modules, such as one or more application specific integrated circuits. When implemented in software, these modules may be implemented as one or more computer programs executing on one or more processors, such as programs stored in the memory 232 executed by the central processor 222 of FIG. 2.

在一种示例性实施例中,所述数据库差异的识别装置还包括但不限于:In an exemplary embodiment, the apparatus for identifying database differences further includes, but is not limited to:

字段定位模块,配置为对所述存在差异的记录进行字段逐个比对,定位存在差异的字段。The field locating module is configured to perform field-by-field comparison on the records having differences, and locate the fields having differences.

在一种示例性实施例中,所述摘要生成模块630包括但不限于:In an exemplary embodiment, the digest generating module 630 includes, but is not limited to:

加密计算单元,配置为采用MD5加密算法计算不同环境下业务数据库信息中每条记录的MD5值,得到每条记录的信息摘要值。The encryption calculation unit is configured to use the MD5 encryption algorithm to calculate the MD5 value of each record in the business database information under different environments, and obtain the information summary value of each record.

在一种示例性实施例中,如图7所示,所述摘要生成模块630包括但不限于:In an exemplary embodiment, as shown in FIG. 7, the digest generating module 630 includes, but is not limited to:

字段剔除单元631,配置为针对不同环境下所述业务数据库信息中的每条记录,剔除所述记录中的动态更新字段;A field removing unit 631 is configured to remove dynamically updated fields in the records for each record in the service database information under different environments;

加密处理单元632,配置为采用信息摘要算法对每条记录的剩余字段进行散列处理,生成每条记录对应的信息摘要值。The encryption processing unit 632 is configured to perform hash processing on the remaining fields of each record using an information digest algorithm to generate an information digest value corresponding to each record.

在一种示例性实施例中,所述差异比对模块640包括但不限于:In an exemplary embodiment, the difference comparison module 640 includes, but is not limited to:

对应存储单元,配置为将每条记录的标识信息与所述记录对应的信息摘要值进行对应存储,得到所述标识信息所对应记录在不同环境下的信息摘要值;The corresponding storage unit is configured to store the identification information of each record and the information summary value corresponding to the record, to obtain the information summary value of the record corresponding to the identification information in different environments;

摘要比对单元,配置为比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。The digest comparison unit is configured to compare the information digest values of the records corresponding to the same identification information in different environments, and obtain a record with a difference.

可选的,本申请还提供一种电子设备,该电子设备以配置为图1所示实施环境的服务器110中,执行图3-图5任一所示的数据库差异的识别方法的全部或者部分步骤。所述电子设备包括:Optionally, the present application further provides an electronic device configured to execute all or part of the database difference identification method shown in any of FIGS. 3-5 in the server 110 configured as the implementation environment shown in FIG. 1. step. The electronic device includes:

处理器;processor;

配置为存储处理器可执行指令的存储器;Memory configured to store processor-executable instructions;

其中,所述处理器被配置为执行上述示例性实施例所述的数据库差异的识别方法。Wherein, the processor is configured to execute the method for identifying a database difference according to the above exemplary embodiment.

该实施例中电子设备的处理器执行操作的具体方式已经在有关该数据库差异的识别方法的实施例中执行了详细描述,此处将不做详细阐述说明。The specific manner in which the processor of the electronic device performs operations in this embodiment has been described in detail in the embodiment of the method for identifying differences in the database, and will not be described in detail here.

在示例性实施例中,还提供了一种存储介质,该存储介质为计算机可读存储介质,例如可以为包括指令的临时性和非临时性计算机可读存储介质。该存储介质存储有计算机程序,该计算机程序可由服务器110的中央处理器222执行以完成上述数据库差异的识别方法。In an exemplary embodiment, a storage medium is also provided, and the storage medium is a computer-readable storage medium, and may be, for example, temporary and non-transitory computer-readable storage media including instructions. A computer program is stored in the storage medium, and the computer program can be executed by the central processing unit 222 of the server 110 to complete the foregoing method for identifying database differences.

应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围执行各种修改和改变。本申请的范围仅由所附的权利要求来限制。It should be understood that the present application is not limited to the precise structure that has been described above and shown in the drawings, and various modifications and changes may be performed without departing from the scope thereof. The scope of the application is limited only by the accompanying claims.

Claims (20)

一种数据库差异的识别方法,其中,所述方法包括:A method for identifying database differences, wherein the method includes: 将不同环境下系统库中存储的业务数据库信息配置成独立文件;Configure the business database information stored in the system library in different environments into independent files; 获取不同环境下所述独立文件中记载的业务数据库信息;Obtaining business database information recorded in said independent files in different environments; 采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值;Hashing each record in the business database information with an information digest algorithm to generate an information digest value corresponding to each record; 根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。According to the identification information of each record, the information summary values of the records corresponding to the same identification information in different environments are compared to obtain a record having a difference. 根据权利要求1所述的方法,其中,在根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录之后,所述方法还包括:The method according to claim 1, wherein after comparing the information summary values of the records corresponding to the same identification information in different environments according to the identification information of each record to obtain a record having a difference, the method further comprises: 对所述存在差异的记录进行字段逐个比对,定位存在差异的字段。Field-by-field comparison is performed on the records with differences, and the fields with differences are located. 根据权利要求1-2任意一项所述的方法,其中,所述采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值,包括:The method according to any one of claims 1-2, wherein the using an information digest algorithm to hash each record in the business database information to generate an information digest value corresponding to each record includes: 采用MD5加密算法计算不同环境下业务数据库信息中每条记录的MD5值,得到每条记录的信息摘要值。The MD5 encryption algorithm is used to calculate the MD5 value of each record in the business database information under different environments to obtain the information summary value of each record. 根据权利要求1-3任意一项所述的方法,其中,所述采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值,包括:The method according to any one of claims 1-3, wherein the adopting an information digest algorithm to hash each record in the business database information to generate an information digest value corresponding to each record includes: 针对不同环境下所述业务数据库信息中的每条记录,剔除所述记录中的动态更新字段;For each record in the business database information under different environments, the dynamic update field in the record is eliminated; 采用信息摘要算法对每条记录的剩余字段进行散列处理,生成每条记录对应的信息摘要值。An information digest algorithm is used to hash the remaining fields of each record to generate an information digest value corresponding to each record. 根据权利要求1-4任意一项所述的方法,其中,所述根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录,包括:The method according to any one of claims 1-4, wherein, according to the identification information of each record, comparing the information summary values of records corresponding to the same identification information in different environments to obtain a record having a difference, including : 将每条记录的标识信息与所述记录对应的信息摘要值进行对应存储,得到所述标识信息所对应记录在不同环境下的信息摘要值;Storing the identification information of each record and the information digest value corresponding to the record to obtain the information digest value of the record corresponding to the identification information in different environments; 比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。The information summary values of the records corresponding to the same identification information under different environments are compared to obtain records with differences. 一种数据库差异的识别装置,其中,所述装置包括:A device for identifying database differences, wherein the device includes: 文件配置模块,配置为将不同环境下系统库中存储的业务数据库信息配置成独立文件;A file configuration module configured to configure the business database information stored in the system library in different environments into independent files; 信息读取模块,配置为获取不同环境下所述独立文件中记载的业务数据库信息;An information reading module configured to obtain business database information recorded in said independent files in different environments; 摘要生成模块,配置为采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值;The digest generating module is configured to perform a hash processing on each record in the service database information by using an information digest algorithm to generate an information digest value corresponding to each record; 差异比对模块,配置为根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。The difference comparison module is configured to compare the information summary values of the records corresponding to the same identification information in different environments according to the identification information of each record to obtain a record having a difference. 根据权利要求6所述的装置,其中,所述装置还包括:The apparatus according to claim 6, wherein the apparatus further comprises: 字段定位模块,配置为对所述存在差异的记录进行字段逐个比对,定位存在差异的字段。The field locating module is configured to perform field-by-field comparison on the records having differences, and locate the fields having differences. 根据权利要求6-7任一项所述的装置,其中,所述摘要生成模块包括:The apparatus according to any one of claims 6 to 7, wherein the digest generating module comprises: 加密计算单元,配置为采用MD5加密算法计算不同环境下业务数据库信息中每条记录的MD5值,得到每条记录的信息摘要值。The encryption calculation unit is configured to use the MD5 encryption algorithm to calculate the MD5 value of each record in the business database information under different environments, and obtain the information summary value of each record. 根据权利要求6-8任意一项所述的装置,其中,所述摘要生成模块包括:The apparatus according to any one of claims 6 to 8, wherein the digest generating module comprises: 字段剔除单元,配置为针对不同环境下所述业务数据库信息中的每条记录,剔除所述记录中的动态更新字段;A field culling unit configured to delete dynamically updated fields in the records for each record in the service database information under different environments; 加密处理单元,配置为采用信息摘要算法对每条记录的剩余字段进行散列处理,生成每条记录对应的信息摘要值。The encryption processing unit is configured to use an information digest algorithm to hash the remaining fields of each record to generate an information digest value corresponding to each record. 根据权利要求6-9任意一项所述的装置,其中,所述差异比对模块包括:The apparatus according to any one of claims 6-9, wherein the difference comparison module comprises: 对应存储单元,配置为将每条记录的标识信息与所述记录对应的信息摘要值进行对应存储,得到所述标识信息所对应记录在不同环境下的信息摘要值;The corresponding storage unit is configured to store the identification information of each record and the information summary value corresponding to the record, to obtain the information summary value of the record corresponding to the identification information in different environments; 摘要比对单元,配置为比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。The digest comparison unit is configured to compare the information digest values of the records corresponding to the same identification information in different environments, and obtain a record with a difference. 一种电子设备,其中,所述电子设备包括:An electronic device, wherein the electronic device includes: 处理器;processor; 配置为存储处理器可执行指令的存储器;Memory configured to store processor-executable instructions; 其中,所述处理器被配置为执行以下步骤:The processor is configured to perform the following steps: 将不同环境下系统库中存储的业务数据库信息配置成独立文件;Configure the business database information stored in the system library in different environments into independent files; 获取不同环境下所述独立文件中记载的业务数据库信息;Obtaining business database information recorded in said independent files in different environments; 采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值;Hashing each record in the business database information with an information digest algorithm to generate an information digest value corresponding to each record; 根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。According to the identification information of each record, the information summary values of the records corresponding to the same identification information in different environments are compared to obtain a record having a difference. 根据权利要求11所述的电子设备,其中,在根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录之后,所述方法还包括:The electronic device according to claim 11, wherein after comparing the information summary values of the records corresponding to the same identification information in different environments according to the identification information of each record to obtain a record having a difference, the method further comprises : 对所述存在差异的记录进行字段逐个比对,定位存在差异的字段。Field-by-field comparison is performed on the records with differences, and the fields with differences are located. 根据权利要求11-12任意一项所述的电子设备,其中,所述采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值,包括:The electronic device according to any one of claims 11-12, wherein the information digest algorithm is used to hash each record in the service database information to generate an information digest value corresponding to each record, including: : 采用MD5加密算法计算不同环境下业务数据库信息中每条记录的MD5值,得到每条记录的信息摘要值。The MD5 encryption algorithm is used to calculate the MD5 value of each record in the business database information under different environments to obtain the information summary value of each record. 根据权利要求11-13任意一项所述的电子设备,其中,所述采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值,包括:The electronic device according to any one of claims 11-13, wherein the information digest algorithm is used to hash each record in the service database information to generate an information digest value corresponding to each record, including: : 针对不同环境下所述业务数据库信息中的每条记录,剔除所述记录中的动态更新字段;For each record in the business database information under different environments, the dynamic update field in the record is eliminated; 采用信息摘要算法对每条记录的剩余字段进行散列处理,生成每条记录对应的信息摘要值。An information digest algorithm is used to hash the remaining fields of each record to generate an information digest value corresponding to each record. 根据权利要求11-14任意一项所述的电子设备,其中,所述根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录,包括:The electronic device according to any one of claims 11 to 14, wherein, according to the identification information of each record, comparing the information summary values of the records corresponding to the same identification information in different environments to obtain a record having a difference, include: 将每条记录的标识信息与所述记录对应的信息摘要值进行对应存储,得到所述标识信息所对应记录在不同环境下的信息摘要值;Storing the identification information of each record and the information digest value corresponding to the record to obtain the information digest value of the record corresponding to the identification information in different environments; 比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。The information summary values of the records corresponding to the same identification information under different environments are compared to obtain records with differences. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序可由处理器执行以下步骤:A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program can execute the following steps by a processor: 将不同环境下系统库中存储的业务数据库信息配置成独立文件;Configure the business database information stored in the system library in different environments into independent files; 获取不同环境下所述独立文件中记载的业务数据库信息;Obtaining business database information recorded in said independent files in different environments; 采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值;Hashing each record in the business database information with an information digest algorithm to generate an information digest value corresponding to each record; 根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。According to the identification information of each record, the information summary values of the records corresponding to the same identification information in different environments are compared to obtain a record having a difference. 根据权利要求16所述的计算机可读存储介质,其中,在根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录之后,所述方法还包括:The computer-readable storage medium according to claim 16, wherein after comparing the information summary values of the records corresponding to the same identification information in different environments according to the identification information of each record, obtaining a record having a difference, the The method also includes: 对所述存在差异的记录进行字段逐个比对,定位存在差异的字段。Field-by-field comparison is performed on the records with differences, and the fields with differences are located. 根据权利要求16-17任意一项所述的计算机可读存储介质,其中,所述采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值,包括:The computer-readable storage medium according to any one of claims 16-17, wherein the information digest algorithm is used to hash each record in the business database information to generate an information summary corresponding to each record Values, including: 采用MD5加密算法计算不同环境下业务数据库信息中每条记录的MD5值,得到每条记录的信息摘要值。The MD5 encryption algorithm is used to calculate the MD5 value of each record in the business database information under different environments to obtain the information summary value of each record. 根据权利要求16-18任意一项所述的计算机可读存储介质,其中,所述采用信息摘要算法对所述业务数据库信息中的每条记录进行散列处理,生成每条记录对应的信息摘要值,包括:The computer-readable storage medium according to any one of claims 16 to 18, wherein the information digest algorithm is used to hash each record in the business database information to generate an information summary corresponding to each record Values, including: 针对不同环境下所述业务数据库信息中的每条记录,剔除所述记录中的动态更新字段;For each record in the business database information under different environments, the dynamic update field in the record is eliminated; 采用信息摘要算法对每条记录的剩余字段进行散列处理,生成每条记录对应的信息摘要值。An information digest algorithm is used to hash the remaining fields of each record to generate an information digest value corresponding to each record. 根据权利要求16-19任意一项所述的计算机可读存储介质,其中,所述根据每条记录的标识信息,比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录,包括:The computer-readable storage medium according to any one of claims 16 to 19, wherein, according to the identification information of each record, the information summary values of records corresponding to the same identification information in different environments are obtained to obtain a difference Records, including: 将每条记录的标识信息与所述记录对应的信息摘要值进行对应存储,得到所述标识信息所对应记录在不同环境下的信息摘要值;Storing the identification information of each record and the information digest value corresponding to the record to obtain the information digest value of the record corresponding to the identification information in different environments; 比对同一标识信息所对应记录在不同环境下的信息摘要值,获得存在差异的记录。The information summary values of the records corresponding to the same identification information under different environments are compared to obtain records with differences.
PCT/CN2018/108242 2018-06-13 2018-09-28 Method and device for identifying database differences Ceased WO2019237574A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810605199.9A CN109002472B (en) 2018-06-13 2018-06-13 Database difference identification method and device
CN201810605199.9 2018-06-13

Publications (1)

Publication Number Publication Date
WO2019237574A1 true WO2019237574A1 (en) 2019-12-19

Family

ID=64601901

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/108242 Ceased WO2019237574A1 (en) 2018-06-13 2018-09-28 Method and device for identifying database differences

Country Status (2)

Country Link
CN (1) CN109002472B (en)
WO (1) WO2019237574A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114490579A (en) * 2022-01-24 2022-05-13 深圳壹账通智能科技有限公司 Cross-network-area database detection method, device, equipment and storage medium

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111723146B (en) * 2019-03-18 2024-06-14 北京沃东天骏信息技术有限公司 Method for monitoring database, management system and storage medium
CN110134691B (en) * 2019-05-15 2021-06-01 北京百度网讯科技有限公司 Data verification method, device, equipment and medium
CN110990284A (en) * 2019-12-09 2020-04-10 中国建设银行股份有限公司 Database standard checking method and device
CN111190905A (en) * 2019-12-31 2020-05-22 北京奇才天下科技有限公司 Database table processing method and device and electronic equipment
CN111339039A (en) * 2020-02-21 2020-06-26 京东数字科技控股有限公司 File comparison method and device, storage medium and electronic device
CN114547182A (en) * 2020-11-25 2022-05-27 深圳云天励飞技术股份有限公司 Personnel information synchronization method, terminal device and storage medium
CN112433988B (en) * 2020-11-30 2024-11-22 中国建设银行股份有限公司 Data verification method, device, computer equipment and storage medium
CN115809266A (en) * 2022-10-31 2023-03-17 平安银行股份有限公司 Data comparison method, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080147612A1 (en) * 2006-12-19 2008-06-19 Mcafee, Inc. Known files database for malware elimination
CN102054035A (en) * 2010-12-29 2011-05-11 北京播思软件技术有限公司 Data range-based method for synchronizing data in database
CN104573121A (en) * 2015-02-09 2015-04-29 浪潮电子信息产业股份有限公司 DB2 database migration tool for migrating from AIX platform to K-UX platform
CN106484739A (en) * 2015-09-01 2017-03-08 中兴通讯股份有限公司 The structure comparative approach of data base and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874320A (en) * 2016-06-20 2017-06-20 阿里巴巴集团控股有限公司 The method and apparatus of distributive type data processing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080147612A1 (en) * 2006-12-19 2008-06-19 Mcafee, Inc. Known files database for malware elimination
CN102054035A (en) * 2010-12-29 2011-05-11 北京播思软件技术有限公司 Data range-based method for synchronizing data in database
CN104573121A (en) * 2015-02-09 2015-04-29 浪潮电子信息产业股份有限公司 DB2 database migration tool for migrating from AIX platform to K-UX platform
CN106484739A (en) * 2015-09-01 2017-03-08 中兴通讯股份有限公司 The structure comparative approach of data base and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114490579A (en) * 2022-01-24 2022-05-13 深圳壹账通智能科技有限公司 Cross-network-area database detection method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN109002472B (en) 2023-07-14
CN109002472A (en) 2018-12-14

Similar Documents

Publication Publication Date Title
WO2019237574A1 (en) Method and device for identifying database differences
CN111917834A (en) A data synchronization method, device, storage medium and computer equipment
CN112395157B (en) Audit log acquisition method and device, computer equipment and storage medium
US20130218843A1 (en) Intelligent data archiving
CN106445643B (en) It clones, the method and apparatus of upgrading virtual machine
US9898386B2 (en) Detecting byte ordering type errors in software code
WO2019047480A1 (en) Program update method, computer-readable storage medium, terminal device and apparatus
CN112699187B (en) Associated data processing method, device, equipment, medium and product
CN111966631A (en) Mirror image file generation method, system, equipment and medium capable of being rapidly distributed
EP3095047A1 (en) Database key identification
CN106844676B (en) Data storage method and device
CN113420081A (en) Data verification method and device, electronic equipment and computer storage medium
CN108170815A (en) A kind of data processing method, device and storage medium
WO2017113694A1 (en) File synchronizing method, device and system
CN111639087A (en) Data updating method and device in database and electronic equipment
WO2019001021A1 (en) Data processing method, apparatus and system, server, and computer storage medium
CN112948494A (en) Data synchronization method and device, electronic equipment and computer readable medium
US10387887B2 (en) Bloom filter driven data synchronization
US20170141922A1 (en) Incremental upgrade method and system for file
CN112000678A (en) Data synchronization method, device, server and storage medium
US20180275961A1 (en) Method and system for fast data comparison using accelerated and incrementally synchronized cyclic data traversal algorithm
CN108182278A (en) A kind of FRU information maintenance methods and relevant apparatus
CN115952300A (en) Dynamic map construction method, dynamic map construction device and readable storage medium
US20150347402A1 (en) System and method for enabling a client system to generate file system operations on a file system data set using a virtual namespace
CN110647423A (en) A method, device and readable medium for creating a storage volume image based on an application

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18922824

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18922824

Country of ref document: EP

Kind code of ref document: A1