CN112214471B - Database management method, device, computer readable storage medium and electronic equipment - Google Patents

Database management method, device, computer readable storage medium and electronic equipment Download PDF

Info

Publication number
CN112214471B
CN112214471B CN201910616254.9A CN201910616254A CN112214471B CN 112214471 B CN112214471 B CN 112214471B CN 201910616254 A CN201910616254 A CN 201910616254A CN 112214471 B CN112214471 B CN 112214471B
Authority
CN
China
Prior art keywords
database
operation log
snapshot
data
database snapshot
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
Application number
CN201910616254.9A
Other languages
Chinese (zh)
Other versions
CN112214471A (en
Inventor
朱雪梅
李玉天
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201910616254.9A priority Critical patent/CN112214471B/en
Publication of CN112214471A publication Critical patent/CN112214471A/en
Application granted granted Critical
Publication of CN112214471B publication Critical patent/CN112214471B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a database management method, a database management device, a computer readable storage medium and electronic equipment, and relates to the technical field of databases. The database management method comprises the following steps: obtaining an operation log aiming at a database between a first database snapshot and a second database snapshot; screening out the operation log judged to be abnormal from the operation logs to obtain a target operation log; performing operation on the database data corresponding to the first database snapshot again according to the target operation log so as to generate a third database snapshot; and adjusting the database according to the second database snapshot and the third database snapshot. That is, the accuracy and consistency of the data within the database is ensured by a double check of the operation log and the database snapshot.

Description

Database management method, device, computer readable storage medium and electronic equipment
Technical Field
The present invention relates to the field of database technologies, and in particular, to a database management method, a database management device, a computer readable storage medium, and an electronic device.
Background
Databases are an important component of modern information technology, as well as the foundation and core of modern computer information systems and computer application systems. The importance of the database is self-evident.
For databases, consistency and accuracy of stored data are important indicators for evaluating the database. However, many unexpected abnormal events can be faced in the running process of the database, so that inconsistent or inaccurate data in the database can be caused. For example, sudden power failure of the operation device, incomplete data writing, writing operation of the same record by a plurality of users, no occurrence of reading and writing, or ID increment renumbering, etc. occur.
In the related art, a log recording mode is generally adopted to record the operation on the database, so that the transaction rollback or the redo is manually carried out when the database is abnormal, and the accuracy of the database is ensured. However, in the actual running process, the accuracy of the database still cannot be ensured only by simple rollback and redo in the face of data exception, and the workload is also great.
Disclosure of Invention
The embodiment of the invention aims to provide a database management method, a database management device, a computer readable storage medium and electronic equipment, which can effectively ensure the accuracy and consistency of data in a database.
Embodiments of the invention may be implemented as follows:
in a first aspect, an embodiment of the present invention provides a database management method, where the steps of the database management method include: obtaining an operation log aiming at a database between a first database snapshot and a second database snapshot; screening out the operation log judged to be abnormal from the operation logs to obtain a target operation log; performing operation on the database data corresponding to the first database snapshot again according to the target operation log so as to generate a third database snapshot; and adjusting the database according to the second database snapshot and the third database snapshot.
In a second aspect, an embodiment of the present invention provides a database management apparatus, including: the device comprises an acquisition module, a screening module, an execution module and an adjustment module; the system comprises an acquisition module, a database storage module and a database storage module, wherein the acquisition module is used for acquiring an operation log aiming at a database between a first database snapshot and a second database snapshot; the screening module is used for screening out the operation log judged to be abnormal in the operation logs to obtain a target operation log; the execution module is used for executing operation on the database data corresponding to the first database snapshot again according to the target operation log so as to generate a third database snapshot; and the adjustment module is used for adjusting the database according to the second database snapshot and the third database snapshot.
In a third aspect, embodiments of the present invention provide a program product, such as a computer readable storage medium, comprising a program for performing the method provided in the first aspect above when being executed by a processor.
In a fourth aspect, an embodiment of the present invention provides an electronic device, including: a processor, a storage medium, and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor in communication with the storage medium via the bus when the electronic device is running, the processor executing the machine-readable instructions to perform the steps of the database management method as described in any of the preceding embodiments.
Compared with the prior art, the database management method provided by the embodiment of the invention obtains the operation log aiming at the database between the first database snapshot and the second database snapshot, and screens out the operation log judged to be abnormal so as to obtain the target operation log. And based on the target operation log, re-executing the operation on the database data corresponding to the first database snapshot to obtain a third database snapshot capable of ensuring the accuracy of the data. And finally, combining the second database snapshot with the third database snapshot to adjust the database. That is, by performing a double check on the operation log and the database snapshot, it is ensured that the data in the adjusted database has accuracy and consistency. The realization process has small performance cost, and even the business facing complex logic does not influence the effect.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an electronic device according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of a database management method according to an embodiment of the present invention;
FIG. 3 is a flow chart of the substeps of step S104 in FIG. 2;
FIG. 4 is a flowchart illustrating another sub-step of step S104 in FIG. 2;
FIG. 5 is another part of a flowchart illustrating steps of a database management method according to an embodiment of the present invention;
FIG. 6 is a flowchart of an example of a database management method according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a database management device according to an embodiment of the present invention.
Icon: 100-an electronic device; 101-memory; 102-a communication interface; 103-a processor; 104-a bus; 200-database management means; 201-an acquisition module; 202-screening out the module; 203 an execution module; 204-an adjustment module; 205-decision module.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
It will be appreciated that the database management method described above may be applied to the electronic device 100 shown in fig. 1. The electronic device 100 may be, but is not limited to, a personal computer (personal computer, PC), a server, a distributed deployment computer, and the like. It is understood that the electronic device 100 is not limited to a physical server, and may be a virtual machine on a physical server, a virtual machine built on a cloud platform, or a computer that can provide the same function as the server or the virtual machine.
The operating system of the electronic device 100 may be, but is not limited to, a Windows system, a Linux system, etc. The electronic device 100 comprises a memory 101, a communication interface 102, a processor 103 and a bus 104, wherein the memory 101, the communication interface 102 and the processor 103 are connected through the bus 104, and the processor 103 is configured to execute executable modules stored in the memory 101, such as computer programs. The memory 101 may include a high-speed random access memory (RAM: random Access Memory), and may further include a non-volatile memory (non-volatile memory), such as at least one disk memory. The communication connection between the electronic device 100 and the external device is achieved through at least one communication interface 102 (which may be wired or wireless).
Bus 104 may be an ISA bus, a PCI bus, an EISA bus, or the like. Only one double-headed arrow is shown in fig. 3, but not only one bus 104 or one type of bus 104.
The memory 101 is used to store a program, for example, the database management apparatus 200 shown in fig. 7. The database management apparatus 200 includes at least one software function module that may be stored in the memory 101 in the form of software or firmware (firmware) or cured in an Operating System (OS) of the electronic device 100. The processor 103 executes the program after receiving the execution instruction to implement the database management method disclosed in the above embodiment of the present invention.
The processor 103 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 103 or instructions in the form of software. The processor 103 may be a general-purpose processor 103, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but may also be a Digital Signal Processor (DSP), application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components.
First embodiment
Referring to fig. 2, fig. 2 shows a database management method according to an embodiment of the invention, which is applied to an electronic device 100. The database management method may include the steps of:
step S101, an operation log for the database between the first database snapshot and the second database snapshot is obtained.
It will be appreciated that the database snapshot may be a read-only static view of the database, which may be understood as a read-only database, that serves the report by providing a static view. And compared with backup recovery, the recovery speed is greatly improved by adopting the database snapshot to recover the database. The database snapshot may characterize data in the database at a time. Corresponding database snapshots may be created at different times during database use. As one embodiment, after the database is built and the initial data snapshot is created, the database snapshot corresponding to the database is periodically created. For example, database snapshot creation may be performed once a day in the early morning hours when database usage is selected less frequently. I.e. creating a database snapshot corresponding to the database at that moment in the morning of each day. As other possible embodiments, database snapshot creation may be performed randomly or in response to a user operation after the database is built and the initial data snapshot is created.
In the embodiment of the present invention, the creation time point of the first database snapshot is earlier than the creation time point of the second database snapshot. For example, if the second database snapshot is a database snapshot created in the current time period, the first database snapshot may be a database snapshot in the previous time period or a database snapshot in the previous two time periods, which is not limited. Alternatively, the first database snapshot may select a snapshot of the database for which the data confirms correct.
Further, an operation log generated between the creation time point of the first database snapshot and the creation time point of the second database snapshot may be obtained from a log for recording processing of the database. For example, it may be obtained from an Xlog log that is self-contained in the database. It will be appreciated that each operation log corresponds to an operation on the data. The operation log may include a change operation log for recording added data or deleted data or modified data, or may include a recorded operation log for searching data, or may include other recorded operation logs for performing other operations based on data.
In some embodiments, to verify the accuracy and consistency of the data in the database at a point in time, which is the time of the expiration of the period to be verified, a period to be verified may be determined. At this time, the first database snapshot may be a database snapshot created at a start time of the period to be checked, and the second database snapshot may be a database snapshot created at an end time of the period to be checked. At this time, the first database snapshot may select an initial database snapshot, or may select a database snapshot that has been checked to determine that the data is correct.
In some embodiments, to automatically implement the database supervision, one database snapshot may be created based on the current database each time, and then used as the second database snapshot, and the corresponding first database snapshot is determined. In particular, determining the corresponding first database snapshot may be selecting the first database snapshot from other stored database snapshots.
Step S102, the operation log judged to be abnormal in the operation log is screened out to obtain a target operation log.
In the embodiment of the present invention, the operation log of the abnormality may include an operation log corresponding to an operation that causes an abnormality, a residue, and a invalidation of data in the database. It will be appreciated that other operations based on the exception data are also exception, and thus, the above-described exception log may also include a log record corresponding to the operation based on the exception data. By screening out the abnormal operation log, the operation corresponding to the obtained target operation log can not influence the accuracy and consistency of the data in the database.
Step S103, according to the target operation log, performing operation on the database data corresponding to the first database snapshot again to generate a third database snapshot.
The number of databases corresponding to the first database snapshot may be a database mirror image corresponding to the time of creation of the first database snapshot. The database mirror image is a backup of the database in another storage space, and the record data in the backup is correspondingly changed along with the change of the data in the database. It can be understood that the data in the database mirror image can be written, the database snapshot can be read, and the read-write separation can be realized when the database mirror image at the same moment is matched with the database snapshot.
In the embodiment of the invention, the corresponding database mirror image can be acquired according to the first database snapshot. And then, according to the time sequence generated by the operation logs of each item mark, corresponding operations are sequentially executed on the database mirror images so as to obtain a new database with more accurate data. A database snapshot of the new database is created as a third database snapshot. It can be appreciated that, since the operations corresponding to the target operation log are normal and do not cause abnormal operations of the data, in the case that the data corresponding to the first database snapshot is determined to be correct, the data corresponding to the third database snapshot is also correct.
Step S104, according to the second database snapshot and the third database snapshot, the database is adjusted.
In the embodiment of the invention, the data can be adopted to ensure the accurate third database snapshot as a reference, whether the data corresponding to the second database snapshot is correct or not is evaluated, and whether the database is recovered or not is judged based on the evaluation result, so that the data in the database is ensured to be accurate and consistent.
As an embodiment, as shown in fig. 3, the step S104 may include the following steps:
sub-step S1041, compares the second database snapshot with the third database snapshot. Alternatively, the data within each table in the second database snapshot may be compared with the data within each table in the third database snapshot.
And substep S1042, if there is a difference between the second database snapshot and the third database snapshot, replacing the second database snapshot with the third database snapshot, and recovering the database according to the third database snapshot.
It will be appreciated that the difference may refer to a corresponding data difference, for example, the second database snapshot may be different from the data value in the same table in the third database snapshot, or the number of data may be different, or the like.
In the embodiment of the invention, the abnormal protection of the database is realized through the substep S1041 and the substep S1042, so that abnormal data in the database is avoided, and the accuracy of the data in the database is ensured.
Further, since new database snapshots are continuously created during the running period of the database, in order to save storage memory, after determining that a database snapshot corresponding to data is accurate, other database snapshots located before the database snapshot can be deleted. Therefore, as shown in fig. 4, the step S104 may further include:
in substep S1043, if the second database snapshot is the same as the third database snapshot, the first database snapshot is deleted.
It will be appreciated that since the data corresponding to the third database snapshot is accurate, the same second database snapshot as it is also accurate. The second database snapshot may serve as a benchmark for verifying the accuracy of the data within the database during subsequent processing of the database run. The first database snapshot and other database snapshots whose acquisition time points precede the first database snapshot can be deleted, thereby saving storage space.
In some other embodiments, as shown in fig. 5, on the basis of the database management method shown in fig. 2, before step S102, the following steps may be further included:
step S201, according to the external key association record, the operation log is combined to obtain the state change information of the first data.
In the embodiment of the present invention, the first data and the second data are data in the same database, and optionally, the first data and the second data are recorded in different data tables in the same database. The first data may be data associated with the second data through an external key. The second data is data for changing the operation log in the operation log. Specifically, the second data corresponding to the change operation log in the operation log can be determined first, and then the first data corresponding to the change operation log is queried according to the external key association record. The first data may include a plurality of data, and the second data may include a plurality of data. It can be understood that the correspondence between tables associated by the foreign key is described in the foreign key association record. That is, when the table a to which the second data belongs has the table B associated by the foreign key, the corresponding first data exists in the table B. Further, the state change information may indicate a change in state of the second data before and after the point in time when the change operation log is generated. For example, the state change information may include one of data from none to existence, from existence to none, or remain unchanged.
In step S202, when the state change information of the first data does not match the change operation log, the change operation log and the operation log of the change operation log are then determined to be abnormal operation logs based on the operation log of the first data or the second data.
In the embodiment of the present invention, whether the state change information of the first data matches the change operation log may be determined by comparing whether the state change information matches the action indicated by the change operation log. Such as:
when the change operation log is an added data log (the data is second data) indicating that one data is written into the database, if the corresponding first data is not present in the database due to the writing of the data (i.e., the state change information of the second data is not from scratch), it is determined that the state change information of the first data does not match the change operation log. If the corresponding first data appears in the database due to the writing of the data (i.e., the status change information of the second data is from scratch), it is determined that the status change information of the first data matches the change operation log.
When the change operation log is a deletion data log (the data is second data) indicating that one data in the database is deleted, if the corresponding first data is not lost from the database due to the deletion of the data (i.e., the state change information of the second data is kept unchanged), it is determined that the state change information of the first data does not match the change operation log. If the corresponding first data is lost from the database due to deletion of the data (i.e., the status change information of the second data is from the presence to the absence), it is determined that the status change information of the first data matches the change operation log.
When the change operation log is a modification data log (the data is second data) indicating that the numerical value corresponding to one data in the database is changed, if the corresponding first data does not change the numerical value, the state change information of the first data is judged to be not matched with the change operation log. And if the corresponding first data has the numerical value change, judging that the state change information of the first data is matched with the change operation log.
Further, by the above-described determination, the change operation log that does not match the state change information of the first data is determined as the abnormal operation log. Meanwhile, all operation logs based on the first data and the second data are used as abnormal operation logs after the change operation log. It will be appreciated that the abnormal add-drop operation is invalid in either adding or subtracting data, and therefore, all subsequent operations based on the first and second data are abnormal.
And then, by matching with the deletion of the abnormal operation log in the step S102, the problems of data residues, data abnormality and the like in the generated third database snapshot for verification are avoided.
Further, after determining that an abnormal operation log exists in the operation log, the database management method may further include the steps of: generating alarm information according to the abnormal operation log to remind database maintenance personnel of abnormal occurrence.
In order to facilitate an understanding of the present invention, the following is given by way of example. In the example, the database periodically creates a database snapshot according to a preset time period, as shown in fig. 6, and the database management method includes the steps of:
s1, after a new database snapshot is created, taking the database snapshot as a second database snapshot.
S2, acquiring a database snapshot corresponding to the previous time period as a first database snapshot.
S3, obtaining an XLog log from the creation time corresponding to the first database snapshot to the creation time corresponding to the second database snapshot.
S4, checking whether an abnormal operation log exists in the XLog log. Alternatively, if present, the flow proceeds to both step S5 and step S6. If not, the process ends.
S5, generating alarm information.
S6, screening out the operation logs judged to be abnormal in the Xlog logs to obtain target Xlog.
S7, operating the database mirror image corresponding to the first database snapshot according to the target XLog log to generate a third database snapshot.
S8, comparing the third database snapshot with the second database snapshot. If the two are the same, continuing to take the second database snapshot as the database snapshot of the current time period, and the flow proceeds to step S11. If there is a difference, the flow advances to step S9.
S9, replacing the second database snapshot with the third database snapshot. It will be appreciated that the second database snapshot is deleted and the third database snapshot is stored as the database snapshot at the current time.
S10, based on the third database snapshot, automatically recovering the data of the database. And ensuring the accuracy of the data in the database.
S11, deleting the first database snapshot. When the next time period is to be entered, the flow returns to step S1.
In summary, starting from database creation, periodically based on two adjacent database snapshots and an effective Xlog log between the database snapshots, whether the data in the current database is accurate or not is checked, whether the data in the database is abnormal or not is identified, and measures are correspondingly taken to manage the database, so that the accuracy and consistency of the database are ensured. In other words, the dual verification is performed by utilizing the Xlog log and the snapshot, so that the accuracy and consistency of the database are simply and efficiently ensured. Even if facing the database providing service for complex business, the abnormal data can be found in time and the database can be recovered.
Second embodiment
Referring to fig. 7, fig. 7 shows a database management device 200 according to an embodiment of the invention, where the database management device 200 includes: the device comprises an acquisition module 201, a screening module 202, an execution module 203 and an adjustment module 204.
The obtaining module 201 is configured to obtain an operation log for a database between a creation time point of a first database snapshot and a creation time point of a second database snapshot; wherein the creation time point of the first database snapshot is earlier than the creation time point of the second database snapshot.
In the embodiment of the present invention, the step S101 may be performed by the obtaining module 201.
The screening module 202 is configured to screen out the operation log determined to be abnormal from the operation logs to obtain a target operation log.
In an embodiment of the present invention, the step S102 may be performed by the screening module 202.
The executing module 203 is configured to re-execute an operation on database data corresponding to the first database snapshot according to the target operation log, so as to generate a third database snapshot.
In the embodiment of the present invention, the step S103 may be performed by the execution module 203.
The adjustment module 204 is configured to adjust the database according to the second database snapshot and the third database snapshot.
In the embodiment of the present invention, the step S104 may be performed by the adjustment module 204.
Optionally, the adjustment module 204 is specifically configured to: comparing the second database snapshot with a third database snapshot; if the second database snapshot and the third database snapshot have differences, replacing the second database snapshot with the third database snapshot, and recovering the data of the database according to the third database snapshot.
Further, the database management device 200 further includes a determination module 205.
The above-mentioned determination module 205 is specifically configured to: according to the external key association record, combining the operation log to obtain state change information of the first data; wherein, the first data is associated with second data corresponding to a change operation log in the operation log; and when the state change information of the first data is not matched with the change operation log, judging the change operation log and the operation log of the change operation log based on the first data or the second data as the abnormal operation log.
It will be appreciated that steps S201 and S202 described above may be performed by the determination module 205 described above.
It will be clear to those skilled in the art that, for convenience and brevity of description, reference may be made to the corresponding process in the foregoing method embodiment for the specific working process of the apparatus described above, which is not described herein again.
The embodiments of the present invention also disclose a computer readable storage medium having stored thereon a computer program which, when executed by the processor 103, implements the method disclosed in the previous embodiments of the present invention.
In summary, the embodiments of the present invention provide a database management method, apparatus, computer readable storage medium and electronic device. The database management method comprises the following steps: acquiring an operation log aiming at a database between a creation time point of a first database snapshot and a creation time point of a second database snapshot; wherein the creation time point of the first database snapshot is earlier than the creation time point of the second database snapshot; screening out the operation log judged to be abnormal from the operation logs to obtain a target operation log; performing operation on the database data corresponding to the first database snapshot again according to the target operation log so as to generate a third database snapshot; and adjusting the database according to the second database snapshot and the third database snapshot. That is, the accuracy and consistency of the data within the database is ensured by a double check of the operation log and the database snapshot.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present invention may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes. It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention. It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.

Claims (10)

1. A database management method, characterized in that the steps of the database management method include:
obtaining an operation log aiming at a database between a first database snapshot and a second database snapshot;
screening out the operation log judged to be abnormal from the operation logs to obtain a target operation log;
performing operation on the database data corresponding to the first database snapshot again according to the target operation log so as to generate a third database snapshot;
and adjusting the database according to the second database snapshot and the third database snapshot.
2. The database management method of claim 1, wherein the step of adjusting the database based on the second database snapshot and a third database snapshot comprises:
comparing the second database snapshot with a third database snapshot;
if the second database snapshot and the third database snapshot have differences, replacing the second database snapshot with the third database snapshot, and recovering the data of the database according to the third database snapshot.
3. The database management method of claim 2, wherein the step of adjusting the database based on the second database snapshot and a third database snapshot further comprises:
and if the second database snapshot is the same as the third database snapshot, deleting the first database snapshot.
4. The database management method according to claim 1, wherein the step of screening out the operation log determined to be abnormal from among the operation logs to obtain a target operation log further comprises:
according to the external key association record, combining the operation log to obtain state change information of the first data; wherein, the first data is associated with second data corresponding to a change operation log in the operation log;
and when the state change information of the first data is not matched with the change operation log, judging the change operation log and the operation log of the change operation log based on the first data or the second data as the abnormal operation log.
5. The database management method according to claim 4, wherein the database management method further comprises:
when the abnormal operation log is detected from the operation log, generating alarm information according to the abnormal operation log.
6. A database management apparatus, characterized in that the database management apparatus comprises:
the acquisition module is used for acquiring an operation log aiming at the database between the first database snapshot and the second database snapshot;
the screening module is used for screening out the operation log judged to be abnormal in the operation logs to obtain a target operation log;
the execution module is used for executing operation on the database data corresponding to the first database snapshot again according to the target operation log so as to generate a third database snapshot;
and the adjustment module is used for adjusting the database according to the second database snapshot and the third database snapshot.
7. The database management apparatus of claim 6, wherein the adjustment module is specifically configured to:
comparing the second database snapshot with a third database snapshot;
if the second database snapshot and the third database snapshot have differences, replacing the second database snapshot with the third database snapshot, and recovering the data of the database according to the third database snapshot.
8. The database management apparatus of claim 7, further comprising a decision module, the decision module being specifically configured to:
according to the external key association record, combining the operation log to obtain state change information of the first data; wherein, the first data is associated with second data corresponding to a change operation log in the operation log;
and when the state change information of the first data is not matched with the change operation log, judging the change operation log and the operation log of the change operation log based on the first data or the second data as the abnormal operation log.
9. A computer readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the method according to any of claims 1-5.
10. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating over the bus when the electronic device is running, the processor executing the machine-readable instructions to perform the steps of the database management method according to any one of claims 1 to 5.
CN201910616254.9A 2019-07-09 2019-07-09 Database management method, device, computer readable storage medium and electronic equipment Active CN112214471B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910616254.9A CN112214471B (en) 2019-07-09 2019-07-09 Database management method, device, computer readable storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910616254.9A CN112214471B (en) 2019-07-09 2019-07-09 Database management method, device, computer readable storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112214471A CN112214471A (en) 2021-01-12
CN112214471B true CN112214471B (en) 2024-04-05

Family

ID=74047388

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910616254.9A Active CN112214471B (en) 2019-07-09 2019-07-09 Database management method, device, computer readable storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112214471B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103116533A (en) * 2012-05-28 2013-05-22 北京智网科技股份有限公司 Snapshot implementation method
CN103221925A (en) * 2012-11-23 2013-07-24 华为技术有限公司 Data processing method and storage equipment
CN103914359A (en) * 2012-12-31 2014-07-09 中国移动通信集团浙江有限公司 Data recovery method and device
CN105373448A (en) * 2015-10-27 2016-03-02 北京百度网讯科技有限公司 Method and system for recovering failure data in database
CN107229540A (en) * 2017-06-06 2017-10-03 贵州易鲸捷信息技术有限公司 A kind of database restoring method and system based on time point
CN109885427A (en) * 2019-01-31 2019-06-14 郑州云海信息技术有限公司 A kind of database short-term data guard method, device, memory and equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103116533A (en) * 2012-05-28 2013-05-22 北京智网科技股份有限公司 Snapshot implementation method
CN103221925A (en) * 2012-11-23 2013-07-24 华为技术有限公司 Data processing method and storage equipment
CN103914359A (en) * 2012-12-31 2014-07-09 中国移动通信集团浙江有限公司 Data recovery method and device
CN105373448A (en) * 2015-10-27 2016-03-02 北京百度网讯科技有限公司 Method and system for recovering failure data in database
CN107229540A (en) * 2017-06-06 2017-10-03 贵州易鲸捷信息技术有限公司 A kind of database restoring method and system based on time point
CN109885427A (en) * 2019-01-31 2019-06-14 郑州云海信息技术有限公司 A kind of database short-term data guard method, device, memory and equipment

Also Published As

Publication number Publication date
CN112214471A (en) 2021-01-12

Similar Documents

Publication Publication Date Title
US9645892B1 (en) Recording file events in change logs while incrementally backing up file systems
US8452735B2 (en) Selecting a data restore point with an optimal recovery time and recovery point
US7877360B2 (en) Recovery point identification in CDP environments
US9262260B2 (en) Information processing apparatus, information processing method, and recording medium
US8051041B2 (en) Apparatus and method for file difference management
US10204016B1 (en) Incrementally backing up file system hard links based on change logs
CN112286728A (en) Data backup method, device, equipment and computer storage medium
CN106682162B (en) Log management method and device
CN105573859A (en) Data recovery method and device of database
US10459804B2 (en) Database rollback using WAL
EP3474143B1 (en) Method and apparatus for incremental recovery of data
JP6411696B1 (en) Version control system and version control method
US7900088B1 (en) System for performing incremental file system check
CN110537170B (en) Method, system and computer readable storage device for analyzing large scale data processing jobs
CN108573007A (en) Method, apparatus, electronic equipment and the storage medium of data consistency detection
CN109597746B (en) Fault analysis method and device
CN109240854B (en) Method and system for recovering data of change caused by misoperation
CN109284331B (en) Certificate making information acquisition method based on service data resources, terminal equipment and medium
CN112579327B (en) Fault detection method, device and equipment
CN110046086B (en) Expected data generation method and device for test and electronic equipment
US10936395B1 (en) Smart log parser for backup software to ease troubleshooting
CN112214471B (en) Database management method, device, computer readable storage medium and electronic equipment
CN115146304A (en) Method and device for detecting file leakage behavior
CN107402841A (en) Large-scale distributed file system data recovery method and equipment
CN106569731B (en) Limit storage method, device and equipment

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