Database hierarchical verification method, electronic device and storage medium

By employing a hierarchical verification method to perform hierarchical verification of database objects and data tables, the problem of low accuracy in database synchronization verification in existing technologies is solved, achieving more efficient and accurate synchronization verification.

CN115982124BActive Publication Date: 2026-04-14HANGZHOU WOQU NETWORK TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU WOQU NETWORK TECH
Filing Date
2022-12-12
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Most existing database synchronization verification methods verify multiple parameters simultaneously, resulting in low accuracy of the verification results.

Method used

A hierarchical verification method is adopted. First, object verification is performed on the first database and the second database. If the object verification passes, the data table verification is then performed. If the object verification fails, the result of the object verification failure and the specific information of the different objects are directly output. If the data table verification passes, it means that the database has been synchronized. If it fails, the result of the synchronization verification failure and the specific information of the different data tables are output.

Benefits of technology

By implementing hierarchical verification, the database synchronization verification time is shortened, the verification accuracy is improved, users can easily view the synchronization verification results and specific differences, and the synchronization verification steps are saved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115982124B_ABST
    Figure CN115982124B_ABST
Patent Text Reader

Abstract

The application provides a database hierarchical verification method, an electronic device and a storage medium, and the method comprises the following steps: acquiring data information of a first database and data information of a second database according to a database verification instruction; performing object verification on the first database and the second database; if the object verification result is that the objects of the first database and the second database are consistent, performing data table verification on the first database and the second database, and outputting a data table verification result. The application adopts a hierarchical verification mode, synchronously verifies the data information of the first database and the second database, takes one of the databases as a reference, compares the data differences between the two databases, performs object verification and data table verification on the first database and the second database, directly outputs a verification result of the synchronization failure when one of the information is found to be different, does not need to perform a next step of verification operation, and shortens the time of the synchronization verification of the two databases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of database verification, and in particular to a database hierarchical verification method, electronic device, and storage medium. Background Technology

[0002] After data synchronization is performed on the database, it is necessary to verify the synchronized database to check whether it has been successfully synchronized. Most existing database synchronization verification methods verify multiple parameters at the same time, and the verification parameters are too simple, resulting in low accuracy of the verification results. Summary of the Invention

[0003] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:

[0004] According to one aspect of this application, a database hierarchical verification method is provided, applied to a database verification system, wherein the database verification system is connected to several target databases, each target database including several target data tables; each target database is located on a different server;

[0005] The database hierarchical verification method includes the following steps:

[0006] S100, in response to a database verification instruction, the database verification instruction includes an information retrieval instruction for a first database and an information retrieval instruction for a second database; the first database and the second database are determined from a plurality of target databases;

[0007] S200: According to the database verification instruction, obtain the data information of the first database and the data information of the second database;

[0008] S300. Based on the data information of the first database and the data information of the second database, perform object verification on the first database and the second database; if the object verification result shows that the objects in the first database and the second database are consistent, then proceed to step S400; otherwise, output the object verification result.

[0009] S400: Perform data table verification on the first and second databases, and output the data table verification results.

[0010] In one exemplary embodiment of this application, step S300 includes:

[0011] S311. If the first database and the second database are isomorphic databases, then proceed to step S312.

[0012] S312. Obtain the object and object attribute information from the first database;

[0013] S313. Obtain the object and object attribute information from the second database;

[0014] S314. Determine whether the objects in the first database and the objects in the second database are the same; if the objects in the first database and the objects in the second database are the same, then proceed to step S315; otherwise, output that the object verification fails.

[0015] S315. Determine whether the object attribute information in the first database and the object attribute information in the second database are the same; if the object attribute information in the first database and the object attribute information in the second database are the same, then execute step S400; otherwise, output that the object verification fails.

[0016] In one exemplary embodiment of this application, step S400 includes:

[0017] S411. Traverse all target data tables in the first and second databases; if H1=H2, then execute step S412; otherwise, output the data table validation fails; where H1 is the number of data rows in the first data table; H2 is the number of data rows in the second data table; the first data table is any target data table in the first database; the second data table is a target data table in the second database with the same name as the first data table.

[0018] S412. If I1 = I2, the output data table verification passes; otherwise, the output data table verification fails. Wherein, I1 is the hash value of the first data table and I2 is the hash value of the second data table.

[0019] In one exemplary embodiment of this application, step S315 includes:

[0020] S316. Determine whether the field types in the first database are the same as those in the second database; if the field types in the first database are the same as those in the second database, proceed to step S317; otherwise, output object validation fails.

[0021] S317. Determine whether the field length in the first database is the same as the field length in the second database; if the field length in the first database is the same as the field length in the second database, then proceed to step S318; otherwise, the output object validation fails.

[0022] S318. Determine whether the precision of the fields in the first database is the same as the precision of the fields in the second database; if the precision of the fields in the first database is the same as the precision of the fields in the second database, then execute step S400; otherwise, the output object verification fails.

[0023] In one exemplary embodiment of this application, step S412 is replaced with:

[0024] S413. If I1 = I2, then the output data table verification passes; otherwise, proceed to step S414.

[0025] S414. Based on the name of each target data table in the first database, obtain the first data table name set J={J1,J2,...,J...} i ,...,J n}; where i=1,2,...,n; n is the number of target data tables in the first database; J i The name of the i-th target data table in the first database;

[0026] S415. Based on the name of each target data table in the second database, obtain the second data table name set G={G1,G2,...,G...} x ,...,G m}; where x=1,2,...,m; m is the number of target data tables in the second database; G x This refers to the name of the x-th target data table in the second database.

[0027] S416, If J k +J h ∈G x Then obtain J k The corresponding target data table size R k J h The corresponding target data table capacity R h and G x The corresponding target data table size R x Where, k = 1, 2, ..., n; h = 1, 2, ..., n;

[0028] S417, If R k +R h -R x If ≤R0, then obtain J. k The update time T of the corresponding target data table k J h The update time T of the corresponding target data table h and G x The update time T of the corresponding target data table x Where R0 is the preset capacity threshold;

[0029] S418, If T k ≤T x And T h ≤T x Then J k The corresponding target data table and J h Merge the corresponding target data tables and combine them with G. xPerform data table validation on the corresponding target data table and output the data table validation results.

[0030] In one exemplary embodiment of this application, the objects of the first database include user objects, field objects, index objects, view objects, and trigger objects in the first database.

[0031] In one exemplary embodiment of this application, step S300 further includes:

[0032] S321. If the first database and the second database are heterogeneous databases, then proceed to step S322.

[0033] S322, Obtain objects from the first database and the second database;

[0034] S323. Determine whether the objects in the first database and the objects in the second database are the same; if the objects in the first database and the objects in the second database are the same, then execute step S421; otherwise, output that the object verification fails.

[0035] In one exemplary embodiment of this application, step S421 includes:

[0036] Iterate through all target data tables in the first and second databases; if H1=H2, the output data table verification passes; otherwise, the output data table verification fails.

[0037] According to one aspect of this application, a non-transitory computer-readable storage medium is provided, the storage medium storing at least one instruction or at least one program segment, the at least one instruction or the at least one program segment being loaded and executed by a processor to implement the database hierarchical verification method.

[0038] According to one aspect of this application, an electronic device is provided, including a processor and a non-transitory computer-readable storage medium.

[0039] The present invention has at least the following beneficial effects:

[0040] This invention employs a hierarchical verification method to synchronously verify the data information in a first database and a second database. Using one database as a benchmark, it compares the data differences between the two databases. First, object verification is performed on both databases. If the object verification fails, the result of the failed object verification and the specific information about the different objects are directly output. If the object verification passes, data table verification is performed on both databases. If the data table verification passes, it indicates that the first and second databases are synchronized. If the data table verification fails, the result of the synchronization verification failing and the specific information about the different data tables are output. This allows users to easily view the synchronization verification results and the specific differences between the two databases. By performing hierarchical verification on the first and second databases, when a difference is found in one piece of information, the synchronization failure result is directly output without further verification operations, shortening the synchronization verification time and saving verification steps, thereby improving the accuracy of the synchronization verification. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0042] Figure 1 A flowchart of a database hierarchical verification method provided in an embodiment of the present invention;

[0043] Figure 2 A connection block diagram of a database verification system provided in an embodiment of the present invention. Detailed Implementation

[0044] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0045] A hierarchical database verification method, applied to a database verification system, such as... Figure 2As shown, the database verification system is connected to several target databases, each of which contains several target data tables. Each target database is located on a different server, and each target data table in the target database stores several target data entries. The database verification system is used to verify the data synchronization between the several target databases it is connected to. If the data information of two target databases is consistent, it means that the data of these two target databases has been synchronized.

[0046] The database hierarchical verification method, such as Figure 1 As shown, it includes the following steps:

[0047] S100, in response to a database verification instruction, the database verification instruction includes an information retrieval instruction for a first database and an information retrieval instruction for a second database; the first database and the second database are determined from a plurality of target databases;

[0048] Database verification commands can be manually issued by users through the user server. For example, if a user wants to perform synchronous verification on all target databases, they can directly send the database verification command to the database verification system through the user server. Database verification commands can also be automatically issued by the user server at a user-defined time. For example, if a user sets the automatic synchronous verification of all target databases to be performed every Wednesday at 3 PM, the user server will set the automatic command sending time to 3 PM every Wednesday. At the set time, the user server will automatically send the database verification command to the database verification system, which will then perform synchronous verification on the target databases.

[0049] The database verification command includes a first database information retrieval command and a second database information retrieval command, which are used to retrieve data information from the first database and the second database, respectively. The first database and the second database can be any two target databases selected from all target databases, or they can be two target databases specified by the user. If the user does not specify target databases, the first database and the second database in the database verification command are two target databases selected arbitrarily from all target databases. If the user specifies two target databases, these two target databases are mapped to the first database and the second database, indicating that the user wants to perform a synchronization verification on these two target databases to verify whether the data in these two target databases is synchronized.

[0050] S200: According to the database verification instruction, obtain the data information of the first database and the data information of the second database;

[0051] The data information in the first database includes all object information in the corresponding first database, and the data information in the second database includes all object information in the corresponding second database. In other words, all data information in the first and second databases can be obtained.

[0052] S300. Based on the data information of the first database and the data information of the second database, perform object verification on the first database and the second database; if the object verification result shows that the objects in the first database and the second database are consistent, then proceed to step S400; otherwise, output the object verification result.

[0053] S400: Perform data table verification on the first and second databases, and output the data table verification results.

[0054] Steps S300 and S400 respectively perform object verification and data table verification on the first database and the second database. This is a hierarchical verification method; that is, data table verification will only proceed if the first and second databases pass object verification. If the first and second databases pass object verification, then data table verification is performed. If the object verification fails, the system directly outputs "Object verification failed" and outputs the out-of-synchronization object information between the first and second databases. When the data table verification also passes, it indicates that the data in the first and second databases is synchronized, and the output data table verification result is "Synchronization verification passed." If the data table verification fails, the system outputs "Synchronization verification failed," indicating that the data in the first and second databases is out of synchronization, and outputs the different data table information between the first and second databases, allowing the user to view the out-of-synchronization data.

[0055] The above is the first embodiment of the present invention. A hierarchical verification method is used to synchronously verify the data information of the first and second databases. Taking one database as a benchmark, the data differences between the two databases are compared. First, object verification is performed on the first and second databases. If the object verification fails, the result of the object verification failure and the specific information of the different objects are directly output. If the object verification passes, data table verification is performed on the first and second databases. If the data table verification passes, it indicates that the first and second databases are synchronized. If the data table verification fails, the result of the synchronization verification failure and the specific information of the different data tables are output. This allows users to view the synchronization verification results and the specific differences between the two databases. By performing hierarchical verification on the first and second databases, when a difference is found in one piece of information, the synchronization failure verification result is directly output without further verification operations, shortening the synchronization verification time and saving synchronization verification steps.

[0056] Since databases are divided into two types, homogeneous databases and heterogeneous databases, it is necessary to distinguish between the two types of databases and then perform synchronous verification for different types of databases.

[0057] The second embodiment of the present invention is a synchronization verification method for homogeneous databases, as follows:

[0058] Steps S100 and S200 in the second embodiment are the same as those in the first embodiment.

[0059] Further, step S300 includes:

[0060] S311. If the first database and the second database are isomorphic databases, then proceed to step S312.

[0061] S312. Obtain the objects and object attribute information of the first database; the objects of the first database include user objects, data table structure objects, field objects, index objects, view objects, trigger objects, scheduled task objects, etc. in the first database;

[0062] S313. Obtain the objects and object attribute information of the second database; the objects of the second database include user objects, data table structure objects, field objects, index objects, view objects, trigger objects, scheduled task objects, etc. in the second database;

[0063] S314. Determine whether the objects in the first database and the objects in the second database are the same; if the objects in the first database and the objects in the second database are the same, then proceed to step S315; otherwise, output that the object verification fails.

[0064] When comparing objects in a data table, many factors are involved, including: user objects (sending, receiving, or editing users); table structure objects (the structure of the data table); field objects (data fields); index objects (index data); view objects (image data); trigger objects (trigger signals, indicating when a trigger receives a signal or reaches a certain time, automatically performing a preset action on the corresponding data table); and scheduled task objects (timed signals, automatically performing editing actions on the corresponding data table upon receiving a timed signal).

[0065] When comparing objects in the first database and objects in the second database, the comparison parameter is the same object type. For example, when comparing user objects in the first database and user objects in the second database, if they are the same, then the comparison proceeds to check if the next object type is the same. During the object type comparison process, if any object in the first database and the second database is different, the verification result is directly output, indicating that the object verification failed, and the different object types compared are also output. If the index objects in the first database and the second database are different, the synchronization verification operation is not continued, and the error is directly output, indicating that the object verification failed, and the index objects are different, so that users can easily see the differences between the two. If all object types in the first database and the second database are the same, then the next synchronization verification operation is performed.

[0066] S315. Determine whether the object attribute information in the first database and the object attribute information in the second database are the same; if the object attribute information in the first database and the object attribute information in the second database are the same, then execute step S400; otherwise, output that the object verification fails.

[0067] The object attribute information includes the table attribute information and field attribute information of the corresponding target database. The object attribute information of the same type in the first database and the second database are verified respectively. If they are the same, it means that the object verification passes and the next step of data table verification is performed. If, during the comparison, one of the object attribute information is found to be different, the object verification fails and the object attribute information that caused the difference is output directly.

[0068] Further, step S315 includes:

[0069] S316. Determine whether the field types in the first database are the same as those in the second database; if the field types in the first database are the same as those in the second database, proceed to step S317; otherwise, output object validation fails.

[0070] The field type refers to the field type of the corresponding data table in the database, which includes numeric, string, and date / time types, etc. The field types of each data table in the database may be different. Therefore, by checking the field types of data tables with the same data table name in two databases, the two data tables can be synchronized and verified.

[0071] S317. Determine whether the field length in the first database is the same as the field length in the second database; if the field length in the first database is the same as the field length in the second database, then proceed to step S318; otherwise, the output object validation fails.

[0072] The field length is the field length of the data table to be validated in the corresponding database. It can consist of letters, symbols, and numbers. Since it is necessary to determine whether the data in the data table is consistent, the field length is also one of the discrimination factors.

[0073] S318. Determine whether the precision of the fields in the first database is the same as the precision of the fields in the second database; if the precision of the fields in the first database is the same as the precision of the fields in the second database, then execute step S400; otherwise, the output object verification fails.

[0074] Field precision is also one of the verification factors for the data table to be verified in the corresponding database. During the synchronous verification of the data table, the more verification factors there are, the higher the dimension of verification, and the more accurate the verification result will be.

[0075] Field type, field length, and field precision are further classifications of field attributes. In addition, field attributes also include field comments, character sets, field default values, etc. Different field attributes of the first and second databases are validated in a hierarchical manner to check the differences between objects in the two databases. When performing synchronization validation, the data tables with the same name in the two databases are compared. Data tables with the same name are considered to be synchronized data tables, so only data tables with the same name need to be compared.

[0076] Further, step S400 includes:

[0077] S411. Traverse all target data tables in the first and second databases; if H1=H2, then execute step S412; otherwise, output the data table validation fails; where H1 is the number of data rows in the first data table; H2 is the number of data rows in the second data table; the first data table is any target data table in the first database; the second data table is a target data table in the second database with the same name as the first data table.

[0078] S412. If I1 = I2, the output data table verification passes; otherwise, the output data table verification fails. Wherein, I1 is the hash value of the first data table and I2 is the hash value of the second data table.

[0079] The hash value is the encrypted result of the corresponding data table. Usually, for the information security of the data table, it is necessary to encrypt the data table information. The data table is encrypted using the MD5 encryption algorithm. Therefore, when performing synchronous verification of the data table, the encrypted hash value is also a factor to be considered. By comparing whether the hash values ​​of the two data tables are equal, it is possible to verify whether the data in the two data tables are the same.

[0080] Step S400 is the data table verification method of the second embodiment. If the first database is set as the base database, a target data table is randomly selected from the first database, and a target data table with the same name as this target data table is selected from the second database. The two target data tables have the same name, indicating that they are corresponding synchronized data tables. The number of data rows and hash value of the two are verified in turn. If the number of data rows is the same, the hash value is verified. If the number of data rows is different, the verification result of the data table verification failure is directly output, and the information of the two target data tables being out of sync is also output. If the hash values ​​of the two are also the same, it means that the data table verification is passed, indicating that the data of the two target data tables has been synchronized. Then, a target data table is randomly selected from the first database, and the target data table with the corresponding name is found in the second database. The data table verification process is repeated until all target data tables in the first database have been verified. If the data table verification of all target data tables is passed, the synchronization verification result between the first database and the second database is output as passed. Otherwise, the synchronization verification result is output as failed. If no target data table with the name of the first database is found in the second database, it also means that the synchronization has failed.

[0081] Furthermore, after all target tables in the first database have undergone data table validation and passed the validation, the second database is then checked for any target tables that have not been validated. If such tables exist, it indicates that the data in the two databases is not entirely identical, and the output synchronization validation result is "failed." If no such tables exist, it indicates that the data in the two databases is fully synchronized, and the output synchronization validation result is "passed." This method improves the accuracy of database validation, making database synchronization validation more precise.

[0082] Furthermore, in the target database, there is also a situation where data tables are merged, that is, two or more data tables in the first database are merged into a new target data table and synchronized to the second database. However, the data table verification method in the second embodiment is no longer suitable for this type of data table merging. Therefore, a third embodiment of the present invention is proposed. The third embodiment of the present invention is based on the second embodiment, and the step S412 of the second embodiment is replaced as follows:

[0083] S413. If I1 = I2, then the output data table verification passes; otherwise, proceed to step S414.

[0084] S414. Based on the name of each target data table in the first database, obtain the first data table name set J={J1,J2,...,J...} i ,...,J n}; where i=1,2,...,n; n is the number of target data tables in the first database; J i The name of the i-th target data table in the first database;

[0085] S415. Based on the name of each target data table in the second database, obtain the second data table name set G={G1,G2,...,G...} x ,...,G m}; where x=1,2,...,m; m is the number of target data tables in the second database; G x This refers to the name of the x-th target data table in the second database.

[0086] S416, If J k +J h ∈G x Then obtain J k The corresponding target data table capacity R k J h The corresponding target data table capacity R h and G x The corresponding target data table size R x Where, k = 1, 2, ..., n; h = 1, 2, ..., n;

[0087] S417, If R k +R h -R x If ≤R0, then obtain J. k The update time T of the corresponding target data table k J h The update time T of the corresponding target data table h and G x The update time T of the corresponding target data table x Where R0 is the preset capacity threshold;

[0088] S418, If T k ≤T x And T h ≤T x Then J k The corresponding target data table and J h Merge the corresponding target data tables and combine them with G. x Perform data table validation on the corresponding target data table and output the data table validation results.

[0089] In the third embodiment of the present invention, if a single target data table in the first database and the second database fails the data table verification, then multiple target data tables in the first database are further compared with the corresponding target data tables in the second database for further verification. The third embodiment of the present invention adopts the case of merging two target data tables. First, two target data tables are randomly obtained from the first database, and the names of these two target data tables are combined. Then, a target data table with the same name as this combination is selected from all target data tables in the second database. This target data table is a combination of the two target data tables selected in the first database. Then, the capacity and update time of the three are compared. If the difference between the capacity of the two target data tables selected in the first database and the capacity of the target data table selected in the second database is within a set threshold, and the update times of the three are similar, then an association relationship is established between the three, and they are considered to be a combination relationship. The two target data tables in the first database are regarded as one target data table, and then data table verification is performed with the target table selected in the second database, and the verification result is output. This can adapt to the verification situation of data table merging processing. If the names of the two target data tables selected in the first database do not have corresponding target data tables in the second database, then two new target data tables are selected from the first data table, and the search is performed in the second database according to the names of the combinations, until all target data tables in the first database have been selected and compared.

[0090] The fourth embodiment of the present invention is a synchronization verification method for heterogeneous databases, as follows:

[0091] Steps S100 and S200 in the fourth embodiment are the same as those in the first embodiment.

[0092] Step S300 of the fourth embodiment includes:

[0093] S321. If the first database and the second database are heterogeneous databases, then proceed to step S322.

[0094] S322, Obtain objects from the first database and the second database;

[0095] S323. Determine whether the objects in the first database and the objects in the second database are the same; if the objects in the first database and the objects in the second database are the same, then execute step S421; otherwise, output that the object verification fails.

[0096] Step S421 of the fourth embodiment includes:

[0097] Iterate through all target data tables in the first and second databases; if H1=H2, the output data table verification passes; otherwise, the output data table verification fails.

[0098] The fourth embodiment is a synchronization verification method for heterogeneous databases. Compared with the synchronization verification method for homogeneous databases, the object verification method for heterogeneous databases only verifies the object type, and the data table verification only verifies the number of data rows. Compared with the existing heterogeneous database synchronization verification methods, the heterogeneous database synchronization verification method of the present invention has a shorter verification time and more accurate verification results.

[0099] Embodiments of the present invention also provide a non-transitory computer-readable storage medium that can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method in the method embodiments, wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiments.

[0100] Embodiments of the present invention also provide an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0101] While specific embodiments of the invention have been described in detail by way of examples, those skilled in the art should understand that the examples are for illustrative purposes only and are not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention.

Claims

1. A database hierarchical verification method, characterized in that, This is applied to a database verification system, which is connected to several target databases, each of which includes several target data tables; each target database is hosted on a different server. The method includes the following steps: S100, in response to a database verification instruction, the database verification instruction includes an information retrieval instruction for a first database and an information retrieval instruction for a second database; the first database and the second database are determined from a plurality of target databases; S200: Obtain data information from the first database and data information from the second database according to the database verification instruction; S300. Based on the data information of the first database and the data information of the second database, perform object verification on the first database and the second database; If the object verification result shows that the objects in the first database and the second database are consistent, then proceed to step S400; Otherwise, output the object verification result; S400. Perform data table verification on the first database and the second database, and output the data table verification results; Step S300 includes S311-S315: S311. If the first database and the second database are homogeneous databases, then proceed to step S312. S312. Obtain the object and object attribute information from the first database; S313. Obtain the object and object attribute information from the second database; S314. Determine whether the objects in the first database and the objects in the second database are the same; if the objects in the first database and the objects in the second database are the same, then execute step S315; otherwise, output that the object verification fails. S315. Determine whether the object attribute information in the first database and the object attribute information in the second database are the same; if the object attribute information in the first database and the object attribute information in the second database are the same, then execute step S400; otherwise, output that the object verification fails. Step S400 includes S411-S418: S411. Traverse all target data tables in the first database and the second database; if H1=H2, then execute step S413; otherwise, output the data table verification fails; where H1 is the number of data rows in the first data table; H2 is the number of data rows in the second data table; the first data table is any of the target data tables in the first database; the second data table is a target data table in the second database with the same name as the first data table; S413. If I1 = I2, the output data table verification passes; otherwise, proceed to step S414; where I1 is the hash value of the first data table and I2 is the hash value of the second data table. S414. Based on the name of each target data table in the first database, obtain the first data table name set J = {J1, J2, ..., J...} i ,...,J n }; where i = 1, 2, ..., n; n is the number of target data tables in the first database; J i Let i be the name of the i-th target data table in the first database; S415. Based on the name of each target data table in the second database, obtain the second data table name set G={G1,G2,...,G...} x ,...,G m }; where x=1,2,...,m; m is the number of target data tables in the second database; G x This refers to the name of the x-th target data table in the second database. S416, If J k +J h ∈G x Then obtain J k The corresponding target data table capacity R k J h The corresponding target data table capacity R h and G x The corresponding target data table capacity R x Where, k = 1, 2, ..., n; h = 1, 2, ..., n; S417, If R k +R h -R x If ≤R0, then obtain J. k The update time T of the corresponding target data table k J h The update time T of the corresponding target data table h and G x The update time T of the corresponding target data table x Where R0 is the preset capacity threshold; S418, If T k ≤T x And T h ≤T x Then J k The corresponding target data table and J h Merge the corresponding target data tables and combine them with G. x Perform data table validation on the corresponding target data table and output the data table validation results.

2. The method according to claim 1, characterized in that, Step S315 includes: S316. Determine whether the field types in the first database are the same as those in the second database; if the field types in the first database are the same as those in the second database, then proceed to step S317; otherwise, output object validation fails. S317. Determine whether the field length in the first database is the same as the field length in the second database; if the field length in the first database is the same as the field length in the second database, then execute step S318; otherwise, output object validation fails. S318. Determine whether the precision of the fields in the first database is the same as the precision of the fields in the second database; if the precision of the fields in the first database is the same as the precision of the fields in the second database, then execute step S400; otherwise, the output object verification fails.

3. The method according to claim 1, characterized in that, The objects in the first database include user objects, field objects, index objects, view objects, and trigger objects.

4. The method according to claim 1, characterized in that, Step S300 further includes: S321. If the first database and the second database are heterogeneous databases, then proceed to step S322. S322. Obtain objects from the first database and objects from the second database; S323. Determine whether the objects in the first database and the objects in the second database are the same; if the objects in the first database and the objects in the second database are the same, then execute step S421; otherwise, output that the object verification fails. Step S421 includes: Iterate through all target data tables in the first and second databases; if H1=H2, the output data table verification passes; otherwise, the output data table verification fails.

5. A non-transitory computer-readable storage medium, wherein the storage medium stores at least one instruction or at least one program segment, characterized in that, The at least one instruction or the at least one program segment is loaded and executed by the processor to implement the method as described in any one of claims 1-4.

6. An electronic device, characterized in that, Includes a processor and the non-transitory computer-readable storage medium as described in claim 5.

Citation Information

Patent Citations

  • Data verification method and device based on database migration, equipment and medium

    CN113392090A

  • Database table data management method, apparatus and system

    WO2017071337A1