Database switching method, system and equipment based on multiple guarantees and medium
By performing logical rewrite and asynchronous execution performance verification on historical SQL data, combined with pilot traffic and incremental parallel development, the security and stability problems in the database switching process are solved, and efficient data synchronization and switching in the financial and medical fields are achieved.
Patent Information
- Application Number
- CN202510651741.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-20
- Publication Date
- 2025-08-12
AI Technical Summary
The financial and medical fields face technical challenges such as data consistency, performance verification, privacy protection and multi-source data integration during database switching. The existing technology solutions are at high risk and have low security guarantees.
Provide a database switching method based on multiple guarantees, which ensures the security and stability of database environment switching by obtaining historical SQL data, asynchronously performing performance verification, pilot traffic verification, incremental parallel development and second-level rollback guarantee.
It improves security guarantees during the switching process of database environment, ensures the logic of the old and new database scripts, optimizes the performance verification process, reduces operation and maintenance costs, and ensures data integrity and business continuity.
Smart Images

Figure CN120470061A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data synchronization technology, and in particular to a database switching method, system, device and medium based on multiple guarantees. Background Art
[0002] With the deepening of enterprise digital transformation and the promotion of domestic substitution policies, migrating core business systems from Oracle Database (hereinafter referred to as "Oracle") to independently controllable databases (such as open source databases and domestic distributed databases) has become an important demand in the fields of financial technology, government affairs, energy, etc. As a representative of traditional commercial databases, Oracle has powerful transaction processing capabilities, but it has problems such as high licensing costs, closed architecture, and insufficient scalability. It is difficult to adapt to the high concurrency and elastic expansion business needs of the Internet era.
[0003] In the financial industry, database migration and data processing technologies face numerous challenges. Traditional financial systems rely heavily on commercial databases such as Oracle. While stable, these databases are subject to high licensing fees and limited scalability. For example, Lufax launched a "de-O" project to reduce costs and improve system flexibility, migrating its systems from Oracle to open-source databases such as MySQL. However, the migration process presented challenges with data consistency, performance verification, and system stability. Furthermore, financial institutions also need to ensure data integrity and business continuity when migrating databases, placing higher demands on the technical solution.
[0004] In the medical industry, data synchronization and processing technologies are also inadequate. Medical data is highly sensitive and private, and data accuracy and security are crucial. For example, in disease prediction and diagnosis, large amounts of patient medical records, genetic data, and imaging data need to be synchronized and processed in real time, but existing technologies still need to improve the real-time and accuracy of data synchronization. In addition, the multimodal nature of medical data (such as the combination of imaging data and clinical information) increases the complexity of data processing, and existing data processing technologies have difficulties in integrating these multi-source data. At the same time, the medical industry has strict data privacy protection regulations, and how to achieve efficient data processing and synchronization while meeting privacy requirements is a problem that needs to be solved urgently.
[0005] In summary, database migration and data processing in both the financial and healthcare sectors face technical challenges such as data consistency, performance verification, privacy protection, and multi-source data integration. During the database migration process, urgent technical challenges arise, such as ensuring logical consistency between the old and new database scripts, verifying the performance of the new database without impacting online business, and responding to unexpected failures and ensuring rapid rollback. Summary of the Invention
[0006] The present invention provides an artificial intelligence-based database switching method, system, computer equipment and medium based on multiple guarantees to solve the problems of high risk and low security of existing database switching solutions.
[0007] In a first aspect, a database switching method based on multiple guarantees is provided, comprising:
[0008] Obtain historical SQL data from a preset business database, perform logical replication on the historical SQL data, and obtain replicated SQL data;
[0009] Based on asynchronous execution, SQL performance verification is performed according to the historical SQL data and the replicated SQL data to obtain a performance verification result;
[0010] If the performance verification result is that the SQL performance verification fails, a repair instruction is sent to the preset developer user terminal;
[0011] If the performance verification result is that the SQL performance verification is passed, the replicated SQL data is deployed to a preset new environment for pilot traffic verification to obtain a pilot verification result;
[0012] If the pilot verification result is that the pilot traffic verification has failed, returning to the step of sending a repair instruction to the preset developer user terminal;
[0013] If the pilot verification result is that it passes the pilot traffic verification, the database environment is switched based on incremental parallel development and second-level rollback guarantee.
[0014] In a second aspect, a database switching system based on multiple guarantees is provided, including:
[0015] A script replication module is used to obtain historical SQL data from a preset business database, perform logical replication on the historical SQL data, and obtain replicated SQL data;
[0016] A performance verification module is used to perform SQL performance verification based on the historical SQL data and the replicated SQL data based on asynchronous execution to obtain a performance verification result;
[0017] A pilot verification module is used to determine whether the performance verification result is failed. If the performance verification result is failed, a repair instruction is sent to a preset developer user terminal. If the performance verification result is passed, the replicated SQL data is deployed to a preset new environment for pilot traffic verification to obtain a pilot verification result.
[0018] The environment switching module is used to determine whether the pilot verification result fails the pilot traffic verification. If the pilot verification result fails the pilot traffic verification, the module returns to the pilot verification module and performs the step of sending a repair instruction to the preset developer user terminal. If the pilot verification result passes the pilot traffic verification, the database environment is switched based on incremental parallel development and second-level rollback guarantee.
[0019] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned database switching method based on multiple guarantees are implemented.
[0020] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned database switching method based on multiple guarantees are implemented.
[0021] In the solution implemented by the above-mentioned database switching method, system, computer device and storage medium based on multiple guarantees, historical SQL data in a preset business database can be obtained, and the historical SQL data can be logically replicated to obtain replicated SQL data. Based on asynchronous execution, SQL performance verification is performed based on the historical SQL data and the replicated SQL data to obtain a performance verification result. If the performance verification result fails the SQL performance verification, a repair instruction is sent to a preset developer user terminal. If the performance verification result passes the SQL performance verification, the replicated SQL data is deployed to a preset new environment for pilot traffic verification to obtain a pilot verification result. If the pilot verification result fails the pilot traffic verification, the step of sending a repair instruction to the preset developer user terminal is returned. If the pilot verification result passes the pilot traffic verification, the database environment is switched based on incremental parallel development and second-level rollback guarantees. This improves security during the database environment switching process. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0023] Figure 1 This is a schematic diagram of an application environment of a database switching method based on multiple guarantees in one embodiment of the present invention;
[0024] Figure 2This is a flowchart of a database switching method based on multiple guarantees in one embodiment of the present invention;
[0025] Figure 3 1 is a schematic structural diagram of a database switching system based on multiple guarantees in one embodiment of the present invention;
[0026] Figure 4 is a structural diagram of a computer device in one embodiment of the present invention;
[0027] Figure 5 FIG. 2 is another structural diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0029] The database switching method based on multiple guarantees provided by the embodiment of the present invention can be applied in the following situations: Figure 1 In an application environment, the client communicates with the server through a network. The server can obtain historical SQL data in a preset business database through the client, perform logical replication on the historical SQL data, obtain replicated SQL data, perform SQL performance verification based on the historical SQL data and the replicated SQL data based on asynchronous execution, obtain a performance verification result, and if the performance verification result is that the SQL performance verification fails, a repair instruction is sent to the preset developer user end. If the performance verification result is that the SQL performance verification passes, the replicated SQL data is deployed to a preset new environment for pilot traffic verification to obtain a pilot verification result. If the pilot verification result is that the pilot traffic verification fails, the step of sending a repair instruction to the preset developer user end is returned. If the pilot verification result is that the pilot traffic verification passes, the database environment is switched based on incremental parallel development and second-level rollback guarantee, thereby improving the security guarantee of database environment switching. The client can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server can be implemented with an independent server or a server cluster consisting of multiple servers. The present invention is described in detail below through specific embodiments.
[0030] See also Figure 2 As shown, Figure 2A flowchart of a database switching method based on multiple guarantees provided in an embodiment of the present invention includes the following steps:
[0031] S1. Obtain historical SQL data from a preset business database, perform logical replication on the historical SQL data, and obtain replicated SQL data.
[0032] In the embodiment of the present invention, obtaining historical SQL data in a preset business database refers to obtaining business-related SQL scripts (such as query, insert, update, store, etc. scripts) in an old Oracle database.
[0033] In the embodiment of the present invention, the logical replication of the historical SQL data refers to rewriting all SQL scripts in the application that operate the Oracle database according to the syntax rules of the UbiSQL database, for example, converting Oracle's unique ROWNUM pseudo-column paging (such as SELECT * FROM TABLE WHERE ROWNUM <= 10) into the standard LIMIT syntax supported by UbiSQL (such as SELECT * FROM TABLE LIMIT 10).
[0034] In the embodiment of the present invention, by performing logical replication on the historical SQL data, the syntax differences between Oracle and UbiSQL (such as the paging syntax ROWNUM→LIMIT, data type conversion, etc.) can be resolved, ensuring that the new script can be correctly executed in UbiSQL.
[0035] In the embodiment of the present invention, the Oracle database is a relational database management system and is one of the most popular database systems in the world.
[0036] In the embodiment of the present invention, the UbiSQL database is a distributed database product built within the Ping An Group. It has the characteristics of high security and is mainly used in the core business systems of the financial industry. In the field of financial technology, the database created by financial technology companies can better protect data security.
[0037] In detail, the historical SQL data refers to the Oracle script of the Oracle database.
[0038] In detail, the replicated SQL data refers to the UbiSQL script of the UbiSQL database.
[0039] In an embodiment of the present invention, after logically rewriting the historical SQL data to obtain the replicated SQL data, it is necessary to transform the persistence layer framework, connect the main thread to the preset original environment, and preset the asynchronous thread to the new environment.
[0040] In detail, the preset original environment may refer to an Oracle database environment, and the preset new environment may refer to a UbiSQL database environment.
[0041] In the embodiment of the present invention, by acquiring historical SQL data from a preset business database and performing logical replication on the historical SQL data to obtain replicated SQL data, the efficiency of subsequent SQL performance verification can be improved.
[0042] In the healthcare sector, logical replication technology is primarily used for the synchronization and processing of medical data, particularly in the areas of disease prediction and diagnosis. For example, when analyzing massive amounts of medical data using deep learning algorithms, logical replication technology can be used to optimize data processing and improve data synchronization efficiency. Furthermore, the application of medical AI technology in new drug development and intelligent diagnosis and treatment also relies on logical replication technology to ensure data accuracy and real-time performance.
[0043] In the fintech sector, logical replication technology plays a vital role in database upgrades for core financial systems. For example, after upgrading their core life insurance system to OceanBase, an insurance institution was able to optimize complex SQL statements using logical replication, successfully addressing the challenges of high concurrency and large data volumes. This not only improved system performance but also reduced operation and maintenance costs.
[0044] S2. Based on asynchronous execution, SQL performance verification is performed according to the historical SQL data and the replicated SQL data to obtain a verification result.
[0045] In an embodiment of the present invention, the SQL performance verification is performed based on the historical SQL data and the replicated SQL data based on asynchronous execution. The historical SQL data is executed by a main thread, and the replicated SQL data is executed by an asynchronous thread. The correctness, integrity and performance of the replicated SQL data are verified based on the execution results, which can expose potential problems in advance.
[0046] In the embodiment of the present invention, the SQL performance verification is performed based on the asynchronous execution and the historical SQL data and the replicated SQL data to obtain the verification result, including:
[0047] Execute the historical SQL data based on the main thread to obtain main thread execution data;
[0048] Execute the replicated SQL data based on an asynchronous thread to obtain asynchronous execution data;
[0049] Generate a missing script list according to the main thread execution data and the asynchronous execution data;
[0050] Calculate the execution script coverage rate according to the asynchronous execution data;
[0051] Perform script exception monitoring based on the asynchronous execution data to obtain an exception monitoring result;
[0052] Performing a script logic consistency comparison based on the main thread execution data and the asynchronous execution data to obtain a consistency comparison result;
[0053] Summarize the missing script list, the script coverage, the abnormality monitoring results, and the consistency comparison results to obtain script verification data;
[0054] Perform load verification on the preset UbiSQL database based on asynchronous threads to obtain load verification data;
[0055] A verification result is determined based on the script verification data and the load verification data.
[0056] In detail, generating a missing script list according to the main thread execution data and the asynchronous execution data includes:
[0057] Obtaining the execution script ID in the historical SQL data according to the main thread execution data to obtain the historical script ID;
[0058] Obtaining the execution script ID in the replication SQL data according to the main thread execution data to obtain the replication script ID;
[0059] Obtain a missing script marker by comparing the historical script ID with the duplicate script ID marker;
[0060] A missing script list is generated based on the missing script tags.
[0061] Specifically, the execution script ID uniquely identifies and distinguishes each execution script. Obtaining the execution script IDs for both historical SQL data and replicated SQL data allows for precise location of each script. By comparing these two IDs, it's possible to determine which scripts were omitted during the replication process, providing a basis for subsequent repairs.
[0062] In an embodiment of the present invention, calculating the execution script coverage rate based on the asynchronous execution data refers to confirming the sum and number of executed scripts and the total number of scripts in the replicated SQL data based on the asynchronous execution data, and calculating the ratio of the sum and number of executed scripts to the total number of scripts to obtain the script coverage rate.
[0063] In an embodiment of the present invention, performing script exception monitoring based on the asynchronous execution data to obtain an exception monitoring result refers to capturing exceptions returned by the asynchronous execution data (such as syntax errors, missing indexes, and data type mismatches), recording the abnormal SQL and stack information to obtain the exception monitoring result. The stack information is a data structure used to store information such as function call relationships and local variables during program runtime. When capturing exceptions returned by asynchronous execution data, recording the stack information can provide a detailed overview of the program's execution status at the time the exception occurred, including the function in which the exception occurred, the function call level, and the values of related variables at the time, helping developers quickly locate and resolve problems.
[0064] In the embodiment of the present invention, performing script logic consistency comparison based on the main thread execution data and the asynchronous execution data refers to obtaining whether the execution results of the main thread execution data and the asynchronous execution data for the same business are consistent.
[0065] Specifically, performing a script logic consistency comparison based on the main thread execution data and the asynchronous execution data to obtain a consistency comparison result includes:
[0066] Obtaining the execution result of the preset query request in the main thread execution data to obtain the main thread execution result;
[0067] Obtaining the execution result of the preset query request in the asynchronous execution data to obtain the asynchronous execution result;
[0068] Comparing the field values of the main thread execution result and the asynchronous execution result in sequence based on a hash algorithm to obtain an initial comparison result;
[0069] If the initial comparison result shows that the main thread execution result and the asynchronous execution result have different field values, then confirming that the consistency comparison result is inconsistent;
[0070] If it is determined according to the initial comparison result that the main thread execution result and the asynchronous execution result have the same field value, then the consistency comparison result is confirmed to be consistent.
[0071] In the embodiment of the present invention, the asynchronous thread-based load verification of the preset UbiSQL database to obtain load verification data includes:
[0072] Connecting the preset production environment user request to the UbiSQL database through an asynchronous thread;
[0073] Using a preset database monitoring tool to monitor the performance parameters of the UbiSQL database when executing the production environment user;
[0074] Identifying SQL scripts that have an impact on the performance of the UbiSQL database based on the performance parameters, and obtaining performance-related SQL data;
[0075] The performance parameters and the performance-related SQL data are aggregated to obtain load verification data.
[0076] In an embodiment of the present invention, the verification result is determined based on the script verification data and the load verification data. This means judging whether there are any missing scripts, any abnormal scripts, and whether the consistency of the replicated SQL data is up to standard when it is executed based on the script verification data. And judging whether the performance parameters of the UbiSQL database meet the standards when simulating the complexity of real business based on the load verification data. If there are no missing scripts and abnormal scripts when the replicated SQL data is executed, the execution results of the replicated SQL data are completely consistent with those of the historical SQL data, and the performance parameters of the UbiSQL database meet the standards when simulating the complexity of real business, then the performance verification result is confirmed to have passed the SQL performance verification, otherwise the performance verification result is confirmed to have failed the SQL performance verification.
[0077] In an embodiment of the present invention, the SQL script that has an impact on the performance of the UbiSQL database is identified based on the performance parameters to obtain performance-related SQL data. The performance parameters can be monitored in real time. When the performance parameters fluctuate significantly, the corresponding execution script is identified, and it is confirmed that the execution script is an SQL script that has an impact on the performance of the UbiSQL database. Targeted optimization can be performed subsequently based on the performance-related SQL data.
[0078] S3. Determine whether the verification result passes the SQL performance verification.
[0079] If the performance verification result is that the SQL performance verification has not been passed, S4 is executed to send a repair instruction to the preset developer user terminal.
[0080] In an embodiment of the present invention, when the performance verification result is that the SQL performance verification fails, it indicates that the replicated SQL data has errors or needs to be optimized. Therefore, a repair instruction needs to be sent to the preset developer user terminal to repair or optimize the replicated SQL data.
[0081] In this embodiment of the present invention, the repair instructions include information about issues discovered during the verification process, such as a list of missing scripts, details of abnormal scripts, descriptions of consistency issues, and performance bottlenecks. Based on this information, the developer user can repair and optimize the replicated SQL data to ensure that it meets business requirements and performance standards.
[0082] In the field of fintech, the development team's code management system is the core technical architecture supporting the iteration of fintech products. In complex scenarios such as core financial system development, high-frequency trading platform maintenance, and intelligent risk control model iteration, developers use a developer client that integrates version control, conflict detection, and code compliance verification to achieve collaborative management of multi-module code within a distributed architecture. For example, when a leading internet bank was restructuring its intelligent credit approval system, the development team relied on a proprietary client platform to support 100+ developers in parallel development of over 2,000 code modules within a microservices architecture. Through a real-time code replication and verification mechanism, the rate of interface conflicts between modules was reduced, code merging efficiency was improved, and the launch cycle of fintech products was significantly shortened.
[0083] In the healthcare sector, the management of outsourced development teams in medical institutions faces the dual challenges of data security and system compatibility. In scenarios such as electronic medical record system upgrades, the development of medical AI-assisted diagnostic models, and the integration of regional medical information platforms, outsourced development teams achieve secure and controllable management of medical software code through developer client systems that comply with HIPAA (the U.S. Health Insurance Portability and Accountability Act) and GB / T 35273 (Information Security Technology Personal Information Security Specification). For example, when building a regional medical alliance information sharing platform, a tertiary hospital introduced a client system with data desensitization and operation log traceability capabilities, supporting the collaborative development of core code involving 3 million patient data by 80 developers from five outsourced teams. By establishing a fine-grained permission control mechanism, code development efficiency is guaranteed while reducing the risk of data leakage.
[0084] In the healthcare field, medical institutions usually outsource development teams, and each developer in the development team can upload and modify the code through the developer user terminal.
[0085] If the performance verification result is that the SQL performance verification is passed, S5 is executed to deploy the replicated SQL data to a preset new environment for pilot traffic verification to obtain a pilot verification result.
[0086] In the embodiment of the present invention, deploying the replicated SQL data to a pre-set new environment for pilot traffic verification and obtaining a pilot verification result refers to deploying the replicated SQL data to the new environment, which is configured with a designated master read-write UbiSQL. A portion of users (e.g., 10%) are switched to this environment to handle designated business processes. If there are no issues, all traffic is gradually switched to this environment to ensure stable production.
[0087] In the embodiment of the present invention, the preset new environment may refer to a UbiSQL database environment.
[0088] In the embodiment of the present invention, the step of deploying the replicated SQL data into a preset new environment for pilot traffic verification to obtain a pilot verification result includes:
[0089] Selecting a preset proportion of users to process a preset business process according to the replicated SQL data in the preset new environment to obtain response data;
[0090] Obtaining incremental business data in the preset new environment and modifying business data;
[0091] Perform Oracle data synchronization based on the business data and modified business data to obtain synchronized data;
[0092] Determining, based on the response data, whether the processing capability of the replicated SQL data for the business process in the new environment meets the preset performance requirements;
[0093] If the performance requirements are met, confirm whether the pilot verification result has passed the pilot flow verification;
[0094] If it does not meet the requirements, it is confirmed whether the pilot verification result is that it has failed the pilot flow, and the preset proportion of users are switched back to the preset original environment according to the synchronization data.
[0095] In detail, the preset original environment may refer to an Oracle database environment.
[0096] In detail, the preset business process may refer to a query business.
[0097] In an embodiment of the present invention, the response data packet contains data such as functional correctness, response time, error rate, etc. When these data all meet the preset thresholds, the pilot verification result is confirmed to have passed the pilot traffic verification; otherwise, the pilot verification result is confirmed to have failed the pilot traffic verification.
[0098] S6. Determine whether the pilot verification result passes the pilot traffic verification.
[0099] If the pilot verification result is that the pilot traffic verification has not been passed, the process returns to S4 and sends a repair instruction to the preset developer user terminal.
[0100] If the pilot verification result is that the pilot traffic verification is passed, S7 is executed to switch the database environment based on incremental parallel development and second-level rollback guarantee.
[0101] In an embodiment of the present invention, the database environment switching based on incremental parallel development and second-level rollback guarantee includes:
[0102] Running the preset original environment and the preset new environment in parallel, and expanding the business scenario of the preset new environment;
[0103] In the newly added business scenario, multiple rounds of stress testing are performed on the preset new environment according to the replicated SQL data to obtain stress test results;
[0104] Determining whether the preset new environment passes the multiple rounds of stress testing in the newly added business scenario based on the stress test results;
[0105] If the multiple rounds of stress testing fail, the main thread rated data source is switched to the preset original environment;
[0106] If the multiple rounds of stress testing are passed, the data source configuration of the preset original environment is removed, the preset new environment is run on a single track, and the operating status data of the preset new environment during the single track operation is obtained in real time.
[0107] Specifically, multiple rounds of stress testing involve running multiple stress tests on a pre-defined new environment in newly added business scenarios, simulating varying levels of business load, such as high concurrent requests and large data processing volumes. After each test, the stress test results are collected and analyzed to assess the performance, stability, and reliability of the new environment under varying loads.
[0108] Specifically, the stress test results include database performance metrics (such as response time, throughput, and error rate), system resource usage (CPU, memory, disk I / O, and other resource utilization), and any anomalies (such as system crashes and data loss). These results are used to determine whether the new environment can withstand the pressure of real-world business scenarios and meet business requirements.
[0109] In the embodiment of the present invention, by performing database environment switching based on incremental parallel development and second-level rollback guarantee, the security during database environment switching can be improved.
[0110] In the fintech sector, business databases carry vast amounts of core information, including transaction flows, user assets, and risk control data. The continuity and integrity of this data are crucial to the operational security and customer trust of financial institutions. For example, one bank processed over 20 million transactions, accumulating petabytes of customer asset data in its database. During the upgrade from a traditional centralized to a distributed database architecture, they adopted an active-active environment switching solution. By deploying dual data centers in the same city and a remote disaster recovery center, they established a three-tier disaster recovery system. If the newly deployed distributed database environment experiences downtime due to a sudden network failure or code vulnerability, the intelligent monitoring system detects the anomaly within 30 seconds and triggers an automatic failover mechanism, seamlessly migrating business traffic to the legacy environment. This ensures the stability and continuity of financial services.
[0111] In the healthcare sector, medical institutions' business databases store critical medical data, including patient electronic medical records, medical images, and test reports. This data is crucial not only for the accuracy of clinical diagnosis and treatment but also for patient privacy and well-being. For example, a large medical group, comprising 15 hospitals, stores the lifecycle health data of over 5 million patients in its business databases. During the cloud migration of medical information systems, a strategy for tiered storage of hot and cold data and dynamic environment switching was established. The new cloud database environment processes real-time medical data, while the legacy environment serves as a backup and emergency response environment. If the new cloud environment experiences performance bottlenecks or system crashes due to data overload, the intelligent operations and maintenance platform can complete the switchover to the legacy environment within one minute, based on preset thresholds (e.g., response time exceeding 500ms or system resource utilization exceeding 90%). This ensures uninterrupted medical care for inpatients while ensuring the security of their sensitive medical information.
[0112] In the embodiment of the present invention, by innovatively integrating multiple data sources into the application, an asynchronous execution stage is added before switching to the new database, and at the same time, combined with self-developed assurance tools (for performance verification), detection and monitoring are carried out in the entire de-O process. After the improvement, not only can the occurrence of anomalies such as missing scripts, syntax errors, and uncovered scripts be prevented in advance, but also the new database can be executed asynchronously without affecting the normal online functions to ensure the performance of the new database; at the same time, by transforming the persistence layer, the application can switch data sources in seconds, which can easily solve online emergencies and reduce business risks. Compared with the traditional de-O solution, it is compatible and optimized: it reduces the risk of traditional one-time switching of databases, and at the same time has no special requirements for system data, providing a new solution option for lighter-weight solutions to de-O in the core system.
[0113] As can be seen, in the above solution, historical SQL data from the Oracle database is obtained and logically replicated according to the UbiSQL database's syntax rules to resolve syntax discrepancies and generate replicated SQL data. Next, using asynchronous execution, the historical SQL data is executed in the main thread, while the replicated SQL data is executed in an asynchronous thread. The replicated SQL data is then verified for correctness, completeness, and performance. Verification includes generating a list of missing scripts, calculating script coverage, monitoring script anomalies, comparing script logical consistency, and performing load validation on the UbiSQL database. These results are used to determine whether the SQL performance validation has been passed. If the validation fails, remediation instructions are sent to the developer user end. If the validation passes, the replicated SQL data is deployed in a new UbiSQL database environment for pilot traffic validation. A select number of users are selected to process business processes in the new environment. Based on the response data, the replicated SQL data's ability to handle the business processes meets performance requirements. The incremental and modified business data in the new environment is then synchronized to the Oracle database. If the pilot validation fails, the process returns to the step where the remediation instructions were sent. If it passes, the new environment is run in parallel, business scenarios are expanded, and multiple rounds of stress testing are performed in the newly added scenarios. Based on the stress test results, if it fails, the system switches back to the original environment. If it passes, the original environment data source configuration is removed, the new environment is run on a single track, and its operating status data is obtained in real time, thereby ensuring the stability and reliability of the database switching process and reducing business risks.
[0114] It should be understood that the order of execution of the steps in the above embodiments does not necessarily mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0115] In one embodiment, a database switching system based on multiple guarantees is provided, and the database switching system based on multiple guarantees corresponds one-to-one to the database switching method based on multiple guarantees in the above embodiment. Figure 3 As shown, the database switching system based on multiple guarantees includes a script replication module 101, a performance verification module 102, a pilot verification module 103, and an environment switching module 104. The functional modules are described in detail as follows:
[0116] The script replication module 101 is used to obtain historical SQL data in a preset business database, perform logical replication on the historical SQL data, and obtain replicated SQL data;
[0117] A performance verification module 102 is configured to perform SQL performance verification based on the historical SQL data and the replicated SQL data based on asynchronous execution to obtain a performance verification result;
[0118] The pilot verification module 103 is configured to determine whether the performance verification result is failed. If the performance verification result is failed, a repair instruction is sent to a preset developer user terminal. If the performance verification result is passed, the replicated SQL data is deployed to a preset new environment for pilot traffic verification to obtain a pilot verification result.
[0119] The environment switching module 104 is used to determine whether the pilot verification result is that the pilot traffic verification has failed. If the pilot verification result is that the pilot traffic verification has failed, the module returns to the step of sending a repair instruction to the preset developer user terminal. If the pilot verification result is that the pilot traffic verification has passed, the database environment is switched based on incremental parallel development and second-level rollback guarantee.
[0120] In one embodiment, when executing the asynchronous execution based on the SQL performance verification according to the historical SQL data and the replicated SQL data and obtaining the verification result, the script replication module 101 is specifically configured to:
[0121] Execute the historical SQL data based on the main thread to obtain main thread execution data;
[0122] Execute the replicated SQL data based on an asynchronous thread to obtain asynchronous execution data;
[0123] Generate a missing script list according to the main thread execution data and the asynchronous execution data;
[0124] Calculate the execution script coverage rate according to the asynchronous execution data;
[0125] Perform script exception monitoring based on the asynchronous execution data to obtain an exception monitoring result;
[0126] Performing a script logic consistency comparison based on the main thread execution data and the asynchronous execution data to obtain a consistency comparison result;
[0127] Summarize the missing script list, the script coverage, the abnormality monitoring results, and the consistency comparison results to obtain script verification data;
[0128] Perform load verification on the preset UbiSQL database based on asynchronous threads to obtain load verification data;
[0129] A verification result is determined based on the script verification data and the load verification data.
[0130] In one embodiment, when generating the missing script list according to the main thread execution data and the asynchronous execution data, the performance verification module 102 is specifically configured to:
[0131] Obtaining the execution script ID in the historical SQL data according to the main thread execution data to obtain the historical script ID;
[0132] Obtaining the execution script ID in the replication SQL data according to the main thread execution data to obtain the replication script ID;
[0133] Obtain a missing script marker by comparing the historical script ID with the duplicate script ID marker;
[0134] A missing script list is generated based on the missing script tags.
[0135] In one embodiment, when the performance verification module 102 performs the script logic consistency comparison based on the main thread execution data and the asynchronous execution data to obtain the consistency comparison result, it is specifically configured to:
[0136] Obtaining the execution result of the preset query request in the main thread execution data to obtain the main thread execution result;
[0137] Obtaining the execution result of the preset query request in the asynchronous execution data to obtain the asynchronous execution result;
[0138] Comparing the field values of the main thread execution result and the asynchronous execution result in sequence based on a hash algorithm to obtain an initial comparison result;
[0139] If the initial comparison result shows that the main thread execution result and the asynchronous execution result have different field values, then confirming that the consistency comparison result is inconsistent;
[0140] If it is determined according to the initial comparison result that the main thread execution result and the asynchronous execution result have the same field value, then the consistency comparison result is confirmed to be consistent.
[0141] In one embodiment, when the performance verification module 102 performs the load verification on the preset UbiSQL database based on the asynchronous thread and obtains the load verification data, it is specifically used to:
[0142] Connecting the preset production environment user request to the UbiSQL database through an asynchronous thread;
[0143] Using a preset database monitoring tool to monitor the performance parameters of the UbiSQL database when executing the production environment user;
[0144] Identifying SQL scripts that have an impact on the performance of the UbiSQL database based on the performance parameters, and obtaining performance-related SQL data;
[0145] The performance parameters and the performance-related SQL data are aggregated to obtain load verification data.
[0146] In one embodiment, when the pilot verification module 103 executes the pilot traffic verification by deploying the replicated SQL data into a preset new environment and obtains the pilot verification result, it is specifically configured to:
[0147] The unencrypted key is grouped according to a preset byte length to obtain a grouped data set;
[0148] Encrypting each group of data in the grouped data set to obtain an encryption result set;
[0149] All encryption results in the encryption result set are concatenated in sequence to obtain the encryption key.
[0150] In one embodiment, when executing the database environment switch based on incremental parallel development and second-level rollback guarantee, the environment switch module 104 is specifically configured to:
[0151] Running the preset original environment and the preset new environment in parallel, and expanding the business scenario of the preset new environment;
[0152] In the newly added business scenario, multiple rounds of stress testing are performed on the preset new environment according to the replicated SQL data to obtain stress test results;
[0153] Determining whether the preset new environment passes the multiple rounds of stress testing in the newly added business scenario based on the stress test results;
[0154] If the multiple rounds of stress testing fail, the main thread rated data source is switched to the preset original environment;
[0155] If the multiple rounds of stress testing are passed, the data source configuration of the preset original environment is removed, the preset new environment is run on a single track, and the operating status data of the preset new environment during the single track operation is obtained in real time.
[0156] The present invention provides a database switching system based on multiple guarantees, which performs dual status information verification on the user's bank card and ID card, ensures that the user's bank card information and ID card data can be accurately obtained, generates front and back images of the ID card based on the ID card data, and then verifies the key input by the user by downloading a pre-set key and decrypting it, thereby ensuring the reliability of the user's ID card verification. Finally, service access is performed based on the bank card information and the front and back images of the ID card, thereby improving the security of financial transactions.
[0157] For the specific definition of the database switching system based on multiple guarantees, please refer to the definition of the database switching method based on multiple guarantees above, which will not be repeated here. The various modules in the above-mentioned database switching system based on multiple guarantees can be implemented in whole or in part through software, hardware, and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0158] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, it implements the functions or steps on the server side of a database switching method based on multiple guarantees.
[0159] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, memory, network interface, display screen and input system connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server via a network connection. When the computer program is executed by the processor, it implements the functions or steps on the client side of a database switching method based on multiple guarantees.
[0160] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are performed:
[0161] Obtain historical SQL data from a preset business database, perform logical replication on the historical SQL data, and obtain replicated SQL data;
[0162] Based on asynchronous execution, SQL performance verification is performed according to the historical SQL data and the replicated SQL data to obtain a performance verification result;
[0163] If the performance verification result is that the SQL performance verification fails, a repair instruction is sent to the preset developer user terminal;
[0164] If the performance verification result is that the SQL performance verification is passed, the replicated SQL data is deployed to a preset new environment for pilot traffic verification to obtain a pilot verification result;
[0165] If the pilot verification result is that the pilot traffic verification has failed, returning to the step of sending a repair instruction to the preset developer user terminal;
[0166] If the pilot verification result is that it passes the pilot traffic verification, the database environment is switched based on incremental parallel development and second-level rollback guarantee.
[0167] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0168] Obtain historical SQL data from a preset business database, perform logical replication on the historical SQL data, and obtain replicated SQL data;
[0169] Based on asynchronous execution, SQL performance verification is performed according to the historical SQL data and the replicated SQL data to obtain a performance verification result;
[0170] If the performance verification result is that the SQL performance verification fails, a repair instruction is sent to the preset developer user terminal;
[0171] If the performance verification result is that the SQL performance verification is passed, the replicated SQL data is deployed to a preset new environment for pilot traffic verification to obtain a pilot verification result;
[0172] If the pilot verification result is that the pilot traffic verification has failed, returning to the step of sending a repair instruction to the preset developer user terminal;
[0173] If the pilot verification result is that it passes the pilot traffic verification, the database environment is switched based on incremental parallel development and second-level rollback guarantee.
[0174] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can be found in the relevant descriptions of the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0175] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0176] Those skilled in the art will clearly understand that for the sake of convenience and brevity in description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above.
[0177] Finally, it should be noted that if software tools or components other than those of our company appear in the application examples, they are merely for illustration and do not represent actual use. The above-described embodiments are intended only to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above-described embodiments or replace some of the technical features therein with equivalents. Such modifications or replacements do not deviate from the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention and should be included within the scope of protection of the present invention.
Claims
1. A database switching method based on multiple guarantees, characterized in that: include: Obtain historical SQL data from a preset business database, perform logical replication on the historical SQL data, and obtain replicated SQL data; Based on asynchronous execution, SQL performance verification is performed according to the historical SQL data and the replicated SQL data to obtain a performance verification result; If the performance verification result is that the SQL performance verification fails, a repair instruction is sent to the preset developer user terminal; If the performance verification result is that the SQL performance verification is passed, the replicated SQL data is deployed to a preset new environment for pilot traffic verification to obtain a pilot verification result; If the pilot verification result is that the pilot traffic verification has failed, returning to the step of sending a repair instruction to the preset developer user terminal; If the pilot verification result is that it passes the pilot traffic verification, the database environment is switched based on incremental parallel development and second-level rollback guarantee.
2. The database switching method based on multiple guarantees according to claim 1, characterized in that: The asynchronous execution-based SQL performance verification is performed according to the historical SQL data and the replicated SQL data to obtain a verification result, including: Execute the historical SQL data based on the main thread to obtain main thread execution data; Execute the replicated SQL data based on an asynchronous thread to obtain asynchronous execution data; Generate a missing script list according to the main thread execution data and the asynchronous execution data; Calculate the execution script coverage rate according to the asynchronous execution data; Perform script exception monitoring based on the asynchronous execution data to obtain an exception monitoring result; Performing a script logic consistency comparison based on the main thread execution data and the asynchronous execution data to obtain a consistency comparison result; Summarize the missing script list, the script coverage, the abnormality monitoring results, and the consistency comparison results to obtain script verification data; Perform load verification on the preset UbiSQL database based on asynchronous threads to obtain load verification data; A verification result is determined based on the script verification data and the load verification data.
3. The database switching method based on multiple guarantees according to claim 2, characterized in that: The generating of the missing script list according to the main thread execution data and the asynchronous execution data includes: Obtaining the execution script ID in the historical SQL data according to the main thread execution data to obtain the historical script ID; Obtaining the execution script ID in the replication SQL data according to the asynchronous execution data to obtain the replication script ID; Obtain a missing script marker by comparing the historical script ID with the duplicate script ID marker; A missing script list is generated based on the missing script tags.
4. The database switching method based on multiple guarantees according to claim 2, characterized in that: The performing a script logic consistency comparison based on the main thread execution data and the asynchronous execution data to obtain a consistency comparison result includes: Obtaining the execution result of the preset query request in the main thread execution data to obtain the main thread execution result; Obtaining the execution result of the preset query request in the asynchronous execution data to obtain the asynchronous execution result; Comparing the field values of the main thread execution result and the asynchronous execution result in sequence based on a hash algorithm to obtain an initial comparison result; If the initial comparison result shows that the main thread execution result and the asynchronous execution result have different field values, then confirming that the consistency comparison result is inconsistent; If it is determined according to the initial comparison result that the main thread execution result and the asynchronous execution result have the same field value, then the consistency comparison result is confirmed to be consistent.
5. The database switching method based on multiple guarantees according to claim 2, characterized in that: The asynchronous thread-based load verification of the preset UbiSQL database to obtain load verification data includes: Connecting the preset production environment user request to the UbiSQL database through an asynchronous thread; Using a preset database monitoring tool to monitor the performance parameters of the UbiSQL database when executing the production environment user; Identifying SQL scripts that have an impact on the performance of the UbiSQL database based on the performance parameters, and obtaining performance-related SQL data; The performance parameters and the performance-related SQL data are aggregated to obtain load verification data.
6. The database switching method based on multiple guarantees according to claim 1, characterized in that: The replicated SQL data is deployed into a preset new environment for pilot traffic verification, and the pilot verification results are obtained, including: Selecting a preset proportion of users to process a preset business process according to the replicated SQL data in the preset new environment to obtain response data; Obtaining incremental business data in the preset new environment and modifying business data; Perform Oracle data synchronization based on the business data and modified business data to obtain synchronized data; Determining, based on the response data, whether the processing capability of the replicated SQL data for the business process in the new environment meets the preset performance requirements; If the performance requirements are met, confirm whether the pilot verification result has passed the pilot flow verification; If it does not meet the requirements, it is confirmed whether the pilot verification result is that it has failed the pilot flow, and the preset proportion of users are switched back to the preset original environment according to the synchronization data.
7. The database switching method based on multiple guarantees according to claim 1, characterized in that: The database environment switch based on incremental parallel development and second-level rollback guarantee includes: Running the preset original environment and the preset new environment in parallel, and expanding the business scenario of the preset new environment; In the newly added business scenario, multiple rounds of stress testing are performed on the preset new environment according to the replicated SQL data to obtain stress test results; Determining whether the preset new environment passes the multiple rounds of stress testing in the newly added business scenario based on the stress test results; If the multiple rounds of stress testing fail, the main thread rated data source is switched to the preset original environment; If the multiple rounds of stress testing are passed, the data source configuration of the preset original environment is removed, the preset new environment is run on a single track, and the operating status data of the preset new environment during the single track operation is obtained in real time.
8. A database switching system based on multiple guarantees, characterized in that: include: A script replication module is used to obtain historical SQL data from a preset business database, perform logical replication on the historical SQL data, and obtain replicated SQL data; A performance verification module is used to perform SQL performance verification based on the historical SQL data and the replicated SQL data based on asynchronous execution to obtain a performance verification result; A pilot verification module is used to determine whether the performance verification result is failed. If the performance verification result is failed, a repair instruction is sent to a preset developer user terminal. If the performance verification result is passed, the replicated SQL data is deployed to a preset new environment for pilot traffic verification to obtain a pilot verification result. The environment switching module is used to determine whether the pilot verification result fails the pilot traffic verification. If the pilot verification result fails the pilot traffic verification, the module returns to the pilot verification module and performs the step of sending a repair instruction to the preset developer user terminal. If the pilot verification result passes the pilot traffic verification, the database environment is switched based on incremental parallel development and second-level rollback guarantee.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the database switching method based on multiple guarantees according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the database switching method based on multiple guarantees according to any one of claims 1 to 7 are implemented.