Data synchronization method, device, equipment, medium and program product

Through automated generation of storage scripts and operation permission management, data synchronization problems between production environment and disaster recovery environment are solved, the efficiency and accuracy of data synchronization are improved, and the security and business continuity of the database are ensured.

CN119128017APending Publication Date: 2024-12-13CCB FINTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411322276.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In the prior art, databases in production environments are different from disaster recovery databases in application environments, resulting in data such as domain names and IP addresses that cannot be synchronized to the disaster recovery database normally, affecting data security and business continuity.

Method used

By automatically generating storage scripts, the storage scripts are determined according to the application environment differences between the target data, the first database and the second database, and the user account operation permissions are given to ensure that the target data is correctly stored and verified in the second database, and the operation permissions are recycled. Ensure database security.

Benefits of technology

It improves the efficiency and accuracy of data synchronization, ensures the correctness and security of data in a disaster recovery environment, and avoids unnecessary operations of the database by user accounts after data synchronization is completed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119128017A_ABST
    Figure CN119128017A_ABST
Patent Text Reader

Abstract

The invention provides a data synchronization method, device and equipment, a medium and a program product, which can be applied to the technical fields of data security and financial science and technology. The method comprises the steps that in response to a user account, target data is stored in a first database, a storage script used for storing the target data in a second database is determined, and the application environments of the first database and the second database are different; the storage script is determined based on the target data, a first application environment of the first database and a second application environment of the second database; giving a first operation authority to the user account; controlling the user account to execute the storage script on the second database by using the first operation authority, and storing the target data into the second database; switching the second database to the first application environment, and verifying the correctness of the target data in the second database; and under the condition that the target data in the second database is correct, recycling the first operation authority of the user account, and storing the change of the second database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the fields of data security and financial technology, and specifically to a data synchronization method, device, equipment, medium and program product. Background Art

[0002] A disaster recovery database (DRD) is a backup database system established in a database management system to cope with possible catastrophic events such as natural disasters, software and hardware failures, etc. In the event of a disaster or system failure, enabling the DRD can ensure data security and business continuity.

[0003] In the process of implementing the present disclosure, the inventors found that the prior art has at least the following problems: due to the complexity of the system, there are situations where application environment data is stored in the database in the production environment and the disaster recovery database. Therefore, when the disaster recovery database is enabled, application environment data such as domain names and IP addresses cannot be put into use, resulting in the inability to synchronize data in the production environment to the disaster recovery database normally. The disaster recovery database is slow to be enabled in the disaster recovery environment, affecting data security and business continuity. Summary of the invention

[0004] In view of the above problems, the present disclosure provides a data synchronization method, apparatus, device, medium and program product.

[0005] According to a first aspect of the present disclosure, a data synchronization method is provided, including: in response to a user account storing target data to a first database, determining a storage script for storing the target data in a second database, wherein the application environments of the first database and the second database are different, and the storage script is determined based on the target data, a first application environment of the first database, and a second application environment of the second database; granting a first operation permission to the user account, wherein the first operation permission is used to operate the second database; controlling the user account to execute the storage script on the second database using the first operation permission to store the target data in the second database; switching the second database to the first application environment to verify the correctness of the target data in the second database; and, if the target data in the second database is correct, reclaiming the first operation permission of the user account and saving the changes to the second database.

[0006] According to an embodiment of the present disclosure, in response to a user account storing target data in a first database, a storage script for storing the target data in a second database is determined, including: in response to a user account storing the target data in the first database, determining a first data format of the target data under a first application environment; based on the first data format, environmental differences between the first application environment and the second application environment, determining a second data format of the target data under the second application environment; and determining the storage script based on the second data format and the target data.

[0007] According to an embodiment of the present disclosure, based on the first data format, the environmental difference between the first application environment and the second application environment, determining the second data format of the target data under the second application environment includes: determining the environmental difference based on the first application environment and the second application environment, wherein the environmental difference includes service dependency difference, user authority difference, and configuration parameter difference; and determining the second data format based on the first data format and the environmental difference.

