Backup method and device, recovery method and device, computer equipment and storage medium

By employing a backup method that coordinates the agent and storage ends, efficient data recovery of the data sharing cluster is achieved. Through a combined backup strategy of initial full backup and non-initial incremental backup, data integrity and rapid recovery are ensured, solving the problems of low storage resource utilization and low recovery efficiency in traditional technologies.

CN121166445APending Publication Date: 2025-12-19GUANGZHOU DINGJIA COMPUTER TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511318324.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-16
Publication Date
2025-12-19

AI Technical Summary

Technical Problem

Traditional incremental backup methods for data sharing clusters suffer from low storage resource utilization and low data recovery efficiency, especially when incremental backup sets fail and require chained recovery, resulting in limited data recovery efficiency.

Method used

The backup method employs a collaborative approach between the agent and the storage end. The first backup copies all data files and archived logs, while subsequent backups copy changed data files. A notification is sent after the backup is completed to trigger a snapshot, ensuring data integrity and rapid recovery.

Benefits of technology

It improves the efficiency of data recovery, reduces storage resource consumption, shortens recovery time, ensures the accuracy and efficiency of recovery, and solves the problem of low data recovery efficiency in traditional technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121166445A_ABST
    Figure CN121166445A_ABST
Patent Text Reader

Abstract

The invention relates to a backup method and device, a recovery method and device, computer equipment, a readable storage medium and a computer program product. The backup method is applied to an agent side and comprises the following steps: initiating a backup request for a database to be backed up to a storage side; mounting the backup set to a preset backup directory through the access interface information; under the condition that the backup request is the first backup request for the database to be backed up, copying each data file to be backed up in the backup set and a corresponding archiving log to a preset backup directory to complete backup of the database to be backed up; under the condition that the backup request is not the first backup request for the database to be backed up, copying the changed data file to be backed up in the backup set to a preset backup directory to complete backup of the database to be backed up; and after the backup of the database to be backed up is completed, sending backup completion notification information to the storage end. By adopting the method, the data recovery efficiency of the data sharing cluster can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, and in particular to a backup method, a recovery method, an apparatus, a computer device, a readable storage medium and a computer program product. BACKGROUND

[0002] In the face of the unprecedented business volume and the explosive data volume in the digital age, a data sharing cluster (or a shared storage database cluster) supporting high availability and scalability of network computing environment has emerged. In order to prevent data loss caused by hardware failure, software failure, natural disaster, misoperation, etc., higher requirements are put forward for the performance and efficiency of data backup and recovery of the data sharing cluster.

[0003] Although the incremental backup mode of the traditional technology in the data sharing cluster saves backup storage space compared with the full backup, the incremental backup needs to backup the newly added or modified data based on the last full or incremental backup, and the backup data set still occupies a large storage space of the database, the storage resource utilization rate is low, and there is a problem of invalidation if one of the incremental backup sets is invalid, which leads to the need for chain recovery in subsequent data recovery, and the data recovery efficiency is limited.

[0004] Therefore, the traditional technology has the problem of low data recovery efficiency in the recovery of the data sharing cluster. SUMMARY

[0005] Therefore, it is necessary to provide a backup method, a recovery method, an apparatus, a computer device, a readable storage medium and a computer program product capable of improving the data recovery efficiency of the data sharing cluster.

[0006] In a first aspect, the present application provides a backup method applied to an agent end, the method comprising the following steps:

[0007] initiating a backup request for a to-be-backed-up database to a storage end; the backup request is used to instruct the agent end to connect the storage end, so that the storage end acquires a backup set corresponding to the backup request, and returns access interface information corresponding to the backup set to the agent end;

[0008] mounting the backup set to a pre-device backup directory through the access interface information;

[0009] in the case that the backup request is a first backup request for the to-be-backed-up database, copying each to-be-backed-up data file in the backup set to the pre-device backup directory, and copying an archive log corresponding to the to-be-backed-up data file to the pre-device backup directory, to complete the backup of the to-be-backed-up database;

[0010] copying the changed to-be-backed-up data file in the backup set to the pre-device backup directory to complete the backup of the to-be-backed-up database;

[0011] sending backup completion notification information to the storage end after the backup of the to-be-backed-up database is completed; the backup completion notification information is used to instruct the storage end to perform snapshot saving on the backup set.

[0012] In one of the embodiments, the copying the changed to-be-backed-up data file in the backup set to the pre-device backup directory comprises:

[0013] obtaining a current to-be-backed-up data file; the current to-be-backed-up data file is any one to-be-backed-up data file in the backup set;

[0014] copying the current to-be-backed-up data file to the pre-device backup directory in a case where the current to-be-backed-up data file does not exist in the backup set;

[0015] obtaining a differential file content and copying the differential file content to the pre-device backup directory in a case where the current to-be-backed-up data file exists in the backup set and the file content of the current to-be-backed-up data file and the same-named data file is different.

[0016] In one of the embodiments, the obtaining the differential file content comprises:

[0017] obtaining a magic number identifier of a historical backup set in a last backup of the backup request, and deriving a BCT file of the historical backup set according to the magic number identifier;

[0018] obtaining a changed data block in the current to-be-backed-up data file according to the BCT file when the BCT file is valid, and taking the changed data block as the differential file content;

[0019] obtaining a target data page in which a file data block in the current to-be-backed-up data file is changed according to an automatic storage management interface when the BCT file is invalid, and taking the target data page as the differential file content.

[0020] In one of the embodiments, the obtaining the target data page in which the file data block in the current to-be-backed-up data file is changed according to the automatic storage management interface comprises:

[0021] According to the automatic storage management file handle of the data file to be backed up, the page size of the automatic storage management file corresponding to the data file to be backed up is acquired;

[0022] Through the automatic storage management interface corresponding to the page size, the first data page header corresponding to each data page contained in the automatic storage management file and the second data page header corresponding to each data page contained in the data file with the same name are acquired;

[0023] If the log sequence number in the first data page header of any data page is different from the log sequence number in the second data page header corresponding to the data page, the data page is taken as the target data page.

[0024] In a second aspect, the application provides a backup method applied to a storage end, and the method comprises the following steps:

[0025] In response to a backup request for a database to be backed up initiated by an agent end;

[0026] According to the backup request, a backup set corresponding to the backup request is created, and the backup set is stored;

[0027] Access interface information corresponding to the backup set is returned to the agent end, and the access interface information is used to instruct the agent end to mount the backup set to a pre-device backup directory, and in a case where the backup request is a first backup request for the database to be backed up, each data file to be backed up in the backup set is copied to the pre-device backup directory to complete backup of the database to be backed up; in a case where the backup request is not a first backup request for the database to be backed up, the data file to be backed up that has changed in the backup set is copied to the pre-device backup directory to complete backup of the database to be backed up; so that the agent end sends backup completion notification information after backup of the database to be backed up is completed;

[0028] The backup completion notification information is received, and a snapshot of the backup set is saved according to the backup completion notification information.

[0029] In one of the embodiments, the step of creating a backup set corresponding to the backup request according to the backup request and storing the backup set comprises:

[0030] In a case where the backup request is a first backup request for the database to be backed up, a storage pool is created, and a storage volume is created in the storage pool;

[0031] In a case where the backup request is not a first backup request for the database to be backed up, a snapshot volume of a last backup of the backup request is acquired, and a first cloned volume is created for the snapshot volume.

[0032] store the storage volume or the first cloned volume as a backup set corresponding to the backup request.

[0033] In a third aspect, the present application provides a recovery method applied to an agent end, the method comprising the following steps:

[0034] initiating a recovery request for a backup database to a storage end; the recovery request is used to instruct the agent end to connect the storage end, so that the storage end acquires a backup set to be recovered corresponding to the recovery request, and returns access interface information corresponding to the backup set to be recovered to the agent end; the backup database is backed up by any one of the backup methods described above;

[0035] mounting the backup set to be recovered to a preset recovery directory through the access interface information;

[0036] closing the backup database, and recovering the closed backup database based on an archive log of the backup set to be recovered, to complete recovery of the backup database.

[0037] In one of the embodiments, after the backup database is recovered, the closed backup database is reopened; the method further comprises:

[0038] after the backup database is reopened, in response to a dismounting request initiated by the storage end, closing the backup database and dismounting the backup set to be recovered on the preset recovery directory.

[0039] In a fourth aspect, the present application provides a recovery method applied to a storage end, the method comprising the following steps:

[0040] in response to a recovery request for a backup database initiated by an agent end; the backup database is backed up by any one of the backup methods described above;

[0041] according to the recovery request, acquiring a backup set that has completed backup and is saved through snapshot, cloning the backup set to obtain a second cloned volume, and storing the second cloned volume as a backup set to be recovered;

[0042] returning access interface information corresponding to the backup set to be recovered to the agent end; the access interface information is used to instruct the agent end to mount the backup set to be recovered to a preset recovery directory, close the backup database, recover the closed backup database based on an archive log of the backup set to be recovered, and complete recovery of the backup database.

[0043] In one of the embodiments, after the agent side completes the restoration of the backed-up database, the method further comprises:

[0044] When detecting the operation of canceling mounting the backup set to be restored, a cancel mounting request corresponding to the backup set to be restored is initiated to the agent side, and the storage of the backup set to be restored is canceled; the cancel mounting request is used to instruct the agent side to close the backed-up database and cancel the mounting of the backup set to be restored on the preset restoration directory;

[0045] When detecting the operation of deleting the backup set to be restored, the backup set to be restored is deleted.

[0046] In a fifth aspect, the present application provides a backup device applied to an agent side, the device comprising:

[0047] A backup request sending module is configured to initiate a backup request for a database to be backed up to a storage side; the backup request is used to instruct the agent side to connect the storage side, so that the storage side acquires a backup set corresponding to the backup request and returns access interface information corresponding to the backup set to the agent side;

[0048] A first backup set mounting module is configured to mount the backup set to a preset backup directory through the access interface information;

[0049] A first data backup module is configured to, in a case where the backup request is a first backup request for the database to be backed up, copy each to-be-backed-up data file in the backup set to the preset backup directory, and copy an archive log corresponding to the to-be-backed-up data file to the preset backup directory, so as to complete the backup of the database to be backed up;

[0050] A second data backup module is configured to, in a case where the backup request is not a first backup request for the database to be backed up, copy a to-be-backed-up data file that has changed in the backup set to the preset backup directory, so as to complete the backup of the database to be backed up;

[0051] A completion notification sending module is configured to, after the backup of the database to be backed up is completed, send a backup completion notification information to the storage side; the backup completion notification information is used to instruct the storage side to perform snapshot saving on the backup set.

[0052] In a sixth aspect, the present application provides a backup device applied to a storage side, the device comprising:

[0053] A backup request response module is configured to respond to a backup request for a database to be backed up initiated by an agent side;

[0054] The first backup set storage module is configured to create a backup set corresponding to the backup request according to the backup request, and store the backup set.

[0055] The first interface information returning module is configured to return access interface information corresponding to the backup set to the agent end, and the access interface information is used to instruct the agent end to mount the backup set to a pre-backup directory, and in a case where the backup request is a first backup request for the to-be-backed-up database, copy each to-be-backed-up data file in the backup set to the pre-backup directory to complete backup of the to-be-backed-up database; in a case where the backup request is not a first backup request for the to-be-backed-up database, copy a to-be-backed-up data file that has changed in the backup set to the pre-backup directory to complete backup of the to-be-backed-up database; so that the agent end sends backup completion notification information after backup of the to-be-backed-up database is completed.

[0056] The completion notification receiving module is configured to receive the backup completion notification information, and perform snapshot saving on the backup set according to the backup completion notification information.

[0057] In a seventh aspect, the present application provides a recovery device applied to an agent end, and the device comprises:

[0058] The recovery request sending module is configured to initiate a recovery request for a backed-up database to a storage end; the recovery request is used to instruct the agent end to connect the storage end, so that the storage end acquires a to-be-recovered backup set corresponding to the recovery request, and returns access interface information corresponding to the to-be-recovered backup set to the agent end; the backed-up database is backed up by using any one of the backup methods.

[0059] The second backup set mounting module is configured to mount the to-be-recovered backup set to a pre-set recovery directory through the access interface information.

[0060] The data recovery module is configured to close the backed-up database, recover the closed backed-up database based on an archive log of the to-be-recovered backup set, and complete recovery of the backed-up database.

[0061] In an eighth aspect, the present application provides a recovery device applied to a storage end, and the device comprises:

[0062] The recovery request response module is configured to respond to a recovery request for a backed-up database initiated by an agent end; the backed-up database is backed up by using any one of the backup methods.

[0063] The second backup set storage module is configured to obtain a corresponding completed backup and a backup set saved by snapshot according to the recovery request, clone the backup set to obtain a second cloned volume, and store the second cloned volume as a backup set to be recovered.

[0064] The second interface information returning module is configured to return access interface information corresponding to the backup set to be recovered to the proxy end, and the access interface information is used to instruct the proxy end to mount the backup set to be recovered to a preset recovery directory, close the backed-up database, and recover the closed backed-up database based on an archive log of the backup set to be recovered, so as to complete the recovery of the backed-up database.

[0065] In a ninth aspect, the present application further provides a computer device including a memory and a processor, the memory stores a computer program, and the processor implements the steps of the backup method and the recovery method when executing the computer program.

[0066] In a tenth aspect, the present application further provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the method when executed by a processor.

[0067] In an eleventh aspect, the present application further provides a computer program product, which includes a computer program, and the computer program implements the steps of the method when executed by a processor.

[0068] The backup method, the recovery method, the device, the computer device, the readable storage medium and the computer program product, by initiating a backup request for the to-be-backed-up database to the storage end; the backup request is used to instruct the agent end to connect the storage end, so that the storage end obtains a backup set corresponding to the backup request, and returns access interface information corresponding to the backup set to the agent end; the backup set is mounted to the pre-device backup directory through the access interface information; in the case that the backup request is a first backup request for the to-be-backed-up database, each to-be-backed-up data file in the backup set is copied to the pre-device backup directory, and an archive log corresponding to the to-be-backed-up data file is copied to the pre-device backup directory, so as to complete the backup of the to-be-backed-up database; in the case that the backup request is not a first backup request for the to-be-backed-up database, the to-be-backed-up data file that exists in the backup set is copied to the pre-device backup directory, so as to complete the backup of the to-be-backed-up database; after the backup of the to-be-backed-up database is completed, backup completion notification information is sent to the storage end; the backup completion notification information is used to instruct the storage end to perform snapshot saving on the backup set. By initiating a backup request for the to-be-backed-up database to the storage end, the agent end can be connected to the storage end, and the backup set of the storage end can be mounted to the pre-device backup directory locally of the agent end, so that the agent end can quickly and efficiently access the backup data of the storage end, and the positioning preparation time of the agent end for the backup data is shortened for subsequent recovery processes. By copying full data files and archive logs during the first backup, the data integrity during the first backup can be ensured, and a data benchmark is provided for identifying changed data in non-first backup, so that a complete initial state of the backed-up database is provided for recovery, the archive log ensures that the recovery can be accurately positioned to a specified target time point during recovery, and the recovery success rate is improved. By copying the files changed after the last backup during non-first backup, the amount of backup data can be reduced, the storage resource consumption and space occupation are reduced, the data range and complexity are reduced for subsequent recovery, and thus the combined backup of the first complete backup and the non-first incremental backup enables only the combined backup data to be loaded during subsequent recovery, so that the data integrity is ensured, the storage space is reduced, and the recovery time is shortened, thereby improving the efficiency of subsequent recovery. After the backup is completed, the notification is sent to trigger the storage end to perform snapshot saving, so that a read-only copy of the original state of the backup set at a specific time point can be saved, data invalidation caused by subsequent data changes is avoided, the snapshot copy only records the changed data through write-time copying, the storage resource occupation space is reduced, a specific time point and a complete and consistent data source are provided for subsequent instant recovery, and thus the accuracy and efficiency of the recovery are ensured, and the problem of low data recovery efficiency in the recovery of the data sharing cluster in the traditional technology is solved. BRIEF DESCRIPTION OF DRAWINGS

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

[0070] Figure 1 This is an application environment diagram of a backup method in one embodiment;

[0071] Figure 2 This is a flowchart illustrating a backup method in one embodiment;

[0072] Figure 3 This is a flowchart illustrating another backup method in one embodiment;

[0073] Figure 4 This is a flowchart illustrating a recovery method in one embodiment;

[0074] Figure 5 This is a flowchart illustrating another recovery method in one embodiment;

[0075] Figure 6 This is a flowchart illustrating a backup method applied to a proxy in a specific embodiment;

[0076] Figure 7 This is a flowchart illustrating a backup method applied to the storage side in a specific embodiment;

[0077] Figure 8 This is a flowchart illustrating a recovery method applied to a proxy in a specific embodiment;

[0078] Figure 9 This is a flowchart illustrating a recovery method applied to the storage side in a specific embodiment;

[0079] Figure 10 This is a structural block diagram of a backup device in one embodiment;

[0080] Figure 11 This is a structural block diagram of another backup device in one embodiment;

[0081] Figure 12 This is a structural block diagram of a recovery device in one embodiment;

[0082] Figure 13 This is a structural block diagram of another recovery device in one embodiment;

[0083] Figure 14 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0084] 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.

[0085] It should be noted that the terms "first," "second," etc., used in this application may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion.

[0086] The backup method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, for example, two types of servers can participate in data backup and recovery: a proxy server 101 (hereinafter referred to as the proxy end), which performs backup and recovery operations; and a storage server 102 (hereinafter referred to as the storage end), which stores backup and recovery resources. The proxy end 101 can initiate a backup request for the database to be backed up to the storage end 102 to connect to the storage end 102. The storage end 102 can create a corresponding backup set according to the backup request, store the backup set, and return the access interface information corresponding to the backup set to the proxy end 101. The proxy end 101 can mount the backup set to a preset backup directory through the access interface information. If the backup request is the first backup request for the database to be backed up, the proxy end 101 can copy each data file to be backed up in the backup set to the preset backup directory, and also copy the archived logs corresponding to the data files to be backed up to the preset backup directory to complete the backup of the database to be backed up. If the backup request is not the first backup request for the database to be backed up, the proxy end 101 can copy the changed data files to be backed up in the backup set to the preset backup directory to complete the backup of the database to be backed up. Agent 101 can send a backup completion notification to storage 102 after the backup of the database to be backed up is complete. Storage 102 receives the backup completion notification and saves a snapshot of the backup set. Agent 101 and storage 102 can be independent physical servers; they can also be a server cluster or distributed system consisting of multiple physical servers, i.e., a data sharing cluster, such as DMDSC (DM Data Shared Cluster); or they can be cloud servers providing cloud computing services. In a data sharing cluster, there are multiple server nodes, and agent 101 can be on any node in the data sharing cluster.

[0087] In one exemplary embodiment, such as Figure 2As shown, a backup method is provided and applied to the agent 101. This embodiment applies the method to... Figure 1 The method is illustrated using a proxy terminal 101 as an example. In this embodiment, the method includes the following steps S202 to S210. Wherein:

[0088] Step S202: Initiate a backup request for the database to be backed up to storage terminal 102; the backup request is used to instruct agent terminal 101 to connect to storage terminal 102 so that storage terminal 102 can obtain the backup set corresponding to the backup request and return the access interface information corresponding to the backup set to agent terminal 101.

[0089] During backup and recovery, you can use the snapshot and cloning functions of ZFS (Zettabyte File System) and the iSCSI (Internet Small Computer System Interface) storage protocol for network storage.

[0090] In a specific implementation, a user can select a database to be backed up in the data sharing cluster on the user interface of the database management system and submit a backup operation for it. After the agent 101 detects the user's backup operation, it sends a backup request to the storage 102 for the database to be backed up. The backup request is used to instruct the agent 101 to connect to the storage 102 through the access interface so that the storage 102 can obtain the backup set corresponding to the backup request and return the access interface information corresponding to the backup set to the agent 101.

[0091] Step S204: Mount the backup set to the preset backup directory by accessing the interface information.

[0092] In the specific implementation, a preset backup directory can be stored on the agent 101 to store backup sets. The agent 101 can mount the backup sets to the preset backup directory by accessing the interface information.

[0093] For example, access interface information can be provided based on the iSCSI (Internet Small Computer System Interface) interface protocol according to relevant operations. Agent 101 can initialize the iSCSI Initiator, initiate access and connection requests to the iSCSI Target installed on storage 102, connect the Initiator of agent 101 to the Target of storage 102, and mount the backup set to a preset / agent / data directory, so that agent 101 can directly and quickly access and use the backup set in storage 102 through a preset specific folder path.

[0094] After mounting the backup set to the preset backup directory, the agent 101 can also flush the data (i.e., dirty page data) in the memory of the database to be backed up that has not been written to the disk, and synchronize the dirty page data to the disk to ensure data consistency. This can be done using the checkpoint operation (i.e., checkpoint(100)) of DISQL (a database client tool).

[0095] Step S206: If the backup request is the first backup request for the database to be backed up, copy each data file to be backed up in the backup set to the preset backup directory, and copy the archived logs corresponding to the data files to be backed up to the preset backup directory to complete the backup of the database to be backed up.

[0096] It should be noted that the data sharing cluster can operate in archive mode, meaning the database stores archived logs containing transaction timestamps or Log Sequence Numbers (LSNs). Agent 101 can access all archived logs in the data sharing cluster from any node within the cluster.

[0097] In the specific implementation, when the backup request is the first backup request for the database to be backed up, that is, the backup request is the initial composite backup, the agent 101 can copy each data file to be backed up in the backup set to the preset backup directory. At the same time, it can obtain the log sequence number (LSN) of the backup set, including the start log sequence number (BEGIN_LSN) and the end log sequence number (END_LSN). Based on the two log sequence numbers, the corresponding archived logs are obtained, and then the archived logs corresponding to the data files to be backed up are copied to the preset backup directory.

[0098] For example, agent 101 can use DMASMTOOL (Automatic Storage Management Tool) to copy each data file to be backed up in the backup set to the preset / agent / data directory. Simultaneously, it can copy the archived logs corresponding to the data files to be backed up in the backup set generated during the backup process to the / agent / data directory. Agent 101 can also copy each configuration file to be backed up in the backup set (such as dm.ini and dm.ctl files) to the preset / agent / data directory.

[0099] Step S208: If the backup request is not the first backup request for the database to be backed up, copy the changed data files to be backed up in the backup set to the preset backup directory to complete the backup of the database to be backed up.

[0100] In practical implementation, when the backup request is not the first backup request for the database to be backed up (i.e., the backup request is not the initial composite backup), the backup can be concentrated on copying the data files to be backed up whose filenames or contents have changed since the last backup to the preset backup directory. Simultaneously, the archived logs corresponding to the data files to be backed up generated during the backup process can also be copied to the preset backup directory.

[0101] Step S210: After the backup of the database to be backed up is completed, a backup completion notification message is sent to the storage terminal 102; the backup completion notification message is used to instruct the storage terminal 102 to save a snapshot of the backup set.

[0102] In a specific implementation, after the backup of the database to be backed up is completed, the agent 101 can send a backup completion notification message to the storage 102, which instructs the storage 102 to save a snapshot of the backup set.

[0103] When the backup is complete, the agent 101 can also record the page size of the database to be backed up and the magic number (bakset_magic) used to uniquely identify the backup set to ensure the integrity and legitimacy of the backup set.

[0104] The aforementioned backup method applied to the agent end, by initiating a backup request for the database to be backed up to the storage end, enables the agent end to connect to the storage end and mount the backup set of the storage end to a preset backup directory on the agent end's local machine. This ensures that the agent end can quickly and efficiently access the backup data on the storage end, shortening the agent end's preparation time for locating backup data in the subsequent recovery process. By copying the full data files and archived logs during the first backup, both the data integrity at the time of the first backup and the data baseline for identifying changed data in subsequent backups are ensured. This provides a complete initial state of the backed-up database for recovery, and the archived logs also ensure that the recovery can accurately locate the specified target time point, improving the recovery success rate. By copying files that have changed since the last backup in subsequent backups, the amount of backup data can be reduced, lowering storage costs. The reduced resource consumption and space occupation narrowed the data scope and complexity for subsequent recovery. This combined backup of the initial full backup and subsequent incremental backups allows subsequent recovery to rely solely on loading the combined backup data, ensuring data integrity while reducing storage space and shortening recovery time, thus improving recovery efficiency. A notification is sent after backup completion to trigger a snapshot save on the storage side. This saves a read-only copy of the backup set's original state at a specific point in time, preventing backup data from becoming invalid due to subsequent data changes. The snapshot copy also records only changed data through copy-on-write, reducing storage space occupation and providing a clear time point and a complete and consistent data source for subsequent real-time recovery. This ensures the accuracy and efficiency of recovery, solving the problem of low data recovery efficiency in traditional data-sharing clusters.

[0105] In an exemplary embodiment, copying a modified data file to be backed up from the backup set to a preset backup directory includes: obtaining the current data file to be backed up; the current data file to be backed up is any one of the data files to be backed up from the backup set; if the current data file to be backed up does not have a data file with the same name as the backup set, copying the current data file to be backed up to the preset backup directory; if the current data file to be backed up has a data file with the same name as the backup set, and the file content of the current data file to be backed up differs from that of the data file with the same name, obtaining the differing file content and copying the differing file content to the preset backup directory.

[0106] In practical implementation, for cases where the backup request is not the first backup request for the database to be backed up, any data file to be backed up in the backup set can be obtained as the current data file to be backed up; if the current data file to be backed up does not have a data file with the same name as the backup set, that is, the current data file to be backed up is not in the historical backup set of the last backup, but a new data file created after the last backup, the current data file to be backed up is copied to the preset backup directory; if the current data file to be backed up has a data file with the same name as the backup set, and the file content of the current data file to be backed up differs from that of the data file with the same name, that is, the current data file to be backed up has a data file with the same name in the historical backup set of the last backup, but the file content has changed since the last backup, the differing file content is obtained and copied to the preset backup directory.

[0107] The technical solution of this embodiment addresses the scenario of non-initial backups by having the agent copy newly added data files that do not have the same name, as well as modified data files that have the same name but different content. This ensures the data integrity of newly added files while reducing the resource consumption of copying modified files. This differentiated hybrid backup strategy balances data integrity and resource utilization, achieving efficient synthetic backup and providing necessary support for subsequent accurate and timely recovery.

[0108] In an exemplary embodiment, obtaining the differencing file content includes: obtaining the magic number identifier of the historical backup set in the previous backup of the backup request, and exporting the BCT file of the historical backup set based on the magic number identifier; when the BCT file is valid, obtaining the changed data blocks in the current data file to be backed up based on the BCT file, and using the changed data blocks as the differencing file content; when the BCT file is invalid, obtaining the target data page in the current data file to be backed up where the file data blocks have changed based on the automatic storage management interface, and using the target data page as the differencing file content.

[0109] Among them, the BCT file (Block Change Tracking) is used to record the change information of each data block in the data file. An invalid BCT file may mean that the historical backup set has not enabled the BCT file or that the BCT file is abnormal.

[0110] In practical implementation, when a data file to be backed up has the same name as a data file in the backup set, but the content of the data file to be backed up differs from that of the data file with the same name, the magic number identifier of the historical backup set from the previous backup request can be obtained. The BCT file of the historical backup set can then be exported based on the magic number identifier. For example, DISQL can be used to export the BCT file.

[0111] When the BCT file is valid, the changed data blocks in the current backup file can be obtained from the BCT file, and these changed data blocks can be used as the differences in the file content. For example, the changed data blocks can be copied to a preset backup directory using the dd tool provided by DMASMTOOL. After the copy is complete, the data headers of the data files with the same name can be checked and matched based on the log sequence number of the backup file corresponding to the changed data blocks to ensure the data consistency and integrity of the current backup file after copying.

[0112] When a BCT file is invalid, the target data page where the file data block in the current data file to be backed up has been modified can be obtained using the automatic storage management interface, and this target data page can be used as the differencing file content. For example, a dmasm_client tool (automatic storage management client tool) can be encapsulated and designed based on dmasmapi2.h (an automatic storage management interface) to back up the target data page where the file data block in the current data file to be backed up has been modified.

[0113] The technical solution of this embodiment addresses the issue of altered data files with the same name but different content. By utilizing BCT files, the agent can accurately identify changes in data blocks within the differing file content, thereby ensuring accurate acquisition of the differing file content. This provides an accurate and reliable data file foundation for copying files with the same name but different content during non-initial backups.

[0114] In an exemplary embodiment, obtaining the target data page in the currently backed-up data file where the file data block has changed according to the automatic storage management interface includes: obtaining the page size of the automatic storage management file corresponding to the data file to be backed up based on the automatic storage management file handle of the data file to be backed up; obtaining the first data page header corresponding to each data page contained in the automatic storage management file and the second data page header corresponding to each data page contained in the data file with the same name through the automatic storage management interface corresponding to the page size; if the log sequence number in the first data page header corresponding to any data page is different from the log sequence number in the second data page header corresponding to the data page, then the data page is taken as the target data page.

[0115] The Automatic Storage Management file handle is an identifier used in the ASM (Automatic Storage Management) file to identify and manage data files.

[0116] In the specific implementation, for cases where the BCT file is invalid, the agent 101 can obtain the page size of the automatic storage management file corresponding to the data file to be backed up based on the automatic storage management file handle. Then, through the automatic storage management interface corresponding to the page size, it can obtain the data page headers corresponding to each data page contained in the automatic storage management file, as well as the data page headers corresponding to each data page contained in the data file with the same name. For example, if the obtained page size (page_size) of the automatic storage management file corresponding to the data file to be backed up is an integer multiple of 512, the dmasm_file_read_by_offset interface in dmasmapi2.h can be used; otherwise, the dmasm_file_read_by_offset_normal interface can be used. This can be encapsulated and designed as a dmasm_client tool to read the data page headers corresponding to each data page contained in the automatic storage management file and the data file with the same name, respectively.

[0117] If the log sequence number in the header of the data page of the automatic storage management file corresponding to the data file to be backed up is different from the log sequence number in the header of the data page of the data file with the same name, it indicates that the corresponding data page has changed. Then, the data page is used as the target data page, and the target data page is copied as the difference file content to the preset backup directory.

[0118] In this embodiment, the agent utilizes the Automatic Storage Management (ASM) file of the data file to be backed up and adapts the corresponding interface according to the page size of the ASM file. It can accurately read the data page headers of each data page contained in the ASM file and the data page headers of each data page contained in the same data file. Based on the difference in the log sequence number in the data page header, it can accurately identify the data page that has changed in the same data file, thereby accurately and effectively identifying the difference file content when the BCT file is invalid.

[0119] In one exemplary embodiment, such as Figure 3 As shown, a backup method is provided, applied to storage terminal 102, and the method includes the following steps S302 to S306. Wherein:

[0120] Step S302: Responding to the backup request for the database to be backed up initiated by the agent 101.

[0121] Step S304: Based on the backup request, create the backup set corresponding to the backup request and store the backup set.

[0122] Step S306: Return the access interface information corresponding to the backup set to the agent 101. The access interface information is used to instruct the agent 101 to mount the backup set to the preset backup directory. If the backup request is the first backup request for the database to be backed up, copy each data file to be backed up in the backup set to the preset backup directory to complete the backup of the database to be backed up. If the backup request is not the first backup request for the database to be backed up, copy the data files to be backed up that have changed in the backup set to the preset backup directory to complete the backup of the database to be backed up. This will enable the agent 101 to send a backup completion notification after the backup of the database to be backed up is completed.

[0123] Step S308: Receive backup completion notification information and save a snapshot of the backup set according to the backup completion notification information.

[0124] In its implementation, storage terminal 102 can respond to a backup request for the database to be backed up initiated by agent terminal 101, create a corresponding backup set according to the backup request, and store the backup set. It then returns the access interface information corresponding to the backup set to agent terminal 101 so that agent terminal 101 can perform a backup operation on the database to be backed up. Storage terminal 102 receives a backup completion notification from agent terminal 101 and, based on the backup completion notification, saves a snapshot of the backup set. For example, storage terminal 102 can use ZFS to save a snapshot of the first backup set: `zfs snapshot pool_name / vol_name@tag`, or use ZFS to save a snapshot of backup sets that are not the first backup set: `zfs snapshot pool_name / vol_name2@tag`.

[0125] In this embodiment, the storage end responds to the backup request from the agent and creates a corresponding backup set, providing basic resources for the agent to subsequently mount and back up the backup set. By returning the access interface information corresponding to the backup set to the agent, the agent can ensure efficient and fast access to the storage backup set, improving the agent's backup efficiency. By saving a snapshot of the backup set after a complete backup, the storage space occupied is reduced, and a clear time point and a complete and consistent data source are provided for subsequent real-time recovery, thereby ensuring the accuracy and efficiency of subsequent recovery.

[0126] In an exemplary embodiment, based on the backup request, creating a backup set corresponding to the backup request and storing the backup set includes: if the backup request is the first backup request for the database to be backed up, creating a storage pool and creating a storage volume in the storage pool; if the backup request is not the first backup request for the database to be backed up, obtaining the snapshot volume of the previous backup of the backup request and creating a first clone volume for the snapshot volume; and storing the storage volume or the first clone volume as the backup set corresponding to the backup request.

[0127] In its implementation, when responding to a backup request initiated by the agent 101, the storage terminal 102 can determine whether the backup request is the first synthetic backup. If the backup request is the first backup request for the database to be backed up, i.e., the first synthetic backup request, the storage terminal 102 can create a storage pool and then create storage volumes within that pool. For example, ZFS (Zettabyte File System) can be used, with the -s flag used to create a zfsvolume sparse volume (also known as a thin volume), such as zfs create-sb block_size-Vvolume_size pool_name / vol_name, to ensure that storage pool space is allocated on demand during data writing.

[0128] If the backup request is not the first backup request for the database to be backed up, i.e., the backup request is not the first synthesized backup, the snapshot volume of the previous backup can be obtained, and a first clone volume can be created on the snapshot volume. For example, the ZFS snapshot value corresponding to the previous backup set can be obtained, and a clone volume can be created based on the snapshot value corresponding to the previous backup set, such as zfs clone pool_name / vol_name@snapshotpool_name / vol_name2.

[0129] Then, the storage volume or the first cloned volume is stored as the backup set corresponding to the backup request. Specifically, the storage volume or the first cloned volume can be stored as the backup set corresponding to the backup request in the iSCSI Target of storage terminal 102.

[0130] The technical solution in this embodiment creates corresponding backup sets by distinguishing between the first backup and non-first backups, providing a basic independent storage space for the backup process on the agent side and ensuring the isolation between backup data and original data. Furthermore, during non-first backups, a readable and writable clone volume is created for the snapshot volume of historical backups, which can share unmodified data blocks with the original dataset. Storage space is allocated only for modifications made to the clone, thereby saving storage resources and ensuring the consistency of backup data at specific points in time. This reduces the backup time window to the second level, thus achieving efficient management of backup resources. It provides a persistent and traceable backup set for subsequent recovery, making it easy to quickly locate the target backup set to be recovered during subsequent recovery, and laying a reliable resource foundation for subsequent real-time and efficient recovery.

[0131] In one exemplary embodiment, such as Figure 4 As shown, a recovery method is provided, applied to agent 101, and the method includes the following steps S402 to S406. Wherein:

[0132] Step S402: Initiate a recovery request for the backed-up database to the storage terminal 102; the recovery request is used to instruct the agent terminal 101 to connect to the storage terminal 102 so that the storage terminal 102 can obtain the backup set to be recovered corresponding to the recovery request and return the access interface information corresponding to the backup set to be recovered to the agent terminal 101; the backed-up database is backed up using any of the above backup methods.

[0133] Step S404: Mount the backup set to be restored to the preset recovery directory by accessing the interface information.

[0134] Step S406: Close the backed-up database. Based on the archived logs of the backup set to be restored, restore the closed backed-up database to complete the restoration of the backed-up database.

[0135] The preset recovery directory can be the same as the preset backup directory in the above backup method; for example, both can be the preset / agent / data directory.

[0136] In a specific implementation, a user can select a backup database in the data sharing cluster that has been backed up using any of the above backup methods on the user interface of the database management system and request a recovery operation. After the agent 101 detects the user's recovery operation, it sends a recovery request to the storage 102 for the backup database. The recovery request instructs the agent 101 to connect to the storage 102 so that the storage 102 can obtain the backup set to be recovered corresponding to the recovery request and return the access interface information corresponding to the backup set to be recovered to the agent 101.

[0137] Agent 101 can mount the backup set to be restored to a preset recovery directory by accessing the interface information. For example, agent 101 can initialize the iSCSI initiator, initiate access and connection requests to the iSCSI Target installed on storage 102, so that the initiator of agent 101 connects to the Target of storage 102 and mounts the backup set to a preset / agent / data directory.

[0138] Agent 101 shuts down the backed-up database and restores it based on the archived logs of the backup set to be restored, thus completing the offline recovery of the backed-up database. For example, Dmrman (DM recoverymanager, an offline recovery tool) can be used to restore the shut-down backup-up database to a specified point in time or log sequence number state based on the archived logs of the backup set to be restored. Agent 101 can also copy the configuration files (such as dm.ini and dm.ctl files) from the backup set to be restored to a preset recovery directory, such as the preset / agent / data directory.

[0139] The technical solution of this embodiment, by initiating a recovery request for the backed-up database to the storage end, enables the agent to connect to the storage end and mount the backup set of the storage end to a preset backup directory on the agent's local machine. This ensures that the agent can quickly and efficiently access the backup data to be recovered on the storage end, shortening the agent's location and preparation time for the backup data to be recovered, and making it possible to achieve second-level instant recovery. Closing the backed-up database ensures that no new data is written during the recovery process, guaranteeing the consistency of the recovered data. By restoring the closed backed-up database based on the archived logs of the backup set to be recovered, it can ensure accurate recovery to the specified target time point, thereby meeting the fine-grained recovery requirements at precise time points.

[0140] In an exemplary embodiment, after the backup database has been restored, the closed backup database is reopened; the restoration method further includes: after the backup database is reopened, in response to the unmount request initiated by the storage terminal 102, closing the backup database and unmounting the backup set to be restored on the preset restoration directory.

[0141] In its implementation, after the backup database completes offline recovery, agent 101 can reopen the closed backup database, allowing the database instances within it to run normally. After the backup database reopens, agent 101 can respond to a demount request initiated by storage 102, closing the backup database and unmounting the backup set to be recovered from the preset recovery directory. For example, after completing offline recovery and reopening the backup database, agent 101 responds to a demount request initiated by storage 102, closing the backup database, unmounting the backup set to be recovered from / agent / data / , disconnecting agent 101's initiator from storage 102's target, and then closing agent 101's initiator.

[0142] The technical solution of this embodiment ensures data consistency and integrity after recovery by reopening the closed backup database after recovery, so that the database instance can run normally. This guarantees the normal stability of the database after recovery. By responding to the unmount request and closing the backup database after reopening the backup database, the mounting of the backup set to be recovered is canceled, thereby releasing the storage space occupied during recovery, saving storage resources, and thus improving resource utilization.

[0143] In one exemplary embodiment, such as Figure 5 As shown, a recovery method is provided, applied to storage terminal 102, and the method includes the following steps S502 to S506. Wherein:

[0144] Step S502: In response to the recovery request for the backed-up database initiated by the agent 101; the backed-up database is backed up using any of the above backup methods.

[0145] Step S504: According to the recovery request, obtain the corresponding backup set that has been completed and saved by snapshot, clone the backup set to obtain a second clone volume, and store the second clone volume as the backup set to be restored.

[0146] Step S506: Return the access interface information corresponding to the backup set to be restored to the agent 101; the access interface information is used to instruct the agent 101 to mount the backup set to be restored to the preset recovery directory, shut down the backed-up database, and restore the shut-down backed-up database based on the archived logs of the backup set to be restored, so as to complete the restoration of the backed-up database.

[0147] The corresponding backup set that has been completed and saved by snapshot is obtained by the storage terminal 102 saving a snapshot of the backup set after receiving the backup completion notification information from the agent terminal 101.

[0148] In its implementation, storage terminal 102 can respond to a recovery request initiated by agent terminal 101 for a backup database that has been backed up using any of the aforementioned backup methods. Based on the recovery request, storage terminal 102 can obtain the corresponding backup set that has been completed and saved via snapshot, obtained through the storage terminal 102's backup method. It then clones the backup set to obtain a second clone volume, which is stored as the backup set to be recovered. For example, the second clone volume can be obtained using `zfsclone pool_name / vol_name@tag pool_name / vol_name2`, and stored in the iSCSI Target of storage terminal 102 as backend storage. Storage terminal 102 then returns the access interface information corresponding to the backup set to be recovered to agent terminal 101. This access interface information instructs agent terminal 101 to mount the backup set to be recovered to a preset recovery directory, shut down the backup database, and restore the shut-down backup database based on the archived logs of the backup set to be recovered, thus completing the recovery of the backup database.

[0149] The technical solution of this embodiment, by responding to the recovery request from the agent and obtaining the backup set that has been backed up and snapshotted according to the recovery request, can obtain the specific time point and complete and consistent data source required for recovery, thus ensuring accurate and efficient recovery for the agent. By cloning the backup set, the data resources of the backup set can be reused efficiently, saving recovery time and resource consumption. By returning the access interface information corresponding to the backup set to be recovered to the agent, the agent can be guaranteed to have efficient and fast access to the backup set to be recovered in the storage, thereby improving the recovery efficiency of the agent.

[0150] In an exemplary embodiment, after the agent 101 completes the recovery of the backed-up database, the recovery method further includes: when an operation to unmount the backup set to be recovered is detected, initiating a demount request corresponding to the backup set to be recovered to the agent 101, and canceling the storage of the backup set to be recovered; the demount request is used to instruct the agent 101 to close the backed-up database and cancel the mounting of the backup set to be recovered on the preset recovery directory; when an operation to delete the backup set to be recovered is detected, deleting the backup set to be recovered.

[0151] In the specific implementation, after the agent 101 completes the recovery of the backed-up database, the user can choose whether to unmount or delete the backup set to be recovered on the database management system's user interface. When an operation to unmount the backup set to be recovered is detected, the storage terminal 102 can send an unmount request corresponding to the backup set to be recovered to the agent 101 and cancel the storage of the backup set to be recovered. The unmount request is used to instruct the agent 101 to shut down the backed-up database and cancel the mount of the backup set to be recovered on the preset recovery directory. For example, when an operation to unmount the backup set to be recovered is detected, the storage terminal 102 can send an unmount request corresponding to the backup set to be recovered to the agent 101, requesting the agent 101 to shut down the backed-up database, cancel the mount of the backup set to be recovered on / agent / data / , and wait until the agent 101 no longer uses the backup set to be recovered before the storage terminal 102 cancels the backend storage of the backup set to be recovered in the iSCSI Target.

[0152] When an operation to delete a backup set to be restored is detected, the backup set to be restored is deleted. For example, ZFS can be used to delete a backup set to be restored: zfs destroy pool_name / vol_name2.

[0153] In this embodiment, after the agent completes the recovery, the storage end detects the operation of unmounting or deleting the backup set to be recovered, thereby canceling the storage of the backup set to be recovered or deleting the backup set to be recovered. This releases the storage space occupied during the recovery, saves storage resources, and improves resource utilization.

[0154] Specifically, such as Figure 6 As shown, a backup method for agent 101 is provided.

[0155] 1. Mount the ZFS VOLUME on the storage side to the agent side. 1.1. First, initialize an Initiator to search for and connect to the Target on the storage side; 1.2. Then mount the Initiator to the / agent / data directory.

[0156] 2. Flush the current data to disk: Execute Disql: checkpoint(100).

[0157] 3. Begin online backup:

[0158] 3.1. Initial Backup: Perform a full backup. 3.1.1. Copy data files and configuration files (dm.ini, dm.ctl, dm_service.prikey) using DMASMTOOL; 3.1.2. Command example: DMASMTOOL>cp+DMDATA / data / rac / SYSTEM.DBF / agent / data / SYSTEM.DBF; 3.1.3. Execute DISQL: sp_backup_copy_end(' / agent / data / bak'); This also writes the backup set to the mount path; 3.1.4. Locate the BEGIN_LSN and END_LSN in the current backup set, and find the corresponding archive logs based on these LSNs; 3.1.5. The archive logs found here should contain archive logs from multiple nodes. These archive logs should be generally continuous. After confirming the continuity of the archive logs, copy them to / agent / data / ; 3.1.6. Backup completes, recording the database's page_size and the backup set's bakset_magic.

[0159] 3.2. Non-initial synthetic backup: Perform synthetic backup logic. 3.2.1. Traverse the data files and configuration files (same as the configuration file entries in the full backup); 3.2.2. Copy the configuration file to / agent / data, overwriting any existing files with the same name; 3.2.3. If it is a new data file created after the last merge backup, copy it directly to / agent / data; 3.2.4. If it is a data file and a file with the same name exists in / agent / data: 3.2.4.1. Query the last recorded bakset_magic in the database and export the BCT file using Disql; Disql>sp_dump_bct(' / agent / data / bct',bakset_magic,NULL,0); 3.2.4.2. Determine which data files have changed since the last merge backup based on the BCT file; 3.2.4.3. Copy the data blocks using the dd tool provided by DMASMTOOL, for example: DMASMTOOL>ddif=+DMDATA / data / rac / main.dbf of = / home / dmdba / test / main.dbf bs = 8192 count = 1 skip = 33 seek = 33; 3.2.4.4. After copying, verify the data pages. Match them one by one according to the data page header format given by DMDSC; 3.2.4.5. If BCT is not enabled, or the BCT file is abnormal, a composite backup needs to be performed using the following method; 3.2.4.6. Encapsulate and design a dmasm_client tool based on dmasmapi2.h provided by DMDSC. 3.2.4.7. The steps for requesting data via the dmasm_client tool are as follows: 3.2.4.7.1. Open the current ASM file handle using dmasm_file_open; 3.2.4.7.2. If page_size is a multiple of 512, use dmasm_file_read_by_offset; otherwise, use the dmasm_file_read_by_offset_normal interface to read the page header; 3.2.4.7.3. Read and parse the page header of the data file with the same name in / agent / data using system functions; 3.2.4.7.4. Determine if the LSN recorded in the two page headers has changed. If it has changed, the task data page has been modified, and the page is copied to / agent / data; 3.2.4.7.5. After processing each page, close the ASM file handle; 3.2.6. The backup synthesis ends, and the page_size and backup set bakset_magic are recorded.

[0160] Specifically, such as Figure 7As shown, a backup method is provided for use on storage device 102.

[0161] 1. When starting a backup, the storage device checks whether this is the first time creating a backup.

[0162] 2. If this is the first time creating a backup, then perform the full backup process. 2.1. Use the ZFS file system on the storage side and create a storage pool: `zfs create pool` `zpool create`; 2.2. Use the `-s` flag to create a sparse ZFS volume: `zfs create -s -bblock_size -V volume_size pool_name / vol_name`.

[0163] 3. If this is not the first time, then proceed with the synthetic backup process: find the backup set of the last synthetic backup, find the corresponding ZFS snapshot value, and create a ZFS clone based on the snapshot of the last backup set: zfs clone pool_name / vol_name@snapshot pool_name / vol_name2.

[0164] 4. Use the volume created in the above steps as the backend storage for the iSCSI Target, and record the corresponding volume name.

[0165] 5. After the agent notifies you that the backup is complete, take a snapshot of the current volume. 5.1. If it is the first backup: zfssnapshot pool_name / vol_name@tag; 5.2. If it is not the first backup: zfs snapshot pool_name / vol_name2@tag.

[0166] 6. Record the name of the created ZFS snapshot in the database.

[0167] Specifically, such as Figure 8 As shown, a recovery method for agent 101 is provided.

[0168] 1. Recovery begins.

[0169] 2. Initialize the ISCSI Initiator to scan and connect to the Target, and mount the Target volume to / agent / data.

[0170] 3. Modify the dm.ini and dm.ctl files in the backup files, changing each path in them to the path in / agent / data.

[0171] 4. Use dmrman to restore. Since archived logs were backed up during backup, the user can specify the restore point in time or LSN here.

[0172] 5. After successful recovery, open the database; the database instance can run normally.

[0173] 6. Upon receiving a request to unmount the replica from the front end, the unmount replica process begins. 6.1. Shut down the database; 6.2. Unmount / agent / data / ; 6.3. Disconnect from the Target and shut down the Initiator; 6.4. The unmount replica process ends. Recovery Notes: Back up the DMDSC cluster data. Currently, due to DMASM limitations, recovery to a single machine is only possible immediately.

[0174] Specifically, such as Figure 9 As shown, a recovery method applied to storage terminal 102 is provided.

[0175] 1. The user selects a backup set to restore from the interface. The storage device uses the unique ID of the backup set to locate the database and find the corresponding volume.

[0176] 2. Take a snapshot of the volume: zfs snapshot pool_name / vol_name@tag.

[0177] 3. Clone the volume: zfs clone pool_name / vol_name@tag pool_name / vol_name2.

[0178] 4. Use the cloned volume as the backstore of the iSCSI Target and wait for the agent to connect.

[0179] 5. Once the agent recovers successfully, the volume will remain. If the user cancels the mount of the replica, the following process will occur: 5.1. Request the agent to shut down the database and cancel the mount of the ISCSI Initiator; 5.2. After the agent no longer uses the volume, cancel the volume as the ISCSI Target backstore; 5.3. The replica cancellation process ends.

[0180] 6. If the user chooses to delete the copy. 6.1. ZFS deletes the volume: `zfs destroy pool_name / vol_name2`

[0181] 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.

[0182] Based on the same inventive concept, embodiments of this application also provide backup devices for implementing the backup methods applied to the agent end, backup devices for the storage end, recovery devices for the recovery methods applied to the agent end, and recovery devices for the recovery methods applied to the storage end. The solutions provided by these devices are similar to those described in the methods above. Therefore, the specific limitations in one or more backup device and recovery device embodiments provided below can be found in the limitations of the backup and recovery methods described above, and will not be repeated here.

[0183] In one exemplary embodiment, such as Figure 10 As shown, a backup device is provided, applied to agent 101, including:

[0184] The backup request sending module 1010 is used to send a backup request to the storage terminal 102 for the database to be backed up; the backup request is used to instruct the agent terminal 101 to connect to the storage terminal 102 so that the storage terminal 102 can obtain the backup set corresponding to the backup request and return the access interface information corresponding to the backup set to the agent terminal 101.

[0185] The first backup set mounting module 1020 is used to mount the backup set to the preset backup directory through access interface information;

[0186] The first data backup module 1030 is used to copy each data file to be backed up in the backup set to a preset backup directory and copy the archived logs corresponding to the data files to be backed up to the preset backup directory when the backup request is the first backup request for the database to be backed up.

[0187] The second data backup module 1040 is used to copy the changed data files to be backed up in the backup set to a preset backup directory when the backup request is not the first backup request for the database to be backed up, so as to complete the backup of the database to be backed up.

[0188] The completion notification sending module 1050 is used to send a backup completion notification message to the storage terminal 102 after the backup of the database to be backed up is completed; the backup completion notification message is used to instruct the storage terminal 102 to save a snapshot of the backup set.

[0189] In an exemplary embodiment, the second data backup module 1040 is further configured to obtain a current data file to be backed up; the current data file to be backed up is any one of the data files to be backed up in the backup set; if the current data file to be backed up does not have a data file with the same name as the backup set, the current data file to be backed up is copied to a preset backup directory; if the current data file to be backed up has a data file with the same name as the backup set, and the file content of the current data file to be backed up differs from that of the data file with the same name, the differing file content is obtained and copied to the preset backup directory.

[0190] In an exemplary embodiment, the second data backup module 1040 is further configured to obtain the magic number identifier of the historical backup set in the previous backup of the backup request, and export the BCT file of the historical backup set according to the magic number identifier; when the BCT file is valid, obtain the changed data blocks in the current data file to be backed up according to the BCT file, and use the changed data blocks as the difference file content; when the BCT file is invalid, obtain the target data page in the current data file to be backed up where the file data blocks have changed according to the automatic storage management interface, and use the target data page as the difference file content.

[0191] In an exemplary embodiment, the second data backup module 1040 is further configured to: obtain the page size of the automatic storage management file corresponding to the data file to be backed up based on the automatic storage management file handle of the data file to be backed up; obtain the first data page header corresponding to each data page contained in the automatic storage management file and the second data page header corresponding to each data page contained in the data file with the same name through the automatic storage management interface corresponding to the page size; if the log sequence number in the first data page header corresponding to any data page is different from the log sequence number in the second data page header corresponding to the data page, then the data page is taken as the target data page.

[0192] In one exemplary embodiment, such as Figure 11 As shown, a backup device is provided, applied to storage terminal 102, including:

[0193] Backup request response module 1110 is used to respond to backup requests for the database to be backed up initiated by agent 101;

[0194] The first backup set storage module 1120 is used to create a backup set corresponding to the backup request according to the backup request, and store the backup set;

[0195] The first interface information return module 1130 is used to return the access interface information corresponding to the backup set to the agent 101. The access interface information is used to instruct the agent 101 to mount the backup set to the preset backup directory. When the backup request is the first backup request for the database to be backed up, the agent 101 copies each data file to be backed up in the backup set to the preset backup directory to complete the backup of the database to be backed up. When the backup request is not the first backup request for the database to be backed up, the agent 101 copies the data files to be backed up that have changed in the backup set to the preset backup directory to complete the backup of the database to be backed up. This allows the agent 101 to send a backup completion notification after the backup of the database to be backed up is completed.

[0196] The completion notification receiving module 1140 is used to receive backup completion notification information and save a snapshot of the backup set based on the backup completion notification information.

[0197] In an exemplary embodiment, the first backup set storage module 1120 is further configured to: create a storage pool and create a storage volume in the storage pool when the backup request is the first backup request for the database to be backed up; obtain the snapshot volume of the previous backup of the backup request when the backup request is not the first backup request for the database to be backed up, create a first clone volume on the snapshot volume; and store the storage volume or the first clone volume as the backup set corresponding to the backup request.

[0198] In one exemplary embodiment, such as Figure 12 As shown, a recovery device is provided, applied to agent 101, including:

[0199] The recovery request sending module 1210 is used to initiate a recovery request for the backed-up database to the storage terminal 102; the recovery request is used to instruct the agent terminal 101 to connect to the storage terminal 102 so that the storage terminal 102 can obtain the backup set to be recovered corresponding to the recovery request and return the access interface information corresponding to the backup set to be recovered to the agent terminal 101; the backed-up database is backed up using any of the above backup methods;

[0200] The second backup set mounting module 1220 is used to mount the backup set to be restored to the preset recovery directory by accessing the interface information.

[0201] The data recovery module 1230 is used to shut down the backed-up database and restore the shut-down backed-up database based on the archived logs of the backup set to be restored, so as to complete the restoration of the backed-up database.

[0202] In an exemplary embodiment, the recovery device is further configured to reopen the closed backup database after the backup database has been fully restored; and after the backup database has been reopened, in response to a demount request initiated by the storage terminal 102, close the backup database and cancel the mount of the backup set to be restored on the preset recovery directory.

[0203] In one exemplary embodiment, such as Figure 13 As shown, a recovery device is provided, applied to storage terminal 102, including:

[0204] The recovery request response module 1310 is used to respond to a recovery request for the backed-up database initiated by the agent 101; the backed-up database is backed up using any of the above backup methods;

[0205] The second backup set storage module 1320 is used to obtain the corresponding backup set that has been completed and saved by snapshot according to the recovery request, clone the backup set to obtain the second clone volume, and store the second clone volume as the backup set to be recovered.

[0206] The second interface information return module 1330 is used to return the access interface information corresponding to the backup set to be restored to the agent 101. The access interface information is used to instruct the agent 101 to mount the backup set to be restored to the preset recovery directory, close the backed-up database, and restore the closed backed-up database based on the archived logs of the backup set to be restored, so as to complete the restoration of the backed-up database.

[0207] In an exemplary embodiment, the recovery device is further configured to, after the agent 101 has completed the recovery of the backed-up database, when an operation to unmount the backup set to be recovered is detected, initiate a demount request corresponding to the backup set to be recovered to the agent 101 and cancel the storage of the backup set to be recovered; the demount request is used to instruct the agent 101 to close the backed-up database and cancel the mounting of the backup set to be recovered on the preset recovery directory; when an operation to delete the backup set to be recovered is detected, delete the backup set to be recovered.

[0208] The modules in the aforementioned backup and recovery devices can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the corresponding operations of each module.

[0209] In one exemplary embodiment, a computer device is provided, which can be a storage terminal or a proxy terminal, and its internal structure diagram can be as follows. Figure 14As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, 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 computing 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 data to be backed up or restored. The I / O interfaces allow the processor to exchange information with external devices. The communication interface allows communication with external terminals via a network connection. When executed by the processor, the computer program implements a backup and recovery method.

[0210] Those skilled in the art will understand that Figure 14 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.

[0211] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described backup and recovery methods.

[0212] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the embodiments of the backup and recovery methods described above.

[0213] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the various embodiments of the backup and recovery methods described above.

[0214] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0215] Those skilled in the art will understand that all or part of the processes in the methods of 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, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory 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 resistive 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, artificial intelligence processors, etc., and are not limited to these.

[0216] 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 application.

[0217] 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 backup method, characterized in that, Applied to the proxy side, the method includes: A backup request for the database to be backed up is initiated to the storage terminal; the backup request is used to instruct the agent to connect to the storage terminal so that the storage terminal can obtain the backup set corresponding to the backup request and return the access interface information corresponding to the backup set to the agent. The backup set is mounted to a preset backup directory using the access interface information. When the backup request is the first backup request for the database to be backed up, each data file to be backed up in the backup set is copied to the preset backup directory, and the archived logs corresponding to the data files to be backed up are copied to the preset backup directory to complete the backup of the database to be backed up. If the backup request is not the first backup request for the database to be backed up, copy the changed data files to be backed up in the backup set to the preset backup directory to complete the backup of the database to be backed up. After the backup of the database to be backed up is completed, a backup completion notification is sent to the storage device; the backup completion notification is used to instruct the storage device to save a snapshot of the backup set.

2. The method according to claim 1, characterized in that, The step of copying the changed data files to be backed up from the backup set to the preset backup directory includes: Obtain the current data file to be backed up; the current data file to be backed up is any one of the data files to be backed up in the backup set; If the currently backed-up data file does not have a data file with the same name as the backup set, copy the currently backed-up data file to the preset backup directory; If the current data file to be backed up and the backup set have a data file with the same name, and the file content of the current data file to be backed up and the data file with the same name are different, the difference in file content is obtained and the difference in file content is copied to the preset backup directory.

3. The method according to claim 2, characterized in that, The file content from which the differences are obtained includes: Obtain the magic number identifier of the historical backup set in the previous backup of the backup request, and export the BCT file of the historical backup set based on the magic number identifier; When the BCT file is valid, obtain the changed data blocks in the current data file to be backed up based on the BCT file, and use the changed data blocks as the file content of the difference. When the BCT file is invalid, the target data page where the file data block in the current data file to be backed up has changed is obtained according to the automatic storage management interface, and the target data page is used as the file content of the difference.

4. The method according to claim 3, characterized in that, The step of obtaining the target data page in the currently backed-up data file where the file data block has been modified according to the automatic storage management interface includes: Based on the automatic storage management file handle of the data file to be backed up, obtain the page size of the automatic storage management file corresponding to the data file to be backed up; The first data page header corresponding to each data page contained in the automatic storage management file and the second data page header corresponding to each data page contained in the data file with the same name are obtained through the automatic storage management interface corresponding to the page size. If the log sequence number in the first data page header corresponding to any data page is different from the log sequence number in the second data page header corresponding to that data page, then that data page is taken as the target data page.

5. A backup method, characterized in that, Applied to the storage end, the method includes: Responding to a backup request initiated by the agent for the database to be backed up; Based on the backup request, create a backup set corresponding to the backup request and store the backup set; The access interface information corresponding to the backup set is returned to the agent. The access interface information is used to instruct the agent to mount the backup set to a preset backup directory. If the backup request is the first backup request for the database to be backed up, each data file to be backed up in the backup set is copied to the preset backup directory to complete the backup of the database to be backed up. If the backup request is not the first backup request for the database to be backed up, the data files to be backed up that have changed in the backup set are copied to the preset backup directory to complete the backup of the database to be backed up. This allows the agent to send a backup completion notification after the backup of the database to be backed up is completed. Receive the backup completion notification information, and save a snapshot of the backup set according to the backup completion notification information.

6. The method according to claim 5, characterized in that, The step of creating a backup set corresponding to the backup request and storing the backup set includes: If the backup request is the first backup request for the database to be backed up, a storage pool is created, and a storage volume is created in the storage pool; If the backup request is not the first backup request for the database to be backed up, obtain the snapshot volume of the previous backup of the backup request, and create a first clone volume for the snapshot volume; The storage volume or the first cloned volume is stored as the backup set corresponding to the backup request.

7. A recovery method, characterized in that, Applied to the proxy side, the method includes: A recovery request for the backed-up database is initiated to the storage terminal; the recovery request is used to instruct the agent terminal to connect to the storage terminal, so that the storage terminal obtains the backup set to be recovered corresponding to the recovery request, and returns the access interface information corresponding to the backup set to be recovered to the agent terminal; the backed-up database is backed up by the method described in any one of claims 1 to 6; The backup set to be restored is mounted to the preset recovery directory using the access interface information. The backed-up database is shut down, and the backed-up database is restored based on the archived logs of the backup set to be restored, so as to complete the restoration of the backed-up database.

8. The method according to claim 7, characterized in that, After the backed-up database has been restored, the previously closed backed-up database is reopened; the method further includes: After the backed-up database is reopened, in response to the unmount request initiated by the storage terminal, the backed-up database is closed and the mount of the backup set to be restored on the preset recovery directory is canceled.

9. A recovery method, characterized in that, Applied to the storage end, the method includes: In response to a recovery request initiated by the agent for a backed-up database; the backed-up database is backed up using the method described in any one of claims 1 to 6; According to the recovery request, obtain the corresponding backup set that has been completed and saved with snapshots, clone the backup set to obtain a second clone volume, and store the second clone volume as the backup set to be recovered; The access interface information corresponding to the backup set to be restored is returned to the agent. The access interface information is used to instruct the agent to mount the backup set to be restored to the preset recovery directory, shut down the backed-up database, and restore the shut-down backed-up database based on the archived logs of the backup set to be restored, so as to complete the restoration of the backed-up database.

10. The method according to claim 9, characterized in that, After the agent completes the restoration of the backed-up database, the method further includes: When an operation to unmount the backup set to be restored is detected, an unmount request corresponding to the backup set to be restored is initiated to the agent, and the storage of the backup set to be restored is canceled; the unmount request is used to instruct the agent to shut down the backed-up database and cancel the mounting of the backup set to be restored on the preset recovery directory; When an operation to delete the backup set to be restored is detected, the backup set to be restored is deleted.

11. A backup device, characterized in that, The device, applied to the agent end, includes: The backup request sending module is used to initiate a backup request for the database to be backed up to the storage end; the backup request is used to instruct the agent to connect to the storage end so that the storage end can obtain the backup set corresponding to the backup request and return the access interface information corresponding to the backup set to the agent. The first backup set mounting module is used to mount the backup set to a preset backup directory through the access interface information; The first data backup module is used to copy each data file to be backed up in the backup set to the preset backup directory and copy the archived logs corresponding to the data files to be backed up to the preset backup directory when the backup request is the first backup request for the database to be backed up. The second data backup module is used to copy the changed data files to be backed up in the backup set to the preset backup directory when the backup request is not the first backup request for the database to be backed up, so as to complete the backup of the database to be backed up. The completion notification sending module is used to send a backup completion notification to the storage terminal after the backup of the database to be backed up is completed; the backup completion notification is used to instruct the storage terminal to save a snapshot of the backup set.

12. A backup device, characterized in that, The device, applied to the storage end, includes: The backup request response module is used to respond to backup requests for the database to be backed up initiated by the agent. The first backup set storage module is used to create a backup set corresponding to the backup request according to the backup request, and store the backup set; The first interface information return module is used to return the access interface information corresponding to the backup set to the agent. The access interface information is used to instruct the agent to mount the backup set to a preset backup directory. When the backup request is the first backup request for the database to be backed up, the agent copies each data file to be backed up in the backup set to the preset backup directory to complete the backup of the database to be backed up. When the backup request is not the first backup request for the database to be backed up, the agent copies the data files to be backed up that have changed in the backup set to the preset backup directory to complete the backup of the database to be backed up. This allows the agent to send a backup completion notification after the backup of the database to be backed up is completed. The completion notification receiving module is used to receive the backup completion notification information and save a snapshot of the backup set according to the backup completion notification information.

13. A recovery device, characterized in that, The device, applied to the agent end, includes: A recovery request sending module is used to initiate a recovery request for the backed-up database to the storage end; the recovery request is used to instruct the agent to connect to the storage end, so that the storage end can obtain the backup set to be recovered corresponding to the recovery request, and return the access interface information corresponding to the backup set to be recovered to the agent; the backed-up database is backed up by the method described in any one of claims 1 to 6; The second backup set mounting module is used to mount the backup set to be restored to a preset recovery directory through the access interface information; The data recovery module is used to shut down the backed-up database and, based on the archived logs of the backup set to be recovered, restore the shut-down backed-up database to complete the recovery of the backed-up database.

14. A recovery device, characterized in that, The device, applied to the storage end, includes: A recovery request response module is used to respond to a recovery request initiated by the agent for a backed-up database; the backed-up database is backed up using the method described in any one of claims 1 to 6; The second backup set storage module is used to obtain the corresponding backup set that has been completed and saved by snapshot according to the recovery request, clone the backup set to obtain a second clone volume, and store the second clone volume as the backup set to be recovered. The second interface information return module is used to return the access interface information corresponding to the backup set to be restored to the agent. The access interface information is used to instruct the agent to mount the backup set to be restored to a preset recovery directory, close the backed-up database, and restore the closed backed-up database based on the archived logs of the backup set to be restored, so as to complete the restoration of the backed-up database.

15. 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 method according to any one of claims 1 to 10.

16. 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 method according to any one of claims 1 to 10.

17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Incremental backup method and device, electronic equipment and storage medium

    CN116909813A

  • Database backup method and device, equipment and medium

    CN118484342A