Method and System for Constructing a Database Sandbox Environment Based on CDM Super Replicas

Through the CDM super replica construction method, combined with snapshots and archive logs, the database sandbox environment is quickly built, solving the time-consuming and labor-intensive construction problems in the existing technology, and achieving efficient and independent data recovery and troubleshooting.

CN119720177BActive Publication Date: 2025-07-11GUANGZHOU JINYUAN INTELLIGENT TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411789171.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-07-11
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

When simulating data at the time point of the database problem, the existing technology needs to re-export the full backup from the main library and build an environment, which is time-consuming and labor-intensive, and has a large load on the production environment, affecting business stability.

Method used

The CDM super replica construction method is adopted to export backup data from the source database regularly and save snapshots, and build a database sandbox environment with archive logs. It uses NFS mount to achieve rapid construction to avoid the performance impact on the production environment.

Benefits of technology

Build a data environment at the specified time point in a short time, simplify troubleshooting and data recovery, reduce the impact on the production environment, improve construction efficiency, and ensure that the sandbox environment is consistent with the target time point.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119720177B_ABST
    Figure CN119720177B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of databases, and specifically to a method and system for constructing a database sandbox environment based on CDM super replicas. The method includes: periodically exporting backup data and archived logs from the source database to a storage node according to the backup policy and log acquisition policy set by the user. After the backup data is restored, it is stored in the data directory and a snapshot is taken. The file name of the last archived log corresponding to the snapshot data and the archived log data position information are saved to the snapshot record table, and the key information of the archived log file is saved to the archived log record table. When constructing the database sandbox, according to the time point for constructing the database sandbox set by the user, the snapshot closest to this time point is selected from the snapshot record table, and this snapshot is used in combination with the archived logs to construct the database sandbox environment. Through periodic backup during off-peak business hours, snapshot management, archived log acquisition and application, and precise point-in-time recovery, an efficient and accurate database sandbox environment construction is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of databases, and particularly to a method and system for constructing a database sandbox environment based on a CDM super copy. Background Art

[0002] Current database applications usually adopt a master-slave mode, where the master database is responsible for read and write operations, and the slave database is used for disaster recovery and read operations.

[0003] Whether it is the master database or the slave database, the data is updated in real-time or near real-time. When an error occurs in the business system, usually the data has been updated and the problematic data has been overwritten, posing challenges to troubleshooting. If it is necessary to simulate the data at the problem time point, it is necessary to re-export the full backup from the master database and re-build the database environment. If the selected time point is inaccurate, it is necessary to re-backup and re-build, and repeat this process. Exporting the full data usually takes several hours, and it will also increase the load on the master database, which may cause new failures. In addition, transferring the exported copy data to the new environment and restoring the data also takes several hours, consuming time, effort and wasting resources. Summary of the Invention

[0004] The object of the present invention is to propose a method and system for constructing a database sandbox environment based on a CDM super copy, which can quickly construct a data environment at a specified time point in a short time, thus greatly simplifying the process of troubleshooting and data recovery.

[0005] To achieve the object of the present invention, the following technical solutions are adopted:

[0006] The first aspect of the present invention proposes a method for constructing a database sandbox environment based on a CDM super copy, including the following steps:

[0007] According to the backup policy configured by the user, export the backup data from the source database at a scheduled time and transfer it to the storage node;

[0008] After performing a recovery process on the backup data, save it to the data directory of the storage node and take a snapshot of the data directory. At the same time, save the last archived log file name and the archived log data position information corresponding to the snapshot data to the snapshot record table;

[0009] According to the log acquisition policy configured by the user, obtain the archived log files from the source database at a scheduled time and save them to the archived log directory of the storage node. At the same time, record the key information of the archived log files and save it to the archived log record table;

[0010] When the user sets the time point for constructing the database sandbox at the operation front end, select a snapshot record closest to the time point for constructing the database sandbox from the snapshot record table in combination with the snapshot record table and the archived log record table;

[0011] Use the snapshot data corresponding to the selected snapshot record and the archival log to construct a database sandbox environment.

[0012] A further improvement is that when exporting backup data from the source database, the first export is a full backup data, and the subsequent exports are incremental backup data.

[0013] A further improvement is that for the full backup data, after recovery processing, it is directly saved to the data directory of the storage node and a snapshot is taken of the data directory; for the incremental backup data, after recovery processing, it is merged into the data directory of the storage node and a snapshot is taken of the data directory.

[0014] A further improvement is that the key information of the archival log file includes the serial number, file name, file size, start time and end time of the corresponding data of the archival log file.

[0015] A further improvement is that the snapshot record table also records the snapshot ID, snapshot time, and snapshot data directory path.

[0016] A further improvement is that exporting backup data and obtaining the archival log file are carried out during the idle time of the source database business system.

[0017] A further improvement is that the specific method of using the snapshot data corresponding to the selected snapshot record and the archival log to construct a database sandbox environment includes:

[0018] Clone snapshot data: Create a sandbox data directory on the storage node and clone the selected snapshot data into the sandbox data directory;

[0019] Mount directory: Mount the sandbox data directory of the storage node to the configuration data directory of the sandbox target host by NFS mounting, and mount the archival log directory of the storage node to the configuration archival log directory of the sandbox target host by NFS mounting;

[0020] Generate configuration file: Generate a database instance configuration file, and specify in the configuration file that the data directory of the sandbox database instance points to the configuration data directory of the sandbox target host, and write the configuration file to the data directory of the sandbox database instance;

[0021] Start database instance: Start and run the database instance on the sandbox target host;

[0022] Apply archival log: Query and apply all archival logs from the snapshot end time to the user-specified time point for constructing the database sandbox from the archival log record table.

[0023] A further improvement lies in that the specific method for querying and applying all archived logs from the snapshot end time to the user-set time point for building the database sandbox from the archived log record table includes:

[0024] Query archived logs: Query all archived logs from the archived log record table between the snapshot data end time and the user-set time point for building the database sandbox;

[0025] Determine the starting position: Use the archived log data position information in the snapshot record table to specify the starting position of the first archived log through the --start-position parameter;

[0026] Determine the end time: Specify the application end time of the last archived log through the --stop-datetime parameter;

[0027] Apply logs: Use the database tool to apply these archived logs and refresh the records in the archived logs into the sandbox database instance.

[0028] A further improvement lies in that the database instance is started and run on the sandbox target host through SSH.

[0029] The second aspect of the present invention proposes a system for building a database sandbox environment based on CDM super replicas, including:

[0030] A backup data export unit, configured to regularly export backup data from the source database according to the backup policy configured by the user and transmit it to the storage node;

[0031] A backup data processing and storage unit, configured to perform recovery processing on the backup data, save it to the data directory of the storage node, take a snapshot of the data directory, and simultaneously save the file name of the last archived log corresponding to the snapshot data and the archived log data position information to the snapshot record table;

[0032] An archived log acquisition and storage unit, configured to regularly acquire archived log files from the source database according to the log acquisition policy configured by the user, save them to the archived log directory of the storage node, and simultaneously record the key information of the archived log files and save it to the archived log record table;

[0033] A database sandbox environment construction unit, configured to, when the user sets the time point for building the database sandbox at the operation front end, select a snapshot record closest to the time point for building the database sandbox from the snapshot record table in combination with the snapshot record table and the archived log record table, and use the snapshot data corresponding to the selected snapshot record in combination with the archived logs to build the database sandbox environment.

[0034] The beneficial effects of the present invention are:

[0035] The data backup of the present invention is obtained during the idle time of the business system, avoiding the performance impact on the production environment. The backup data snapshot is compressed and stored in the storage node, occupying little space and not consuming production environment resources. The process of obtaining the archived log is lightweight and fast, usually completed within a few minutes, without the need to connect to the production database, reducing the impact on the production environment.

[0036] The backup data snapshot has been pre-stored in the storage node, eliminating the need for users to spend several hours exporting it. During database sandboxing, it only needs to be mounted to the sandbox target host through the NFS network, and this operation is completed within seconds. The archived log file is usually about 1GB in size, and the operation of applying one archived log is completed within seconds to minutes, greatly shortening the construction time. From mounting the backup data to applying the archived log, the entire construction process of the database instance is completed within minutes, significantly improving the efficiency.

[0037] In addition, the sandbox database constructed by the present invention is independent and does not affect the use of the production database. Users can freely perform various operations in the sandbox environment without any impact on the production environment. When constructing the sandbox data, users only need to perform simple interface operations to complete the construction of the database instance within minutes. When constructing the sandbox data, only simple interface operations are required to complete the construction of the database instance within minutes. When it is not needed, it can be quickly cleared, only by stopping the database instance and canceling the NFS network mount. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is a flowchart of a method for constructing a database sandbox environment based on CDM super replicas according to the present invention;

[0039] Figure 2 It is a flowchart of a method for constructing a database sandbox environment by combining snapshot data corresponding to selected snapshot records with archived logs in the present invention;

[0040] Figure 3 It is a schematic diagram of the construction of the sandbox environment in the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0041] In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, in order to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, the detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.

[0042] It should be understood that, as used in the specification of the present application and the appended claims, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their combinations.

[0043] It should also be understood that the term "and / or" used in the specification of the present application and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0044] In the description of the present disclosure, it should be understood that if the terms "upper", "lower", "front", "rear", "left" and "right" and the like indicate the orientation or positional relationship, they are based on the orientation or positional relationship shown in the drawings. This is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the indicated position or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation of the present disclosure. Additionally, in the description of the specification of the present application and the appended claims, the terms "first", "second", "third", etc. are only used for differential description and should not be construed as indicating or implying relative importance.

[0045] The reference to "one embodiment" or "some embodiments" etc. described in the specification of the present application means that a specific feature, structure or characteristic described in connection with that embodiment is included in one or more embodiments of the present application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments" etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0046] Please refer to the appended Figure 1 - appended Figure 3 , a method for constructing a database sandbox environment based on CDM (Copy Data Management) super replicas according to a first aspect of an embodiment of the present invention includes the following steps:

[0047] Step S1: According to the backup policy configured by the user, export backup data from the source database (which can be the master database or the slave database) at regular intervals according to a predetermined time and transfer it to the storage node.

[0048] Specifically, when exporting backup data from the source database, the first export is full backup data, and subsequent exports are incremental backup data.

[0049] It should be understood that the user can configure a backup policy at the operation front end. This backup policy is used to set the time, frequency, backup type (full backup or incremental backup), etc. for exporting backup data from the source database. Generally, the time for exporting backup data is usually during the idle time of the source database business system, and the backup data is transmitted over the network to the storage node.

[0050] Step S2: After restoring the backup data, save it to the data directory of the storage node and take a snapshot of the data directory. Each snapshot is a full amount of data that can be used by the database. At the same time, save the name of the last archived log file corresponding to the snapshot data and the archived log data position information to the snapshot record table.

[0051] Specifically, for full backup data, after performing a restore operation, directly save it to the data directory of the storage node and take a snapshot of the data directory; for incremental backup data, after performing a restore operation, merge it into the data directory of the storage node and take a snapshot of the data directory. The snapshot is a data snapshot at a certain point in time and can be used for restoration or building a sandbox environment at any time.

[0052] It can be understood that the backup data usually undergoes special processing such as compression before network transmission and cannot be directly recognized and used by the database. To make it recognizable and usable by the database, reprocessing of the backup data is required, such as decompression operations. This process is called restore.

[0053] Step S3: According to the log acquisition policy configured by the user, regularly obtain archived log files from the source database (which can be the master database or the slave database) at a predetermined time and save them to the archived log directory of the storage node. At the same time, record the key information of the archived log files and save it to the archived log record table.

[0054] Specifically, the key information of the archived log files includes the serial number, file name, file size, start time and end time of the corresponding data, etc. Through these key information, archived logs can be managed and utilized more efficiently to build a database sandbox environment.

[0055] It should be understood that the archive log is a type of log file in the database management system, which is used to record all change operations of the database to ensure data consistency and recoverability. The user can configure a backup policy at the operation front end. This backup policy is used to set the time, frequency, etc. for obtaining archived log files from the source database. Generally, the time for obtaining archived log files is usually during the idle time of the source database business system. The operation of obtaining archived log files will not affect the database, and each acquisition continues the serial number and position information of the previous archived file without duplicate acquisition.

[0056] Step S4: When the user sets the time point for building the database sandbox at the operation front end, select a snapshot record closest to the time point for building the database sandbox from the snapshot record table in combination with the snapshot record table and the archive log record table.

[0057] It should be understood that the snapshot record table stores the last archive log file name and archive log data site information corresponding to the snapshot data. The end time of the data of the snapshot can be found from the archive log record table according to the archive log file name. Therefore, a snapshot record closest to the time point for building the database sandbox can be found by combining the snapshot record table and the archive log record table according to the time point for building the database sandbox set by the user. That is, when the user wants to build a database sandbox environment at a specific time point, the system will search for the snapshot record closest to the time point set by the user in the snapshot record table, which can ensure that the selected snapshot can be closest to the time point expected by the user to the greatest extent.

[0058] Step S5: Use the snapshot data corresponding to the selected snapshot record in combination with the archive log to build the database sandbox environment.

[0059] It can be understood that by restoring the snapshot data and supplementing and updating according to the change information in the archive log, a database sandbox environment corresponding to the time point for building the database sandbox set by the user is realized, ensuring that the built sandbox environment is exactly the same as the production environment state at the specified time point.

[0060] Preferably, the snapshot record table also records the snapshot ID, snapshot time, and snapshot data directory path.

[0061] Specifically, in this embodiment, exporting the backup data and obtaining the archive log file are performed during the idle time of the source database business system, which can minimize the impact on the normal operation of the business, avoid the system performance degradation or jamming caused by data export and obtaining the archive log during the business peak period, and ensure the continuity and stability of the business.

[0062] The present invention realizes the efficient and accurate construction of the database sandbox environment through regular backup, snapshot management, archive log acquisition and application, and precise time point recovery during the idle time of the business system.

[0063] In this embodiment, the specific method of using the snapshot data corresponding to the selected snapshot record in combination with the archive log to build the database sandbox environment in step S5 includes:

[0064] Step S51: Clone the snapshot data: Create a sandbox data directory on the storage node, and clone the selected snapshot data into the sandbox data directory to prepare the basic data for building the sandbox environment.

[0065] Step S52: Mount Directories: Mount the sandbox data directory of the storage node to the configured data directory of the sandbox target host by means of NFS (Network File System) mounting. The purpose of this is to enable the sandbox target host to directly access the data on the storage node without having to copy the data again, simplifying the data transmission process; mount the archived log directory of the storage node to the configured archived log directory of the sandbox target host by means of NFS mounting. The purpose of this is to enable the sandbox target host to directly access the archived logs on the storage node so as to apply the archived logs when building the sandbox environment.

[0066] It can be understood that by means of NFS directory mounting, data sharing and accessibility are achieved for subsequent operations and use on the sandbox target host.

[0067] Step S53: Generate Configuration File: Generate a database instance configuration file to specify the data directory path of the sandbox database instance. In the configuration file, the data directory of the sandbox database instance is specified to point to the configured data directory of the sandbox target host, and the configuration file is written to the data directory of the sandbox database instance.

[0068] It can be understood that the configuration file includes various configuration parameters of the database instance, such as data directory path, log directory path, listening port, etc., to ensure that the database instance can correctly identify and use the sandbox data.

[0069] Step S54: Start Database Instance: Start and run the database instance on the sandbox target host to enter an operable state.

[0070] It should be understood that during the startup process, the system will read the parameters in the configuration file, initialize the database instance, and start the database service.

[0071] Step S55: Apply Archived Logs: Query and apply all archived logs from the snapshot end time to the user-specified time point for building the database sandbox from the archived log record table.

[0072] The present invention can achieve rapid initialization of the sandbox environment, reduce the time for data transmission and recovery, and improve the construction efficiency by creating a sandbox data directory on the storage node, cloning the selected snapshot data into the sandbox data directory, and mounting the sandbox data directory of the storage node to the configured data directory of the sandbox target host by means of NFS mounting, and mounting the archived log directory of the storage node to the configured archived log directory of the sandbox target host by means of NFS mounting. By combining the snapshot records and archived logs, it can be accurately restored to any user-specified time point to ensure that the data state of the sandbox environment is exactly the same as that of the target time point.

[0073] Further, in this embodiment, the specific method for querying and applying all archived logs from the snapshot end time to the user-specified time point for building the database sandbox in step S55 includes:

[0074] Step S551: Query archived logs: Query all archived logs from the archived log record table between the snapshot data end time and the user-specified time point for building the database sandbox, ensuring data integrity and pertinence.

[0075] It can be understood that by querying the archived logs, only the archived logs within the specified time range are selected, avoiding unnecessary log processing.

[0076] Step S552: Determine the starting position: Use the archived log data site information in the snapshot record table to specify the starting position of the first archived log through the --start-position parameter.

[0077] It can be understood that this operation of determining the starting position utilizes the archived log data site information in the snapshot record table and specifies the accurate starting position of the first archived log through a specific parameter, ensuring that the archived logs are applied starting from the correct data site and avoiding data inconsistency issues.

[0078] Step S553: Determine the end time: Specify the application end time of the last archived log through the --stop-datetime parameter.

[0079] It can be understood that by determining the end time, it is ensured that the archived logs are applied up to the user-specified time point and will not exceed this time point.

[0080] Step S554: Apply logs: Use the database tool to apply these archived logs and refresh the records in the archived logs to the sandbox database instance.

[0081] It can be understood that by applying the logs, it is ensured that all necessary archived logs are correctly applied to the sandbox database instance and restored to the user-specified time point.

[0082] Specifically, the records in the archived logs can be refreshed to the sandbox database instance through the apply archived log method. apply: The operation of applying logs. The archived logs record the logical operation records of the business, which can be understood as sql operations; the database system provides tools for applying logs, such as mysqlbinlog for mysql and rman for oracle. The log application tools input the archived log parameters and execute the logical data of the archived logs to refresh the data to the database instance to achieve the purpose of updating the database records.

[0083] Through the above steps, all archived logs can be accurately applied from the end time of the snapshot data to the time point of the database sandbox constructed as set by the user, ensuring that the data status in the sandbox environment is exactly the same as the time point required by the user.

[0084] Preferably, in step S54, starting and running the database instance on the sandbox target host is by means of SSH (Secure Shell).

[0085] Generally speaking, the data backup of the present invention is obtained during the idle time of the business system, avoiding the performance impact on the production environment. The backup data snapshot is compressed and stored in the storage node, occupying little space and not occupying the production environment resources. The process of obtaining the archived logs is lightweight and fast, usually completed within a few minutes, without connecting to the production database, reducing the impact on the production environment.

[0086] The backup data snapshot has been saved in the storage node in advance, and there is no need for the user to spend several hours exporting it. When constructing the database sandbox, it only needs to be mounted to the sandbox target host through the NFS network, and this operation is completed within seconds. The archived log file is usually about 1GB in size, and the operation of applying one archived log is completed within seconds to minutes, greatly shortening the construction time. From mounting the backup data to applying the archived logs, the entire construction process of the database instance is completed within minutes, significantly improving the efficiency.

[0087] In addition, the sandbox database constructed by the present invention is independent and does not affect the use of the production database. Users can freely perform various operations in the sandbox environment without any impact on the production environment. When it is necessary to construct the sandbox data, the user only needs to perform simple interface operations to complete the construction of the database instance within minutes. When it is necessary to construct the sandbox data, only simple interface operations are required to complete the construction of the database instance within minutes. When it is not needed, it can be quickly cleaned up, only by stopping the database instance and canceling the NFS network mount.

[0088] A second aspect of the embodiments of the present invention provides a system for constructing a database sandbox environment based on a CDM super replica, which is used to execute a method for constructing a database sandbox environment based on a CDM super replica in the first embodiment of the present invention. Specifically, the system includes:

[0089] A backup data export unit, which is used to export backup data from the source database regularly according to the backup policy configured by the user and transmit it to the storage node.

[0090] A backup data processing and storage unit is used to perform recovery processing on backup data, save it to the data directory of the storage node after the processing, take a snapshot of the data directory, and at the same time save the last archived log file name corresponding to the snapshot data and the archived log data position information to the snapshot record table.

[0091] An archived log acquisition and storage unit is used to regularly obtain archived log files from the source database according to the log acquisition policy configured by the user, save them to the archived log directory of the storage node, and at the same time record the key information of the archived log files and save it to the archived log record table.

[0092] A database sandbox environment construction unit is used to, when the user sets the time point for constructing the database sandbox at the operation front end, select a snapshot record closest to the time point for constructing the database sandbox from the snapshot record table in combination with the snapshot record table and the archived log record table, and use the snapshot data corresponding to the selected snapshot record and the archived log to construct the database sandbox environment.

[0093] Since the system for constructing a database sandbox environment based on the CDM super replica provided by the embodiments of the present invention corresponds to the method for constructing a database sandbox environment based on the CDM super replica provided by the first aspect of the present invention, the implementation manners of the foregoing method for constructing a database sandbox environment based on the CDM super replica are also applicable to the system for constructing a database sandbox environment based on the CDM super replica provided by this embodiment, and will not be described in detail in this embodiment.

[0094] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraint conditions of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0095] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included in the protection scope of this application.

Claims

1. A method for constructing a database sandbox environment based on CDM super replicas, characterized in that It includes the following steps: According to the backup policy configured by the user, export the backup data from the source database at regular intervals according to a predetermined time and transfer it to the storage node; After performing recovery processing on the backup data, save it to the data directory of the storage node and take a snapshot of the data directory. At the same time, save the last archived log file name and archived log data position information corresponding to the snapshot data to the snapshot record table; According to the log acquisition policy configured by the user, obtain the archived log files from the source database at regular intervals according to a predetermined time and save them to the archived log directory of the storage node. At the same time, record the key information of the archived log files and save it to the archived log record table; When the user sets the time point for building the database sandbox at the operation front end, select a snapshot record closest to the time point for building the database sandbox from the snapshot record table in combination with the snapshot record table and the archived log record table; Use the snapshot data corresponding to the selected snapshot record and the archived log to build the database sandbox environment, including: Clone the snapshot data: Create a sandbox data directory on the storage node and clone the selected snapshot data to the sandbox data directory; Mount the directory: Mount the sandbox data directory of the storage node to the configured data directory of the sandbox target host by means of NFS mounting, and mount the archived log directory of the storage node to the configured archived log directory of the sandbox target host by means of NFS mounting; Generate a configuration file: Generate a database instance configuration file. In the configuration file, specify that the data directory of the sandbox database instance points to the configured data directory of the sandbox target host, and write the configuration file to the data directory of the sandbox database instance; Start the database instance: Start and run the database instance on the sandbox target host; Apply the archived log: Query and apply all archived logs from the end time of the snapshot to the time point for building the database sandbox set by the user from the archived log record table, including: Query the archived log: Query all archived logs between the end time of the snapshot data and the time point for building the database sandbox set by the user from the archived log record table; Determine the starting position: Use the archived log data position information in the snapshot record table to specify the starting position of the first archived log through the --start-position parameter; Determine the end time: Specify the application end time of the last archived log through the --stop-datetime parameter; Apply the log: Use the database tool to apply these archived logs and refresh the records in the archived logs to the sandbox database instance.

2. The method for constructing a database sandbox environment based on CDM super replicas according to claim 1, wherein When exporting the backup data from the source database, the first export is the full backup data, and the subsequent exports are incremental backup data.

3. The method for constructing a database sandbox environment based on CDM super replicas according to claim 2, characterized in that, For the full backup data, after performing recovery processing, directly save it to the data directory of the storage node and take a snapshot of the data directory; for the incremental backup data, after performing recovery processing, merge it into the data directory of the storage node and take a snapshot of the data directory.

4. A method for constructing a database sandbox environment based on CDM super replicas according to claim 1, characterized in that, The key information of the archived log file includes the serial number, file name, file size, start time and end time of the corresponding data of the archived log file.

5. A method for constructing a database sandbox environment based on CDM super replicas according to claim 1, characterized in that The snapshot record table also records the snapshot ID, snapshot time, and snapshot data directory path.

6. A method for constructing a database sandbox environment based on CDM super replicas according to claim 1, characterized in that, Exporting backup data and obtaining archived log files are performed during the idle time of the source database business system.

7. A method for constructing a database sandbox environment based on CDM super replicas according to claim 1, characterized in that Starting and running a database instance on the sandbox target host is done via SSH.

8. A system for constructing a database sandbox environment based on CDM super replicas, characterized in that, A method for constructing a database sandbox environment based on a CDM super copy as described in any one of claims 1-7, includes: A backup data export unit, configured to export backup data from the source database at regular intervals according to a backup policy configured by the user and transfer it to a storage node; A backup data processing and storage unit, configured to perform recovery processing on the backup data, save it to the data directory of the storage node, take a snapshot of the data directory, and simultaneously save the last archived log file name corresponding to the snapshot data and the archived log data position information to the snapshot record table; An archived log acquisition and storage unit, configured to obtain archived log files from the source database at regular intervals according to a log acquisition policy configured by the user, save them to the archived log directory of the storage node, and simultaneously record the key information of the archived log files and save it to the archived log record table; A database sandbox environment construction unit, configured to, when the user sets a database sandbox construction time point at the operation front end, select a snapshot record closest to the database sandbox construction time point from the snapshot record table in combination with the snapshot record table and the archived log record table, and use the snapshot data corresponding to the selected snapshot record and the archived log to construct a database sandbox environment.

Citation Information

Patent Citations

  • Oracle timely mounting and restoring system based on timing backup

    CN109325075A

  • Method and equipment for recovering data based on backup system

    CN113360322A