CN113760608B - Data recovery method and device, electronic equipment and storage medium - Google Patents
Data recovery method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113760608B CN113760608B CN202111053302.1A CN202111053302A CN113760608B CN 113760608 B CN113760608 B CN 113760608B CN 202111053302 A CN202111053302 A CN 202111053302A CN 113760608 B CN113760608 B CN 113760608B
- Authority
- CN
- China
- Prior art keywords
- target
- log
- rollback
- data
- type
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000011084 recovery Methods 0.000 title claims abstract description 119
- 238000000034 method Methods 0.000 title claims abstract description 104
- 230000008859 change Effects 0.000 claims abstract description 101
- 238000004458 analytical method Methods 0.000 claims description 81
- 238000004891 communication Methods 0.000 claims description 18
- 239000000470 constituent Substances 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 230000002159 abnormal effect Effects 0.000 abstract description 12
- 238000005516 engineering process Methods 0.000 abstract description 2
- 230000008569 process Effects 0.000 description 11
- 230000006870 function Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 4
- 238000012360 testing method Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000012217 deletion Methods 0.000 description 3
- 230000037430 deletion Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000012508 change request Methods 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003032 molecular docking Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
- G06F11/1469—Backup restoration techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/1805—Append-only file systems, e.g. using logs or journals to store data
- G06F16/1815—Journaling file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Computer Security & Cryptography (AREA)
- Quality & Reliability (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application provides a data recovery method and device, electronic equipment and a storage medium. Wherein the method comprises the following steps: obtaining a target redo log file of a target database; analyzing the target redo log file to obtain a target rollback log; according to the composition fields of the target rollback log, analyzing the target rollback log to obtain a rollback log record; generating a recovery instruction for recovering the target database according to the rollback log record; and indicating the equipment where the target database is located to execute a recovery instruction so as to recover the target database from the state after the error data change is executed to the historical data state. The method and the device solve the problem that the target database cannot be restored under the condition that the target database is not backed up after the abnormal operation is executed or the backup file of the target database is unavailable after the abnormal operation is executed in the related technology.
Description
Technical Field
The present application relates to the field of database technologies, and in particular, to a data recovery method and apparatus, an electronic device, and a storage medium.
Background
During the use process of the MySQL database, the data in the MySQL database can be frequently modified, so that the situation that the modified MySQL database has error data is difficult to avoid.
In the related art, in the case that error data exists in the MySQL database and recovery is required, if no data backup and binlog file (a file for recording data update or potential update in the MySQL database) exist in the MySQL database, the data recovery cannot be performed on the MySQL database.
Therefore, there is a problem in the related art that when the target database is not backed up after performing the abnormal operation or the backup file is not available after performing the abnormal operation, data recovery cannot be performed on the erroneous data in the database.
Disclosure of Invention
The application provides a data recovery method and device, electronic equipment and a storage medium, which at least solve the problem that in the related art, when a target database is not backed up after abnormal operation is executed or a backup file is unavailable after the abnormal operation is executed, the data recovery of error data in the database cannot be carried out.
According to an aspect of an embodiment of the present application, there is provided a data recovery method including:
obtaining a target redo log file of a target database, wherein the target redo log file is generated when error data change is executed in the target database;
Analyzing the target redo log file to obtain a target rollback log;
analyzing the target rollback log according to the composition fields of the target rollback log to obtain a rollback log record, wherein the rollback log record is information for indicating the historical data state before the target database executes the error data change;
Generating a recovery instruction for recovering the target database according to the rollback log record;
and indicating the equipment where the target database is located to execute the recovery instruction so as to recover the target database from the state after the error data change is executed to the historical data state.
Optionally, in the foregoing method, the parsing the target rollback log from the target redo log file includes:
Determining at least one target rollback log block in the target redo log file, wherein each target rollback log block comprises one target rollback log;
analyzing a log segment of the target rollback log in the target rollback log block by using a first analysis mode to obtain the target rollback log, wherein the target rollback log block comprises logs of various log types, the various log types comprise target log types of the target rollback log, and the first analysis mode is matched with the log types of the target rollback log.
Optionally, in the foregoing method, the parsing, using a first parsing method, the log segment in which the target rollback log is located in the target rollback log block includes: analyzing the current log segment in the target rollback log block by using a plurality of analysis modes respectively until the target rollback log is analyzed, wherein the starting position of the current log segment is the first position positioned behind the log segment successfully identified in the previous time or is the starting position of the target rollback log block:
When the first analysis mode in the multiple analysis modes is used for identifying the type starting identifier of the target log type at the starting position of the current log segment, continuing to identify the type ending identifier of the target log type in the target rollback log by using the first analysis mode, taking the position of the type ending identifier of the target log type as the ending position of the current log segment, and taking the content analyzed from the starting position of the current log segment to the ending position of the current log segment as the target rollback log;
And under the condition that a second analysis mode in the multiple analysis modes is used for identifying a type starting identifier of a second log type at the starting position of the current log segment, continuously using the second analysis mode for identifying a type ending identifier of the second log type in the target rollback log, and taking a first position after the type ending identifier of the second log type as the starting position of the next log segment, wherein the second analysis mode is any analysis mode except the first analysis mode in the multiple analysis modes.
Optionally, in the foregoing method, the parsing the target rollback log according to the constituent fields of the target rollback log, to obtain a rollback log record includes:
Determining an order relationship between each of the constituent fields of the target rollback log;
Analyzing the target rollback log according to the order relation to obtain a field value of each component field;
And obtaining the rollback log record according to the field value of each component field.
Optionally, the method, wherein generating a recovery instruction for recovering the target database according to the rollback log record includes:
determining a history primary key value of history data through the rollback log record, wherein the history data is a history field name and a history field value of a history composition field of the history data, the history data is the error data change data executed in the target database before the error data is changed, and the history composition field is a field with a modified field value after the error data is changed in the history data;
and writing the history main key value into a writing position for writing the main key value of the data to be modified in a recovery statement template, writing the history field name into a writing position for writing the field name of the field to be modified in the recovery statement template, and writing the history field value into a writing position for writing the field value of the field to be modified in the recovery statement template, so as to obtain the recovery instruction.
Optionally, in the foregoing method, the instructing the device where the target database is located to execute the recovery instruction to recover the target database from a state after the error data change is executed to the historical data state includes:
indicating the equipment to locate target data in the target database according to the historical primary key value in the recovery instruction, wherein the target data is data after the historical data is changed through the error data;
Indicating the equipment to locate a target field changed by the error data in the target data according to the history field name in the recovery instruction;
The device is instructed to modify the current value in the target field by the historical field value to restore the target database to the historical data state.
Optionally, as in the previous method, before the obtaining the target redo log file of the target database, the method further includes:
Acquiring target data changes executed by the target database in historical time;
and under the condition that the target data change is determined to be not in accordance with a preset change requirement, determining the target data change as the error data change.
Optionally, in the foregoing method, after determining that the target data change does not meet the preset change requirement, the method further includes:
Determining a target service party corresponding to the target database, wherein the target service party is a service party capable of operating the target database;
and interrupting the operation of the target business party on the target database.
According to another aspect of the embodiment of the present application, there is also provided a data recovery apparatus, including:
the system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring a target redo log file of a target database, wherein the target redo log file is generated when error data change is executed in the target database;
the first analysis module is used for analyzing the target redo log file to obtain a target rollback log;
the second analysis module is used for analyzing the target rollback log according to the composition fields of the target rollback log to obtain a rollback log record, wherein the rollback log record is information for indicating the historical data state before the target database executes the error data change;
the recovery instruction module is used for generating a recovery instruction for recovering the target database according to the rollback log record;
and the database recovery module is used for indicating the equipment where the target database is located to execute the recovery instruction so as to recover the target database from the state after the error data is changed to the historical data state.
According to still another aspect of the embodiments of the present application, there is provided an electronic device including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus; wherein the memory is used for storing a computer program; a processor for performing the method steps of any of the embodiments described above by running the computer program stored on the memory.
According to a further aspect of the embodiments of the present application there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the method steps of any of the embodiments described above when run.
In the embodiment of the application, the method of analyzing the target redo log file of the target database is adopted, the corresponding rollback log record is obtained through analyzing the target redo log file of the target database, and the rollback log record is the information for indicating the historical data state before the target database executes the error data change, so that the purpose of recovering the target database to the historical data state corresponding to the target rollback log in the target redo log file according to the rollback log record can be realized, the technical effect of providing a new implementation mode for recovering the database is achieved, and the problem that the target database cannot be recovered under the condition that the backup file is unavailable after the target database executes the abnormal operation in the prior art is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the application or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic diagram of a hardware environment of an alternative data recovery method according to an embodiment of the present application;
FIG. 2 is a flow chart of an alternative data recovery method according to an embodiment of the application;
FIG. 3 is a block diagram of an alternative data recovery device according to an embodiment of the present application;
fig. 4 is a block diagram of an alternative electronic device in accordance with an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of an embodiment of the present application, there is provided a data recovery method. Alternatively, in the present embodiment, the above-described data recovery method may be applied to a hardware environment constituted by a terminal and a server. The server is connected with the terminal through a network, and can be used for providing services (such as game services, application services and the like) for the terminal or clients installed on the terminal, and a database can be arranged on the server or independent of the server and used for providing data storage services for the server.
The network may include, but is not limited to, at least one of: wired network, wireless network. The wired network may include, but is not limited to, at least one of: a wide area network, a metropolitan area network, a local area network, and the wireless network may include, but is not limited to, at least one of: WIFI (WIRELESS FIDELITY ), bluetooth. The terminal may not be limited to a PC, a mobile phone, a tablet computer, or the like.
The data recovery method of the embodiment of the application can be executed by a server, a terminal or both. The data recovery method performed by the terminal according to the embodiment of the present application may also be performed by a client installed thereon.
Taking the example that the data recovery method in this embodiment is executed by the server as an example, fig. 1 is a schematic flow chart of an alternative data recovery method according to an embodiment of the present application, and as shown in fig. 1, the flow chart of the method may include the following steps:
Step S101, a target redo log file of a target database is obtained, wherein the target redo log file is generated when error data change is executed in the target database.
The data recovery method in this embodiment may be applied to a scenario where data recovery is required for a specified database, for example: the method can be used for solving the problem that the target database is not backed up after the abnormal operation is executed, or the target database is subjected to data recovery under the condition that the backup file is unavailable after the abnormal operation is executed, or the like, or the method can be used for carrying out data recovery on the databases under other scenes. In the embodiment of the application, the data recovery method is described by taking the example that the target database is not backed up or backed up after the abnormal operation is executed, and the data recovery method is also applicable to other types of target databases executing error data change under the condition of no contradiction.
Taking a scenario that the target database has no backup file after the target database cannot be started or is abnormally operated as an example, the target database is restored to a historical data state before error data change is executed by carrying out data restoration on the target database.
The target database may be a database that makes data changes and the target database may generate a target redo log file after the data changes are made.
Further, the target redo log file may be a log file generated when an error data change is performed in the target database.
The error data change may include, but is not limited to, a change operation such as writing error data in the target database or performing an error data deletion.
For example, after performing an error operation (e.g., writing erroneous data) on the target database, the business side corresponding to the target database causes an erroneous data change to be performed in the target database, so that a target Redo Log File, such as a redox Log File, corresponding to the erroneous data change performed by the target database is generated.
Step S102, analyzing from the target redo log file to obtain a target rollback log.
After the target redo log file is obtained, the target rollback log can be obtained by analyzing the redo log file.
The target database may have performed a plurality of data changes before the target database performs the erroneous data changes, and in the case where the target rollback log corresponding to at least one data change is not deleted, the at least one target rollback log may be parsed in the target redo log file. Thus, the parsed target rollback log may include one or more.
Step S103, analyzing the target rollback log according to the composition fields of the target rollback log to obtain a rollback log record, wherein the rollback log record is information for indicating the historical data state before the target database executes the error data change.
After all the target rollback logs of the target redo log are obtained, each target rollback log can be analyzed to obtain the rollback log record in each target rollback log.
In the case of obtaining the target rollback log, the structure of the target rollback log may be determined through the constituent fields of the target rollback log, and each constituent field may be determined to refer to a parameter type, so that the target rollback log is parsed according to the constituent fields of the target rollback log, to obtain the rollback log record.
The rollback log record may be information indicating historical data states before the target database performed the erroneous data changes, which may include, but is not limited to: the error data changes the corresponding change position and the parameter value before the change. For example, when the error data change changes the value corresponding to the value of the primary key X and the update column Y from a NULL value (i.e., NULL) to "xxx"; the value corresponding to primary key X and update column Y may be included in the rollback log record as a NULL value (i.e., NULL).
Step S104, a recovery instruction for recovering the target database is generated according to the rollback log record.
After the rollback log record is obtained, a recovery instruction for recovering the target database can be generated according to the rollback log record.
The restore instruction may be an instruction for restoring the target database from a state after execution of the erroneous data change to a historical data state. The resume instruction may include location information and a value (which may be a null value) that needs to be resumed.
In the case that there are multiple target rollback logs, since each target rollback log includes one rollback log record, different rollback log records are used to indicate different historical data states of the target database; for example, when there are three rollback log records (A, B, C), A corresponds to the historical data state 3 minutes before the target database performed the error data change, B corresponds to the historical data state 2 minutes before the target database performed the error data change, and C corresponds to the historical data state 1 minute before the target database performed the error data change. Thus, corresponding recovery instructions a, b, c may be generated according to A, B, C, respectively.
For example, on the basis of the foregoing example, in the case where the values corresponding to the primary key X and the update column Y may be included in the rollback log record as NULL values (i.e., NULL), the recovery instruction Q generated from the rollback log record may be an instruction for instructing to modify the values of the primary key X and the update column Y as NULL values.
Step S105, instruct the device where the target database is located to execute a recovery instruction to recover the target database from the state after the execution of the error data change to the historical data state.
After the recovery instruction is generated, the device in which the target database is located can be instructed to execute the recovery instruction so as to recover the target database from the state after the error data change is executed to the historical data state
The device in which the target database is located may be a computing device corresponding to the target database, or may be a computing device for modifying data in the target database.
When the recovery instruction includes one, the device where the target database is located may be instructed to execute the unique recovery instruction, so as to recover the target database from the state after the error data is executed to the historical data state corresponding to the recovery instruction.
And under the condition that the recovery instructions comprise a plurality of recovery instructions, the equipment in which the target database is positioned is instructed to execute the target recovery instructions so as to recover the target database from the state after the error data is executed to the target historical data state, wherein the target recovery instructions are the recovery instructions for recovering the target database, and the target historical data state is the historical data state of the target database indicated by the rollback log record corresponding to the target recovery instructions. That is, the device where the target database is located may be instructed to determine, from the plurality of recovery instructions, a target recovery instruction for performing recovery, so as to recover the target database from a state after the execution of the error data change to a historical data state corresponding to the target recovery instruction.
For example, in the case where only the aforementioned recovery instruction Q exists, and the service party corresponding to the target database determines that the target database is recovered by the recovery instruction Q, the recovery instruction Q may be triggered to execute by a preset operation (for example, clicking "confirm recovery to the state") to instruct the device where the target database is located to execute the recovery instruction Q, so as to recover the target database from the state after the execution of the erroneous data change to the historical data state where the value corresponding to the primary key X and the update column Y is NULL (i.e., NULL).
According to the method in the embodiment, when the target database is not backed up after the abnormal operation is executed or the backup file is unavailable after the abnormal operation is executed, the target database is restored to the historical data state corresponding to the target rollback log in the target redo log file through the target redo log file of the target database, so that the purpose of restoring the error data state in the target database to the correct data state is achieved, and a new implementation mode for restoring the database is provided.
As an optional implementation manner, the parsing the target rollback log from the target redo log file in step S102 includes the following steps:
in step S201, at least one target rollback log block is determined in the target redo log file, where each target rollback log block includes a target rollback log.
Because the data updating is carried out once on each pair of target databases, a latest target rollback log Block (namely, redo Block) corresponding to the data updating is generated in the target Redo log file, and at least the latest target rollback log Block is reserved in the target Redo log file; thus, after the target redo log file of the target database is obtained, the target redo log file may be parsed (e.g., by log block name, etc.) to obtain at least one target rollback log block, and each target rollback log block includes a target rollback log (i.e., MLOG _undo_insert).
Step S202, analyzing a log segment of a target rollback log in a target rollback log block by using a first analysis mode to obtain the target rollback log, wherein the target rollback log block comprises logs of various log types, the various log types comprise target log types of the target rollback log, and the first analysis mode is matched with the log types of the target rollback log.
A target rollback log block may include several different types of log segments, optionally identified as resolved to the target rollback log when resolved to a log segment named MLOG _ UNDO _ INSERT.
The target rollback log is a record contained in a target rollback log block, the target rollback log block comprises logs of various log types, and the various log types comprise target log types to which the target rollback log belongs, so that a first analysis mode matched with the log type to which the target rollback log belongs needs to be determined in all analysis modes corresponding to the target rollback log block.
After determining the first analysis mode corresponding to the target rollback log, the first analysis mode can be used for analyzing the log segment where the target rollback log is located in the target rollback log block, and the target rollback log is obtained.
For example, how much space is occupied by each redox record (i.e., log) in a redox block (i.e., a target rollback log block) is uncertain, so each redox record in the redox block can be parsed out through all parsing modes corresponding to the target rollback log block until a log segment where the target rollback log is located is parsed in a first parsing mode to obtain the target rollback log, or the target rollback log can be obtained by starting parsing from a first position of the target rollback log block in the first parsing mode, and when the target rollback log cannot be parsed, skipping a position where the parsing cannot be performed and starting parsing from a next position until the log segment where the target rollback log is located is parsed in the first parsing mode.
When there are multiple target rollback log blocks, the target rollback log may be obtained by respectively parsing each target rollback log block by the method in this embodiment.
By the method in the embodiment, the purpose of analyzing and obtaining the target rollback log in the target redo log file can be achieved, so that the target database can be recovered according to the target rollback log in the later period.
As shown in fig. 2, as an alternative embodiment, in the foregoing method, the step S201 of parsing the log segment where the target rollback log is located in the target rollback log block by using a first parsing method, and the step of obtaining the target rollback log includes the following steps: the method comprises the steps of respectively analyzing a current log segment in a target rollback log block by using a plurality of analysis modes according to the following modes until the target rollback log is analyzed, wherein the starting position of the current log segment is the first position positioned behind the log segment successfully identified in the previous time or is the starting position of the target rollback log block:
In step S301, when the first parsing method of the multiple parsing methods is used to identify the type start identifier of the target log type at the start position of the current log segment, the first parsing method is continuously used to identify the type end identifier of the target log type in the target rollback log, and the position where the type end identifier of the target log type is located is used as the end position of the current log segment, and the content parsed from the start position of the current log segment to the end position of the current log segment is used as the target rollback log.
After the target rollback log is determined, the target rollback log can be analyzed in a first analysis mode to obtain the target rollback log, and because the space occupied by each log in the target rollback log block cannot be determined, the log segment of each log in the target rollback log block cannot be determined, the target rollback log block can be analyzed in a circulating mode in each analysis mode until the target rollback log is analyzed in the target rollback log block in the first analysis mode.
When the corresponding N logs have been parsed by the N parsing methods, the current log segment is the other log segments except the log segments of the N logs in the target rollback log block, that is, the starting position of the current log segment is the first position after the log segment successfully identified in the previous time; when the log is analyzed in the target rollback log block without any analysis mode, the current log segment is the target rollback log block, that is, the starting position of the current log segment is the starting position of the target rollback log block.
If the type start identifier of the target log type is identified at the start position of the current log segment by the first analysis mode, the first analysis mode may be continuously used to identify the type end identifier of the target log type in the target rollback log.
The type start identifier of the target log type may be one or more identifiers located at a start position in all logs corresponding to the log type of the target rollback log.
The type end identifier of the target log type may be one or more identifiers located at an end position in all logs corresponding to the log type of the target rollback log.
After the type start identifier and the type end identifier are identified, all bytes between the type start identifier and the type end identifier (including the type start identifier and the type end identifier) can be used as a log segment of the target rollback log, so that the position of the type end identifier of the target log type can be used as the end position of the current log segment, and the content analyzed from the start position of the current log segment to the end position of the current log segment can be used as the target rollback log.
In step S302, when the second parsing method of the multiple parsing methods is used to identify the type start identifier of the second log type at the start position of the current log segment, the second parsing method is continuously used to identify the type end identifier of the second log type in the target rollback log, and the first position after the type end identifier of the second log type is used as the start position of the next log segment, where the second parsing method is any one of the multiple parsing methods except the first parsing method.
The manner of resolving the current log segment by the second resolving manner to obtain the log of the second log type corresponding to the second resolving manner is identical to the manner in step S301, and will not be described herein.
When the type end identifier of the second log type is identified in the target rollback log by using the second analysis mode, a log of the second log type corresponding to the second analysis mode can be determined in the current log segment, and then the first position after the type end identifier of the second log type can be used as the starting position of the next log segment, so that analysis can be continuously performed from the starting position of the next log segment through each analysis mode.
And circulating until the target rollback log is parsed out through a first parsing mode.
By the method in the embodiment, the target rollback log block can be analyzed in a circulating analysis mode through each analysis mode to obtain the target rollback log, and the method has the advantage of high analysis efficiency.
As an optional implementation manner, in the foregoing method, the step S103 of parsing the target rollback log according to the composition field of the target rollback log to obtain the rollback log record includes the following steps:
In step S401, an order relationship between the respective constituent fields of the target rollback log is determined.
And step S402, analyzing the target rollback log according to the order relation to obtain the field value of each component field.
Step S403, according to the field value of each component field, a rollback log record is obtained.
After the target rollback log is obtained, the order relation among all the component fields in the target rollback log can be determined, and then the target rollback log can be analyzed according to the analysis mode of all the component fields so as to obtain the field value of each component field. Each component field may have a corresponding field name.
For any rollback log, the rollback log includes a plurality of component fields, wherein the position of the data for performing the error data change can be determined according to the information corresponding to the field UNIQ FILED OR PRIMARY FILED, and then the data before the error data change is performed at the position is queried according to the information corresponding to the field UPDATE FILED, so as to obtain the data before the error data change is performed.
By the method in the embodiment, the rollback log record can be obtained quickly according to the analysis of the target rollback log, so that the aim of obtaining the data before the error data change of the target database is achieved.
As an alternative embodiment, the step S104 of generating a recovery instruction for recovering the target database according to the rollback log record includes the following steps:
In step S501, the history primary key value of the history data, the history field name and the history field value of the history component field of the history data are determined by rollback log record, wherein the history data is the data of executing the error data change in the target database before executing the error data change, and the history component field is the field of which the field value is modified after the error data change in the history data.
After the rollback log record is obtained, a history primary key value of the history data, a history field name of a history composition field of the history data and a history field value can be determined according to the rollback log record.
The history primary key value may be a sequence number of a history primary key for indicating data for which erroneous data change is performed. The history primary key value matches the primary key value of the data changed by the error data.
The history field name may be a field name indicating a field in which an erroneous data change is made in the data corresponding to the history primary key, may be characterized by a parameter type (for example, addr (address)) corresponding to the field, and the like.
The history field value may be a value of a field corresponding to the history field name before the error data is changed.
Step S502, writing the history primary key value into a writing position for writing the primary key value of the data to be modified in the recovery statement template, writing the history field name into a writing position for writing the field name of the field to be modified in the recovery statement template, and writing the history field value into a writing position for writing the field value of the field to be modified in the recovery statement template, thereby obtaining a recovery instruction.
After the history primary key value is obtained, the history primary key value can be written into a writing position for writing the primary key value of the data to be modified in the recovery statement template; after the history field name is obtained, the history field name can be written into a writing position for writing the field name of the field to be modified in the recovery statement template; after the history field value is obtained, the history field value may be written into a writing location in the recovery statement template for writing the field value of the field to be modified, to obtain a recovery instruction.
The resume statement template may be a template that is preset for writing resume information (i.e., history primary key value, history field name, history field value, etc.) for generating a corresponding resume instruction.
For example, update ' type_test ' ″ test5 ' set ' history field name =history field value where ' id = ' history primary key value ';
When the history primary key value is 18, the history field name is addr, and the history field value is NULL, the generated recovery instruction is: update ' type_test ' ″ test5 ' set ' addr ' =null wire ' id ' = '18';
When the history primary key value is 19, the history field name is addr, and the history field value is yyy, the generated recovery instruction is: update 'type_test' & gt, 'test 5' set 'addr = yyy wherem' id = '19'.
By the method in the embodiment, the recovery instruction for recovering the target database can be automatically constructed, so that the target database can be automatically recovered to the historical data state before the error data change according to the recovery instruction.
As an alternative embodiment, the step S105 of instructing the device where the target database is located to execute the recovery instruction to recover the target database from the state after the execution of the error data change to the historical data state includes the following steps:
In step S601, the pointing device locates the target data in the target database according to the history primary key value in the recovery command, where the target data is the data after the history data is changed by the error data.
In step S602, the pointing device locates, in the target data, the target field changed by the erroneous data according to the history field name in the resume instruction.
In step S603, the pointing device modifies the current value in the target field by the history field value to restore the target database to the history data state.
After the recovery instruction is generated, the target database may be data modified according to the recovery instruction.
After the device in which the target database is located receives the recovery instruction, the historical data is consistent with the primary key value of the target data after the error data is changed, so that the target data can be positioned in the target database according to the analyzed historical primary key value in the recovery instruction.
After locating the target data, since the history data is consistent with the field name of the target data changed by the error data, the target field changed by the error data can be located in the target data after the history field name in the reply instruction is resolved.
After the target field in the target data is positioned, the current value in the target field can be modified according to the historical field value, so that the aim of recovering the target database to the historical data state is fulfilled.
By the method in the embodiment, the recovery of the target database to the historical data state can be automatically completed through the recovery instruction, so that the recovery efficiency of the database can be effectively improved, and the workload of database maintenance personnel is reduced.
As an alternative embodiment, as in the foregoing method, before the step S101 of obtaining the target redo log file of the target database, the method further includes the following steps:
step S701, obtaining a target data change executed by the target database at a history time.
After the target database performs the target data change in the historical time, the target data change can be obtained by monitoring the target database.
The historical time may be a point in time prior to the current time.
The target data change may be a change, addition, deletion, etc. of the data.
In step S702, when it is determined that the target data change does not meet the preset change requirement, the target data change is determined as an erroneous data change.
After the target data change is acquired, whether the target data change is an erroneous data change can be determined by determining whether the target data change meets a preset change requirement.
The preset change request may be a request for limiting a legal data change, for example, limiting a legal data type or a legal change method (for example, only an addition or a deletion is illegal).
For example, if the target data change is to modify the value of the address field having the primary key 18 to "xxx" when the preset change request is that the value of the address field cannot be "xxx", the target data change is determined to be an erroneous data change.
By the method in the embodiment, whether the target database is changed with error data can be automatically judged, so that the response efficiency of recovering the target database is improved.
As an optional implementation manner, as in the foregoing method, after determining that the target data change does not meet the preset change requirement in step S702, the method further includes the following steps:
Step S801, determining a target service party corresponding to the target database, where the target service party is a service party capable of operating the target database.
Step S802, the operation of the target business party on the target database is interrupted.
After determining that the target data change is the error data change, determining a service party corresponding to the target database through the target database docking interface.
The target business party is a business party capable of operating on the target database.
Under the condition that the error data change of the target database is determined, the purpose of interrupting the operation of the target business party on the target database can be achieved by switching the interface of the target business party on the target database. And re-allowing the target business party to operate on the target database after the target database is restored to the historical data state.
According to the method in the embodiment, under the condition that the target database is determined to have error data change, the operation of the target business side on the target database is interrupted, so that the problem that the target rollback log in the target database is cleared due to the operation of the target business side after the error data change is avoided, and the rollback log in the redo log file only has information corresponding to the data state after the error data change, so that the target database cannot be restored to the normal historical data state is solved, and the success rate of restoring the target database can be effectively improved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM (Read-Only Memory)/RAM (Random Access Memory), magnetic disk, optical disk) and including instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present application.
According to another aspect of the embodiment of the present application, there is also provided a data recovery apparatus for implementing the above data recovery method. FIG. 3 is a block diagram of an alternative data recovery device according to an embodiment of the present application, as shown in FIG. 3, which may include:
the system comprises an acquisition module 1, a database management module and a database management module, wherein the acquisition module 1 is used for acquiring a target redo log file of a target database, wherein the target redo log file is generated when error data change is executed in the target database;
The first analysis module 2 is used for analyzing the target redo log file to obtain a target rollback log;
The second parsing module 3 is configured to parse the target rollback log according to the constituent fields of the target rollback log, to obtain a rollback log record, where the rollback log record is information for indicating a historical data state before the target database performs the error data change;
the recovery instruction module 4 is used for generating a recovery instruction for recovering the target database according to the rollback log record;
And the database recovery module 5 is used for instructing the equipment where the target database is located to execute a recovery instruction so as to recover the target database from the state after the error data change is executed to the historical data state.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. In addition, the specific process of implementing the functions of each module in the apparatus of the embodiment of the present invention may be referred to the related description in the method embodiment, which is not repeated herein.
As an alternative embodiment, as the aforementioned apparatus, the first parsing module 2 includes:
the determining unit is used for determining at least one target rollback log block in the target redo log file, wherein each target rollback log block comprises a target rollback log;
The analysis unit is used for analyzing the log segment of the target rollback log in the target rollback log block by using a first analysis mode to obtain the target rollback log, wherein the target rollback log block comprises logs of various log types, the various log types comprise the target log type of the target rollback log, and the first analysis mode is matched with the log type of the target rollback log.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. In addition, the specific process of implementing the functions of each module in the apparatus of the embodiment of the present invention may be referred to the related description in the method embodiment, which is not repeated herein.
As an alternative embodiment, as in the previous device, the parsing unit is configured to: the method comprises the steps of respectively analyzing a current log segment in a target rollback log block by using a plurality of analysis modes according to the following modes until the target rollback log is analyzed, wherein the starting position of the current log segment is the first position positioned behind the log segment successfully identified in the previous time or is the starting position of the target rollback log block:
Under the condition that a first analysis mode in a plurality of analysis modes is used for identifying a type starting identifier of a target log type at the starting position of a current log segment, continuously using the first analysis mode for identifying a type ending identifier of the target log type in a target rollback log, taking the position of the type ending identifier of the target log type as the ending position of the current log segment, and taking the content analyzed from the starting position of the current log segment to the ending position of the current log segment as a target rollback log;
And under the condition that a second analysis mode in the multiple analysis modes is used for identifying a type starting identifier of a second log type at the starting position of the current log segment, continuously using the second analysis mode for identifying a type ending identifier of the second log type in the target rollback log, and taking the first position after the type ending identifier of the second log type as the starting position of the next log segment, wherein the second analysis mode is any analysis mode except the first analysis mode in the multiple analysis modes.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. In addition, the specific process of implementing the functions of each module in the apparatus of the embodiment of the present invention may be referred to the related description in the method embodiment, which is not repeated herein.
As an alternative embodiment, the second parsing module 3 is configured to:
Determining order relation among various constituent fields of the target rollback log;
Analyzing the target rollback log according to the order relation to obtain a field value of each component field;
And obtaining the rollback log record according to the field value of each component field.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. In addition, the specific process of implementing the functions of each module in the apparatus of the embodiment of the present invention may be referred to the related description in the method embodiment, which is not repeated herein.
As an alternative embodiment, the recovery instruction module 4 is configured to:
Determining a history primary key value of history data through rollback log records, wherein the history data is a history field name and a history field value of a history composition field of the history data, the history data is execution error data change data in a target database before execution error data change, and the history composition field is a field in the history data, the field value of which is modified after error data change;
Writing the history main key value into a writing position for writing the main key value of the data to be modified in the recovery statement template, writing the history field name into a writing position for writing the field name of the field to be modified in the recovery statement template, and writing the history field value into a writing position for writing the field value of the field to be modified in the recovery statement template, so as to obtain the recovery instruction.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. In addition, the specific process of implementing the functions of each module in the apparatus of the embodiment of the present invention may be referred to the related description in the method embodiment, which is not repeated herein.
As an alternative embodiment, as in the previous device, the database recovery module 5 is configured to:
The indicating equipment locates target data in a target database according to the historical primary key value in the recovery instruction, wherein the target data is changed by the historical data;
The indicating equipment locates the target field changed by the error data in the target data according to the history field name in the recovery instruction;
The pointing device modifies the current value in the target field with the history field value to restore the target database to the history data state.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. In addition, the specific process of implementing the functions of each module in the apparatus of the embodiment of the present invention may be referred to the related description in the method embodiment, which is not repeated herein.
As an alternative embodiment, the apparatus as described above further comprises a determining module configured to:
Acquiring target data changes executed by a target database in historical time;
And when the target data change is determined not to meet the preset change requirement, determining the target data change as an error data change.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. In addition, the specific process of implementing the functions of each module in the apparatus of the embodiment of the present invention may be referred to the related description in the method embodiment, which is not repeated herein.
As an alternative embodiment, the apparatus as described above further includes an interrupt module, configured to:
Determining a target service party corresponding to the target database, wherein the target service party is a service party capable of operating the target database;
and interrupting the operation of the target business party on the target database.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. In addition, the specific process of implementing the functions of each module in the apparatus of the embodiment of the present invention may be referred to the related description in the method embodiment, which is not repeated herein.
According to another embodiment of the present application, there is also provided an electronic apparatus including: as shown in fig. 4, the electronic device may include: the device comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 are in communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
The processor 1501 is configured to execute the program stored in the memory 1503, thereby implementing the steps of the method embodiment described above.
The bus mentioned above for the electronic device may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The bus may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but may also be a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components.
The embodiment of the application also provides a computer readable storage medium, wherein the storage medium comprises a stored program, and the program executes the method steps of the method embodiment.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a U disk, ROM, RAM, a mobile hard disk, a magnetic disk or an optical disk.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logic function division, and there may be other division manners in which a practical implementation may be, for example, multiple modules or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with respect to each other may be through some interface, module or indirect coupling or communication connection of modules, electrical or otherwise.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution provided in this embodiment.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application, which are intended to be comprehended within the scope of the present application.
Claims (9)
1. A method of data recovery, comprising:
obtaining a target redo log file of a target database, wherein the target redo log file is generated when error data change is executed in the target database;
Analyzing the target redo log file to obtain a target rollback log;
according to the composition field of the target rollback log, analyzing the target rollback log to obtain a rollback log record, which comprises the following steps: determining at least one target rollback log block in the target redo log file, wherein each target rollback log block comprises one target rollback log, each target rollback log block comprises logs of various log types, and the various log types comprise target log types to which the target rollback log belongs; analyzing the current log segment in the target rollback log block by using a plurality of analysis modes respectively until the target rollback log is analyzed, wherein the starting position of the current log segment is the first position positioned behind the log segment successfully identified in the previous time or is the starting position of the target rollback log block: when a first analysis mode in the multiple analysis modes is used for identifying the type starting identifier of the target log type at the starting position of the current log segment, continuing to use the first analysis mode for identifying the type ending identifier of the target log type in the target rollback log, taking the position of the type ending identifier of the target log type as the ending position of the current log segment, taking the content analyzed from the starting position of the current log segment to the ending position of the current log segment as the target rollback log, wherein the first analysis mode is matched with the log type to which the target rollback log belongs, and when a second analysis mode in the multiple analysis modes is used for identifying the type starting identifier of the second log type at the starting position of the current log segment, continuing to use the second analysis mode for identifying the type ending identifier of the second log type in the target rollback log, taking the first position after the type ending identifier of the second log type as the next log segment, taking the first position after the type ending identifier as the second log type ending identifier as the next log segment, taking the second analysis mode as the first analysis mode, taking the first analysis mode as the error data, and taking the first analysis mode as the error analysis mode, wherein the error data and the error analysis mode is used for indicating the change history record;
Generating a recovery instruction for recovering the target database according to the rollback log record;
and indicating the equipment where the target database is located to execute the recovery instruction so as to recover the target database from the state after the error data change is executed to the historical data state.
2. The method of claim 1, wherein parsing the target rollback log according to the composition field of the target rollback log to obtain a rollback log record comprises:
Determining an order relationship between each of the constituent fields of the target rollback log;
Analyzing the target rollback log according to the order relation to obtain a field value of each component field;
And obtaining the rollback log record according to the field value of each component field.
3. The method of claim 2, wherein generating a recovery instruction for recovering the target database from the rollback log record comprises:
Determining a history primary key value of history data through the rollback log record, wherein the history data is data of executing the error data change in the target database before executing the error data change, and the history component field is a field of the history data, of which the field value is modified after the error data change;
and writing the history main key value into a writing position for writing the main key value of the data to be modified in a recovery statement template, writing the history field name into a writing position for writing the field name of the field to be modified in the recovery statement template, and writing the history field value into a writing position for writing the field value of the field to be modified in the recovery statement template, so as to obtain the recovery instruction.
4. The method of claim 3, wherein the instructing the device in which the target database is located to execute the restore instruction to restore the target database from the state after the error data change is performed to the historical data state comprises:
indicating the equipment to locate target data in the target database according to the historical primary key value in the recovery instruction, wherein the target data is data after the historical data is changed through the error data;
Indicating the equipment to locate a target field changed by the error data in the target data according to the history field name in the recovery instruction;
The device is instructed to modify the current value in the target field by the historical field value to restore the target database to the historical data state.
5. The method of any one of claims 1 to 4, wherein prior to the obtaining the target redo log file of the target database, the method further comprises:
Acquiring target data changes executed by the target database in historical time;
and under the condition that the target data change is determined to be not in accordance with a preset change requirement, determining the target data change as the error data change.
6. The method of claim 5, wherein, in the event that the target data change is determined not to meet the preset change requirement, after determining the target data change as an erroneous data change, the method further comprises:
Determining a target service party corresponding to the target database, wherein the target service party is a service party capable of operating the target database;
and interrupting the operation of the target business party on the target database.
7. A data recovery apparatus, comprising:
the system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring a target redo log file of a target database, wherein the target redo log file is generated when error data change is executed in the target database;
the first analysis module is used for analyzing the target redo log file to obtain a target rollback log;
The second parsing module is configured to parse the target rollback log according to the constituent fields of the target rollback log, to obtain a rollback log record, and includes: determining at least one target rollback log block in the target redo log file, wherein each target rollback log block comprises one target rollback log, each target rollback log block comprises logs of various log types, and the various log types comprise target log types to which the target rollback log belongs; analyzing the current log segment in the target rollback log block by using a plurality of analysis modes respectively until the target rollback log is analyzed, wherein the starting position of the current log segment is the first position positioned behind the log segment successfully identified in the previous time or is the starting position of the target rollback log block: when a first analysis mode in the multiple analysis modes is used for identifying the type starting identifier of the target log type at the starting position of the current log segment, continuing to use the first analysis mode for identifying the type ending identifier of the target log type in the target rollback log, taking the position of the type ending identifier of the target log type as the ending position of the current log segment, taking the content analyzed from the starting position of the current log segment to the ending position of the current log segment as the target rollback log, wherein the first analysis mode is matched with the log type to which the target rollback log belongs, and when a second analysis mode in the multiple analysis modes is used for identifying the type starting identifier of the second log type at the starting position of the current log segment, continuing to use the second analysis mode for identifying the type ending identifier of the second log type in the target rollback log, taking the first position after the type ending identifier of the second log type as the next log segment, taking the first position after the type ending identifier as the second log type ending identifier as the next log segment, taking the second analysis mode as the first analysis mode, taking the first analysis mode as the error data, and taking the first analysis mode as the error analysis mode, wherein the error data and the error analysis mode is used for indicating the change history record;
the recovery instruction module is used for generating a recovery instruction for recovering the target database according to the rollback log record;
and the database recovery module is used for indicating the equipment where the target database is located to execute the recovery instruction so as to recover the target database from the state after the error data is changed to the historical data state.
8. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus, characterized in that,
The memory is used for storing a computer program;
the processor is configured to perform the method steps of any of claims 1 to 6 by running the computer program stored on the memory.
9. A computer-readable storage medium, characterized in that the storage medium has stored therein a computer program, wherein the computer program is arranged to perform the method steps of any of claims 1 to 6 when run.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111053302.1A CN113760608B (en) | 2021-09-08 | 2021-09-08 | Data recovery method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111053302.1A CN113760608B (en) | 2021-09-08 | 2021-09-08 | Data recovery method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113760608A CN113760608A (en) | 2021-12-07 |
CN113760608B true CN113760608B (en) | 2024-09-17 |
Family
ID=78794062
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111053302.1A Active CN113760608B (en) | 2021-09-08 | 2021-09-08 | Data recovery method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113760608B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114443359A (en) * | 2021-12-23 | 2022-05-06 | 厦门市美亚柏科信息股份有限公司 | Method for restoring deleted data through logic analysis, terminal device and storage medium |
CN115858497A (en) * | 2022-12-20 | 2023-03-28 | 唯思电子商务(深圳)有限公司 | Method based on TDSQL rollback |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102156720A (en) * | 2011-03-28 | 2011-08-17 | 中国人民解放军国防科学技术大学 | Method, device and system for restoring data |
CN103745016A (en) * | 2006-03-10 | 2014-04-23 | 甲骨文国际公司 | Detecting database events using recovery logs |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101071484B1 (en) * | 2009-06-15 | 2011-10-10 | 대성홀딩스 주식회사 | A method for recovering logical data errors in database |
CN105279045A (en) * | 2015-10-28 | 2016-01-27 | 浪潮(北京)电子信息产业有限公司 | Method and system for recovering data of database |
CN108664359B (en) * | 2018-05-23 | 2020-12-29 | 上海达梦数据库有限公司 | Database recovery method, device, equipment and storage medium |
CN111694893B (en) * | 2020-04-23 | 2023-04-25 | 武汉达梦数据库股份有限公司 | Partial rollback analysis method and data synchronization system based on log analysis |
-
2021
- 2021-09-08 CN CN202111053302.1A patent/CN113760608B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103745016A (en) * | 2006-03-10 | 2014-04-23 | 甲骨文国际公司 | Detecting database events using recovery logs |
CN102156720A (en) * | 2011-03-28 | 2011-08-17 | 中国人民解放军国防科学技术大学 | Method, device and system for restoring data |
Also Published As
Publication number | Publication date |
---|---|
CN113760608A (en) | 2021-12-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107220142B (en) | Method and device for executing data recovery operation | |
CN112596951B (en) | NAS data disaster recovery method, device, equipment and storage medium | |
JP6411696B1 (en) | Version control system and version control method | |
CN112506702B (en) | Disaster recovery method, device, equipment and storage medium for data center | |
CN113760608B (en) | Data recovery method and device, electronic equipment and storage medium | |
JP2006031109A (en) | Management system and management method | |
CN111858468A (en) | Distributed file system metadata verification method, system, terminal and storage medium | |
CN108664255B (en) | Software upgrading method and device | |
CN107765990A (en) | A kind of system disk management method and device | |
CN105550071A (en) | System file upgrading and detecting method and communication device | |
CN113608750B (en) | Deployment method and device of monitoring component, computer equipment and storage medium | |
CN113254271B (en) | Data sequence recovery method, device, equipment and storage medium | |
CN113064755B (en) | Data recovery method, device, equipment, medium and program product | |
CN110968456A (en) | Method and device for processing fault disk in distributed storage system | |
CN113806309A (en) | Metadata deleting method, system, terminal and storage medium based on distributed lock | |
CN114036002A (en) | Block chain data backup method and device, storage medium and electronic equipment | |
CN117290158A (en) | Data recovery method and device, electronic equipment and storage medium | |
CN113778763B (en) | Intelligent switching method and system for three-way interface service faults | |
CN106708541A (en) | Version upgrading processing method and apparatus | |
US20220129446A1 (en) | Distributed Ledger Management Method, Distributed Ledger System, And Node | |
CN115168236A (en) | Automatic testing method, electronic device and storage medium | |
CN114625697A (en) | File system recovery method and device, electronic equipment and storage medium | |
CN115543698B (en) | Data backup method, device, equipment and storage medium | |
CN112860284B (en) | SP upgrade package generation method and device for equipment remote upgrade and computer equipment | |
CN114048075A (en) | Disk testing method and device, electronic equipment and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |