CN104991836A - Database recovery method and apparatus and database server - Google Patents

Database recovery method and apparatus and database server Download PDF

Info

Publication number
CN104991836A
CN104991836A CN201510346105.7A CN201510346105A CN104991836A CN 104991836 A CN104991836 A CN 104991836A CN 201510346105 A CN201510346105 A CN 201510346105A CN 104991836 A CN104991836 A CN 104991836A
Authority
CN
China
Prior art keywords
statement
backup file
database
commit
perform
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.)
Granted
Application number
CN201510346105.7A
Other languages
Chinese (zh)
Other versions
CN104991836B (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.)
Beijing Xiaomi Technology Co Ltd
Xiaomi Inc
Original Assignee
Xiaomi Inc
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 Xiaomi Inc filed Critical Xiaomi Inc
Priority to CN201510346105.7A priority Critical patent/CN104991836B/en
Publication of CN104991836A publication Critical patent/CN104991836A/en
Application granted granted Critical
Publication of CN104991836B publication Critical patent/CN104991836B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to a database recovery method and apparatus and a database server. The database recovery method provided by the disclosure comprises: analyzing a backup file of a database according to a preset statement merge rule, wherein the backup file comprises more than one execution statement, and determining more than two execution statements to be combined into one group submission statement; according to the more than two execution statements to be combined into one group submission statement, generating the group submission statement; and adding the group submission statement into a database message queue in a preset order, and executing the group submission statement in the database message queue. The disclosure reduces database recovery time, and shortens service suspension time in a database recovery process, thus improving user experience.

Description

The method of restore database, device and database server
Technical field
The disclosure relates to computer technology, particularly relates to the method for restore database, device and database server.
Background technology
Database is when delaying machine, probably cause the loss of data of whole database, in order to ensure that the data of losing can be recovered in time, normally a full backup is regularly carried out to database and generate full backup file, then on the basis of full backup, do incremental backup again generate incremental backup file, because the strategy of incremental backup is many, such as per hourly carry out an incremental backup, or all an incremental backup etc. is carried out to any one operation of database, so the number of incremental backup file is many, the full backup file that backup produces and incremental backup file can leave on the hard disk of or multiple servers.After database delays machine, adopt and first import full backup file, then the strategy importing incremental backup file successively recovers database.
Summary of the invention
For overcoming Problems existing in correlation technique, the disclosure provides a kind of method of restore database, device and database server.
According to the first aspect of disclosure embodiment, a kind of method of restore database is provided, comprises:
Merge rule according to default statement to analyze the backup file of database, described backup file comprises one or more perform statement, determine more than two to be combined be a described perform statement organizing commit statement;
According to described more than two to be combined be one group commit statement described perform statement generate described group of commit statement;
Described group of commit statement is added database message queue according to preset order, performs described group of commit statement in described database message queue.
In conjunction with the first aspect of disclosure embodiment, in the first possible implementation of the first aspect of disclosure embodiment, described backup file comprises full backup file and incremental backup file.
In conjunction with the first possible implementation of the first aspect of disclosure embodiment, in the implementation that the second of the first aspect of disclosure embodiment is possible, described basis is preset statement merging rule and is analyzed the backup file of database, determine more than two to be combined be one group commit statement described perform statement, comprising:
Merge rule according to described default statement to analyze described full backup file, determining in described full backup file that more than two to be combined is a described perform statement organizing commit statement;
Merge rule according to described default statement to analyze described incremental backup file, determining in described incremental backup file that more than two to be combined is a described perform statement organizing commit statement.
In conjunction with the implementation that the second of the first aspect of disclosure embodiment is possible, in the third possible implementation of the first aspect of disclosure embodiment, describedly merge rule according to described default statement described full backup file is analyzed, to determine in described full backup file more than two to be combined be the described perform statement of a group commit statement, comprising:
Be two or more full backup son file by described full backup file declustering;
Start two or more processing threads to merge rule to described two or more full backup son file according to described default statement respectively and analyze, determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.
In conjunction with the implementation that the second of the first aspect of disclosure embodiment is possible, in 4th kind of possible implementation of the first aspect of disclosure embodiment, describedly merge rule according to described default statement described full backup file is analyzed, to determine in described full backup file more than two to be combined be the described perform statement of a group commit statement, comprising:
Be two or more full backup son file by described full backup file declustering;
Two or more database server merges rule to described two or more full backup son file according to described default statement respectively and analyzes, and determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.
In conjunction with the implementation that the second of the first aspect of disclosure embodiment is possible, in 5th kind of possible implementation of the first aspect of disclosure embodiment, describedly merge rule according to described default statement described incremental backup file is analyzed, to determine in described incremental backup file more than two to be combined be the described perform statement of a group commit statement, comprising:
Start two or more processing threads to merge rule to incremental backup file described in two or more according to described default statement respectively and analyze, determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement;
Merge rule according to described default statement to analyze incremental backup file described in described two or more, determine that to be combined in incremental backup file described in described two or more is a group commit statement organizing commit statement.
In conjunction with the implementation that the second of the first aspect of disclosure embodiment is possible, in 6th kind of possible implementation of the first aspect of disclosure embodiment, describedly merge rule according to described default statement described incremental backup file is analyzed, to determine in described incremental backup file more than two to be combined be the described perform statement of a group commit statement, comprising:
Two or more database server merges rule to incremental backup file described in two or more according to described default statement respectively and analyzes, and determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement;
Described server merges rule according to described default statement and analyzes incremental backup file described in described two or more, determines that to be combined in incremental backup file described in described two or more is a group commit statement organizing commit statement.
In conjunction with the first aspect of disclosure embodiment, first aspect the first to any one possible implementation in the 6th kind, in 7th kind of possible implementation of the first aspect of disclosure embodiment, described basis is preset statement and is merged before rule analyzes the backup file of database, also comprises:
By in described backup file, the perform statement that the described database of recovery does not have an impact is filtered out.
In conjunction with the first aspect of disclosure embodiment, in the 8th kind of possible implementation of the first aspect of disclosure embodiment, described method also comprises:
The perform statement do not merged in described backup file is added described database message queue according to described preset order, performs the described perform statement in described database message queue.
According to the second aspect of disclosure embodiment, a kind of device of restore database is provided, comprises:
Analytic unit, be configured to merge rule analyze the backup file of database according to presetting statement, described backup file comprises one or more perform statement, determines that more than two are to be combinedly one and organize the described perform statement of commit statement;
Merge cells, be configured to according to described more than two to be combined be one group commit statement described perform statement generate described group of commit statement;
Performance element, is configured to described group of commit statement to add database message queue according to preset order, performs described group of commit statement in described database message queue.
In conjunction with the second aspect of disclosure embodiment, in the first possible implementation of the second aspect of disclosure embodiment, described backup file comprises full backup file and incremental backup file.
In conjunction with the first possible implementation of the second aspect of disclosure embodiment, in the implementation that the second of the second aspect of disclosure embodiment is possible, described analytic unit comprises:
Complete analysis module, is configured to merge rule according to described default statement and analyzes described full backup file, and determining in described full backup file that more than two to be combined is a described perform statement organizing commit statement;
Incremental analysis module, is configured to merge rule according to described default statement and analyzes described incremental backup file, and determining in described incremental backup file that more than two to be combined is a described perform statement organizing commit statement.
In conjunction with the implementation that the second of the second aspect of disclosure embodiment is possible, in the third possible implementation of the second aspect of disclosure embodiment, described complete analysis module comprises:
File declustering submodule, being configured to described full backup file declustering is two or more full backup son file;
Complete analysis submodule, be configured to start two or more processing threads merge rule to described two or more full backup son file according to described default statement respectively and analyze, determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.
In conjunction with the implementation that the second of the second aspect of disclosure embodiment is possible, in the 4th kind of possible implementation of the second aspect of disclosure embodiment, described incremental analysis module comprises:
First incremental analysis submodule, be configured to start two or more processing threads merge rule to incremental backup file described in two or more according to described default statement respectively and analyze, determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement;
Second incremental analysis submodule, merges rule according to described default statement and analyzes incremental backup file described in described two or more, determines that to be combined in incremental backup file described in described two or more is a group commit statement organizing commit statement.
In conjunction with the second aspect of disclosure embodiment, second aspect the first to any one possible implementation in the 4th kind, in the 5th kind of possible implementation of the second aspect of disclosure embodiment, also comprise:
Filtering unit, is configured to filter out in described backup file the perform statement that the described database of recovery does not have an impact.
In conjunction with the second aspect of disclosure embodiment, in 6th kind of possible implementation of the second aspect of disclosure embodiment, described performance element, be configured to the perform statement do not merged in described backup file to add described database message queue according to described preset order, perform the described perform statement in described database message queue.
According to the third aspect of disclosure embodiment, a kind of database server is provided, comprises: processor and the storer being configured to storage backup file and described processor executable;
Wherein, described processor is configured to perform instruction, merge rule to perform analyze the backup file of database according to presetting statement, described backup file comprises one or more perform statement, determines that more than two are to be combinedly one and organize the described perform statement of commit statement; According to described more than two to be combined be one group commit statement described perform statement generate described group of commit statement; Described group of commit statement is added database message queue according to preset order, performs described group of commit statement in described database message queue.
The technical scheme that the present embodiment provides can comprise following beneficial effect: by more than two perform statements to be combined in the backup file (comprising respectively by full backup file and incremental backup file) of database are merged into a group commit statement, realize the disposable execution of multiple identical operation, accelerate the time of restore database, shorten the time of service disruption in restore database process, promote Consumer's Experience; Wherein, full backup file is split further, each full backup son file is analyzed by multiple processing threads or multiple database server simultaneously, the speed of restore database can be improved further; Incremental backup file is analyzed by multiple processing threads or multiple database server and merged, multiple incremental backup files after being combined again are analyzed again, each incremental backup Piece file mergence is a normalized incremental backup file the most at last, improves the resume speed of incremental backup file; By in backup file, the perform statement that restore database does not have an impact is filtered out, accelerate the time of restore database further, shorten the time of service disruption in restore database process, promote Consumer's Experience; Again the perform statement do not merged is added database message queue, improve the operation of database recovery.
Should be understood that, it is only exemplary and explanatory that above general description and details hereinafter describe, and can not limit the disclosure.
Accompanying drawing explanation
Accompanying drawing to be herein merged in instructions and to form the part of this instructions, shows embodiment according to the invention, and is used from instructions one and explains principle of the present invention.
Fig. 1 is the process flow diagram of the method for a kind of restore database according to an exemplary embodiment;
Fig. 2 is the process flow diagram of the method for a kind of restore database according to an exemplary embodiment;
Fig. 3 is the process schematic of the restore database of Fig. 2 exemplary embodiment;
Fig. 4 is the device block diagram of a kind of restore database according to an exemplary embodiment;
Fig. 5 is the device block diagram of a kind of restore database according to an exemplary embodiment;
Fig. 6 is the device block diagram of a kind of restore database according to an exemplary embodiment;
Fig. 7 is the device block diagram of a kind of restore database according to an exemplary embodiment;
Fig. 8 is the device block diagram of a kind of restore database according to an exemplary embodiment;
Fig. 9 is the block diagram of a kind of database server according to an exemplary embodiment.
Embodiment
Here will be described exemplary embodiment in detail, its sample table shows in the accompanying drawings.When description below relates to accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawing represents same or analogous key element.Embodiment described in following exemplary embodiment does not represent all embodiments consistent with the present invention.On the contrary, they only with as in appended claims describe in detail, the example of apparatus and method that aspects more of the present invention are consistent.
Fig. 1 is the process flow diagram of the method for a kind of restore database according to an exemplary embodiment, and as shown in Figure 1, the method is used for, in database server, comprising the following steps.
In a step 101, merge rule according to default statement and analyze the backup file of database, described backup file comprises one or more perform statement, determine more than two to be combined be a described perform statement organizing commit statement;
Presetting statement merging rule can be the rule that user pre-sets according to the type, database language etc. of database, merge rule according to this default statement, database server can determine from the perform statement of the backup file of database which perform statement can merge into a group commit statement.When database server is in the database backup file in the hard disk of one or more database server being returned to operation, need to call one subsynchronous (fsync), usually the situation that must perform multiple identical operation is there will be in this synchronizing process, such as insert continually, sequence etc., now can will represent that the perform statement of this multiple identical operation merges into a group commit statement, the disclosure can adopt the one group in database to submit to (group commit) function that more than two perform statements to be combined are merged into a groupcommit statement.
Illustrate, the perform statement in the backup file of database comprise many continuous print Structured Query Language (SQL) (Structured Query Language, be called for short: SQL) statement, as follows:
INSERT INTO Test values (' Zhao ', ' 90');
INSERT INTO Test values (' king ', ' 80');
INSERT INTO Test values (' Lee ', ' 89');
Suppose that presetting the regular perform statement being set in advance as continuous print same operation of statement merging merges into a group commit statement, therefore, the SQL statement of above-mentioned three updates can merge into a group commit statement:
INSERT INTO Test values (' Zhao ', ' 90'), (' king ', ' 80'), (' Lee ', ' 89').
Such three perform statements will become a group commit statement, and database server can above-mentioned three updates of disposable execution by running this group commit statement.
In a step 102, according to described more than two to be combined be one group commit statement described perform statement generate described group of commit statement;
In a step 101, database server merges rule according to default statement and analyzes backup file, define which perform statement can merge, just can merge these perform statements, generate the group commit statement of similar above-mentioned group commit statement.
In step 103, described group of commit statement is added database message queue according to preset order, perform described group of commit statement in described database message queue.
Preset order can be pre-set according to the operation order of the perform statement in backup file, the group commit statement merged is added database message queue according to this preset order by database server, by the group commit statement in performing database message queue, database is recovered.Owing to merging the perform statement in backup file, therefore originally need the perform statement run one by one, being merged into as much as possible can the group commit statement of disposable execution, greatly improves the speed of restore database.
The method of the restore database of the present embodiment, by more than two perform statements to be combined in the backup file of database are merged into a group commit statement, realize the disposable execution of multiple identical operation, accelerate the time of restore database, shorten the time of service disruption in restore database process, promote Consumer's Experience.
Fig. 2 is the process flow diagram of the method for a kind of restore database according to an exemplary embodiment, and as shown in Figure 2, the backup file of database comprises full backup file and incremental backup file, and the method is used for, in database server, comprising the following steps.
In step 201, by backup file, the perform statement that restore database does not have an impact is filtered out;
Database server filters the perform statement in full backup file and incremental backup file respectively, due to some perform statement, such as query statement, the speed of restore database is not had an impact, therefore the query statement in backup file can be filtered out, the speed of restore database can also be accelerated.
Also the backup file not comprising query statement can be directly generated when generating backup file.In this case, database server can not perform step 201.
In step 202., merge rule analyze full backup file according to default statement, determining in described full backup file that more than two to be combined is a described perform statement organizing commit statement;
The backup file of usual database comprises a full backup file and multiple incremental backup file, and database server is analyzed respectively for each backup file.After full backup file analysis, merge perform statement to be combined in full backup file; After incremental backup file analysis, merge perform statement to be combined in incremental backup file.
Due to the mass data of database, full backup file is usually larger, therefore full backup file declustering first can be become two or more full backup son file when analyzing by database server, start two or more processing threads to merge rule to described two or more full backup son file according to described default statement respectively and analyze, determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.Multiple like this processing threads is analyzed each full backup son file simultaneously, can improve the speed of restore database further.
Optionally, also can adopt described full backup file declustering the process of overall backup file is two or more full backup son file; Merge rule to described two or more full backup son file according to described default statement respectively by two or more database server to analyze, determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.
Database server in the disclosure also can adopt the form of distributed server cluster, merge rule to two or more full backup son file according to described default statement by the separate database server in distributed server cluster respectively in man-to-man mode to analyze, determining in full backup son file described in each that more than two to be combined is a perform statement organizing commit statement.
In step 203, merge rule analyze incremental backup file according to described default statement, determining in described incremental backup file that more than two to be combined is a described perform statement organizing commit statement;
Database server is analyzed incremental backup file, and group commit statement after merging remains and belongs to each incremental backup file.In order to improve the resume speed of incremental backup file, database server first can start two or more processing threads and merge rule to two or more incremental backup file according to described default statement respectively and analyze, and determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement; Then merge rule according to described default statement to try again analysis to two or more incremental backup file, determine that to be combined in described two or more incremental backup file is a group commit statement organizing commit statement, each incremental backup Piece file mergence is a normalized incremental backup file the most at last.
Optionally, also can adopt the process of incremental backup file and merge rule to incremental backup file described in two or more according to described default statement respectively by two or more database server and analyze, determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement; Described server merges rule according to described default statement and analyzes incremental backup file described in described two or more, determines that to be combined in incremental backup file described in described two or more is a group commit statement organizing commit statement.
Database server in the disclosure can adopt the form of above-mentioned distributed server cluster equally, merge rule to two or more incremental backup file according to described default statement by the separate database server in distributed server cluster respectively in man-to-man mode to analyze, to determine in incremental backup file described in each more than two to be combined be the perform statement of a group commit statement, then merging is normalized to the group commit statement of two or more incremental backup file.
In step 204, according to described more than two to be combined be one group commit statement described perform statement generate described group of commit statement;
Database server merges generation group commit statement for full backup file and incremental backup file by analyzing the perform statement to be combined determined respectively.
In step 205, described group of commit statement is added database message queue according to preset order;
In step 206, the perform statement do not merged in described backup file is added described database message queue according to described preset order;
The perform statement do not merged in backup file, except adding database message queue by merging the group commit statement generated, also will also be added database message queue, could form complete backup file like this in database message queue by database server.If the perform statement do not merged in backup file, step 206 can not perform.Step 205 and step 206 are that database performs respectively for full backup file and incremental backup file.
In step 207, described group of commit statement in described database message queue and described perform statement is performed.
All statements in database server performing database message queue the most all backup files return to database.If the perform statement do not merged in backup file, then do not comprise perform statement in the message queue that database server performs.
The method of the restore database of the present embodiment, by analyzing carrying out fractionation to the full backup file of database, combined analysis is carried out to the incremental backup file of database, more than two perform statements to be combined are merged into a group commit statement, realize the disposable execution of multiple identical operation in two kinds of backup files, the time of further quickening restore database, shorten the time of service disruption in restore database process, promote Consumer's Experience.
Exemplarily, Fig. 3 is the process schematic of the restore database of Fig. 2 exemplary embodiment, as shown in Figure 3, database server starts multiple processing threads, wherein, a processing threads is for analyzing full backup file, perform statement to be combined for two or more in full backup file is merged and generates groupcommit statement, comprise the file of this group commit statement for merging full backup file, group commit statement is added database message queue according to preset order by this processing threads, another or multiple processing threads are for analyzing one or more incremental backup file, processing threads and incremental backup file one_to_one corresponding, perform statement to be combined for two or more in an incremental backup file is merged generation group commit statement by a processing threads, comprise the file of this group commit statement for merging incremental backup file, then a processing threads is analyzed again to one or more merging incremental backup file, group commit statement to be combined is merged and generates normalized group commit statement, the file comprising this normalized group commit statement is that normalization merges incremental backup file, normalized group commit statement is added database message queue according to preset order by processing threads.The group commit statement of the merging full backup file in database server performing database message queue and normalization merge the normalized group commit statement of incremental backup file, restore database.
Fig. 4 is the device block diagram of a kind of restore database according to an exemplary embodiment.With reference to Fig. 4, this device comprises analytic unit 11, merge cells 12 and performance element 13.
This analytic unit 11 is configured to merge rule analyze the backup file of database according to presetting statement, and described backup file comprises one or more perform statement, determines that more than two are to be combinedly one and organize the described perform statement of commit statement.
This merge cells 12 be configured to according to analytic unit 11 determine described more than two to be combined be one group commit statement described perform statement generate described group of commit statement.
The described group of commit statement that this performance element 13 is configured to merge cells 12 to generate adds database message queue according to preset order, performs described group of commit statement in described database message queue.
Further, described backup file comprises full backup file and incremental backup file.
Further, described performance element 13 is configured to the perform statement do not merged in described backup file to add described database message queue according to described preset order, performs the described perform statement in described database message queue.
The device of the restore database of the present embodiment, by more than two perform statements to be combined in the backup file of database are merged into a group commit statement, realize the disposable execution of multiple identical operation, accelerate the time of restore database, shorten the time of service disruption in restore database process, promote Consumer's Experience.
Fig. 5 is the device block diagram of a kind of restore database according to an exemplary embodiment.With reference to Fig. 5, this device is on Fig. 4 shown device embodiment basis, and analytic unit 11 also comprises complete analysis module 111 and incremental analysis module 112.
This complete analysis module 111, is configured to merge rule according to described default statement and analyzes described full backup file, and determining in described full backup file that more than two to be combined is a described perform statement organizing commit statement.
This incremental analysis module 112, is configured to merge rule according to described default statement and analyzes described incremental backup file, and determining in described incremental backup file that more than two to be combined is a described perform statement organizing commit statement.
Fig. 6 is the device block diagram of a kind of restore database according to an exemplary embodiment.With reference to Fig. 6, this device is on Fig. 5 shown device embodiment basis, and complete analysis module 111 also comprises file declustering submodule 1111 and complete analysis submodule 1112.
It is two or more full backup son file that this file declustering submodule 1111 is configured to described full backup file declustering.
This complete analysis submodule 1112 is configured to start described two or more full backup son file that two or more processing threads splits out to file declustering submodule 1111 respectively and merges rule according to described default statement and analyze, and determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.
The device of the restore database of the present embodiment, splits further to full backup file, is analyzed by multiple processing threads to each full backup son file simultaneously, can improve the speed of restore database further.
Optionally, the restore database in the disclosure also can be the form of server cluster in a distributed manner, be two or more full backup son file by the separate database server in distributed server cluster by described full backup file declustering; Two or more database server merges rule to described two or more full backup son file according to described default statement respectively and analyzes, and determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.
Fig. 7 is the device block diagram of a kind of restore database according to an exemplary embodiment.With reference to Fig. 7, this device is on Fig. 5 shown device embodiment basis, and incremental analysis module 112 also comprises the first incremental analysis submodule 1121 and the second incremental analysis submodule 1122.
This first incremental analysis submodule 1121 is configured to start two or more processing threads and merges rule to incremental backup file described in two or more according to described default statement respectively and analyze, and determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement.
This second incremental analysis submodule 1122 merges rule according to described default statement and analyzes incremental backup file described in described two or more, determines that to be combined in incremental backup file described in described two or more is a group commit statement organizing commit statement.
The device of the restore database of the present embodiment, by multiple processing threads incremental backup file analyzed and merge, multiple incremental backup files after being combined again are analyzed again, each incremental backup Piece file mergence is a normalized incremental backup file the most at last, improves the resume speed of incremental backup file.
Optionally, restore database in the disclosure also can be the form of server cluster in a distributed manner, merge rule to incremental backup file described in two or more according to described default statement respectively by the two or more separate database server in distributed server cluster to analyze, determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement; Described server merges rule according to described default statement and analyzes incremental backup file described in described two or more, determines that to be combined in incremental backup file described in described two or more is a group commit statement organizing commit statement.
Fig. 8 is the device block diagram of a kind of restore database according to an exemplary embodiment.With reference to Fig. 8, this device, on Fig. 4 shown device embodiment basis, also comprises filtering unit 14.
This filtering unit 14, is configured to filter out in described backup file the perform statement that the described database of recovery does not have an impact.
The device of the restore database of the present embodiment, by filtering out in backup file the perform statement that restore database does not have an impact, accelerating the time of restore database further, shortening the time of service disruption in restore database process, promote Consumer's Experience.
Device shown in Fig. 4-Fig. 8, for realizing the method flow shown in above-mentioned Fig. 1-Fig. 2.About the device in above-described embodiment, wherein the concrete mode of modules executable operations has been described in detail in about the embodiment of the method, will not elaborate explanation herein.
Fig. 9 is the block diagram of a kind of database server according to an exemplary embodiment.With reference to Fig. 9, database server 900 comprises processing components 901, and it comprises one or more processor further, and the memory resource representated by storer 902, can by the executable instruction of processing components 901 for storing, such as application program.The application program stored in storer 902 can comprise each module corresponding to one group of instruction one or more.Can also the full backup file of stored data base and incremental backup file in storer 902.In addition, processing components 901 is configured to perform instruction, to perform the method for above-mentioned restore database.
Database server 900 can also comprise the power management that a power supply module 903 is configured to performing database server 900, a wired or wireless network interface 904 is configured to database server 900 to be connected to network, and input and output (I/O) interface 905.Database server 900 can operate the operating system based on being stored in storer 902, such as Microsft Windows server OS (Windows Server), Apple Macintosh operating system (Mac OS), outstanding Nice operating system (Unix), (SuSE) Linux OS, Unix operating system (FreeBSD) or similar.
A kind of non-transitory computer-readable recording medium, when the instruction in described storage medium is performed by the processor of database server, make database server can perform a kind of method of restore database, described method comprises: merge rule according to default statement and analyze the backup file of database, described backup file comprises one or more perform statement, determine more than two to be combined be one group commit statement described perform statement; According to described more than two to be combined be one group commit statement described perform statement generate described group of commit statement; Described group of commit statement is added database message queue according to preset order, performs described group of commit statement in described database message queue.
Those skilled in the art, at consideration instructions and after putting into practice invention disclosed herein, will easily expect other embodiment of the present invention.The application is intended to contain any modification of the present invention, purposes or adaptations, and these modification, purposes or adaptations are followed general principle of the present invention and comprised the undocumented common practise in the art of the disclosure or conventional techniques means.Instructions and embodiment are only regarded as exemplary, and true scope of the present invention and spirit are pointed out by claim below.
Should be understood that, the present invention is not limited to precision architecture described above and illustrated in the accompanying drawings, and can carry out various amendment and change not departing from its scope.Scope of the present invention is only limited by appended claim.

Claims (17)

1. a method for restore database, is characterized in that, comprising:
Merge rule according to default statement to analyze the backup file of database, described backup file comprises one or more perform statement, determine more than two to be combined be a described perform statement organizing commit statement;
According to described more than two to be combined be one group commit statement described perform statement generate described group of commit statement;
Described group of commit statement is added database message queue according to preset order, performs described group of commit statement in described database message queue.
2. method according to claim 1, is characterized in that, described backup file comprises full backup file and incremental backup file.
3. method according to claim 2, is characterized in that, described basis is preset statement and merged rule and analyze the backup file of database, determines that more than two are to be combinedly one and organize the described perform statement of commit statement, comprising:
Merge rule according to described default statement to analyze described full backup file, determining in described full backup file that more than two to be combined is a described perform statement organizing commit statement;
Merge rule according to described default statement to analyze described incremental backup file, determining in described incremental backup file that more than two to be combined is a described perform statement organizing commit statement.
4. method according to claim 3, it is characterized in that, describedly merge rule according to described default statement and analyze described full backup file, determining in described full backup file that more than two are to be combined is a described perform statement organizing commit statement, comprising:
Be two or more full backup son file by described full backup file declustering;
Start two or more processing threads to merge rule to described two or more full backup son file according to described default statement respectively and analyze, determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.
5. method according to claim 3, it is characterized in that, describedly merge rule according to described default statement and analyze described full backup file, determining in described full backup file that more than two are to be combined is a described perform statement organizing commit statement, comprising:
Be two or more full backup son file by described full backup file declustering;
Two or more database server merges rule to described two or more full backup son file according to described default statement respectively and analyzes, and determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.
6. method according to claim 3, it is characterized in that, describedly merge rule according to described default statement and analyze described incremental backup file, determining in described incremental backup file that more than two are to be combined is a described perform statement organizing commit statement, comprising:
Start two or more processing threads to merge rule to incremental backup file described in two or more according to described default statement respectively and analyze, determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement;
Merge rule according to described default statement to analyze incremental backup file described in described two or more, determine that to be combined in incremental backup file described in described two or more is a group commit statement organizing commit statement.
7. method according to claim 3, it is characterized in that, describedly merge rule according to described default statement and analyze described incremental backup file, determining in described incremental backup file that more than two are to be combined is a described perform statement organizing commit statement, comprising:
Two or more database server merges rule to incremental backup file described in two or more according to described default statement respectively and analyzes, and determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement;
Described server merges rule according to described default statement and analyzes incremental backup file described in described two or more, determines that to be combined in incremental backup file described in described two or more is a group commit statement organizing commit statement.
8. the method according to any one of claim 1 ~ 7, is characterized in that, described basis is preset statement and merged before rule analyzes the backup file of database, also comprises:
By in described backup file, the perform statement that the described database of recovery does not have an impact is filtered out.
9. method according to claim 1, is characterized in that, described method also comprises:
The perform statement do not merged in described backup file is added described database message queue according to described preset order, performs the described perform statement in described database message queue.
10. a device for restore database, is characterized in that, comprising:
Analytic unit, be configured to merge rule analyze the backup file of database according to presetting statement, described backup file comprises one or more perform statement, determines that more than two are to be combinedly one and organize the described perform statement of commit statement;
Merge cells, be configured to according to described more than two to be combined be one group commit statement described perform statement generate described group of commit statement;
Performance element, is configured to described group of commit statement to add database message queue according to preset order, performs described group of commit statement in described database message queue.
11. devices according to claim 10, is characterized in that, described backup file comprises full backup file and incremental backup file.
12. devices according to claim 11, is characterized in that, described analytic unit comprises:
Complete analysis module, is configured to merge rule according to described default statement and analyzes described full backup file, and determining in described full backup file that more than two to be combined is a described perform statement organizing commit statement;
Incremental analysis module, is configured to merge rule according to described default statement and analyzes described incremental backup file, and determining in described incremental backup file that more than two to be combined is a described perform statement organizing commit statement.
13. devices according to claim 12, is characterized in that, described complete analysis module comprises:
File declustering submodule, being configured to described full backup file declustering is two or more full backup son file;
Complete analysis submodule, be configured to start two or more processing threads merge rule to described two or more full backup son file according to described default statement respectively and analyze, determining in full backup son file described in each that more than two to be combined is a described perform statement organizing commit statement.
14. devices according to claim 12, is characterized in that, described incremental analysis module comprises:
First incremental analysis submodule, be configured to start two or more processing threads merge rule to incremental backup file described in two or more according to described default statement respectively and analyze, determining in each described incremental backup file that more than two to be combined is respectively a described perform statement organizing commit statement;
Second incremental analysis submodule, merges rule according to described default statement and analyzes incremental backup file described in described two or more, determines that to be combined in incremental backup file described in described two or more is a group commit statement organizing commit statement.
15. devices according to any one of claim 10 ~ 14, is characterized in that, also comprise:
Filtering unit, is configured to filter out in described backup file the perform statement that the described database of recovery does not have an impact.
16. devices according to claim 10, it is characterized in that, described performance element, is configured to the perform statement do not merged in described backup file to add described database message queue according to described preset order, performs the described perform statement in described database message queue.
17. 1 kinds of database servers, is characterized in that, comprising: processor and the storer being configured to storage backup file and described processor executable;
Wherein, described processor is configured to perform instruction, merge rule to perform analyze the backup file of database according to presetting statement, described backup file comprises one or more perform statement, determines that more than two are to be combinedly one and organize the described perform statement of commit statement; According to described more than two to be combined be one group commit statement described perform statement generate described group of commit statement; Described group of commit statement is added database message queue according to preset order, performs described group of commit statement in described database message queue.
CN201510346105.7A 2015-06-19 2015-06-19 Recover the method, apparatus and database server of database Active CN104991836B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510346105.7A CN104991836B (en) 2015-06-19 2015-06-19 Recover the method, apparatus and database server of database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510346105.7A CN104991836B (en) 2015-06-19 2015-06-19 Recover the method, apparatus and database server of database

Publications (2)

Publication Number Publication Date
CN104991836A true CN104991836A (en) 2015-10-21
CN104991836B CN104991836B (en) 2018-02-23

Family

ID=54303652

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510346105.7A Active CN104991836B (en) 2015-06-19 2015-06-19 Recover the method, apparatus and database server of database

Country Status (1)

Country Link
CN (1) CN104991836B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106951341A (en) * 2017-01-20 2017-07-14 天翼阅读文化传播有限公司 A kind of database backup method for realizing distributed structure/architecture
CN106970855A (en) * 2016-01-14 2017-07-21 华为技术有限公司 The method and apparatus of data recovery
CN110928899A (en) * 2019-11-29 2020-03-27 中孚安全技术有限公司 Universal database backup method and system
CN111240891A (en) * 2018-11-29 2020-06-05 中国移动通信集团内蒙古有限公司 Data recovery method and device based on data consistency among multiple tables of database
CN112612771A (en) * 2020-11-24 2021-04-06 深圳市和讯华谷信息技术有限公司 Data writing method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6202071B1 (en) * 1998-03-24 2001-03-13 International Business Machines Corporation Method and system for improved database disaster recovery
CN101625655A (en) * 2009-08-20 2010-01-13 华中科技大学 Parallel recovery method of memory database
CN102156720A (en) * 2011-03-28 2011-08-17 中国人民解放军国防科学技术大学 Method, device and system for restoring data
CN102662793A (en) * 2012-03-07 2012-09-12 江苏引跑网络科技有限公司 Hot backup and recovery method of distributed database with guarantee of data consistency

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6202071B1 (en) * 1998-03-24 2001-03-13 International Business Machines Corporation Method and system for improved database disaster recovery
CN101625655A (en) * 2009-08-20 2010-01-13 华中科技大学 Parallel recovery method of memory database
CN102156720A (en) * 2011-03-28 2011-08-17 中国人民解放军国防科学技术大学 Method, device and system for restoring data
CN102662793A (en) * 2012-03-07 2012-09-12 江苏引跑网络科技有限公司 Hot backup and recovery method of distributed database with guarantee of data consistency

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106970855A (en) * 2016-01-14 2017-07-21 华为技术有限公司 The method and apparatus of data recovery
CN106970855B (en) * 2016-01-14 2021-04-20 华为技术有限公司 Data recovery method and device
CN106951341A (en) * 2017-01-20 2017-07-14 天翼阅读文化传播有限公司 A kind of database backup method for realizing distributed structure/architecture
CN111240891A (en) * 2018-11-29 2020-06-05 中国移动通信集团内蒙古有限公司 Data recovery method and device based on data consistency among multiple tables of database
CN110928899A (en) * 2019-11-29 2020-03-27 中孚安全技术有限公司 Universal database backup method and system
CN110928899B (en) * 2019-11-29 2023-06-20 中孚安全技术有限公司 Universal database backup method and system
CN112612771A (en) * 2020-11-24 2021-04-06 深圳市和讯华谷信息技术有限公司 Data writing method and system

Also Published As

Publication number Publication date
CN104991836B (en) 2018-02-23

Similar Documents

Publication Publication Date Title
CN104991836A (en) Database recovery method and apparatus and database server
CN107832406B (en) Method, device, equipment and storage medium for removing duplicate entries of mass log data
CN106919675B (en) Data storage method and device
CN109376196B (en) Method and device for batch synchronization of redo logs
CN110795499B (en) Cluster data synchronization method, device, equipment and storage medium based on big data
CN104252481A (en) Dynamic check method and device for consistency of main and salve databases
CN111324610A (en) Data synchronization method and device
CN105205154B (en) Data migration method and device
CN107016019B (en) Database index creation method and device
CN105930479A (en) Data skew processing method and apparatus
CN110716802B (en) Cross-cluster task scheduling system and method
CN106682036A (en) Data exchange system and exchange method thereof
CN107315657B (en) Data backup method and device
CN111767320A (en) Data blood relationship determination method and device
CN111966631A (en) Mirror image file generation method, system, equipment and medium capable of being rapidly distributed
CN104462342B (en) database snapshot synchronization processing method and device
Erraissi et al. Meta-modeling of Zookeeper and MapReduce processing
CN111782404A (en) Data processing method and related equipment
CN111124839A (en) Distributed log data monitoring method and device
CN111966760A (en) Hive data warehouse-based test data generation method and device
CN115858488A (en) Parallel migration method and device based on data governance and readable medium
CN106843822B (en) Execution code generation method and equipment
CN112037003A (en) File account checking processing method and device
CN110941658A (en) Data export method, device, server and storage medium
CN114328716A (en) Data synchronization system, method and corresponding device and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant