Database management method and device and computer equipment

By dynamically controlling the front-end access switch ratio and the state value of the back-end state machine during the data migration process, the user access and database working modes are adjusted, solving the downtime problem caused by data migration in existing technologies and achieving uninterrupted data migration and continuous user access.

CN121807798APending Publication Date: 2026-04-07SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing data migration solutions require downtime during the migration process, leading to prolonged business interruptions and impacting user experience, especially in systems that require continuous service, such as mobile banking systems.

Method used

By controlling the front-end access switch ratio and the back-end state machine state value according to different migration stages during the data migration process, the ratio of user access to the first database and the second database, as well as the working mode, can be dynamically adjusted to achieve data migration without downtime.

Benefits of technology

Achieving stable data migration without downtime ensures users can access the database normally, improving their business experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121807798A_ABST
    Figure CN121807798A_ABST
Patent Text Reader

Abstract

The invention relates to a database management method and device and computer equipment, and the method comprises the steps: determining a data migration stage in a process of carrying out data migration from a first database to a second database; and according to the data migration stage, determining a front-end access switch proportion and a state value of a rear-end state machine. And controlling the proportion of users accessing the first database and the second database and the working modes of the first database and the second database based on the front-end access switch proportion and the state value. According to different data migration stages, the front-end access switch proportion and the state value of the rear-end state machine are determined. According to the method, the proportion of the users accessing the first database and the second database and the working modes of the first database and the second database are controlled based on the front-end access switch proportion and the state value, stable data migration can be achieved under the condition of no shutdown, the users can normally access the databases in the data migration period, and the service experience of the users is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a database management method, apparatus, and computer equipment. Background Technology

[0002] In the field of enterprise information technology, rapid business development often drives the modernization and upgrading of systems. This includes integrating data scattered across multiple heterogeneous systems into a unified platform, or refactoring core functions into service-oriented architectures. In these processes, data migration is an unavoidable and critical step.

[0003] Most existing data migration solutions employ a shutdown migration approach. This approach involves completely halting system services during off-peak hours and then using database tools to export and import data in batches. While the operation is relatively simple, for systems like mobile banking that require continuous customer service, being unable to access the database for several hours leads to prolonged business interruptions and severely impacts user experience. Summary of the Invention

[0004] Therefore, it is necessary to provide a database management method, apparatus, and computer equipment that does not affect user access to the database during the data migration process, in order to address the aforementioned technical problems.

[0005] Firstly, this application provides a database management method. The method includes:

[0006] During the data migration process from the first database to the second database, the data migration stage is determined.

[0007] Based on the data migration phase, determine the front-end access switch ratio and the state values ​​of the back-end state machine;

[0008] Based on the front-end access switch ratio and status value, the proportion of users accessing the first database and the second database, as well as the working modes of the first database and the second database, are controlled.

[0009] In one embodiment, determining the front-end access switch ratio and the back-end state machine state values ​​based on the data migration phase includes:

[0010] When the data migration phase consists of the pre-migration preparation phase and the existing historical data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the second value.

[0011] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0012] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio; wherein, the first ratio represents that users are allowed to access the first database.

[0013] When the state value of the backend state machine is the second value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to prohibit read and write.

[0014] In one embodiment, determining the front-end access switch ratio and the back-end state machine state values ​​based on the data migration phase includes:

[0015] When the data migration phase is an incremental data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the third value.

[0016] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0017] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0018] When the state value of the backend state machine is the third value, the working mode of the first database is controlled to be read-only mode, and the working mode of the second database is controlled to be read-and-write prohibited mode.

[0019] In one embodiment, determining the front-end access switch ratio and the back-end state machine state values ​​based on the data migration phase includes:

[0020] When the data migration phase is the incremental data migration completion phase, the front-end access switch ratio is determined to be the first value and the state value of the back-end state machine is determined to be the fourth value.

[0021] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0022] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0023] When the state value of the backend state machine is the fourth value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to be write-only.

[0024] In one embodiment, the method further includes:

[0025] In the case where the incremental data migration phase is completed, obtain the first data displayed when the user accesses the first database based on the access request.

[0026] Based on the access request, retrieve the second data from the second database;

[0027] Based on the first and second data, determine the data consistency.

[0028] Based on the data consistency, the stability of the second database is determined.

[0029] In one embodiment, the method further includes;

[0030] If the system is stable, the data migration phase is considered the stable phase.

[0031] Based on the data migration phase, determine the front-end access switch ratio and the back-end state machine state values, including:

[0032] During the data migration phase, when the system is in a stable phase, the proportion of the front-end access switch is adjusted according to a preset step size; the minimum value of the proportion is the first value; and the maximum value of the proportion is the fifth value.

[0033] Determine the state value of the backend state machine to be the sixth value;

[0034] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0035] When the front-end access switch ratio is a proportional value, the ratio of users accessing the first database and the second database is a second ratio; whereby the second ratio represents the ratio of users accessing the first database and the second database; when the ratio value is a fifth value, the second ratio is used to represent that only users are allowed to access the second database.

[0036] When the state value of the backend state machine is the sixth value, the working mode of the first database is controlled to be write-only mode, and the working mode of the second database is controlled to be read-and-write enabled mode.

[0037] In one embodiment, determining the front-end access switch ratio and the back-end state machine state values ​​based on the data migration phase includes:

[0038] When the data migration phase is the data migration completion phase, the front-end access switch ratio is determined to be the fifth value and the back-end state machine state value is the seventh value.

[0039] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0040] When the front-end access switch ratio is set to the fifth value, the ratio of users accessing the first and second databases is controlled to be the second ratio.

[0041] When the state value of the backend state machine is the seventh value, the working mode of the first database is controlled to be the read-and-write prohibited mode, and the working mode of the second database is controlled to be the read-and-write allowed mode.

[0042] Secondly, this application also provides a database management apparatus. The apparatus includes:

[0043] The first determining module is used to determine the data migration stage during the data migration process from the first database to the second database.

[0044] The second determining module is used to determine the front-end access switch ratio and the state value of the back-end state machine based on the data migration stage.

[0045] The control module is used to control the proportion of users accessing the first database and the second database, as well as the working modes of the first database and the second database, based on the proportion and status value of the front-end access switch.

[0046] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0047] During the data migration process from the first database to the second database, the data migration stage is determined.

[0048] Based on the data migration phase, determine the front-end access switch ratio and the state values ​​of the back-end state machine;

[0049] Based on the front-end access switch ratio and status value, the proportion of users accessing the first database and the second database, as well as the working modes of the first database and the second database, are controlled.

[0050] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0051] During the data migration process from the first database to the second database, the data migration stage is determined.

[0052] Based on the data migration phase, determine the front-end access switch ratio and the state values ​​of the back-end state machine;

[0053] Based on the front-end access switch ratio and status value, the proportion of users accessing the first database and the second database, as well as the working modes of the first database and the second database, are controlled.

[0054] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0055] During the data migration process from the first database to the second database, the data migration stage is determined.

[0056] Based on the data migration phase, determine the front-end access switch ratio and the state values ​​of the back-end state machine;

[0057] Based on the front-end access switch ratio and status value, the proportion of users accessing the first database and the second database, as well as the working modes of the first database and the second database, are controlled.

[0058] The aforementioned database management method, apparatus, and computer equipment determine the data migration stage during the data migration process from the first database to the second database. Based on the data migration stage, the proportion of front-end access switches and the state values ​​of the back-end state machine are determined. Based on the proportion of front-end access switches and the state values, the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, are controlled. In this application, the proportion of front-end access switches and the state values ​​of the back-end state machine are determined according to different data migration stages. Based on the proportion of front-end access switches and the state values, the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, are controlled. This allows for stable data migration without system downtime, ensuring that users can access the database normally during the data migration process and guaranteeing a positive user experience. Attached Figure Description

[0059] Figure 1 This is a diagram illustrating the application environment of the database management method provided in this embodiment.

[0060] Figure 2 This is a flowchart illustrating the first database management method provided in this embodiment;

[0061] Figure 3 A flowchart illustrating the first control front-end access switch ratio and the back-end state machine provided in this embodiment;

[0062] Figure 4 This is a flowchart illustrating the second control front-end access switch ratio and the back-end state machine provided in this embodiment;

[0063] Figure 5This is a schematic diagram of the third control front-end access switch ratio and back-end state machine process provided in this embodiment;

[0064] Figure 6 A flowchart illustrating the fourth control front-end access switch ratio and back-end state machine provided in this embodiment;

[0065] Figure 7 A flowchart illustrating the fifth control front-end access switch ratio and the back-end state machine provided in this embodiment;

[0066] Figure 8 This is a structural block diagram of a database management device provided in this embodiment;

[0067] Figure 9 This is an internal structural diagram of the computer device provided in this embodiment. Detailed Implementation

[0068] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0069] In the field of enterprise information technology, rapid business development often drives the modernization and upgrading of systems. This includes integrating data scattered across multiple heterogeneous systems into a unified platform, or refactoring core functions into service-oriented architectures. In these processes, data migration is an unavoidable and critical step.

[0070] Most existing data migration solutions employ a shutdown migration approach. This approach involves completely halting system services during off-peak hours and then using database tools to export and import data in batches. While the operation is relatively simple, for systems like mobile banking that require continuous customer service, being unable to access the database for several hours leads to prolonged business interruptions and severely impacts user experience.

[0071] To address the aforementioned technical problems, the database management method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, during the data migration process from the first database to the second database, the control device determines the data migration stage. Based on the data migration stage, the control device determines the front-end access switch ratio and the state value of the back-end state machine. Based on the front-end access switch ratio and state value, the control device controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases.

[0072] The control device can be a standalone control device or a logical control module configured in the server, used to control the front-end access switching ratio and the working mode of the first and second databases of the back-end service.

[0073] In one embodiment, such as Figure 2 As shown, a database management method is provided, which can be applied to... Figure 1 Taking the control equipment in the example, the explanation includes the following steps:

[0074] S201, during the data migration process from the first database to the second database, determine the data migration stage.

[0075] The first database refers to the database from which the data needs to be migrated, also known as the old database. The second database refers to the destination database from which the data is migrated, also known as the new database.

[0076] Optionally, in this embodiment, during the data migration process from the first database to the second database, the data migration stage is determined based on configuration information. The configuration information records the triggering or judgment methods for different data migration stages.

[0077] Optionally, in this embodiment, during the data migration process from the first database to the second database, the data migration stage is determined according to the data migration progress. For example, when migrating existing historical data, it is the existing historical data migration stage; when migrating incremental data, it is the incremental data migration stage.

[0078] S202, based on the data migration stage, determine the front-end access switch ratio and the state value of the back-end state machine.

[0079] The front-end access switch ratio refers to the proportion of users accessing the first and second databases. The back-end state machine is mainly used to control the operating modes of the first and second databases.

[0080] Optionally, in this embodiment, the front-end access switch ratio and the back-end state machine state value are determined based on the data migration stage and the stage list. The stage list records different data migration stages, as well as the corresponding front-end access switch ratio and back-end state machine state values ​​for each stage.

[0081] S203 controls the ratio of users accessing the first database and the second database, as well as the working modes of the first database and the second database, based on the ratio and status value of the front-end access switch.

[0082] Optionally, in this embodiment, the ratio of users accessing the first and second databases is controlled based on the front-end access switch ratio. The operating modes of the first and second databases are controlled based on status values. Specifically, in this embodiment, the interface ratio of the first and second database access interfaces of the front-end access interface is controlled according to the front-end access switch ratio, thereby controlling the ratio of users accessing the first and second databases. The interface ratio of the new and old user interfaces of the front-end access interface is also controlled according to the front-end access switch ratio. Access to the first database is via the old user interface, and access to the second database is via the new user interface. Therefore, by controlling the interface ratio of the new and old user interfaces of the front-end access interface, the ratio of users accessing the first and second databases can be controlled. In this embodiment, the operating modes of the first and second databases are controlled based on status values ​​and a status value list. The status value list records different status values ​​and the corresponding operating modes of the first and second databases for each status value.

[0083] In this embodiment, during the data migration process from the first database to the second database, a data migration stage is determined. Based on the data migration stage, the front-end access switch ratio and the back-end state machine state value are determined. Based on the front-end access switch ratio and state value, the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, are controlled. This application determines the front-end access switch ratio and back-end state machine state value according to different data migration stages. By controlling the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, based on the front-end access switch ratio and state value, stable data migration can be achieved without system downtime. During the data migration, users can access the database normally, ensuring a good user experience.

[0084] In one embodiment, when the data migration phase includes a pre-migration preparation phase and an existing historical data migration phase, the front-end access switch ratio is determined to be a first value and the back-end state machine state value is determined to be a second value. Based on this, such as Figure 3 As shown, an optional implementation method for controlling the ratio of users accessing the first database and the second database, as well as the working modes of the first database and the second database, based on the front-end access switch ratio and status value, includes:

[0085] S301, when the front-end access switch ratio is a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0086] The first ratio represents the user's access to the first database. The first ratio can be understood as the access ratio between the second database and the first database being 0:1, that is, only the first database, i.e. the old database, is allowed to be accessed.

[0087] Optionally, the pre-migration preparation phase refers to the configuration and preparation phase before data migration. During this phase, the front-end service designs and develops an upgraded user interface so that users can access the second database using the new interface and the first database using the old interface. For example, data migration can be performed via file transfer, and this method is not limited to any particular database type. Additionally, for systems operating 24 / 7, it is recommended to issue user announcements in advance to handle unexpected scenarios. If the data volume exceeds tens of millions, data extraction scripts can be prepared in advance to shorten migration time.

[0088] Optionally, the existing historical data migration stage refers to the stage used to migrate existing historical data. Existing historical data refers to historical data prior to the migration date. For example, if the migration date is day T, then historical data from day T-1 onwards will be used as existing historical data. Data added in the first database from day T onwards will be used as incremental data. For instance, if the migration of existing historical data has been completed on day T, and the plan is to migrate incremental data during the off-peak business period on day T+1, then the data generated on day T and day T+1 will be used as incremental data.

[0089] S302, when the state value of the backend state machine is the second value, control the working mode of the first database to allow read and write mode, and control the working mode of the second database to prohibit read and write mode.

[0090] Read mode refers to the mode of reading data from the database, while write mode refers to the mode of writing data to the database.

[0091] Optionally, in this embodiment, when the state value of the backend state machine is the second value, the working mode of the first database is controlled to be read-and-write enabled, and the working mode of the second database is controlled to be read-and-write disabled, according to the state machine list.

[0092] Optionally, the state machine list in this embodiment is shown in Table 1:

[0093] Table 1

[0094]

[0095] In this embodiment, based on Table 1, the second value corresponding to the state machine is the value "1" in Table 1.

[0096] Optionally, in this embodiment, existing historical data can be pre-transmitted to the data platform and migrated to the second database during data migration. Simultaneously, during the migration process, data updates caused by customer operations are recorded in the first database using the letters 'a' and 'u' combined with the date. New temporary tables (multiple temporary tables can be created for multi-table migrations) are created to record the primary key values ​​of deleted data, forming incremental data for subsequent incremental data migration.

[0097] In this embodiment, when the data migration phase includes both the pre-migration preparation phase and the existing historical data migration phase, the front-end access switch ratio is determined to be a first value, and the back-end state machine state value is determined to be a second value. Based on this, when the front-end access switch ratio is the first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio; where the first ratio represents allowing users to access the first database. When the back-end state machine state value is the second value, the operating mode of the first database is controlled to allow read and write operations; the operating mode of the second database is controlled to prohibit read and write operations. In this embodiment, when the data migration phase includes both the pre-migration preparation phase and the existing historical data migration phase, since the data stored in the second database is incomplete and its stability cannot be guaranteed, to ensure the accuracy of user access data and to prevent data from being written into the second database and causing data corruption, only users are allowed to access the first database, and the operating mode of the first database is allow read and write operations. The operating mode of the second database is prohibit read and write operations.

[0098] Based on the above embodiments, when the data migration phase is an incremental data migration phase, such as Figure 4 As shown, based on the data migration stage, the front-end access switch ratio and the state value of the back-end state machine are determined. Based on the front-end access switch ratio and state value, the ratio of users accessing the first and second databases is controlled. The optional implementation methods for the working modes of the first and second databases include:

[0099] S401, when the data migration phase is the incremental data migration phase, determine the front-end access switch ratio as the first value and the back-end state machine state value as the third value.

[0100] The incremental data migration phase refers to the phase of migrating incremental data.

[0101] S402, when the front-end access switch ratio is a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0102] The first ratio represents the user's access to the first database. The first ratio can be understood as the access ratio between the second database and the first database being 0:1, that is, only the first database, i.e. the old database, is allowed to be accessed.

[0103] S403, when the state value of the backend state machine is the third value, control the working mode of the first database to read-only mode and control the working mode of the second database to prohibit read and write.

[0104] Optionally, in this embodiment, the state value of the backend state machine is a third value, corresponding to the execution mode of the state machine with a state value of "0" in Table 1.

[0105] In this embodiment, when the data migration phase is an incremental data migration phase, the front-end access switch ratio is determined to be a first value and the back-end state machine state value is determined to be a third value. When the front-end access switch ratio is the first value, the ratio of users accessing the first database and the second database is controlled to be the first ratio. When the back-end state machine state value is the third value, the operating mode of the first database is controlled to be read-only mode, and the operating mode of the second database is controlled to be read-and-write prohibited mode. Based on this embodiment, only allowing users to read data and prohibiting writing prevents new writes from occurring during incremental synchronization and avoids data loss.

[0106] Based on the above embodiments, in the case where the data migration phase is the incremental data migration completion phase, such as Figure 5 As shown, based on the data migration stage, the front-end access switch ratio and the state value of the back-end state machine are determined. Based on the front-end access switch ratio and state value, the ratio of users accessing the first and second databases is controlled. The optional implementation methods for the working modes of the first and second databases include:

[0107] S501, when the data migration phase is the incremental data migration completion phase, determine the front-end access switch ratio as the first value and the back-end state machine state value as the fourth value.

[0108] The incremental data migration completion stage refers to the stage after the incremental data migration is completed.

[0109] Optionally, in this embodiment, when the data migration stage is the incremental data migration completion stage, the front-end access switch ratio is determined to be a first value and the state value of the back-end state machine is determined to be a fourth value.

[0110] S502, when the front-end access switch ratio is a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0111] The first ratio represents the user's access to the first database. The first ratio can be understood as the access ratio between the second database and the first database being 0:1, that is, only the first database, i.e. the old database, is allowed to be accessed.

[0112] S503, when the state value of the backend state machine is the fourth value, controls the working mode of the first database to allow read and write mode, and controls the working mode of the second database to write-only mode.

[0113] Optionally, in this embodiment, the state value of the backend state machine is the fourth value, corresponding to the execution mode of state machine state value "2" in Table 1. That is to say, when the data migration phase is the incremental data migration completion phase, the stability of the second database is unknown. Therefore, by controlling the front-end access switch ratio to the first ratio, all users are guided to still access the first database, but the data updates brought by all user operations will be written to both the first and second databases simultaneously.

[0114] Based on the above embodiments, to determine the stability of the second database, one optional implementation of the database management method is as follows: When the data migration phase is the incremental data migration completion phase, obtain the first data displayed when a user accesses the first database based on an access request. Based on the access request, obtain the second data from the second database. Based on the first and second data, determine the data consistency. Based on the data consistency, determine the stability of the second database. Specifically, obtain a copy of the first data displayed when a user accesses the database based on an access request (i.e., shadow traffic), then obtain the second data from the second database based on the access request, and match the first and second data. If the match is successful, the data consistency is determined to be consistent. Based on the data consistency request, determine the accuracy rate, and based on the accuracy rate, determine the stability of the second database. For example, if the accuracy rate is 100% within a preset time period, the stability of the second database is determined to be stable. In this embodiment, if the data consistency is inconsistent, the operations and maintenance department needs to be notified for troubleshooting and maintenance.

[0115] In this embodiment, when the incremental data migration phase is complete, the front-end access switch ratio is determined to be a first value and the back-end state machine state value is determined to be a fourth value. When the front-end access switch ratio is the first value, the ratio of users accessing the first database and the second database is controlled to be the first ratio. When the back-end state machine state value is the fourth value, the operating mode of the first database is controlled to allow both read and write operations, and the operating mode of the second database is controlled to be write-only. Based on this embodiment, by controlling the front-end access switch ratio and the back-end state machine, users can be guided to continue accessing the first database during the incremental data migration completion phase, ensuring business accuracy. Furthermore, incremental data can be synchronously written to both the first and second databases, enabling the rollback of erroneous data and improving data accuracy.

[0116] Based on the above embodiments, assuming the stability condition is stable, the data migration phase is determined to be the system stability phase. Under the condition that the data migration phase is the system stability phase, such as... Figure 6 As shown, based on the data migration stage, the front-end access switch ratio and the state value of the back-end state machine are determined. Based on the front-end access switch ratio and state value, the ratio of users accessing the first and second databases is controlled. The optional implementation methods for the working modes of the first and second databases include:

[0117] S601, when the data migration phase is a stable phase of the system, adjusts the ratio of the front-end access switch according to the preset step size.

[0118] The minimum value of the ratio is the first value; the maximum value of the ratio is the fifth value.

[0119] Optionally, in this embodiment, when the data migration phase is a stable system phase, the proportion of the front-end access switch is gradually increased according to a preset step size. For example, the proportion value is gradually increased and adjusted from 0, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, to 100% until the proportion value is adjusted to the fifth value, i.e., 100%.

[0120] S602, determine the state value of the backend state machine as the sixth value.

[0121] S603, when the front-end access switch ratio is a proportional value, controls the ratio of users accessing the first database and the second database to a second ratio.

[0122] The second ratio represents the proportion of users accessing the first and second databases, for example, it is 1. When the ratio value is the fifth value, the second ratio is used to indicate that only users are allowed to access the second database. That is to say, at the completion stage of the data migration phase, the second ratio is 1, and all users can only access the second database through the new user interface.

[0123] S604, when the state value of the backend state machine is the sixth value, controls the working mode of the first database to write-only mode and controls the working mode of the second database to read-and-write-allowed mode.

[0124] Optionally, in this embodiment, the state value of the backend state machine is the sixth value, corresponding to the state value "3" in Table 1.

[0125] It should be noted that in this embodiment, the working mode of the first data is only write-only when the ratio of the front-end access switch changes to the fifth value. When the ratio of the front-end access switch is any value other than the fifth value, the working mode is read-write enabled. That is to say, the working mode of the first database also changes dynamically during this process. When the ratio value is the fifth value, the working mode of the first database is controlled to be write-only; when it is any value other than the fifth value, the working mode of the first database is controlled to be read-write enabled.

[0126] In this embodiment, during the data migration phase when the system is stable, the proportion of the front-end access switch is adjusted according to a preset step size. The state value of the back-end state machine is determined to be the sixth value. When the front-end access switch proportion is at the specified value, the ratio of users accessing the first and second databases is controlled to the second proportion. When the state value of the back-end state machine is the sixth value, the operating mode of the first database is controlled to be write-only, and the operating mode of the second database is controlled to be read-and-write enabled. Based on this embodiment, during the stable phase of the system, by controlling the proportion of the front-end access switch, the user access objects can be gradually migrated from the first database to the second database. During this process, the pressure on the second database can be observed, and timely adjustments can be made to the database to avoid downtime. Furthermore, when new data is added during this process, the new data is simultaneously written to both the first and second databases for subsequent data rollback.

[0127] Based on the above embodiments, in the case where the data migration phase is the data migration completion phase, such as Figure 7As shown, based on the data migration stage, the front-end access switch ratio and the state value of the back-end state machine are determined. Based on the front-end access switch ratio and state value, the ratio of users accessing the first and second databases is controlled. The optional implementation methods for the working modes of the first and second databases include:

[0128] S701, when the data migration phase is the data migration completion phase, the front-end access switch ratio is determined to be the fifth value and the back-end state machine state value is the seventh value.

[0129] S702, when the front-end access switch ratio is the fifth value, controls the ratio of users accessing the first database and the second database to the second ratio.

[0130] Optionally, in this embodiment, when the front-end access switch ratio is the fifth value, the user interface on the user side is controlled to adjust the user ratio of accessing the first database and the second database to the second ratio. When the user ratio is the second ratio, all user interfaces are configured with the new user interface, allowing only the user to access the second database through the new user interface.

[0131] S703, when the state value of the backend state machine is the seventh value, controls the working mode of the first database to be prohibited from reading and writing, and controls the working mode of the second database to be allowed to read and write.

[0132] In this embodiment, when the data migration phase is complete, the front-end access switch ratio is determined to be the fifth value and the back-end state machine state value is the seventh value. With the front-end access switch ratio at the fifth value, the user ratio accessing the first and second databases is controlled to the second ratio. With the back-end state machine state value at the seventh value, the first database's operating mode is controlled to be read-and-write prohibited, and the second database's operating mode is controlled to be read-and-write permitted. Based on this embodiment, the data migration completion phase is achieved, all data read and write operations are performed only on the new data source (i.e., the second database), the connection with the old data source (i.e., the first database) can be completely disconnected, and the migration work is fully completed.

[0133] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0134] Based on the same inventive concept, this application also provides a database management device for implementing the database management method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more database management device embodiments provided below can be found in the limitations of the database management method described above, and will not be repeated here.

[0135] In one embodiment, such as Figure 8 As shown, a database management device 1 is provided, including: a first determining module 10, a second determining module 20, and a control module 30, wherein:

[0136] The first determining module is used to determine the data migration stage during the data migration process from the first database to the second database.

[0137] The second determining module is used to determine the front-end access switch ratio and the state value of the back-end state machine based on the data migration stage.

[0138] The control module is used to control the proportion of users accessing the first database and the second database, as well as the working modes of the first database and the second database, based on the proportion and status value of the front-end access switch.

[0139] In one embodiment, the second determining module is further specifically used for:

[0140] When the data migration phase consists of the pre-migration preparation phase and the existing historical data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the second value.

[0141] The control module is also specifically used for:

[0142] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio; wherein, the first ratio represents that users are allowed to access the first database.

[0143] When the state value of the backend state machine is the second value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to prohibit read and write.

[0144] In one embodiment, the second determining module is further specifically used for:

[0145] When the data migration phase is an incremental data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the third value.

[0146] The control module is also specifically used for:

[0147] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0148] When the state value of the backend state machine is the third value, the working mode of the first database is controlled to be read-only mode, and the working mode of the second database is controlled to be read-and-write prohibited mode.

[0149] In one embodiment, the second determining module is further specifically used for:

[0150] When the data migration phase is the incremental data migration completion phase, the front-end access switch ratio is determined to be the first value and the state value of the back-end state machine is determined to be the fourth value.

[0151] The control module is also specifically used for:

[0152] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0153] When the state value of the backend state machine is the fourth value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to be write-only.

[0154] In one embodiment, a database management device further includes:

[0155] The acquisition module is used to acquire the first data displayed when a user accesses the first database based on an access request, in the case where the incremental data migration phase is completed.

[0156] Based on the access request, retrieve the second data from the second database;

[0157] Based on the first and second data, determine the data consistency.

[0158] Based on the data consistency, the stability of the second database is determined.

[0159] In one embodiment, a database management device further includes:

[0160] The third determination module is used to determine the data migration stage as the system stable stage when the stability condition is stable.

[0161] The second determining module is also specifically used for:

[0162] During the data migration phase, when the system is in a stable phase, the proportion of the front-end access switch is adjusted according to a preset step size; the minimum value of the proportion is the first value; and the maximum value of the proportion is the fifth value.

[0163] Determine the state value of the backend state machine to be the sixth value;

[0164] The control module is also specifically used for:

[0165] When the front-end access switch ratio is a proportional value, the ratio of users accessing the first database and the second database is a second ratio; whereby the second ratio represents the ratio of users accessing the first database and the second database; when the ratio value is a fifth value, the second ratio is used to represent that only users are allowed to access the second database.

[0166] When the state value of the backend state machine is the sixth value, the working mode of the first database is controlled to be write-only mode, and the working mode of the second database is controlled to be read-and-write enabled mode.

[0167] In one embodiment, the second determining module is further specifically used for:

[0168] When the data migration phase is the data migration completion phase, the front-end access switch ratio is determined to be the fifth value and the back-end state machine state value is the seventh value.

[0169] The control module is also specifically used for:

[0170] When the front-end access switch ratio is set to the fifth value, the ratio of users accessing the first and second databases is controlled to be the second ratio.

[0171] When the state value of the backend state machine is the seventh value, the working mode of the first database is controlled to be the read-and-write prohibited mode, and the working mode of the second database is controlled to be the read-and-write allowed mode.

[0172] Each module in the aforementioned database management device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0173] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores database-related data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a database management method.

[0174] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0175] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0176] During the data migration process from the first database to the second database, the data migration stage is determined.

[0177] Based on the data migration phase, determine the front-end access switch ratio and the state values ​​of the back-end state machine;

[0178] Based on the front-end access switch ratio and status value, the proportion of users accessing the first database and the second database, as well as the working modes of the first database and the second database, are controlled.

[0179] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0180] When the data migration phase consists of the pre-migration preparation phase and the existing historical data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the second value.

[0181] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0182] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio; wherein, the first ratio represents that users are allowed to access the first database.

[0183] When the state value of the backend state machine is the second value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to prohibit read and write.

[0184] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0185] When the data migration phase is an incremental data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the third value.

[0186] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0187] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0188] When the state value of the backend state machine is the third value, the working mode of the first database is controlled to be read-only mode, and the working mode of the second database is controlled to be read-and-write prohibited mode.

[0189] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0190] When the data migration phase is the incremental data migration completion phase, the front-end access switch ratio is determined to be the first value and the state value of the back-end state machine is determined to be the fourth value.

[0191] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0192] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0193] When the state value of the backend state machine is the fourth value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to be write-only.

[0194] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0195] In the case where the incremental data migration phase is completed, obtain the first data displayed when the user accesses the first database based on the access request.

[0196] Based on the access request, retrieve the second data from the second database;

[0197] Based on the first and second data, determine the data consistency.

[0198] Based on the data consistency, the stability of the second database is determined.

[0199] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0200] If the system is stable, the data migration phase is considered the stable phase.

[0201] Based on the data migration phase, determine the front-end access switch ratio and the back-end state machine state values, including:

[0202] During the data migration phase, when the system is in a stable phase, the proportion of the front-end access switch is adjusted according to a preset step size; the minimum value of the proportion is the first value; and the maximum value of the proportion is the fifth value.

[0203] Determine the state value of the backend state machine to be the sixth value;

[0204] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0205] When the front-end access switch ratio is a proportional value, the ratio of users accessing the first database and the second database is a second ratio; whereby the second ratio represents the ratio of users accessing the first database and the second database; when the ratio value is a fifth value, the second ratio is used to represent that only users are allowed to access the second database.

[0206] When the state value of the backend state machine is the sixth value, the working mode of the first database is controlled to be write-only mode, and the working mode of the second database is controlled to be read-and-write enabled mode.

[0207] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0208] When the data migration phase is the data migration completion phase, the front-end access switch ratio is determined to be the fifth value and the back-end state machine state value is the seventh value.

[0209] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0210] When the front-end access switch ratio is set to the fifth value, the ratio of users accessing the first and second databases is controlled to be the second ratio.

[0211] When the state value of the backend state machine is the seventh value, the working mode of the first database is controlled to be the read-and-write prohibited mode, and the working mode of the second database is controlled to be the read-and-write allowed mode.

[0212] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0213] During the data migration process from the first database to the second database, the data migration stage is determined.

[0214] Based on the data migration phase, determine the front-end access switch ratio and the state values ​​of the back-end state machine;

[0215] Based on the front-end access switch ratio and status value, the proportion of users accessing the first database and the second database, as well as the working modes of the first database and the second database, are controlled.

[0216] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0217] When the data migration phase consists of the pre-migration preparation phase and the existing historical data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the second value.

[0218] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0219] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio; wherein, the first ratio represents that users are allowed to access the first database.

[0220] When the state value of the backend state machine is the second value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to prohibit read and write.

[0221] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0222] When the data migration phase is an incremental data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the third value.

[0223] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0224] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0225] When the state value of the backend state machine is the third value, the working mode of the first database is controlled to be read-only mode, and the working mode of the second database is controlled to be read-and-write prohibited mode.

[0226] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0227] When the data migration phase is the incremental data migration completion phase, the front-end access switch ratio is determined to be the first value and the state value of the back-end state machine is determined to be the fourth value.

[0228] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0229] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0230] When the state value of the backend state machine is the fourth value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to be write-only.

[0231] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0232] In the case where the incremental data migration phase is completed, obtain the first data displayed when the user accesses the first database based on the access request.

[0233] Based on the access request, retrieve the second data from the second database;

[0234] Based on the first and second data, determine the data consistency.

[0235] Based on the data consistency, the stability of the second database is determined.

[0236] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0237] If the system is stable, the data migration phase is considered the stable phase.

[0238] Based on the data migration phase, determine the front-end access switch ratio and the back-end state machine state values, including:

[0239] During the data migration phase, when the system is in a stable phase, the proportion of the front-end access switch is adjusted according to a preset step size; the minimum value of the proportion is the first value; and the maximum value of the proportion is the fifth value.

[0240] Determine the state value of the backend state machine to be the sixth value;

[0241] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0242] When the front-end access switch ratio is a proportional value, the ratio of users accessing the first database and the second database is a second ratio; whereby the second ratio represents the ratio of users accessing the first database and the second database; when the ratio value is a fifth value, the second ratio is used to represent that only users are allowed to access the second database.

[0243] When the state value of the backend state machine is the sixth value, the working mode of the first database is controlled to be write-only mode, and the working mode of the second database is controlled to be read-and-write enabled mode.

[0244] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0245] When the data migration phase is the data migration completion phase, the front-end access switch ratio is determined to be the fifth value and the back-end state machine state value is the seventh value.

[0246] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0247] When the front-end access switch ratio is set to the fifth value, the ratio of users accessing the first and second databases is controlled to be the second ratio.

[0248] When the state value of the backend state machine is the seventh value, the working mode of the first database is controlled to be the read-and-write prohibited mode, and the working mode of the second database is controlled to be the read-and-write allowed mode.

[0249] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:

[0250] During the data migration process from the first database to the second database, the data migration stage is determined.

[0251] Based on the data migration phase, determine the front-end access switch ratio and the state values ​​of the back-end state machine;

[0252] Based on the front-end access switch ratio and status value, the proportion of users accessing the first database and the second database, as well as the working modes of the first database and the second database, are controlled.

[0253] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0254] When the data migration phase consists of the pre-migration preparation phase and the existing historical data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the second value.

[0255] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0256] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio; wherein, the first ratio represents that users are allowed to access the first database.

[0257] When the state value of the backend state machine is the second value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to prohibit read and write.

[0258] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0259] When the data migration phase is an incremental data migration phase, the front-end access switch ratio is determined as the first value and the state value of the back-end state machine is determined as the third value.

[0260] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0261] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0262] When the state value of the backend state machine is the third value, the working mode of the first database is controlled to be read-only mode, and the working mode of the second database is controlled to be read-and-write prohibited mode.

[0263] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0264] When the data migration phase is the incremental data migration completion phase, the front-end access switch ratio is determined to be the first value and the state value of the back-end state machine is determined to be the fourth value.

[0265] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0266] When the front-end access switch ratio is set to a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio.

[0267] When the state value of the backend state machine is the fourth value, the working mode of the first database is controlled to allow read and write, and the working mode of the second database is controlled to be write-only.

[0268] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0269] In the case where the incremental data migration phase is completed, obtain the first data displayed when the user accesses the first database based on the access request.

[0270] Based on the access request, retrieve the second data from the second database;

[0271] Based on the first and second data, determine the data consistency.

[0272] Based on the data consistency, the stability of the second database is determined.

[0273] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0274] If the system is stable, the data migration phase is considered the stable phase.

[0275] Based on the data migration phase, determine the front-end access switch ratio and the back-end state machine state values, including:

[0276] During the data migration phase, when the system is in a stable phase, the proportion of the front-end access switch is adjusted according to a preset step size; the minimum value of the proportion is the first value; and the maximum value of the proportion is the fifth value.

[0277] Determine the state value of the backend state machine to be the sixth value;

[0278] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0279] When the front-end access switch ratio is a proportional value, the ratio of users accessing the first database and the second database is a second ratio; whereby the second ratio represents the ratio of users accessing the first database and the second database; when the ratio value is a fifth value, the second ratio is used to represent that only users are allowed to access the second database.

[0280] When the state value of the backend state machine is the sixth value, the working mode of the first database is controlled to be write-only mode, and the working mode of the second database is controlled to be read-and-write enabled mode.

[0281] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: determining the front-end access switch ratio and the state values ​​of the back-end state machine based on the data migration phase, including:

[0282] When the data migration phase is the data migration completion phase, the front-end access switch ratio is determined to be the fifth value and the back-end state machine state value is the seventh value.

[0283] Based on the front-end access switch ratio and status values, the system controls the ratio of users accessing the first and second databases, as well as the operating modes of the first and second databases, including:

[0284] When the front-end access switch ratio is set to the fifth value, the ratio of users accessing the first and second databases is controlled to be the second ratio.

[0285] When the state value of the backend state machine is the seventh value, the working mode of the first database is controlled to be the read-and-write prohibited mode, and the working mode of the second database is controlled to be the read-and-write allowed mode.

[0286] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0287] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0288] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A database management method, characterized in that, The method includes: During the data migration process from the first database to the second database, the data migration stage is determined. Based on the data migration phase, determine the front-end access switch ratio and the state value of the back-end state machine; Based on the front-end access switch ratio and the status value, the ratio of users accessing the first database and the second database, as well as the working modes of the first database and the second database, are controlled.

2. The method according to claim 1, characterized in that, The step of determining the front-end access switch ratio and the back-end state machine state value based on the data migration stage includes: When the data migration phase is the pre-migration preparation phase and the existing historical data migration phase, the front-end access switch ratio is determined to be a first value and the state value of the back-end state machine is determined to be a second value. The method of controlling the ratio of users accessing the first database and the second database, and the working modes of the first database and the second database, based on the ratio of the front-end access switch and the status value, includes: When the front-end access switch ratio is a first value, the ratio of users accessing the first database and the second database is a first ratio; wherein, the first ratio represents that users are allowed to access the first database; When the state value of the backend state machine is the second value, the working mode of the first database is controlled to be read-and-write enabled, and the working mode of the second database is controlled to be read-and-write disabled.

3. The method according to claim 1, characterized in that, The step of determining the front-end access switch ratio and the back-end state machine state value based on the data migration stage includes: When the data migration phase is an incremental data migration phase, the front-end access switch ratio is determined to be a first value and the state value of the back-end state machine is determined to be a third value. The method of controlling the ratio of users accessing the first database and the second database, and the working modes of the first database and the second database, based on the ratio of the front-end access switch and the status value, includes: When the front-end access switch ratio is a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio. When the state value of the backend state machine is the third value, the first database is controlled to operate in read-only mode; the second database is controlled to operate in read-and-write-prohibited mode.

4. The method according to claim 3, characterized in that, The step of determining the front-end access switch ratio and the back-end state machine state value based on the data migration stage includes: When the data migration phase is the incremental data migration completion phase, the front-end access switch ratio is determined to be a first value and the state value of the back-end state machine is determined to be a fourth value. The method of controlling the ratio of users accessing the first database and the second database, and the working modes of the first database and the second database, based on the ratio of the front-end access switch and the status value, includes: When the front-end access switch ratio is a first value, the ratio of users accessing the first database and the second database is controlled to be a first ratio. When the state value of the backend state machine is the fourth value, the working mode of the first database is controlled to be read-and-write enabled, and the working mode of the second database is controlled to be write-only.

5. The method according to claim 4, characterized in that, The method further includes: When the data migration phase is the incremental data migration completion phase, the first data displayed when the user accesses the first database based on the access request is obtained; Based on the access request, second data is obtained from the second database; Based on the first data and the second data, determine the data consistency status; Based on the data consistency, the stability of the second database is determined.

6. The method according to claim 5, characterized in that, The method further includes; If the stability condition is stable, the data migration phase is determined to be a system stability phase; The step of determining the front-end access switch ratio and the back-end state machine state value based on the data migration stage includes: When the data migration phase is a stable phase for the system, the ratio of the front-end access switch is adjusted according to a preset step size; wherein the minimum value of the ratio is a first value; and the maximum value of the ratio is a fifth value. The state value of the backend state machine is determined to be the sixth value; The method of controlling the ratio of users accessing the first database and the second database, and the working modes of the first database and the second database, based on the ratio of the front-end access switch and the status value, includes: When the front-end access switch ratio is a proportional value, the ratio of users accessing the first database and the second database is a second ratio; wherein, the second ratio represents the ratio of users accessing the first database and the second database; when the ratio value is the fifth value, the second ratio is used to represent that only users are allowed to access the second database. When the state value of the backend state machine is the sixth value, the working mode of the first database is controlled to be write-only mode, and the working mode of the second database is controlled to be read-and-write enabled mode.

7. The method according to claim 6, characterized in that, The step of determining the front-end access switch ratio and the back-end state machine state value based on the data migration stage includes: When the data migration phase is the data migration completion phase, the front-end access switch ratio is determined to be the fifth value and the state value of the back-end state machine is determined to be the seventh value. The method of controlling the ratio of users accessing the first database and the second database, and the working modes of the first database and the second database, based on the ratio of the front-end access switch and the status value, includes: When the front-end access switch ratio is the fifth value, the ratio of users accessing the first database and the second database is controlled to be the second ratio. When the state value of the backend state machine is the seventh value, the working mode of the first database is controlled to be the read-and-write prohibited mode, and the working mode of the second database is controlled to be the read-and-write allowed mode.

8. A database management device, characterized in that, The device includes: The first determining module is used to determine the data migration stage during the data migration process from the first database to the second database. The second determining module is used to determine the front-end access switch ratio and the state value of the back-end state machine based on the data migration stage. The control module is used to control the ratio of users accessing the first database and the second database, as well as the working modes of the first database and the second database, based on the ratio of the front-end access switch and the status value.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the database management method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the database management method according to any one of claims 1 to 7.