[0008] According to an embodiment of the present disclosure, determining a storage script based on a second data format and target data includes: determining a database connection string corresponding to a second database based on the second data format; and determining a storage script based on the database connection string and the target data.

[0009] According to an embodiment of the present disclosure, the second database is switched to the first application environment to verify the correctness of the target data in the second database, including: converting the target data in the second database into data in a first data format; comparing the data in the first data format with the target data stored in the first database to obtain a comparison result; and when the comparison result indicates that the data in the first data format is the same as the target data stored in the first database, the comparison result indicates that the target data in the second database is correct.

[0010] According to an embodiment of the present disclosure, the data synchronization method also includes: in the event of a failure in the first database, switching the second database to the first application environment; and in response to a user account storing data in the first database, storing the data in the second database switched to the first application environment.

[0011] According to an embodiment of the present disclosure, the data synchronization method also includes: in the event of a fault repair of the first database, synchronizing data on the first database based on switching to the second database of the first application environment; switching the second database to the second application environment; and storing data in the first database in response to a user account storing data in the first database.

[0012] A second aspect of the present disclosure provides a data synchronization device, including:

[0013] a script generation module, configured to determine, in response to a user account storing target data in a first database, a storage script for storing the target data in a second database, wherein the first database and the second database have different application environments, and the storage script is determined based on the target data, a first application environment of the first database, and a second application environment of the second database;

[0014] An account authorization module, used to grant a first operation permission to a user account, wherein the first operation permission is used to operate the second database;

[0015] A script execution module, used to control the user account to execute the stored script on the second database using the first operation permission, and store the target data in the second database;

[0016] A data verification module, used to switch the second database to the first application environment and verify the correctness of the target data in the second database; and

[0017] The authority recovery module is used to recover the first operation authority of the user account and save the changes to the second database when the target data in the second database is correct.

[0018] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.

[0019] The fourth aspect of the present disclosure further provides a computer-readable storage medium on which a computer program or instruction is stored, and the steps of the above method are implemented when the above computer program or instruction is executed by a processor.

[0020] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor.

[0021] According to an embodiment of the present disclosure, when a user account stores target data in a first database, a storage script for storing target data in a second database is determined, and the user account is granted operation rights on the second database, and the user account is controlled to execute the storage script, and the target data is correctly stored in the second database to complete data synchronization. By automatically generating storage scripts, the efficiency and accuracy of the data synchronization process can be improved. After the target data is stored, the second database is switched to the first application environment that is the same as the first database, and it is verified whether the target data in the second database under the first application environment is the same as the target data stored in the first database, so as to determine whether the data synchronization is accurate, thereby improving the accuracy of data synchronization. When the target data in the second database is correct, the user account's operation rights for the second database are reclaimed to prevent the user account from operating the second database after data synchronization is completed. By managing the operation rights at the minimum granularity, the security of the database can be ensured under the premise of ensuring the normal data synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0023] Figure 1 The application scenario diagram of the data synchronization method, apparatus, device, medium and program product according to the embodiment of the present disclosure is schematically shown;

[0024] Figure 2 A flowchart of a data synchronization method according to an embodiment of the present disclosure is schematically shown;

[0025] Figure 3 The interactive flow chart of the data synchronization method according to the embodiment of the present disclosure is schematically shown;

[0026] Figure 4 A structural block diagram of a data synchronization device according to an embodiment of the present disclosure is schematically shown; and

[0027] Figure 5 A block diagram of an electronic device suitable for implementing a data synchronization method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0028] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0029] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0030] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0031] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0032] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the possibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0033] In the technical solution of the present disclosure, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0034] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present disclosure provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating a person's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.

[0035] An embodiment of the present disclosure provides a data synchronization method, including: in response to a user account storing target data to a first database, determining a storage script for storing the target data in a second database, wherein the application environments of the first database and the second database are different, and the storage script is determined based on the target data, a first application environment of the first database, and a second application environment of the second database; granting a first operation permission to the user account, wherein the first operation permission is used to operate the second database; controlling the user account to execute the storage script on the second database using the first operation permission to store the target data in the second database; switching the second database to the first application environment to verify the correctness of the target data in the second database; and when the target data in the second database is correct, reclaiming the first operation permission of the user account and saving the changes to the second database.

[0036] Figure 1 The application scenario diagram of the data synchronization method, apparatus, device, medium and program product according to the embodiments of the present disclosure is schematically shown.

[0037] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0038] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0039] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0040] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.

[0041] It should be noted that the data synchronization method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the data synchronization device provided in the embodiment of the present disclosure can generally be set in the server 105. The data synchronization method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the data synchronization device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.

[0042] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0043] The following will be based on Figure 1 The scene described by Figure 2~Figure 3 The data synchronization method of the embodiment of the present disclosure is described in detail.

[0044] Figure 2 The flowchart of the data synchronization method according to the embodiment of the present disclosure is schematically shown.

[0045] like Figure 2 As shown, the data synchronization method of this embodiment includes operations S210 to S250.

[0046] In operation S210 , in response to a user account storing target data in a first database, a storage script for storing the target data in a second database is determined.

[0047] According to an embodiment of the present disclosure, the application environments of the first database and the second database are different, wherein the application environment of the first database may be a first application environment, the application environment of the second database may be a second application environment, the first application environment may be a production environment, and the second application environment may be a disaster recovery environment. The storage script is determined based on the target data, the first application environment of the first database, and the second application environment of the second database.

[0048] In operation S220, a first operation authority is granted to the user account.

[0049] According to the embodiments of the present disclosure, since the application environment of the second database is a disaster recovery environment, the database of the disaster recovery environment needs to back up the data of the production environment during normal production, and export the data for use after the disaster recovery environment is triggered. Therefore, operations on the second database of the disaster recovery environment require permission authentication, and ordinary user accounts cannot directly write data to the second database. The first operation permission is used to operate the second database. After the first operation permission is granted to the user account, the user account can operate the second database.

[0050] In operation S230, the control user account executes the stored script on the second database using the first operation authority to store the target data in the second database.

[0051] According to an embodiment of the present disclosure, a user account is controlled so that the user account uses the first operation permission to execute a storage script on the second database to store target data in the second database, wherein the target data stored in the second database has a different data format from the target data stored in the first database.

[0052] In operation S240, the second database is switched to the first application environment, and the correctness of the target data in the second database is verified.

[0053] According to an embodiment of the present disclosure, the second database is switched to the first application environment, and the data format of the data stored in the second database is switched to a data format corresponding to the first application environment, and it is verified whether the target data in the second database after the format conversion matches the target data in the first database. If the match is successful, the target data in the second database is written correctly.

[0054] In operation S250, if the target data in the second database is correct, the first operation authority of the user account is revoked, and the changes to the second database are saved.

[0055] According to an embodiment of the present disclosure, when the target data in the second database is correct, indicating that the data synchronization has been completed and the data synchronization result is correct, the changes to the second database are saved and the first operation authority of the user account is reclaimed to prevent the user account from being able to operate on the second database after the data synchronization.

[0056] According to an embodiment of the present disclosure, when a user account stores target data in a first database, a storage script for storing target data in a second database is determined, and the user account is granted operation rights on the second database, and the user account is controlled to execute the storage script, and the target data is correctly stored in the second database to complete data synchronization. By automatically generating storage scripts, the efficiency and accuracy of the data synchronization process can be improved. After the target data is stored, the second database is switched to the first application environment that is the same as the first database, and it is verified whether the target data in the second database under the first application environment is the same as the target data stored in the first database, so as to determine whether the data synchronization is accurate, thereby improving the accuracy of data synchronization. When the target data in the second database is correct, the user account's operation rights for the second database are reclaimed to prevent the user account from operating the second database after data synchronization is completed. By managing the operation rights at the minimum granularity, the security of the database can be ensured under the premise of ensuring the normal data synchronization.

[0057] According to an embodiment of the present disclosure, in response to a user account storing target data in a first database, a storage script for storing the target data in a second database is determined, including: in response to a user account storing the target data in the first database, determining a first data format of the target data under a first application environment; based on the first data format, environmental differences between the first application environment and the second application environment, determining a second data format of the target data under the second application environment; and determining the storage script based on the second data format and the target data.

[0058] According to an embodiment of the present disclosure, in response to a user account storing target data in a first database, a first data format of the target data in a first application environment is determined, and an environmental difference between the first application environment and a second application environment is determined, thereby determining a second data format of the target data in the second application environment according to the environmental difference and the first data format. Based on the second data format and the target data, a storage method of the target data in the second database can be determined, thereby determining a storage script.

[0059] According to an embodiment of the present disclosure, in response to a user account storing target data in a first database, a first data format of the target data in a first application environment is determined, and based on the first data format and the environmental difference between the first application environment and the second application environment, a second data format of the target data in the second application environment is determined, thereby determining a storage script. By accurately determining the second data format according to the environmental difference, the target data is correctly stored in the second database.

[0060] According to an embodiment of the present disclosure, based on the first data format, the environmental difference between the first application environment and the second application environment, determining the second data format of the target data under the second application environment includes: determining the environmental difference based on the first application environment and the second application environment, wherein the environmental difference includes service dependency difference, user authority difference, and configuration parameter difference; and determining the second data format based on the first data format and the environmental difference.

[0061] According to the embodiments of the present disclosure, the environment difference is determined based on the service dependency, user authority, configuration parameters and other environment parameters of the first application environment and the second application environment. The second data format is determined based on the first data format and the environment difference. Taking the service dependency as an example, the service dependency of the first application environment can be extracted according to the first data format, and the service dependency of the first application environment is replaced by the service dependency of the second application environment to update the second data format.

[0062] According to an embodiment of the present disclosure, since there are environmental differences between the first application environment and the second application environment, the storage formats of the same target data in the database under the first application environment and the database under the second application environment may be different. The second data format is determined based on the environmental differences and the first data format, so as to determine the storage script based on the second data format, which can ensure that the data is correctly stored in the second database under the second application environment during the data synchronization process, thereby improving the efficiency and accuracy of data synchronization.

[0063] According to an embodiment of the present disclosure, determining a storage script based on a second data format and target data includes: determining a database connection string corresponding to a second database based on the second data format; and determining a storage script based on the database connection string and the target data.

[0064] According to an embodiment of the present disclosure, based on the service dependency, user authority, configuration parameters and other environmental parameters in the second data format, a database connection string corresponding to the second database is determined, wherein the database connection string is used to connect to the database system so that the application can communicate with the database system. Based on the target data and the second data format, a structured query language (SQL) for storing the target data in the second database is generated, and based on the SQL statement and the database connection string, a storage script is determined.

[0065] According to an embodiment of the present disclosure, a database connection string corresponding to the second database is determined based on the second data format, and a storage script for storing the target data in the second database is determined based on the database connection string and the target data. The connection and communication with the second database can be ensured through the database connection string, and the correctness of the data stored in the second database can be ensured by determining the storage script through the target data, thereby improving the efficiency and accuracy of data synchronization.

[0066] According to an embodiment of the present disclosure, the second database is switched to the first application environment to verify the correctness of the target data in the second database, including: converting the target data in the second database into data in a first data format; comparing the data in the first data format with the target data stored in the first database to obtain a comparison result; and when the comparison result indicates that the data in the first data format is the same as the target data stored in the first database, the comparison result indicates that the target data in the second database is correct.

[0067] According to an embodiment of the present disclosure, after the target data stored in the second database is converted into data in the first data format, it is compared with the target data stored in the first database to obtain a comparison result.

[0068] According to an embodiment of the present disclosure, when the comparison result indicates that the data in the first data format is the same as the target data stored in the first database, it indicates that the data stored in the second database can meet the application requirements of the first application environment after being converted into the first data format, so it can be determined that the target data in the second database is correct. When the comparison result indicates that the data in the first data format is different from the target data stored in the first database, it indicates that the data stored in the second database still cannot meet the application requirements of the first application environment after being converted into the first data format, so it can be determined that the target data in the second database is incorrect.

[0069] According to an embodiment of the present disclosure, by converting the data format of the target data in the second database into the first data format and comparing it with the target data stored in the first database, it is possible to determine whether the data in the second database is consistent with the data in the first database after switching to the first application environment, thereby determining whether the second database can be used as a database in a production environment in a disaster recovery situation, thereby improving the accuracy of data synchronization.

[0070] According to an embodiment of the present disclosure, the data synchronization method also includes: in the event of a failure in the first database, switching the second database to the first application environment; and in response to a user account storing data in the first database, storing the data in the second database switched to the first application environment.

[0071] According to an embodiment of the present disclosure, in the event of a failure in the first database, the second database in the disaster recovery environment can be switched to the first application environment, ie, the production environment, so that the second database can be used in the production environment.

[0072] According to an embodiment of the present disclosure, in the event of a failure in the first database, operations performed on the database in the production environment need to be saved in the second database switched to the first application environment to ensure that operations performed on the database can be accurately responded to.

[0073] According to an embodiment of the present disclosure, in the event of a failure in the first database, the second database is switched to the first application environment, and the data stored in the database of the first application environment is stored in the second database, thereby ensuring the consistency and correctness of the data in a disaster recovery situation.

[0074] According to an embodiment of the present disclosure, the data synchronization method also includes: in the event of a fault repair of the first database, synchronizing data on the first database based on switching to the second database of the first application environment; switching the second database to the second application environment; and in response to a user account storing data in the first database, storing the data in the first database.

[0075] According to an embodiment of the present disclosure, in the case where the first database still has a fault, the operations performed on the database in the production environment have been saved in the second database switched to the first application environment, and the first database has not performed the operations performed by the user account during the fault. Therefore, in the case of fault repair of the first database, in order to ensure the correctness of the data in the first database, data synchronization of the first database can be performed based on the second database switched to the first application environment, so that the data saved in the first database is the latest data in the current production environment.

[0076] According to an embodiment of the present disclosure, when the fault of the first database is repaired, the operations on the production environment will be saved to the first database, and the second database will be restored to the second application environment, that is, the disaster recovery environment, so that it can be enabled in the event that the first database fails again. Therefore, the second database is switched to the second application environment, and the data is stored in the first database when the user account stores data in the database of the production environment.

[0077] According to the embodiments of the present disclosure, after the first database recovers from a failure, the data in the second database is used to synchronize the first database to ensure data integrity. The second database is switched back to the second application environment, and the first database is used again as the database in the first application environment, thereby ensuring data consistency and improving the ability of data synchronization to cope with failure situations.

[0078] Figure 3 The interactive flow chart of the data synchronization method according to the embodiment of the present disclosure is schematically shown.

[0079] like Figure 3 As shown, the interactive process includes operations S301 to S316, wherein operations S301 to S310 are operations for storing target data in the first database based on a user account, and a process for synchronizing data with the second database, and operations S311 to S316 are a process for switching databases from a failure of the first database to a failure repair process.

[0080] In operation S301, the user account sends a request to the database management system to store target data in the first database. In operation S302, the database management system stores the target data in the first database. In operation S303, the database management system determines the storage script based on the target data. In operation S304, the database management system grants the first operation permission to the user account. In operation S305, the user account executes the storage script to store the target data in the second database. In operation S306, the database management system controls the second database to switch to the first application environment. In operation S307, the second database sends the target data in the first application environment, i.e., the second target data, to the database management system. In operation S308, the first database sends the target data stored in the first database, i.e., the first target data, to the database management system. In operation S309, the database management system determines the correctness of the target data stored in the second database based on the first target data and the second target data. In operation S310, the database management system reclaims the first permission from the user account.

[0081] In operation S311, the first database has a software or hardware problem or a disaster, and reports an error to the database management system. In operation S312, the database management system controls the second database to switch to the first application environment. The operations on the database in the production environment are converted to operations on the second database. In operation S313, the software or hardware problem or disaster of the first database is recovered, and a database recovery message is sent to the database management system. In operation S314, the second database sends the data currently stored in the second database to the database management system. In operation S315, the first database is synchronized with the data stored in the second database. In operation S316, the database management system controls the second database to switch back to the second application environment. And based on operations S301 to S310, the operations on the first database in the production environment are synchronized to the second database in the second application environment.

[0082] Based on the above data synchronization method, the present disclosure also provides a data synchronization device. Figure 4 The device is described in detail.

[0083] Figure 4 The structure block diagram of the data synchronization device according to the embodiment of the present disclosure is schematically shown.

[0084] like Figure 4 As shown, the data synchronization device 400 of this embodiment includes a script generation module 410 , an account authorization module 420 , a script execution module 430 , a data verification module 440 and a permission recovery module 450 .

[0085] The script generation module 410 is used to determine a storage script for storing the target data in the second database in response to the user account storing the target data in the first database, wherein the application environments of the first database and the second database are different, and the storage script is determined based on the target data, the first application environment of the first database, and the second application environment of the second database. In one embodiment, the script generation module 410 can be used to perform the operation S210 described above, which will not be repeated here.

[0086] The account authorization module 420 is used to grant the first operation permission to the user account, wherein the first operation permission is used to operate the second database. In one embodiment, the account authorization module 420 can be used to perform the operation S220 described above, which will not be described in detail here.

[0087] The script execution module 430 is used to control the user account to execute the stored script on the second database using the first operation authority, and store the target data in the second database. In one embodiment, the script execution module 430 can be used to execute the operation S230 described above, which will not be repeated here.

[0088] The data verification module 440 is used to switch the second database to the first application environment and verify the correctness of the target data in the second database. In one embodiment, the data verification module 440 can be used to perform the operation S240 described above, which will not be described in detail here.

[0089] The authority recovery module 450 is used to recover the first operation authority of the user account and save the changes to the second database when the target data in the second database is correct. In one embodiment, the authority recovery module 450 can be used to perform the operation S250 described above, which will not be repeated here.

[0090] According to an embodiment of the present disclosure, the script generation module 410 includes a first format determination submodule, a second format determination submodule, and a script generation submodule.

[0091] The first format determination submodule is configured to determine a first data format of the target data in a first application environment in response to a user account storing the target data in the first database.

[0092] The second format determination submodule is used to determine a second data format of the target data in the second application environment based on the first data format and the environment difference between the first application environment and the second application environment.

[0093] The script generation submodule is used to determine a storage script based on the second data format and the target data.

[0094] According to an embodiment of the present disclosure, the second format determination submodule includes a difference determination unit and a second format determination unit.

[0095] The difference determination unit is used to determine the environment difference based on the first application environment and the second application environment, wherein the environment difference includes service dependency difference, user authority difference, and configuration parameter difference.

[0096] The second format determining unit is used to determine the second data format based on the first data format and the environment difference.

[0097] According to an embodiment of the present disclosure, the script generation submodule includes a connection string generation unit and a script generation unit.

[0098] The connection string generating unit is used to determine a database connection string corresponding to the second database based on the second data format.

[0099] The script generation unit is used to determine the storage script based on the database connection string and the target data.

[0100] According to an embodiment of the present disclosure, the data verification module 440 includes a format conversion submodule, a data comparison submodule and a verification success submodule.

[0101] The format conversion submodule is used to convert the target data in the second database into data in the first data format.

[0102] The data comparison submodule is used to compare the data in the first data format with the target data stored in the first database to obtain a comparison result.

[0103] The verification success submodule is used to indicate that the target data in the second database is correct when the comparison result indicates that the data in the first data format is the same as the target data stored in the first database.

[0104] According to an embodiment of the present disclosure, the data synchronization device 400 further includes a first environment switching module and a data transfer module.

[0105] The first environment switching module is used to switch the second database to the first application environment when a failure occurs in the first database.

[0106] The data transfer module is used to store data in the first database in response to the user account storing the data in the second database switched to the first application environment.

[0107] According to an embodiment of the present disclosure, the data synchronization device 400 further includes a data synchronization module, a second environment switching module and a data storage module.

[0108] The data synchronization module is used to synchronize data on the first database based on the second database switched to the first application environment when the first database fails to repair itself.

[0109] The second environment switching module is used to switch the second database to the second application environment.

[0110] The data storage module is used to store data in the first database in response to the user account storing the data in the first database.

[0111] According to an embodiment of the present disclosure, any multiple modules of the script generation module 410, the account authorization module 420, the script execution module 430, the data verification module 440 and the permission recovery module 450 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the script generation module 410, the account authorization module 420, the script execution module 430, the data verification module 440 and the permission recovery module 450 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in an appropriate combination of any of them. Alternatively, at least one of the script generation module 410, the account authorization module 420, the script execution module 430, the data verification module 440 and the permission recovery module 450 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.

[0112] Figure 5 A block diagram of an electronic device suitable for implementing a data synchronization method according to an embodiment of the present disclosure is schematically shown.

[0113] like Figure 5 As shown, the electronic device 500 according to an embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 to a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0114] In RAM 503, various programs and data required for the operation of electronic device 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.

[0115] According to an embodiment of the present disclosure, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The electronic device 500 may further include one or more of the following components connected to the input / output (I / O) interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage portion 508 as needed.

[0116] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0117] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.

[0118] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiment of the present disclosure.

[0119] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 501. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0120] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 509, and / or installed from the removable medium 511. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0121] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.

[0122] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).

[0123] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0124] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.

[0125] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A data synchronization method, characterized in that: The method comprises: In response to a user account storing target data in a first database, determining a storage script for storing the target data in a second database, wherein the first database and the second database have different application environments, and the storage script is determined based on the target data, a first application environment of the first database, and a second application environment of the second database; Granting a first operation permission to the user account, wherein the first operation permission is used to operate the second database; Controlling the user account to execute the stored script on the second database using the first operation authority, and storing the target data in the second database; Switching the second database to the first application environment, and verifying the correctness of the target data in the second database; and When the target data in the second database is correct, the first operation authority of the user account is revoked and the changes to the second database are saved.

2. The method according to claim 1, characterized in that In response to the user account storing the target data in the first database, determining a storage script for storing the target data in the second database includes: In response to the user account storing target data in the first database, determining a first data format of the target data in the first application environment; determining a second data format of the target data in the second application environment based on the first data format and an environment difference between the first application environment and the second application environment; and The storage script is determined based on the second data format and the target data.

3. The method according to claim 2, characterized in that The determining, based on the first data format and the environment difference between the first application environment and the second application environment, the second data format of the target data in the second application environment includes: Determining the environment differences based on the first application environment and the second application environment, wherein the environment differences include service dependency differences, user authority differences, and configuration parameter differences; and Based on the first data format and the environmental difference, the second data format is determined.

4. The method according to claim 2, characterized in that: The step of determining the storage script based on the second data format and the target data includes: Based on the second data format, determining a database connection string corresponding to the second database; and The stored script is determined based on the database connection string and the target data.

5. The method according to claim 2, characterized in that: The step of switching the second database to the first application environment and verifying the correctness of the target data in the second database includes: converting the target data in the second database into data in the first data format; Comparing the data in the first data format with the target data stored in the first database to obtain a comparison result; and When the comparison result indicates that the data in the first data format is identical to the target data stored in the first database, the comparison result indicates that the target data in the second database is correct.

6. The method according to claim 1, characterized in that The method further comprises: In the event that the first database fails, switching the second database to the first application environment; and In response to the user account storing data in the first database, the data is stored in the second database switched to the first application environment.

7. The method according to claim 6, characterized in that The method further comprises: In case of a fault repair of the first database, synchronizing data of the first database based on the second database switched to the first application environment; switching the second database to the second application environment; and In response to the user account storing data in the first database, the data is stored in the first database.

8. A data synchronization device, characterized in that: The device comprises: a script generation module, configured to determine, in response to a user account storing target data in a first database, a storage script for storing the target data in a second database, wherein the first database and the second database have different application environments, and the storage script is determined based on the target data, a first application environment of the first database, and a second application environment of the second database; An account authorization module, used to grant a first operation permission to the user account, wherein the first operation permission is used to operate the second database; A script execution module, used to control the user account to execute the stored script on the second database using the first operation permission, and store the target data in the second database; a data verification module, configured to switch the second database to the first application environment and verify the correctness of the target data in the second database; and The permission recovery module is used to recover the first operation permission of the user account and save the changes to the second database when the target data in the second database is correct.

9. An electronic device, comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.