Data recovery method, device and equipment and readable storage medium

文档序号:1952390 发布日期:2021-12-10 浏览:28次 中文

阅读说明:本技术 一种数据恢复方法、装置、设备及可读存储介质 (Data recovery method, device and equipment and readable storage medium ) 是由 邵宛岩 唐山 范渊 刘博� 于 2021-09-26 设计创作,主要内容包括:本申请公开了一种数据恢复方法、装置、设备及可读存储介质,该方法包括:获取每条数据修改操作的改前检查点、改后检查点;确定数据被误改动后,利用改前检查点和改后检查点,获取每条数据修改操作对应的改前数据内容和改后数据内容;比对同一条数据修改操作的改前数据内容和改后数据内容,得到差异内容;利用差异内容,确定被误操作数据对应的目标改前检查点;对目标改前检查点对应的目标改前数据内容进行数据恢复处理。本申请不仅可以定位误操作数据,还可对误操作数据进行恢复处理,能够保障数据的完整性和正确性,进一步可以保障对外服务的正确性。(The application discloses a data recovery method, a device, equipment and a readable storage medium, wherein the method comprises the following steps: acquiring a before-modification check point and a after-modification check point of each data modification operation; after the data is determined to be wrongly modified, utilizing a pre-modification check point and a post-modification check point to acquire pre-modification data content and post-modification data content corresponding to each data modification operation; comparing the before-modification data content and the after-modification data content of the same data modification operation to obtain difference content; determining a target before-change check point corresponding to the misoperation data by using the difference content; and performing data recovery processing on target pre-change data content corresponding to the target pre-change check point. The method and the device can not only locate the misoperation data, but also recover and process the misoperation data, can ensure the integrity and correctness of the data, and further can ensure the correctness of external services.)

1. A method for data recovery, comprising:

acquiring a before-modification check point and a after-modification check point of each data modification operation;

after the data is determined to be changed by mistake, acquiring the before-change data content and the after-change data content corresponding to each data modification operation by using the before-change check point and the after-change check point;

comparing the pre-modification data content and the post-modification data content of the same data modification operation to obtain difference content;

determining a target pre-modification check point corresponding to the misoperation data by using the difference content;

and performing data recovery processing on the target pre-modification data content corresponding to the target pre-modification check point.

2. The data recovery method of claim 1, wherein obtaining a pre-checkpoint and a post-checkpoint of each data modification operation comprises:

acquiring a flow packet of a data object to be protected;

judging whether the flow packet corresponds to a data modification operation;

if yes, blocking the flow packet, and acquiring a check point before change from a database server; and releasing the flow packet, and acquiring the modified check point from the database server.

3. The data recovery method according to claim 2, wherein the obtaining the traffic packet of the data object to be protected includes:

acquiring a flow packet of the data object to be protected by mirroring; the data object to be protected comprises a database IP, a port, an account and a password.

4. The data recovery method of claim 2, wherein determining whether the traffic packet corresponds to a data modification operation comprises:

searching whether a keyword corresponding to the data modification operation exists in the flow packet;

if so, determining the data modification operation corresponding to the flow packet;

and if not, determining that the flow packet does not correspond to the data modification operation.

5. The data recovery method of claim 2, wherein the obtaining a pre-change checkpoint from a database server comprises:

and connecting the database server, and executing a database check point query statement to acquire a check point before modification corresponding to the data modification operation.

6. The data recovery method according to claim 1, wherein obtaining the pre-modification data content and the post-modification data content corresponding to each of the data modification operations using the pre-modification checkpoint and the post-modification checkpoint comprises:

inquiring the before-change data content corresponding to the before-change check point in a database log;

and inquiring the modified data content corresponding to the modified check point in the database log.

7. The data recovery method according to claim 1, wherein performing data recovery processing on the target pre-modification data content corresponding to the target pre-modification check point includes:

and updating or inserting the target pre-modification data content corresponding to the target pre-modification check point to finish data recovery.

8. A data recovery apparatus, comprising:

the checkpoint acquisition module is used for acquiring a before-modification checkpoint and an after-modification checkpoint of each data modification operation;

the data content acquisition module is used for acquiring the pre-modification data content and the post-modification data content corresponding to each data modification operation by using the pre-modification check point and the post-modification check point after the data is determined to be modified by mistake;

the data comparison module is used for comparing the before-modification data content and the after-modification data content of the same data modification operation to obtain difference content;

the misoperation data determining module is used for determining a target before-change check point corresponding to the misoperation data by using the difference content;

and the data recovery module is used for performing data recovery processing on the target before-modification data content corresponding to the target before-modification check point.

9. An electronic device, comprising:

a memory for storing a computer program;

a processor for implementing the steps of the data recovery method according to any one of claims 1 to 7 when executing said computer program.

10. A readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the data recovery method according to any one of claims 1 to 7.

Technical Field

The present application relates to the field of data storage technologies, and in particular, to a data recovery method, apparatus, device, and readable storage medium.

Background

With the development of information systems, the information systems collect more and more data, so that guaranteeing the integrity and correctness of the data is a basic condition for the information systems to provide services correctly to the outside. However, most of the information systems are manually operated in the external service providing and operation and maintenance scenes, so that misoperation is avoided, and data are deleted or modified mistakenly.

The data is deleted or modified by mistake, and the integrity and the correctness of the data are damaged, so that the information system cannot provide correct service for the outside.

Therefore, how to quickly recover the data of the misoperation is a technical problem which needs to be solved urgently by the technical personnel in the field at present.

Disclosure of Invention

The application aims to provide a data recovery method, a data recovery device, data recovery equipment and a readable storage medium, which can quickly locate data which is operated by mistake and carry out effective recovery processing, and can ensure that an information system can provide services correctly.

In order to solve the technical problem, the application provides the following technical scheme:

a method of data recovery, comprising:

acquiring a before-modification check point and a after-modification check point of each data modification operation;

after the data is determined to be changed by mistake, acquiring the before-change data content and the after-change data content corresponding to each data modification operation by using the before-change check point and the after-change check point;

comparing the pre-modification data content and the post-modification data content of the same data modification operation to obtain difference content;

determining a target pre-modification check point corresponding to the misoperation data by using the difference content;

and performing data recovery processing on the target pre-modification data content corresponding to the target pre-modification check point.

Preferably, the obtaining of the pre-modification checkpoint and the post-modification checkpoint of each data modification operation includes:

acquiring a flow packet of a data object to be protected;

judging whether the flow packet corresponds to a data modification operation;

if yes, blocking the flow packet, and acquiring a check point before change from a database server; and releasing the flow packet, and acquiring the modified check point from the database server.

Preferably, the obtaining the traffic packet of the data object to be protected includes:

acquiring a flow packet of the data object to be protected by mirroring; the data object to be protected comprises a database IP, a port, an account and a password.

Preferably, the determining whether the traffic packet corresponds to a data modification operation includes:

searching whether a keyword corresponding to the data modification operation exists in the flow packet;

if so, determining the data modification operation corresponding to the flow packet;

and if not, determining that the flow packet does not correspond to the data modification operation.

Preferably, the obtaining of the pre-change checkpoint from the database server includes:

and connecting the database server, and executing a database check point query statement to acquire a check point before modification corresponding to the data modification operation.

Preferably, the obtaining of the pre-modification data content and the post-modification data content corresponding to each data modification operation by using the pre-modification checkpoint and the post-modification checkpoint includes:

inquiring the before-change data content corresponding to the before-change check point in a database log;

and inquiring the modified data content corresponding to the modified check point in the database log.

Preferably, the data recovery processing of the target pre-modification data content corresponding to the target pre-modification check point includes:

and updating or inserting the target pre-modification data content corresponding to the target pre-modification check point to finish data recovery.

A data recovery apparatus comprising:

the checkpoint acquisition module is used for acquiring a before-modification checkpoint and an after-modification checkpoint of each data modification operation;

