Data recovery method and electronic device
By obtaining the identifier and first snapshot of the backup data to be restored of the target database, incremental backup data recovery is performed based on the restored backup data, solving the problem that database data cannot be reused after recovery and improving data recovery efficiency.
Patent Information
- Application Number
- CN202210911760.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-28
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-07-28
AI Technical Summary
In the prior art, a new database entity is created after database data is restored, which makes it impossible to continue data recovery based on the restored data, resulting in low recovery efficiency.
By obtaining the identifier of the backup data to be restored of the target database, the restored backup data based on the same full backup data is obtained. When the first snapshot is queried, the backup data to be restored is restored according to the incremental backup data recovery method, avoiding the creation of a new database entity and continuing data recovery based on the restored backup data.
It improves the efficiency of data recovery, solves the problem of being unable to reuse recovered data due to database configuration updates after data recovery, and enables continued data recovery based on the restored backup data.
Smart Images

Figure CN115421968B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a data recovery method and electronic equipment. Background Art
[0002] With the continuous development of Internet technology, enterprises are increasingly dependent on data processing. Therefore, data protection of databases is becoming increasingly important.
[0003] To minimize the impact of data loss or corruption on data processing, a backup system can be set up for the database. This system can back up database data through differential and incremental backups during various backup time windows. When data in the database needs to be restored, the database executes the "open reset logs" command, which creates a new database entity (incarnation). Production equipment then retrieves the backup data from the backup device and performs a full restore of all data backed up before the restoration time point, thus achieving database data recovery.
[0004] However, the above solution will create a new database entity after restoring the data. The newly created database entity is different from the previous database entity, so when data recovery is needed again later, it is impossible to continue data recovery based on the restored data, which leads to low data recovery efficiency. Summary of the Invention
[0005] The embodiments of the present application provide a data recovery method and an electronic device, which can improve the efficiency of data recovery.
[0006] In a first aspect, the present application provides a data recovery method, which is executed by a production device, and includes: obtaining an identifier of backup data to be restored of a target database; when the backup data to be restored is incremental backup data, obtaining the restored backup data; wherein the restored backup data and the backup data to be restored are backup data based on the same full backup data, the backup time of the restored backup data is earlier than the backup time of the backup data to be restored, and the restored backup data is the most recent restored backup data with a backup time to the backup time of the backup data to be restored; in response to a query to a first snapshot, restoring the backup data to be restored according to the incremental backup data recovery method; wherein the first snapshot is used to determine the state of the target database at the recovery time of the restored backup data; the recovery method of the incremental backup data is a method of restoring the backup data to be restored based on the differential incremental backup data between the backup data to be restored and the restored backup data.
[0007] It is understandable that, because this method obtains the identifier of the backup data to be restored of the target database, when the backup data to be restored is incremental backup data, it obtains the restored backup data based on the same full backup data, and when the first snapshot is queried, the backup data to be restored is restored based on the incremental backup data that differs between the restored backup data and the backup data to be restored. Since the first snapshot that can restore the target database to the state at the recovery time of the restored backup data is queried in advance, the problem of generating a new database entity after the last data recovery, which results in the inability to identify the database entity of the target database, and continuing data recovery based on the restored backup data is avoided, and the restored backup data can be reused, thereby improving the efficiency of data recovery.
[0008] In one possible implementation, in response to querying the first snapshot, restoring the backup data to be restored according to the incremental backup data restoration method includes: in response to querying the first snapshot, restoring the target database to a first state according to the first snapshot; the first state is the state of the target database after data recovery using the restored backup data; and restoring the target database in the first state using the backup data to be restored according to the incremental backup data restoration method.
[0009] It is understandable that after querying the first snapshot, restoring the target database and then recovering the data based on the restored target database can solve the problem of being unable to reuse the recovered data due to database configuration update after data recovery.
[0010] In another possible implementation, according to the incremental backup data recovery method, the backup data to be restored is used to restore the target database in the first state, including: obtaining n incremental backup data between the restored backup data and the backup data to be restored; n backup times of data backup have passed between the restored backup data and the backup data to be restored; n is an integer greater than or equal to 1; based on the n incremental backup data, differential incremental backup data is determined; and according to the differential incremental backup data, the backup data to be restored of the target database in the first state is restored.
[0011] It is understandable that by using the differential incremental backup data between the restored backup data and the backup data to be restored, the differential incremental backup data is continued to be restored based on the restored backup data, which reduces the amount of data that needs to be restored, thereby improving the efficiency of data recovery.
[0012] In another possible implementation, obtaining the identifier of the backup data to be restored of the target database includes: obtaining the identifier of the backup data to be restored of the target database from metadata record information; the metadata record information includes the identifier of the backup data recorded when the backup data is backed up at each backup time.
[0013] It is understandable that obtaining the identifier of the backup data to be restored from the metadata record information can facilitate subsequent determination of the backup data to be restored according to the identifier of the backup data to be restored, thereby improving data recovery efficiency.
[0014] In another possible implementation, the identifier is used to indicate the backup data type and the serial number corresponding to each backup data type; the backup data type includes full backup data or incremental backup data; the serial number corresponding to each backup data type includes a full backup serial number or an incremental backup serial number.
[0015] It is understandable that the backup data is identified by the full backup serial number and the incremental backup serial number, which facilitates the subsequent determination of the backup data that needs to be restored, thereby improving data recovery efficiency.
[0016] In another possible implementation, n incremental backup data between the restored backup data and the backup data to be restored are obtained, including: determining the incremental backup data corresponding to the incremental backup serial numbers greater than the restored backup data and the incremental backup serial numbers less than or equal to the backup data to be restored as n incremental backup data; the incremental backup serial numbers are determined based on the identification of the backup data to be restored.
[0017] It is understandable that the backup data that needs to be restored is determined by the incremental backup sequence number, thereby improving data recovery efficiency.
[0018] In another possible implementation, when the backup data to be restored is incremental backup data, before obtaining the restored backup data, it also includes: determining the backup data type of the backup data to be restored based on the identifier of the backup data to be restored, and the backup data type includes full backup data or incremental backup data.
[0019] It can be understood that determining the type of the backup data to be restored by using the identifier of the backup data to be restored improves the speed of determining the type of the backup data.
[0020] In another possible implementation, after obtaining the identifier of the backup data to be restored of the target database, it also includes: when the backup data to be restored is full backup data, restoring the backup data to be restored according to the full backup data method; the full backup data restoration method is a method of restoring the backup data to be restored based on the full backup data.
[0021] It can be understood that the situation where the backup data to be restored only includes the full backup data is expanded.
[0022] In another possible implementation, the first snapshot includes configuration information of the target database at the restoration time of the restored backup data, log information of the target database at the restoration time of the restored backup data, and data information of the restored backup data.
[0023] It is understandable that the first snapshot stores the relevant information of the target database, which can facilitate restoring the target database to the configuration state after the last data recovery, so as to reuse the recovered data.
[0024] In another possible implementation, after restoring the backup data to be restored in an incremental backup data restoration manner, the method further includes: clearing the content in the first snapshot; obtaining a second state of the target database after restoring the backup data to be restored; and updating the first snapshot according to the second state.
[0025] It is understandable that after the data is restored, the first snapshot is updated so that when data is restored later, data restoration can be continued based on the data restored this time.
[0026] In another possible implementation, after restoring the backup data to be restored in the incremental backup data restoration method, the method further includes:
[0027] Obtaining a second state of the target database after restoring the backup data to be restored;
[0028] A second snapshot is generated according to the second state, wherein the second snapshot is used to determine the second state.
[0029] It is understandable that the first snapshot is added after the data is restored, so that when data is restored later, the data can be restored based on the data restored this time.
[0030] In the second aspect, the present application provides a data recovery device, and the present application can divide the data recovery device into functional modules according to the method provided in the first aspect above. For example, each functional module can be divided according to each function, or two or more functions can be inherited in one processing module. Exemplarily, the present application can divide the data recovery device into an identification acquisition module, a data acquisition module, and a data recovery module, etc. according to the function. The description of the possible technical solutions and beneficial effects executed by each of the functional modules divided above can refer to the technical solutions provided by the first aspect above or its corresponding possible implementation methods, and will not be repeated here.
[0031] In a third aspect, an embodiment of the present application provides a computing device, comprising a processor and a memory, wherein the memory is used to store computer program instructions, which are loaded and executed by the processor to enable the computing device to implement the data recovery method described in the above aspects.
[0032] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores at least one computer program instruction, and the computer program instruction is loaded and executed by a processor to implement the data recovery method as described in the above aspects.
[0033] In a fifth aspect, embodiments of the present application provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computing device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computing device to perform the data recovery method provided in various optional implementations of the above aspects.
[0034] For the specific descriptions of the second to fifth aspects and their various implementations in this application, reference can be made to the detailed descriptions in the first aspect and its various implementations; and for the beneficial effects of the second to fifth aspects and their various implementations, reference can be made to the analysis of the beneficial effects in the first aspect and its various implementations, which will not be repeated here.
[0035] These and other aspects of the present application will become more readily apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 is a schematic diagram showing a data management system according to an exemplary embodiment;
[0037] Figure 2 yes Figure 1 A schematic diagram of a differential incremental backup involved in the illustrated embodiment;
[0038] Figure 3 is a flowchart illustrating a data recovery method according to an exemplary embodiment;
[0039] Figure 4 is a flowchart illustrating a data recovery method according to an exemplary embodiment;
[0040] Figure 5 yes Figure 4 A schematic diagram of a process of querying whether a first snapshot exists involved in the illustrated embodiment;
[0041] Figure 6 yes Figure 4 A schematic diagram of a process for restoring a database involved in the illustrated embodiment;
[0042] Figure 7 yes Figure 4A schematic diagram of a process for determining differential incremental backup data that needs to be restored in the illustrated embodiment;
[0043] Figure 8 yes Figure 4 A schematic diagram of a first snapshot update process involved in the illustrated embodiment;
[0044] Figure 9 yes Figure 4 A schematic diagram of a target database data recovery process involved in the illustrated embodiment;
[0045] Figure 10 is a structural diagram of a data recovery device provided by an exemplary embodiment of the present application;
[0046] Figure 11 It is a structural diagram of a computing device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0048] In this document, "plurality" refers to two or more. "And / or" describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates an "or" relationship between the associated objects.
[0049] The subsequent embodiments of this application provide a data recovery solution, which can be applied in scenarios where data support is needed for daily operations such as production, management, and strategy. In order to support the continuous development of information technology, enterprises need to protect their own data assets. The important information assets of enterprises can generally be scattered in several different systems, including core databases, customer data, transaction data, and various types of management data. In the process of daily data maintenance, there may be risks of data damage caused by damage to data storage devices, data misoperation, and data human destruction. Therefore, it is necessary to back up the data and perform data recovery based on the backup data to protect the data in the database. Please refer to Figure 1 , Figure 1 1 is a schematic diagram of a data management system according to an embodiment of the present application, which includes a production system 110 and a backup system 120. The production system 110 includes a database 111, a backup proxy component 112, an operating system 113, and a production storage component 114. The backup system 120 includes a backup service component 121 and a backup storage component 122.
[0050] The data management system may include backup devices and production devices. The production devices are located in production system 110, and the backup devices are located in backup system 120. The production devices can be computing devices, and the backup devices can also be computing devices. The production devices and backup devices can be different computing devices or the same computing device, without limitation. The computing devices can be smartphones, tablet computers, e-book readers, personal laptops, servers, and the like.
[0051] Optionally, the production storage component 114 may be a component with a snapshot generation function, and the backup proxy component 112 may be a plug-in installed on the production device. The backup storage component 122 may store backup data. The backup service component 121 and the backup proxy component 112 may be connected via a communication network. The backup proxy component 112 may transmit the backup data to the backup service component 121 via the communication network. The backup service component 121 then sends the backup data to the backup storage component 122 for storage.
[0052] In a possible implementation, the production system and the backup system may be connected via a communication network. Optionally, the communication network is a wired network or a wireless network.
[0053] Optionally, the above-mentioned wireless network or wired network uses standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network. In some embodiments, technologies and / or formats including hypertext markup language (HTML), extensible markup language (XML), etc. are used to represent data exchanged over the network. In addition, conventional encryption technologies such as secure socket layer (SSL), transport layer security (TLS), virtual private network (VPN), and internet protocol security (IPsec) can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.
[0054] Exemplarily, the computing device may perform data backup in a differential incremental backup manner. In the differential incremental backup manner, each data backup is performed by backing up the difference data between the last backup result and the current backup result.
[0055] Figure 2 This is a schematic diagram of a differential incremental backup involved in the embodiment of this application. Figure 2 As shown, at the backup time on the first day, the computing device can perform a full backup; at the backup time on the second day, the computing device can perform a differential incremental backup; at the backup time on the third day, the computing device can also perform a differential incremental backup; at the backup time on the fourth day, the computing device still performs a differential incremental backup; at the backup time on the fifth day, a full backup of the data can be performed.
[0056] Among them, the backup time on the first day can be the time to start data backup, the backup time on the second to fourth days can be the time for daily fast differential incremental backup of data, and the backup time on the fifth day can be the time for complete full backup of data during idle time (such as weekends).
[0057] The full backup data on the first day is the full data at the backup time of the first day, the differential incremental backup data on the second day is the differential backup data between the full data backed up at the backup time of the second day and the full data backed up at the backup time of the first day, the differential incremental backup data on the third day is the differential backup data between the full data backed up at the backup time of the third day and the full data backed up at the backup time of the second day, the differential incremental backup data on the fourth day is the differential backup data between the full data backed up at the backup time of the fourth day and the full data backed up at the backup time of the third day, and the full backup data on the fifth day is the full data backed up at the backup time of the fifth day.
[0058] For example, data backup at the backup time on the first day may be a full data backup, and the full data at this time includes data a, data b, and data c; data backup at the backup time on the second day may be a differential incremental backup. If data a becomes data d at this time, then the data backup at the backup time on the second day will only back up data a to become data d; data backup at the backup time on the third day may be a differential incremental backup. If data d becomes data e at this time, then the data backup at the backup time on the third day will only back up data d to become data e; data backup at the backup time on the fourth day may be a differential incremental backup. If data b becomes data f at this time, then the data backup at the backup time on the fourth day will only back up data b to become data f; data backup at the backup time on the fifth day may be a full data backup, and the full data at this time includes data e, data f, and data c.
[0059] Figure 3The flowchart of a data recovery method provided by an exemplary embodiment of the present application is shown. The data recovery method can be executed by a computing device, for example, the computing device can be Figure 1 The production equipment in the data management system shown. The data recovery determination method includes the following steps:
[0060] Step 301: Obtain the identifier of the backup data to be restored in the target database.
[0061] In an embodiment of the present application, when data in a target database of a production device needs to be restored, the production device may obtain an identifier of the backup data to be restored of the target database.
[0062] The backup data to be restored may be backup data corresponding to data that needs to be restored in the target database. The backup data may have an identifier corresponding to the data content of the backup data.
[0063] In one possible implementation, when the production equipment is producing data on a daily basis, the produced data can be stored in the target database in real time. The data in the target database can be backed up at each backup time, and the backup data can be transmitted and stored in the backup device so that the production equipment can obtain it from the backup device when corresponding data recovery is needed.
[0064] The target database can be a relational database or an in-memory database.
[0065] Step 302, when the backup data to be restored is incremental backup data, obtain the restored backup data; wherein, the restored backup data and the backup data to be restored are backup data based on the same full backup data, the backup time of the restored backup data is earlier than the backup time of the backup data to be restored, and the restored backup data is the restored backup data whose backup time is most recent to the backup time of the backup data to be restored.
[0066] In an embodiment of the present application, the production equipment determines whether the backup data to be restored is incremental backup data. When it is determined that the data to be restored is incremental backup data, it can obtain the restored backup data whose backup time is earlier than the backup time of the backup data to be restored and is the closest, and which is backed up based on the same full backup data, based on the identifier of the backup data to be restored.
[0067] In a possible implementation, the restored backup data may be full backup data or incremental backup data.
[0068] In order to improve the efficiency of data recovery based on the restored backup data by reusing the restored backup data, the restored backup data closest to the backup data to be restored can be obtained based on the log content of the target database and then proceed to the subsequent steps. The log content of the target database records the most recently restored backup data.
[0069] In one possible implementation, when the backup data to be restored is incremental backup data, since each backup data can be identified in order during the data backup process, it can be determined according to the identification of the backup data to be restored that the backup time is earlier than the backup time of the backup data to be restored, and the most recent backup data based on the same full backup data is obtained as the restored backup data.
[0070] Step 303: In response to the query of the first snapshot, the backup data to be restored is restored according to the incremental backup data restoration method; wherein the first snapshot is used to determine the state of the target database at the restoration time of the restored backup data; the incremental backup data restoration method is a method of restoring the backup data to be restored based on the differential incremental backup data between the backup data to be restored and the restored backup data.
[0071] In an embodiment of the present application, after obtaining the restored backup data, the production device can start to query whether a first snapshot exists. If the first snapshot is found, the backup data to be restored can be restored based on the differential incremental backup data between the backup data to be restored and the restored backup data.
[0072] In a possible implementation, the first snapshot may be a storage snapshot generated by the production device after data recovery.
[0073] The first snapshot may be a storage snapshot generated after the most recent data recovery, or may be a storage snapshot generated after each data recovery.
[0074] In one possible implementation, the state of the target database at the time of recovery of the restored backup data can be used to indicate the restored data, the system change number of the database, and the database log number contained in the newly generated database entity after the target database recovers the restored backup data.
[0075] Among them, there may be various data management objects set for the convenience of data management in the database management system, and the data management objects may be database entities.
[0076] For example, database entities can be data stored in database tables, views, stored procedures, and various data management objects.
[0077] In summary, in an embodiment of the present application, the production equipment can obtain the identifier of the backup data to be restored of the target database, and when the backup data to be restored is incremental backup data, obtain the most recently restored backup data based on the same full backup data, and when the first snapshot is queried, restore the backup data to be restored based on the differential incremental backup data between the restored backup data and the backup data to be restored. Since the first snapshot that can restore the target database to the state at the recovery time of the restored backup data is queried in advance, the problem of being unable to identify the database entity of the target database due to the generation of a new database entity after the last data recovery and continuing data recovery based on the restored backup data is avoided, and the restored backup data can be reused, thereby improving the efficiency of data recovery.
[0078] Figure 4 The flowchart of a data recovery method provided by an exemplary embodiment of the present application is shown. The data recovery method can be executed by a computing device, for example, the computing device can be Figure 1 The data recovery method includes the following steps:
[0079] Step 401: Obtain the identifier of the backup data to be restored in the target database.
[0080] In an embodiment of the present application, the production device obtains an identifier of the backup data to be restored corresponding to the data to be restored in the target database.
[0081] In a possible implementation, the production device may obtain the identifier of the backup data to be restored of the target database from the metadata record information.
[0082] The metadata record information includes an identifier of the backup data recorded when the backup data is backed up at each backup time.
[0083] For example, when the production equipment is producing data, the data produced by the production equipment can be backed up synchronously. At the same time, the backed up data can be recorded in the form of identifiers to generate metadata record information including identifiers of each backup data.
[0084] In one possible implementation, the identifier is used to indicate the backup data type and the serial number corresponding to each backup data type; the backup data type includes full backup data or incremental backup data; the serial number corresponding to each backup data type includes a full backup serial number or an incremental backup serial number.
[0085] That is to say, by obtaining metadata record information, the backup data type of the backup data at each backup time can be obtained, that is, whether the backup data at each backup time is full backup data or incremental backup data; if the backup data type of the backup data at the backup time is full backup data, the serial number to which the full backup data at the backup time belongs can also be obtained; if the backup data type of the backup data at the backup time is incremental backup data, the serial number of the full backup data to which the incremental backup data at the backup time belongs can also be obtained, as well as the serial number to which the incremental backup data under the full backup data belongs.
[0086] For example, if a full backup is performed at the backup time, the full backup serial number corresponding to the full backup data is recorded at the backup time. If an incremental backup is performed at the backup time, the full backup serial number of the last full backup and the incremental backup serial number under the full backup are recorded at the backup time. This can be recorded as "full backup serial number" + "." + "incremental backup serial number". If you follow the steps below: Figure 2 If data is backed up at the backup time shown, the metadata record information may include the content shown in Table 1 below.
[0087] Table 1
[0088] Backup time Backup Type Backup serial number Day 1 Full backup 1 the next day Differential incremental backup 1.1 Day 3 Differential incremental backup 1.2 Day 4 Differential incremental backup 1.3 Day 5 Full backup 2 Day 6 Differential incremental backup 2.1 … … …
[0089] Step 402: Determine the type of the backup data to be restored based on the identifier of the backup data to be restored.
[0090] In an embodiment of the present application, the production equipment can determine the backup data type of the backup data to be restored based on the obtained identifier of the backup data to be restored, that is, determine whether the backup data to be restored is full backup data or incremental backup data under a certain full backup data. The backup data type may include full backup data or incremental backup data.
[0091] Since the production device can determine the subsequent data recovery method according to the backup data type of the backup data to be recovered, it is necessary to determine the backup data type of the backup data to be recovered according to the obtained identifier of the backup data to be recovered.
[0092] For example, if the metadata record information contains the content shown in Table 1, and the backup data to be restored needs to be restored from the backup data after the backup time on the third day, based on the backup sequence number 1.2 at the backup time on the third day, it can be determined that the backup data type to be restored is incremental backup data. If the backup data to be restored needs to be restored from the backup data after the backup time on the fifth day, based on the backup sequence number 2 at the backup time on the fifth day, it can be determined that the backup data type to be restored is full backup data.
[0093] Step 403 : When the backup data to be restored is full backup data, the backup data to be restored is restored in a full backup data restoration manner.
[0094] In an embodiment of the present application, when the backup data type of the backup data to be restored is determined to be full backup data by obtaining the identifier of the backup data to be restored, the backup data to be restored can be restored according to the full backup data.
[0095] The full backup data recovery method is a method of recovering the backup data to be recovered based on the full backup data.
[0096] That is to say, when the backup time corresponding to the backup data to be restored happens to be backed up through full backup, then at this time, since the full backup data can be obtained, there is no need to continue data recovery based on other restored backup data, so the backup data to be restored can be directly restored according to the full backup data.
[0097] Since the restored backup data and the backup data to be restored are backup data based on different full backup data, there is no need to reuse them based on the first restored backup data, and data restoration can be performed directly based on the full data.
[0098] Step 404: When the backup data to be restored is incremental backup data, the restored backup data is obtained.
[0099] In an embodiment of the present application, when the backup data type of the backup data to be restored is determined to be incremental backup data by obtaining an identifier of the backup data to be restored, the restored backup data can be determined and the restored backup data can be obtained.
[0100] The restored backup data and the backup data to be restored may be backup data based on the same full backup data, and the backup time of the restored backup data is earlier than the backup time of the backup data to be restored.
[0101] That is to say, when it is determined that the backup data to be restored does not contain only full backup data, the full backup data contained in the backup data to be restored is determined by the identifier of the backup data to be restored, and it is determined whether there is restored backup data in the backup data that contains the same full backup data and has a backup time earlier than the backup time of the backup data to be restored. If there is restored backup data that meets the conditions, the restored backup data can be obtained.
[0102] In a possible implementation, when determining the restored backup data, it may be found that there are one or more restored backup data that meet the conditions, and each restored backup data may be obtained.
[0103] Exemplarily, if the content included in the metadata record information is as shown in Table 1, the backup data to be restored needs to be restored through the backup data after the data backup is performed at the backup time on the third day. According to the backup sequence number 1.2 at the backup time on the third day, it can be determined that the full backup data included in the backup data to be restored is the full backup data 1. At the same time, according to the backup sequence number 1.2 at the backup time on the third day, it can be determined that the backup time earlier than the backup data to be restored is the backup time of the second day, corresponding to the backup sequence number 1.1. If it is determined that data recovery has been performed at the backup time corresponding to the backup sequence number 1.1, the restored backup data at the backup time corresponding to the backup sequence number 1.1 is obtained. If the backup data to be restored needs to be restored through the backup data after the data backup at the backup time on the fourth day, according to the backup sequence number 1.3 at the backup time on the fourth day, it can be determined that the full backup data contained in the backup data to be restored is the full backup data 1. At the same time, according to the backup sequence number 1.3 at the backup time on the fourth day, it can be determined that the backup time earlier than the backup data to be restored is the backup time of the second day, and the corresponding backup sequence numbers are 1.1 and 1.2. If it is determined that data recovery has been performed at the backup time corresponding to backup sequence number 1.1 and the backup time corresponding to backup sequence number 1.2, then the restored backup data at the backup time corresponding to backup sequence number 1.1 and the restored backup data at the backup time corresponding to backup sequence number 1.2 are obtained.
[0104] Step 405 : In response to finding the first snapshot, the target database is restored to the first state according to the first snapshot.
[0105] In an embodiment of the present application, the production device queries whether a first snapshot exists. If the first snapshot is found to exist, the production device can restore the target database to the first state according to the content in the first snapshot.
[0106] The first state may be a state of the target database after data recovery using the restored backup data. The first snapshot may be used to determine the state of the target database at the time of recovery of the restored backup data.
[0107] In a possible implementation, the first snapshot may include configuration information of the target database at the time of restoration of the restored backup data, log information of the target database at the time of restoration of the restored backup data, and data information of the restored backup data.
[0108] Among them, the configuration information of the target database may include the system change number (SCN), the domain name system (DNS) connection string, the database host name and other information; the log information of the target database may include the database log number, and the log information of the target database is used to record the operation information of the target database; the data information of the restored backup data may include the storage address information of the restored backup data, the end time node information of the restored backup data, etc.
[0109] Since after data recovery, the target database needs to create a new database entity (incarnation), and the recovered data is in the newly created database entity, the database entity of the newly created target database belongs to a different database than the target database before data recovery. In other words, the database entity of the newly created target database and the target database before data recovery have different database log numbers, system change numbers, etc., which makes it impossible to reuse the restored backup data the next time data recovery is performed. As a result, each time the backup data is used for data recovery, it can only be restored according to the full data, for example, according to the full data consisting of the most recent full backup data generated before the time point when data recovery is required and all incremental backup data generated since the most recent full backup data. By using the first snapshot to store the updated database log number and SCN of the newly created target database corresponding to the previously restored backup data, when data recovery is required again, the target database can be restored to the updated target database corresponding to the previously restored backup data, thereby achieving the reuse of the restored backup data.
[0110] In one possible implementation, the production device queries whether the first snapshot exists through the snapshot name of the first snapshot. If the query finds that the first snapshot exists, a confirmation instruction is returned. If the query finds that the first snapshot does not exist, a negative instruction is returned. When the confirmation instruction is received, the first snapshot can be called through the interface to perform first snapshot recovery.
[0111] For example, the snapshot name of the first snapshot may be Incremental_PRE_SNAP.
[0112] In another possible implementation, when the first restored backup data and the backup data to be restored are based on different full backup data, the backup data to be restored can be restored using a full data restore method. The first restored backup data is the restored backup data that was backed up earlier than the backup time of the backup data to be restored and is the most recent backup time of the backup data to be restored.
[0113] Among them, when the first restored backup data and the backup data to be restored are backup data based on different full backup data, the backup data to be restored can be restored based on the full backup data of the backup data to be restored, the incremental backup data at the backup data to be restored under the full backup data, and the incremental backup data before the backup data to be restored under the full backup data.
[0114] For example, if the backup identifier corresponding to the backup time of the backup data to be restored is 1.4, the full backup data recovery method is to restore the backup data to be restored based on the full backup data identified as 1, the incremental backup data identified as 1.4, and the incremental backup data corresponding to 1.1, 1.2, and 1.3, which are identified as less than 1.4.
[0115] For example, Figure 5 This is a flowchart of a method for querying whether a first snapshot exists according to an embodiment of the present application. For example, if the name of the first snapshot is Incremental_PRE_SNAP, Figure 5 As shown, first, the storage system can be logged in through the storage system interface by using the storage user name and the corresponding password (S51) to obtain the permission to query the first snapshot, and then the snapshot information with the snapshot name "Incremental_PRE_SNAP" is queried through the storage system interface (S52), and it is determined whether the snapshot Incremental_PRE_SNAP exists (S53). If it exists, True is returned in response, and if it does not exist, False is returned in response.
[0116] Then, Figure 6 This is a flowchart of restoring a database according to an embodiment of the present application. For example, if the name of the first snapshot is Incremental_PRE_SNAP, Figure 6 As shown, first, the storage system can be logged in through the storage system interface by using the storage user name and the corresponding password (S61) to obtain the permission to call the first snapshot, and then the snapshot named "Incremental_PRE_SNAP" is executed through the storage system interface (S62).
[0117] In a possible implementation, the first snapshot may also be a storage snapshot generated by a file system storing the configuration, data files, and log files of the database according to a snapshot function.
[0118] Step 406 : Restore the backup data to be restored of the target database in the first state according to the incremental backup data restoration method.
[0119] In an embodiment of the present application, the production device can restore the backup data to be restored of the target database in the first state in sequence according to the incremental backup data recovery method.
[0120] The incremental backup data recovery method may be a method of recovering the backup data to be recovered based on the differential incremental backup data between the backup data to be recovered and the recovered backup data.
[0121] In one possible implementation, n incremental backup data between the restored backup data and the backup data to be restored are obtained; n backup times of data backup are performed between the restored backup data and the backup data to be restored; n is an integer greater than or equal to 1; then, based on the n incremental backup data, differential incremental backup data are determined; and according to the differential incremental backup data, the backup data to be restored of the target database in the first state is restored.
[0122] Among them, since the restored backup data and the backup data to be restored are backup data based on the same full backup data, when the restored backup data can be reused, it is only necessary to obtain n incremental backup data of the difference between the restored backup data and the backup data to be restored, so as to determine the differential incremental backup data, and restore the data of the target database in the first state based on the restored backup data according to the differential incremental backup data.
[0123] For example, if it is determined that the restored backup data is the incremental backup data restored at the backup time of the second day, and the backup data to be restored is the incremental backup data that needs to be restored at the backup time of the fourth day, then the two incremental backup data that are the difference between the restored backup data and the backup data to be restored can be determined, and the data of the target database in the first state can be restored according to the two incremental backup data that are the difference.
[0124] In a possible implementation, the production device may further determine n incremental backup data as differential incremental backup data according to the identifier.
[0125] That is to say, the incremental backup data corresponding to the incremental backup serial numbers greater than the restored backup data and the incremental backup serial numbers less than or equal to the backup data to be restored can be determined as n incremental backup data, and the incremental backup serial numbers can be determined based on the identification of the backup data to be restored.
[0126] For example, as shown in Table 1, if it is determined that the restored backup data is the incremental backup data restored at the backup time of the second day, the corresponding identifier is 1.1, and the backup data to be restored is the incremental backup data at the backup time of the fourth day that needs to be restored, the corresponding identifier is 1.3, then it can be determined that the two incremental backup data that are different between the restored backup data and the backup data to be restored are the incremental backup data identified as 1.2 and 1.3, and the data of the target database in the first state can be restored according to the incremental backup data identified as 1.2 and 1.3.
[0127] For example, Figure 7 This is a schematic diagram of a process for determining differential incremental backup data that needs to be restored in an embodiment of the present application. Figure 7As shown, first, the production equipment parses the serial number corresponding to the most recent backup data at the current time point that needs to be restored, parses out the full backup serial number X and the incremental backup serial number Y (S71), and determines whether the backup data to be restored is the full backup data (S72). If it is determined to be the full backup data, the full backup data is directly determined as the backup data that needs to be restored. If it is determined that it is not the full backup data, the full backup serial number and the incremental backup serial number of the backup data restored last time can be parsed (S73). For example, if the serial number of the restored backup data is 1.2, the full backup serial number is 1 and the incremental backup serial number is 2. The serial number of the backup data restored last time can be ab, and then it is determined whether the full backup serial number X of the backup data to be restored is equal to the full backup serial number a of the backup data restored last time (S74). If the full backup serial number X of the backup data to be restored is not equal to the full backup serial number a of the backup data restored last time, it can be determined that the differential incremental backup data to be restored is equal to the sum of the full backup data X and the incremental backup data under the full backup data X that is less than or equal to the incremental backup serial number Y (S75). If the full backup serial number X of the backup data to be restored is equal to the full backup serial number a of the backup data restored last time If the full backup sequence number a of the duplicate backup data is equal, then continue to determine whether the incremental backup sequence number Y is greater than the incremental backup sequence number b (S76). If the incremental backup sequence number Y is less than or equal to the incremental backup sequence number b, then it can be determined that the differential incremental backup data to be restored is equal to the sum of the full backup data X and each incremental backup data under the full backup data X that is less than or equal to the incremental backup sequence number Y. If the incremental backup sequence number Y is greater than the incremental backup sequence number b, then it can be determined that the differential incremental backup data to be restored is equal to the sum of the incremental backup data corresponding to X.(b+1) to XY (S77).
[0128] In a possible implementation, after data recovery, the production device may clear the content in the first snapshot, then obtain a second state of the target database after the backup data to be recovered is recovered, and update the first snapshot according to the second state.
[0129] The second state may include updated configuration information of the target database after restoring the backup data to be restored, updated log information of the target database after restoring the backup data to be restored, and updated data information of the target database after restoring the backup data to be restored.
[0130] That is to say, after data recovery, the recovered data can be used as newly generated restored backup data and stored in a snapshot through the first snapshot, and the relevant information of the target database in the first snapshot can be updated so that when data recovery is subsequently performed, data recovery can be continued based on the updated first snapshot on the basis of the restored data, thereby improving the efficiency of data recovery.
[0131] In another possible implementation, after data recovery, the production device may further obtain a second state of the target database after recovery of the backup data to be recovered, and generate a second snapshot according to the second state; wherein the second snapshot may be used to determine the second state.
[0132] The second state may also include updated configuration information of the target database after restoring the backup data to be restored, updated log information of the target database after restoring the backup data to be restored, and updated data information of the target database after restoring the backup data to be restored. The second snapshot may restore the database entity of the target database to the second state. When the production device queries the second snapshot, it may also restore the backup data to be restored using the incremental backup data restoration method.
[0133] That is to say, the first snapshots corresponding to the previously restored backup data are not deleted, and the second snapshots corresponding to the currently restored backup data are directly added by adding new snapshots, so that one can be selected from the snapshots including the first snapshot and the second snapshot in the future, and data can be restored based on the restored backup data corresponding to each snapshot according to the differential incremental backup data.
[0134] for example, Figure 8 This is a schematic diagram of a first snapshot update process involved in the embodiment of the present application. Figure 8 As shown, first, a user can log in to the storage system through the storage system interface using a storage user name and a corresponding password (S81) to obtain permission to modify, delete, or add a first snapshot. Then, the first snapshot named "Incremental_PRE_SNAP" is deleted through the storage system interface (S82). Then, the first snapshot named "Incremental_PRE_SNAP" is generated on the storage through the storage system interface according to the configuration information of the target database, the data disk, and the log disk (S83).
[0135] For example, Figure 9 This is a schematic diagram of a target database data recovery process involved in the embodiment of this application. Figure 9As shown, first, check whether the Incremental_PRE_SNAP snapshot exists (S91). Then, if the Incremental_PRE_SNAP snapshot exists, start checking metadata record information, find whether there is recovery copy metadata, and find the copy of the incremental backup data that needs to be restored (S92). If the recovery copy metadata exists, the Incremental_PRE_SNAP snapshot can be used to restore the target database (S93), and then the differential incremental backup data copy can be used to restore the data of the target database (S94). If the recovery copy metadata does not exist or it is determined in step S91 that the Incremental_PRE_SNAP snapshot does not exist, the data of the target database can be restored according to the full data, and the full data includes the full backup data and the copies of each incremental backup data under the full backup data (S95). After step S93 and step S95, the Incremental_PRE_SNAP snapshot can be cleared first, and then the Incremental_PRE_SNAP snapshot can be generated on the storage according to the configuration information, data disk and log disk of the target database (S96), and then "alter database open resetlogs" command to restart the target database.
[0136] Exemplarily, data recovery is performed according to the solution shown in the embodiment of the present application. The backup data copies that need to be restored for data recovery at various recovery times are shown in Table 2 below.
[0137] Table 2
[0138]
[0139]
[0140] Among them, if the recovery time is on the first day and there is no data that has been restored last time, the backup data that needs to be restored currently is the full backup data identified as 1; if the recovery time is on the second day and the backup data that has been restored last time is the full backup data identified as 1, then the backup data that needs to be restored currently is the incremental backup data identified as 1.1; if the recovery time is on the third day and the backup data that has been restored last time is the full backup data identified as 1, then the backup data that needs to be restored currently is the incremental backup data identified as 1.1 and the incremental backup data identified as 1.2 The sum of the three backups; if the recovery time is on the third day, and the last restored backup data is the full data corresponding to the incremental backup data identified as 1.1, then the backup data that needs to be restored currently is the incremental backup data identified as 1.2; if the recovery time is on the fourth day, and the last restored backup data is the full backup data identified as 1, then the backup data that needs to be restored currently is the sum of the incremental backup data identified as 1.1, the incremental backup data identified as 1.2, and the incremental backup data identified as 1.3. The method for determining the backup data that needs to be restored subsequently can be deduced by analogy.
[0141] That is to say, by combining the storage snapshot, that is, the first snapshot, to restore the target database to the state before executing the "openresetlogs" instruction, or the state before the target database was modified, the target database can be maintained in the state when the last data recovery was completed, so that the incremental backup data can continue to be used for recovery, reducing the network transmission and processing time of the restored data, thereby shortening the time required for data recovery of the target database.
[0142] In summary, in an embodiment of the present application, the production equipment can obtain the identifier of the backup data to be restored of the target database, and when the backup data to be restored is incremental backup data, obtain the restored backup data based on the same full backup data, and when the first snapshot is queried, restore the backup data to be restored based on the incremental backup data that differs between the restored backup data and the backup data to be restored. Since the first snapshot that can restore the target database to the state at the recovery time of the restored backup data is queried in advance, the problem of generating a new database entity after the last data recovery, resulting in the inability to identify the database entity of the target database, and continuing data recovery based on the restored backup data is avoided, and the restored backup data can be reused, thereby improving the efficiency of data recovery.
[0143] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the method. It can be understood that in order to realize the above functions, the data recovery device includes at least one of the hardware structure and software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0144] The embodiment of the present application can divide the data recovery device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, other division methods can be used.
[0145] For example, Figure 10 The following is a schematic diagram of a data recovery device 1000 provided by an exemplary embodiment of the present application. The data recovery device 1000 is applied to a computing device and includes:
[0146] The identification acquisition module 1010 is used to obtain the identification of the backup data to be restored in the target database;
[0147] The data acquisition module 1020 is configured to acquire restored backup data when the backup data to be restored is incremental backup data; wherein the restored backup data and the backup data to be restored are backup data based on the same full backup data, the backup time of the restored backup data is earlier than the backup time of the backup data to be restored, and the restored backup data is the most recent restored backup data between the backup time of the backup data to be restored;
[0148] The data recovery module 1030 is used to restore the backup data to be restored in accordance with the incremental backup data recovery method in response to querying the first snapshot; wherein, the first snapshot is used to determine the state of the target database at the recovery time of the restored backup data; the incremental backup data recovery method is a method of restoring the backup data to be restored based on the differential incremental backup data between the backup data to be restored and the restored backup data.
[0149] For example, combined with Figure 3 , the identification acquisition module 1010 can be used to perform the following Figure 3 In step 301 shown, the data acquisition module 1020 can be used to perform the following steps: Figure 3 In step 302 shown, the data recovery module 1030 can be used to perform the following steps: Figure 3 Step 303 is shown.
[0150] In a possible implementation, the data recovery module 1030 includes:
[0151] a state restoration submodule, configured to, in response to finding the first snapshot, restore the target database to a first state according to the first snapshot; the first state being a state of the target database after data recovery using the restored backup data;
[0152] The recovery submodule is configured to restore the target database in the first state using the backup data to be restored according to an incremental backup data recovery method.
[0153] For example, combined with Figure 4 , the state restoration submodule can be used to perform Figure 4 In step 405 shown, the recovery submodule can be used to perform the following steps: Figure 4 Step 406 is shown.
[0154] In a possible implementation, the recovery submodule includes:
[0155] an incremental data acquisition unit, configured to acquire n incremental backup data between the restored backup data and the backup data to be restored; n backup times of data backup are performed between the restored backup data and the backup data to be restored; wherein n is an integer greater than or equal to 1;
[0156] a difference determining unit, configured to determine the differential incremental backup data based on the n incremental backup data;
[0157] A recovery unit is configured to recover the target database in the first state using the backup data to be recovered according to the differential incremental backup data.
[0158] In a possible implementation, the identification acquisition module 1010 includes:
[0159] The identification acquisition submodule is used to obtain the identification of the backup data to be restored of the target database from the metadata record information; the metadata record information includes the identification of the backup data recorded when the backup data is backed up at each backup time.
[0160] In one possible implementation, the identifier is used to indicate the backup data type and the serial number corresponding to each backup data type; the backup data type includes full backup data or incremental backup data; the serial number corresponding to each backup data type includes a full backup serial number or an incremental backup serial number.
[0161] In a possible implementation, the incremental data acquisition unit is configured to:
[0162] The incremental backup data corresponding to the incremental backup serial numbers greater than the restored backup data and the incremental backup serial numbers less than or equal to the backup data to be restored are determined as the n incremental backup data; the incremental backup serial numbers are determined based on the identifiers of the backup data to be restored.
[0163] In a possible implementation, the apparatus further includes:
[0164] A type determination module is used to determine the backup data type of the backup data to be restored based on the identifier of the backup data to be restored before obtaining the restored backup data when the backup data to be restored is incremental backup data, and the backup data type includes full backup data or incremental backup data.
[0165] For example, combined with Figure 4 , the type determination module can be used to perform Figure 4 Step 402 is shown.
[0166] In a possible implementation, the apparatus further includes:
[0167] The second recovery module is used to obtain the identifier of the backup data to be restored of the target database, and when the backup data to be restored is the full backup data, restore the backup data to be restored according to the full backup data method; the full backup data restoration method is a method of restoring the backup data to be restored based on the full backup data.
[0168] For example, combined with Figure 4 , the second recovery module can be used to perform Figure 4 Step 403 is shown.
[0169] In a possible implementation, the first snapshot includes configuration information of the target database at the time of restoration of the restored backup data, log information of the target database at the time of restoration of the restored backup data, and data information of the restored backup data.
[0170] In a possible implementation, the apparatus further includes:
[0171] a clearing module, configured to clear the content in the first snapshot after restoring the backup data to be restored in an incremental backup data restoration manner;
[0172] A first acquisition module is used to acquire a second state of the target database after restoring the backup data to be restored;
[0173] An updating module is configured to update the first snapshot according to the second state.
[0174] In a possible implementation, the apparatus further includes:
[0175] A second acquisition module is configured to, after restoring the backup data to be restored in an incremental backup data restoration manner, acquire a second state of the target database after restoring the backup data to be restored;
[0176] An additional module is configured to generate the second snapshot according to the second state; wherein the second snapshot is used to determine the second state.
[0177] For the detailed description of the above optional methods, please refer to the above method embodiments, which will not be repeated here. In addition, the explanation of any data recovery device provided above and the description of its beneficial effects can refer to the above corresponding method embodiments, which will not be repeated here.
[0178] As an example, combined with Figure 11 The functions implemented in part or in whole in the identification acquisition module 1010, the data acquisition module 1020 and the data recovery module 1030 in the data recovery device can be realized by Figure 11 Processor 1110 in the Figure 11 The program code in the memory 1120 is implemented.
[0179] Figure 11 The following is a schematic diagram of a computing device 1100 according to an exemplary embodiment of the present application. The computing device 1100 may be an electronic device such as a smartphone, tablet computer, e-book, portable personal computer, or smart wearable device. The computing device 1100 in the present application may include one or more of the following components: a processor 1110 and a memory 1120.
[0180] The processor 1110 may include one or more processing cores. The processor 1110 utilizes various interfaces and circuits to connect various components within the terminal. It executes instructions, programs, code sets, or instruction sets stored in the memory 1120, as well as accesses data stored in the memory 1120, to perform various terminal functions and process data. Optionally, the processor 1110 may be implemented in hardware using at least one of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 1110 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the modem handles wireless communications. It is understood that the modem may not be integrated into the processor 1110 and may be implemented separately via a communications chip.
[0181] The memory 1120 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 1120 includes a non-transitory computer-readable storage medium. The memory 1120 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 1120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The operating system may be an Android system (including a system deeply developed based on the Android system), an IOS system developed by Apple (including a system deeply developed based on the IOS system), or other systems. The data storage area may also store data (such as a phone book, audio and video data, chat record data), etc., created by the terminal during use.
[0182] In addition, those skilled in the art will appreciate that the structure of the computing device 1100 shown in the above figures does not limit the computing device 1100. The computing device 1100 may include more or fewer components than shown, or may combine certain components or arrange the components differently. For example, the terminal may also include RF circuits, camera components, sensors, audio circuits, wireless fidelity (WiFi) components, power supplies, Bluetooth components, and other components, which are not described in detail here.
[0183] The present application also provides a computer-readable storage medium storing at least one computer instruction, which is loaded and executed by a processor to implement the data recovery method described in each of the above embodiments. For explanations of the relevant contents and descriptions of the beneficial effects of any of the above-mentioned computer-readable storage media, please refer to the corresponding embodiments above and will not be repeated here.
[0184] The embodiment of the present application also provides a chip. The chip integrates a control circuit and one or more ports for implementing the functions of the above-mentioned data recovery device. Optionally, the functions supported by the chip can be referred to above and will not be repeated here. Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned embodiment can be completed by instructing the relevant hardware through a program. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The above-mentioned processing unit or processor can be a central processing unit, a general-purpose processor, an application specific integrated circuit (ASIC), a microprocessor (digital signal processor, DSP), a field programmable gate array (FPGA) or other programmable logic device, transistor logic device, hardware component or any combination thereof.
[0185] The present application also provides a computer program product comprising instructions, which, when executed on a computer, causes the computer to perform any of the methods described in the above embodiments. The computer program product comprises one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available media may be magnetic media (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., SSD).
[0186] It should be noted that the above-mentioned device for storing computer instructions or computer programs provided in the embodiments of the present application, such as but not limited to, the above-mentioned memory, computer-readable storage medium and communication chip, etc., all have non-volatile (non-transitory). Those skilled in the art should be aware that in the above-mentioned one or more examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware or any combination thereof. When implemented using software, these functions can be stored in a computer-readable storage medium or transmitted as one or more instructions or codes on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein the communication medium includes any medium that is convenient for transmitting a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0187] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A data recovery method, characterized in that: The method is performed by a production device, and the method includes: Obtain the identifier of the backup data to be restored of the target database; Determining, based on the identifier of the backup data to be restored, the type of backup data to be restored, where the backup data type includes full backup data or incremental backup data; When the backup data to be restored is the full backup data, the backup data to be restored is restored in accordance with the full backup data method; the full backup data restoration method is a method of restoring the backup data to be restored based on the full backup data; If the backup data to be restored is incremental backup data, obtaining restored backup data; wherein the backup time of the restored backup data is earlier than the backup time of the backup data to be restored, and the restored backup data is the most recent restored backup data between the backup time of the backup data to be restored; If the restored backup data and the backup data to be restored are backup data based on the same full backup data, in response to querying a first snapshot, the backup data to be restored is restored in an incremental backup data restoration method; wherein, the first snapshot is used to determine the state of the target database at the restoration time of the restored backup data; and the incremental backup data restoration method is a method of restoring the backup data to be restored based on differential incremental backup data between the backup data to be restored and the restored backup data.
2. The method according to claim 1, characterized in that The step of restoring the backup data to be restored in accordance with the incremental backup data restoration method in response to finding the first snapshot includes: In response to querying the first snapshot, restoring the target database to a first state according to the first snapshot; the first state is a state of the target database after data recovery using the restored backup data; According to the incremental backup data recovery method, the target database in the first state is recovered using the backup data to be recovered.
3. The method according to claim 2, characterized in that Restoring the target database in the first state using the backup data to be restored according to the incremental backup data restoration method includes: Obtain n incremental backup data between the restored backup data and the backup data to be restored; n backup times of data backup are passed between the restored backup data and the backup data to be restored; wherein n is an integer greater than or equal to 1; Determining the differential incremental backup data based on the n incremental backup data; According to the differential incremental backup data, the target database in the first state is restored using the backup data to be restored.
4. The method according to any one of claims 1 to 3, characterized in that The step of obtaining the identifier of the backup data to be restored of the target database includes: The identifier of the backup data to be restored of the target database is obtained from metadata record information; the metadata record information includes the identifier of the backup data recorded when the backup data is backed up at each backup time.
5. The method according to claim 4, characterized in that The identifier is used to indicate the backup data type and the serial number corresponding to each backup data type; the backup data type includes full backup data or incremental backup data; the serial number corresponding to each backup data type includes a full backup serial number or an incremental backup serial number.
6. The method according to any one of claims 1 to 3, characterized in that The first snapshot includes configuration information of the target database at the time of restoration of the restored backup data, log information of the target database at the time of restoration of the restored backup data, and data information of the restored backup data.
7. The method according to any one of claims 1 to 3, characterized in that After the backup data to be restored is restored in the incremental backup data restoration mode, the method further includes: Clearing the content of the first snapshot; Acquire a second state of the target database after restoring the backup data to be restored; The first snapshot is updated according to the second state.
8. The method according to any one of claims 1 to 3, characterized in that After the backup data to be restored is restored in the incremental backup data restoration mode, the method further includes: Acquire a second state of the target database after restoring the backup data to be restored; A second snapshot is generated according to the second state; wherein the second snapshot is used to determine the second state.
9. A computing device, characterized in that The computing device includes a processor and a memory; the processor is coupled to the memory; the memory is used to store computer instructions, and the computer instructions are loaded and executed by the processor to enable the computing device to implement the data recovery method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Data recovery method, device and equipment and storage medium
CN112380057A
Method and equipment for recovering data based on backup system
CN113360322A