the data content acquisition module is used for acquiring the pre-modification data content and the post-modification data content corresponding to each data modification operation by using the pre-modification check point and the post-modification check point after the data is determined to be modified by mistake;

the data comparison module is used for comparing the before-modification data content and the after-modification data content of the same data modification operation to obtain difference content;

the misoperation data determining module is used for determining a target before-change check point corresponding to the misoperation data by using the difference content;

and the data recovery module is used for performing data recovery processing on the target before-modification data content corresponding to the target before-modification check point.

An electronic device, comprising:

a memory for storing a computer program;

and the processor is used for realizing the steps of the data recovery method when executing the computer program.

A readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the above-mentioned data recovery method.

By applying the method provided by the embodiment of the application, a before-modification check point and a after-modification check point of each data modification operation are obtained; after the data is determined to be wrongly modified, utilizing a pre-modification check point and a post-modification check point to acquire pre-modification data content and post-modification data content corresponding to each data modification operation; comparing the before-modification data content and the after-modification data content of the same data modification operation to obtain difference content; determining a target before-change check point corresponding to the misoperation data by using the difference content; and performing data recovery processing on target pre-change data content corresponding to the target pre-change check point.

In the application, a pre-modification check point and a post-modification check point corresponding to each data modification operation are obtained first. Then, after it is determined that the data is misoperated, before-modification data content and after-modification data content corresponding to each data modification operation can be acquired based on the before-modification checkpoint and the after-modification checkpoint. The data content before the modification operation of the same data is compared with the data content after the modification operation of the same data, so that the difference content can be determined, and the check point before the modification of the target corresponding to the data which is subjected to misoperation can be determined based on the difference content. And performing data recovery processing based on the target before-modification data content corresponding to the target before-modification check point, so that recovery after the data is determined to be modified by mistake can be completed. Therefore, the method and the device can not only locate the misoperation data, but also recover and process the misoperation data, can ensure the integrity and correctness of the data, and further can ensure the correctness of external services.

Accordingly, embodiments of the present application further provide a data recovery apparatus, a device, and a readable storage medium corresponding to the data recovery method, which have the above technical effects and are not described herein again.

Drawings

In order to more clearly illustrate the technical solutions in the embodiments or related technologies of the present application, the drawings needed to be used in the description of the embodiments or related technologies are briefly introduced below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

Fig. 1 is a flowchart of an implementation of a data recovery method in an embodiment of the present application;

FIG. 2 is a schematic structural diagram of a data recovery apparatus according to an embodiment of the present application;

fig. 3 is a schematic structural diagram of an electronic device in an embodiment of the present application;

fig. 4 is a schematic structural diagram of an electronic device in an embodiment of the present application.

Detailed Description

In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

Referring to fig. 1, fig. 1 is a flowchart illustrating a data recovery method according to an embodiment of the present application, the method including the following steps:

s101, acquiring a pre-modification check point and a post-modification check point of each data modification operation.

In the present application, the check point index database checks the point SCN (System Change Number). Before-modification check points, namely check points corresponding to the database before data modification operation; and after the check point is changed, namely the data modification operation, the check point corresponding to the database is carried out. Data modification operations herein include, but are not limited to, delete (delete), update (update).

A database firewall device may be utilized to obtain a pre-alteration checkpoint and a post-alteration checkpoint for each data modification operation. The database firewall device and the database can adopt a serial connection mode, namely when flow flows through the database firewall device, the database firewall can intercept the flow and acquire a check point before and a check point after each data modification operation.

That is, in the present application, for each executed data modification operation, its corresponding pre-modification checkpoint and post-modification checkpoint may be obtained. Preferably, considering that the data of which the integrity and accuracy are actually concerned is not all data stored in the database, in order to reduce the waste of computer resources, the data modification operation corresponding to the separately set data object to be protected may be recorded.

In a specific embodiment of the present application, the step S101 of obtaining a pre-modification checkpoint and a post-modification checkpoint of each data modification operation includes:

step one, acquiring a flow packet of a data object to be protected;

step two, judging whether the flow packet corresponds to data modification operation;

step three, if not, the flow packet is released;

step four, if yes, blocking the flow packet, and acquiring a check point before change from the database server;

and step five, releasing the traffic packet, and acquiring the modified check point from the database server.

For convenience of description, the above five steps will be described in combination.

First, protected object information may be configured: database object information includes, but is not limited to, database IP, port, account number, password. Configuring data information needing protection: data information that needs to be protected includes, but is not limited to, tables in which the data is stored. That is, the data object to be protected may specifically include, but is not limited to, a database IP, a port, an account number, a password. Namely, tables corresponding to database IP, ports, account numbers and passwords stored in the database are protected.

The first step of obtaining the traffic packet of the data object to be protected may specifically include: acquiring a flow packet of a data object to be protected by mirroring; the data object to be protected comprises a database IP, a port, an account and a password. That is, the configured protected object traffic may be obtained in a mirrored manner. The mirror image mode refers to flow acquisition through an open source tool.

After the traffic packet is obtained, it is determined whether there is a data modification operation in the traffic packet. So that a valid record of pre-alteration checkpoints and post-alteration checkpoints for data modification operations can be made. Specifically, the step two of judging whether the traffic packet corresponds to the data modification operation includes:

step 1, searching whether a keyword corresponding to data modification operation exists in a flow packet;

step 2, if yes, determining data modification operation corresponding to the traffic packet;

and 3, if not, determining that the traffic packet does not correspond to the data modification operation.

Specifically, whether the operation of modifying the data exists in the traffic packet is retrieved through a keyword matching method. Operations to modify data include, but are not limited to, delete, update. When the keywords corresponding to the modified data are retrieved, determining the data modification operation corresponding to the traffic packet; and when the key corresponding to the modified data cannot be retrieved, determining that the data modification operation which does not correspond to the traffic packet is not performed, and ignoring the data packet.

After the data modification operation corresponding to the traffic packet is determined, the traffic packet needs to be blocked first, so that a pre-modification check point corresponding to the data modification operation is obtained before the data modification operation is not executed. For example, the data modification operation corresponding to the link packet is: delete sql, which blocks the flow, i.e., it is left alone first.

Step four, acquiring a check point before change from the database server, including: and connecting the database server, and executing a database check point query statement to acquire a check point before modification corresponding to the data modification operation. The SCN query statement of the database check point can be executed by connecting with a database server. For example, select dbms _ flash _ get _ system _ change _ number from dual is executed and the returned result SCN after the statement is executed is recorded, which can be denoted as a for the sake of distinction. Assuming that A is 123, SCN represents a stamp value returned after the database operation, i.e., a checkpoint.

After the pre-alteration check point is obtained, the traffic packet can be released, and then the post-alteration check point is obtained from the database server. The manner in which a checkpoint-after-change is obtained from a database server is similar to the manner in which a checkpoint-before-change is obtained. That is, the traffic packet blocked in step four is released, and the database server is connected again, and a database check point SCN value query statement is executed, the SCN return value of which is denoted as B here. Assuming B is 124, SCN represents a stamp value returned after the database operation, i.e., a checkpoint.

Thus, the SCN before and after the data is modified each time can be recorded.

And S102, after the data are determined to be changed by mistake, acquiring the before-change data content and the after-change data content corresponding to each data modification operation by using the before-change check point and the after-change check point.

Because the check points have matching corresponding relations with the corresponding data contents, after the data are determined to be operated by mistake, the before-modification data contents and the after-modification data contents corresponding to each data modification operation can be obtained based on the before-modification check points and the after-modification check points.

Specifically, the step S102 acquires the pre-modification data content and the post-modification data content corresponding to each data modification operation by using the pre-modification checkpoint and the post-modification checkpoint, and specifically includes:

firstly, inquiring before-change data content corresponding to the before-change check point in a database log;

and step two, inquiring the modified data content corresponding to the modified check point in the database log.

Because the database log records the data content corresponding to each check point, the before-change data content and the after-change data content corresponding to each data modification operation can be inquired and obtained from the database log based on the before-change check point and the after-change check point.

For example, the SCN value a before each modify data operation and the SCN value B after each modify data operation query the database log for the data content before and after modification:

select*FROM t_a as of scn 123;

select*FROM t_a as of scn 124。

s103, comparing the before-changed data content and the after-changed data content of the same data modification operation to obtain difference content.

In order to locate the data with misoperation, the difference content can be obtained by comparing the difference between the content of the data before modification and the content of the data after modification corresponding to the same data modification operation. The difference content may be used to determine whether the data was mishandled.

And S104, determining a target before-change check point corresponding to the misoperation data by using the difference content.

Specifically, the difference content can be output and displayed on a visual interface, so that the user can determine the target pre-detection point corresponding to the data subjected to misoperation. Or, an automatic determination mode may be adopted to determine the target pre-modification check point corresponding to the misoperated data, for example, the misoperated data corresponds to the misdeleted data a, and when the difference content is the data a, the corresponding pre-modification check point may be determined to be the target pre-modification check point corresponding to the misoperated data.

It should be noted that when the user confirms the modified data content, the data modification operation before the current time can be automatically started after the user inputs data, the data input by the user is matched one by one, and when the modified data is retrieved and the data input by the user is matched, the retrieval is stopped, and the user is informed to execute step S105.

And S105, performing data recovery processing on the target before-modification data content corresponding to the target before-modification check point.

Specifically, the target pre-modification data content corresponding to the target pre-modification check point may be updated or inserted to complete data recovery.

For example, the data content corresponding to the SCN value a confirmed by the user may be assembled into data recovery operations including, but not limited to, update and insert statements, and the correct data may be recovered into the table.

By applying the method provided by the embodiment of the application, a before-modification check point and a after-modification check point of each data modification operation are obtained; after the data is determined to be wrongly modified, utilizing a pre-modification check point and a post-modification check point to acquire pre-modification data content and post-modification data content corresponding to each data modification operation; comparing the before-modification data content and the after-modification data content of the same data modification operation to obtain difference content; determining a target before-change check point corresponding to the misoperation data by using the difference content; and performing data recovery processing on target pre-change data content corresponding to the target pre-change check point.

In the application, a pre-modification check point and a post-modification check point corresponding to each data modification operation are obtained first. Then, after it is determined that the data is misoperated, before-modification data content and after-modification data content corresponding to each data modification operation can be acquired based on the before-modification checkpoint and the after-modification checkpoint. The data content before the modification operation of the same data is compared with the data content after the modification operation of the same data, so that the difference content can be determined, and the check point before the modification of the target corresponding to the data which is subjected to misoperation can be determined based on the difference content. And performing data recovery processing based on the target before-modification data content corresponding to the target before-modification check point, so that recovery after the data is determined to be modified by mistake can be completed. Therefore, the method and the device can not only locate the misoperation data, but also recover and process the misoperation data, can ensure the integrity and correctness of the data, and further can ensure the correctness of external services.

Corresponding to the above method embodiments, the present application further provides a data recovery apparatus, and the data recovery apparatus described below and the data recovery method described above may be referred to correspondingly.

Referring to fig. 2, the apparatus includes the following modules:

a checkpoint acquiring module 101, configured to acquire a pre-modification checkpoint and a post-modification checkpoint of each data modification operation;

the data content acquisition module 102 is configured to acquire pre-alteration data content and post-alteration data content corresponding to each data modification operation by using a pre-alteration check point and a post-alteration check point after determining that data is erroneously altered;

the data comparison module 103 is configured to compare the before-modified data content and the after-modified data content of the same data modification operation to obtain a difference content;

the misoperation data determining module 104 is used for determining a target before-change check point corresponding to the misoperation data by using the difference content;

and the data recovery module 105 is configured to perform data recovery processing on the target pre-modification data content corresponding to the target pre-modification check point.

By applying the device provided by the embodiment of the application, a before-modification check point and a after-modification check point of each data modification operation are obtained; after the data is determined to be wrongly modified, utilizing a pre-modification check point and a post-modification check point to acquire pre-modification data content and post-modification data content corresponding to each data modification operation; comparing the before-modification data content and the after-modification data content of the same data modification operation to obtain difference content; determining a target before-change check point corresponding to the misoperation data by using the difference content; and performing data recovery processing on target pre-change data content corresponding to the target pre-change check point.

In the application, a pre-modification check point and a post-modification check point corresponding to each data modification operation are obtained first. Then, after it is determined that the data is misoperated, before-modification data content and after-modification data content corresponding to each data modification operation can be acquired based on the before-modification checkpoint and the after-modification checkpoint. The data content before the modification operation of the same data is compared with the data content after the modification operation of the same data, so that the difference content can be determined, and the check point before the modification of the target corresponding to the data which is subjected to misoperation can be determined based on the difference content. And performing data recovery processing based on the target before-modification data content corresponding to the target before-modification check point, so that recovery after the data is determined to be modified by mistake can be completed. Therefore, the method and the device can not only locate the misoperation data, but also recover and process the misoperation data, can ensure the integrity and correctness of the data, and further can ensure the correctness of external services.

In a specific embodiment of the present application, the checkpoint acquiring module 101 is specifically configured to acquire a traffic packet of a data object to be protected; judging whether the flow packet corresponds to data modification operation; if yes, blocking the flow packet, and acquiring a check point before change from the database server; and releasing the flow packet, and acquiring the modified check point from the database server.

In a specific embodiment of the present application, the checkpoint acquiring module 101 is specifically configured to acquire a traffic packet of a data object to be protected in a mirror image manner; the data object to be protected comprises a database IP, a port, an account and a password.

In a specific embodiment of the present application, the checkpoint acquiring module 101 is specifically configured to retrieve whether a keyword corresponding to a data modification operation exists in a traffic packet; if so, determining the data modification operation corresponding to the traffic packet; if not, determining that the traffic packet does not correspond to the data modification operation.

In a specific embodiment of the present application, the checkpoint acquiring module 101 is specifically configured to connect to a database server and execute a database checkpoint query statement to acquire a pre-modification checkpoint corresponding to the data modification operation.

In a specific embodiment of the present application, the data content obtaining module 102 is specifically configured to query a database log for a pre-modification data content corresponding to a pre-modification check point; and inquiring the modified data content corresponding to the modified check point in the database log.

In an embodiment of the present application, the data recovery module 105 is specifically configured to update or insert a target pre-modification data content corresponding to the target pre-modification check point to complete data recovery.

Corresponding to the above method embodiment, the present application further provides an electronic device, and the electronic device described below and the data recovery method described above may be referred to in correspondence.

Referring to fig. 3, the electronic device includes:

a memory 332 for storing a computer program;

a processor 322 for implementing the steps of the data recovery method of the above-described method embodiments when executing the computer program.

Specifically, referring to fig. 4, fig. 4 is a schematic structural diagram of an electronic device provided in this embodiment, which may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 322 (e.g., one or more processors) and a memory 332, where the memory 332 stores one or more computer applications 342 or data 344. Memory 332 may be, among other things, transient or persistent storage. The program stored in memory 332 may include one or more modules (not shown), each of which may include a sequence of instructions operating on a data processing device. Still further, the central processor 322 may be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the electronic device 301.

The electronic device 301 may also include one or more power sources 326, one or more wired or wireless network interfaces 350, one or more input-output interfaces 358, and/or one or more operating systems 341.

The steps in the data recovery method described above may be implemented by the structure of the electronic device.

Corresponding to the above method embodiment, this application embodiment further provides a readable storage medium, and a readable storage medium described below and a data recovery method described above may be referred to correspondingly.

A readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the data recovery method of the above-mentioned method embodiments.

The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.

Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种数据分发过程中的失败检测及恢复方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!