[go: up one dir, main page]

CN104991836B - Recover the method, apparatus and database server of database - Google Patents

Recover the method, apparatus and database server of database Download PDF

Info

Publication number
CN104991836B
CN104991836B CN201510346105.7A CN201510346105A CN104991836B CN 104991836 B CN104991836 B CN 104991836B CN 201510346105 A CN201510346105 A CN 201510346105A CN 104991836 B CN104991836 B CN 104991836B
Authority
CN
China
Prior art keywords
sentence
backup file
group
database
execution
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
CN201510346105.7A
Other languages
Chinese (zh)
Other versions
CN104991836A (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.)
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 is directed to a kind of method, apparatus and database server for recovering database.The method that the disclosure recovers database, including:Merge backup file of the rule to database according to default sentence to analyze, the backup file includes one or more execution sentence, determine more than two it is to be combined be a group submission sentence the execution sentence;According to described more than two it is to be combined be that group submits the execution sentence of sentence to generate described group of submission sentence;Described group of submission sentence is added into database message queue according to preset order, performs described group of submission sentence in the database message queue.The disclosure is accelerated to recover the time of database, to shorten the time for recovering service disruption in data base procedure, lifts Consumer's Experience.

Description

Recover the method, apparatus and database server of database
Technical field
This disclosure relates to computer technology, more particularly to recover the method, apparatus and database server of database.
Background technology
Database is when delaying machine, it is more likely that causes the loss of data of whole database, in order to ensure the data energy lost It is enough to recover in time, it is typically regular to database to carry out a full backup generation full backup file, then in full backup On the basis of make incremental backup generation incremental backup file again, because the strategy of incremental backup is relatively more, for example carry out per hour Incremental backup, or any one operation to database all carry out incremental backup etc., so incremental backup is literary The number of part is relatively more, and full backup file caused by backup and incremental backup file can be stored in one or multiple servers Hard disk on.After database delays machine, using first importing full backup file, then the tactful right of incremental backup file is imported successively Database is recovered.
The content of the invention
To overcome problem present in correlation technique, the disclosure provides a kind of method, apparatus and data for recovering database Storehouse server.
According to the first aspect of the embodiment of the present disclosure, there is provided a kind of method for recovering database, including:
Merge backup file of the rule to database according to default sentence to analyze, the backup file including one with Upper execution sentence, determine more than two it is to be combined be the execution sentence that group submits sentence;
According to described more than two it is to be combined be that group submits the execution sentence of sentence to generate described group of submission language Sentence;
Described group of submission sentence is added into database message queue according to preset order, performs the database message queue In described group of submission sentence.
With reference to the embodiment of the present disclosure in a first aspect, the first possible realization side of the first aspect of the embodiment of the present disclosure In formula, the backup file includes full backup file and incremental backup file.
With reference to the first possible implementation of the first aspect of the embodiment of the present disclosure, the first party of the embodiment of the present disclosure In second of possible implementation in face, the basis is preset backup file of the sentence merging rule to database and divided Analysis, determine more than two it is to be combined be group submission sentence the execution sentence, including:
Merge rule according to the default sentence to analyze the full backup file, determine the full backup text It is the execution sentence that group submits sentence that more than two to be combined in part;
Merge rule according to the default sentence to analyze the incremental backup file, determine the incremental backup text It is the execution sentence that group submits sentence that more than two to be combined in part.
With reference to second of possible implementation of the first aspect of the embodiment of the present disclosure, the first party of the embodiment of the present disclosure It is described that rule is merged to full backup file progress according to the default sentence in the third possible implementation in face Analysis, determine in the full backup file more than two it is to be combined be a group submission sentence the execution sentence, including:
It is two or more full backup subfile by the full backup file declustering;
Start two or more and handle thread respectively to described two above full backup subfiles according to the default sentence Merge rule to be analyzed, determine in each full backup subfile more than two it is to be combined be a group submission sentence The execution sentence.
With reference to second of possible implementation of the first aspect of the embodiment of the present disclosure, the first party of the embodiment of the present disclosure It is described that rule is merged to full backup file progress according to the default sentence in the 4th kind of possible implementation in face Analysis, determine in the full backup file more than two it is to be combined be a group submission sentence the execution sentence, including:
It is two or more full backup subfile by the full backup file declustering;
Two or more database server is respectively to described two above full backup subfiles according to the default sentence Merge rule to be analyzed, determine in each full backup subfile more than two it is to be combined be a group submission sentence The execution sentence.
With reference to second of possible implementation of the first aspect of the embodiment of the present disclosure, the first party of the embodiment of the present disclosure It is described that rule is merged to incremental backup file progress according to the default sentence in the 5th kind of possible implementation in face Analysis, determine in the incremental backup file more than two it is to be combined be a group submission sentence the execution sentence, including:
Start two or more processing thread respectively to close incremental backup file described in two or more according to the default sentence And rule is analyzed, it is that a group submits sentence that more than two to be combined in each incremental backup file of determination respectively The execution sentence;
Merge rule according to the default sentence to analyze described two incremental backup files described above, determine institute It is that a group submits the group of sentence to submit sentence to state to be combined in incremental backup file described in two or more.
With reference to second of possible implementation of the first aspect of the embodiment of the present disclosure, the first party of the embodiment of the present disclosure It is described that rule is merged to incremental backup file progress according to the default sentence in the 6th kind of possible implementation in face Analysis, determine in the incremental backup file more than two it is to be combined be a group submission sentence the execution sentence, including:
Two or more database server closes to incremental backup file described in two or more according to the default sentence respectively And rule is analyzed, it is that a group submits sentence that more than two to be combined in each incremental backup file of determination respectively The execution sentence;
The server merges rule according to the default sentence to be carried out to described two incremental backup files described above Analysis, determine that to be combined in described two incremental backup files described above is that a group submits the group of sentence to submit sentence.
The first of first aspect, first aspect with reference to the embodiment of the present disclosure are to any possible realization in the 6th kind Mode, in the 7th kind of possible implementation of the first aspect of the embodiment of the present disclosure, the basis presets sentence and merges rule Before backup file to database is analyzed, in addition to:
The execution sentence not had an impact in the backup file to recovering the database is filtered out.
With reference to the embodiment of the present disclosure in a first aspect, the 8th kind of possible realization side of the first aspect of the embodiment of the present disclosure In formula, methods described also includes:
The execution sentence not merged in the backup file is added into the database message team according to the preset order Row, perform the execution sentence in the database message queue.
According to the second aspect of the embodiment of the present disclosure, there is provided a kind of device for recovering database, including:
Analytic unit, it is configured as being analyzed according to backup file of the default sentence merging rule to database, it is described Backup file includes one or more execution sentence, determine more than two it is to be combined be group submission sentence the execution language Sentence;
Combining unit, be configured as according to described more than two it is to be combined be the execution sentence that group submits sentence Generate described group of submission sentence;
Execution unit, it is configured as described group of submission sentence adding database message queue according to preset order, performs Described group of submission sentence in the database message queue.
With reference to the second aspect of the embodiment of the present disclosure, the first possible realization side of the second aspect of the embodiment of the present disclosure In formula, the backup file includes full backup file and incremental backup file.
With reference to the first possible implementation of the second aspect of the embodiment of the present disclosure, the second party of the embodiment of the present disclosure In second of possible implementation in face, the analytic unit includes:
Complete analysis module, it is configured as dividing the full backup file according to the default sentence merging rule Analysis, determine in the full backup file more than two it is to be combined be a group submission sentence the execution sentence;
Incremental analysis module, it is configured as dividing the incremental backup file according to the default sentence merging rule Analysis, determine in the incremental backup file more than two it is to be combined be a group submission sentence the execution sentence.
With reference to second of possible implementation of the second aspect of the embodiment of the present disclosure, the second party of the embodiment of the present disclosure In the third possible implementation in face, the complete analysis module includes:
File declustering submodule, it is two or more full backup Ziwen to be configured as the full backup file declustering Part;
Complete analysis submodule, it is configured as starting two or more processing thread respectively to described two above full backup Subfile merges rule according to the default sentence and analyzed, and determines to treat for more than two in each full backup subfile Merge into the execution sentence that a group submits sentence.
With reference to second of possible implementation of the second aspect of the embodiment of the present disclosure, the second party of the embodiment of the present disclosure In the 4th kind of possible implementation in face, the incremental analysis module includes:
First incremental analysis submodule, it is configured as starting two or more processing thread respectively to increment described in two or more Backup file merges rule according to the default sentence and analyzed, determine respectively in each incremental backup file two with It is upper it is to be combined be the execution sentence that a group submits sentence;
Second incremental analysis submodule, rule is merged to described two incremental backups described above according to the default sentence File is analyzed, and determines that to be combined in described two incremental backup files described above is that a group submits the group of sentence to submit Sentence.
The first of second aspect, second aspect with reference to the embodiment of the present disclosure are to any possible realization in the 4th kind Mode, in the 5th kind of possible implementation of the second aspect of the embodiment of the present disclosure, in addition to:
Unit is filtered out, is configured as the execution sentence that will do not had an impact in the backup file to recovering the database Filter out.
With reference to the second aspect of the embodiment of the present disclosure, the 6th kind of possible realization side of the second aspect of the embodiment of the present disclosure In formula, the execution unit, it is configured as adding the execution sentence not merged in the backup file according to the preset order Enter the database message queue, perform the execution sentence in the database message queue.
According to the third aspect of the embodiment of the present disclosure, there is provided a kind of database server, including:Processor and it is configured as Store backup file and the memory of the processor-executable instruction;
Wherein, the processor is configured as execute instruction, merges rule to database according to default sentence to perform Backup file is analyzed, the backup file include one or more execution sentence, determine more than two it is to be combined be a group Submit the execution sentence of sentence;According to described more than two it is to be combined be that group submits the execution sentence of sentence to give birth to Into described group of submission sentence;Described group of submission sentence is added into database message queue according to preset order, performs the data Described group of submission sentence in the message queue of storehouse.
The technical scheme that the present embodiment provides can include the following benefits:By the way that the backup file of database (is wrapped Include full backup file and incremental backup file respectively) in more than two it is to be combined perform sentences and merge into group submit language Sentence, the disposable execution of multiple identical operations is realized, accelerate to recover the time of database, shorten and recover to take in data base procedure It is engaged in the time interrupted, lifts Consumer's Experience;Wherein, full backup file is further split, passes through multiple processing threads or more Individual database server is analyzed each full backup subfile simultaneously, can further improve the speed for recovering database Degree;Incremental backup file is analyzed and merged by multiple processing threads or multiple database servers, then to merging after Multiple incremental backup files analyze again, most each incremental backup Piece file mergence is a normalized incremental backup text at last Part, improve the resume speed of incremental backup file;The execution sentence not had an impact in backup file to recovering database is filtered Remove, further speed up the time for recovering database, shorten the time for recovering service disruption in data base procedure, lift user's body Test;The execution sentence not merged is added into database message queue again, improves the operation of database recovery.
It should be appreciated that the general description and following detailed description of the above are only exemplary and explanatory, not The disclosure can be limited.
Brief description of the drawings
Accompanying drawing herein is merged in specification and forms the part of this specification, shows the implementation for meeting the present invention Example, and for explaining principle of the invention together with specification.
Fig. 1 is a kind of flow chart of the method for recovery database according to an exemplary embodiment;
Fig. 2 is a kind of flow chart of the method for recovery database according to an exemplary embodiment;
Fig. 3 is the process schematic of the recovery database of Fig. 2 exemplary embodiments;
Fig. 4 is a kind of device block diagram of recovery database according to an exemplary embodiment;
Fig. 5 is a kind of device block diagram of recovery database according to an exemplary embodiment;
Fig. 6 is a kind of device block diagram of recovery database according to an exemplary embodiment;
Fig. 7 is a kind of device block diagram of recovery database according to an exemplary embodiment;
Fig. 8 is a kind of device block diagram of recovery database according to an exemplary embodiment;
Fig. 9 is a kind of block diagram of database server according to an exemplary embodiment.
Embodiment
Here exemplary embodiment will be illustrated in detail, its example is illustrated in the accompanying drawings.Following description is related to During accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous key element.Following exemplary embodiment Described in embodiment do not represent and the consistent all embodiments of the present invention.On the contrary, they be only with it is such as appended The example of the consistent apparatus and method of some aspects being described in detail in claims, of the invention.
Fig. 1 is a kind of flow chart of the method for recovery database according to an exemplary embodiment, as shown in figure 1, This method is used in database server, comprises the following steps.
In a step 101, merge backup file of the rule to database according to default sentence to analyze, the backup text Part includes one or more execution sentence, determine more than two it is to be combined be group submission sentence the execution sentence;
Default sentence merges the rule rule that can be user pre-set according to the type of database, database language etc. Then, sentence is preset according to this and merges rule, database server can determine from the execution sentence of the backup file of database Go out which execution sentence can be merged into a group submission sentence.Database server takes by one or more database , it is necessary to one subsynchronous (fsync) be called, in the synchronization when backup file access pattern being engaged in the hard disk of device is into the database of operation During the situation that must perform the operation of multiple identicals, such as insert continually, sequence etc. generally occurs, will can now represent The execution sentence of this multiple identical operation merges into a group and submits sentence, and the disclosure can use a kind of group in database Submit (group commit) function that more than two sentences to be combined that perform are merged into a group commit sentence.
For example, the execution sentence in the backup file of database includes a plurality of continuous SQL (Structured Query Language, referred to as:SQL) sentence, it is as follows:
INSERT INTO Test values (' Zhao ', ' 90');
INSERT INTO Test values (' king ', ' 80');
INSERT INTO Test values (' Lee ', ' 89');
Assuming that default sentence, which merges the regular execution sentence for being set in advance as continuous same operation, merges into a group Commit sentences, therefore, the SQL statement of above-mentioned three insertion operations can be merged into a group commit sentence:
INSERT INTO Test values (' Zhao ', ' 90'), (' king ', ' 80'), (' Lee ', ' 89').
Such three perform sentence and will become a group commit sentence, and database server should by operation Group commit sentences can disposably perform above three insertion operation.
In a step 102, according to described more than two it is to be combined be that group submits the execution sentence of sentence to generate Described group of submission sentence;
In a step 101, database server merges rule according to default sentence and backup file is analyzed, and determines Which, which performs sentence, to merge, it is possible to these execution sentences are merged, generate similar above-mentioned group The group of commit sentences submits sentence.
In step 103, described group of submission sentence is added into database message queue according to preset order, performs the number According to described group of submission sentence in the message queue of storehouse.
Preset order can be that the operation order of the execution sentence in foundation backup file is pre-set, database service Device will merge the group submission sentence formed according to preset order addition database message queue, by performing database message team Group in row submits sentence, and database is recovered.Due to being merged to the execution sentence in backup file, thus it is former This needs the execution sentence run one by one, and the group that be merged into disposably to perform as far as possible submits sentence, greatly improves Recover the speed of database.
The method of the recovery database of the present embodiment, passes through more than two execution to be combined in the backup file by database Sentence merges into a group and submits sentence, realizes the disposable execution of multiple identical operations, accelerates to recover the time of database, Shorten the time for recovering service disruption in data base procedure, lift Consumer's Experience.
Fig. 2 is a kind of flow chart of the method for recovery database according to an exemplary embodiment, as shown in Fig. 2 The backup file of database includes full backup file and incremental backup file, and this method is used in database server, including Following steps.
In step 201, the execution sentence not had an impact in backup file to recovering database is filtered out;
Database server filters to the execution sentence in full backup file and incremental backup file respectively, due to Some execution sentences, such as query statement, the speed for recovering database is not had an impact, therefore can be by backup file Query statement filters out, and may also speed up the speed for recovering database.
The backup file not comprising query statement can also be directly generated when generating backup file.In this case, number Step 201 can not be performed according to storehouse server.
In step 202, merge rule according to default sentence to analyze full backup file, determine that the full dose is standby In part file more than two it is to be combined be a group submission sentence the execution sentence;
The backup file of usual database includes a full backup file and multiple incremental backup files, database service Device is analyzed respectively for each backup file.After full backup file analysis, merge and treated in full backup file The execution sentence of merging;After incremental backup file analysis, merge execution sentence to be combined in incremental backup file.
Due to the mass data of database, full backup file is generally larger, therefore database server can in analysis So that full backup file declustering first is turned into two or more full backup subfile, start two or more and handle thread respectively to institute State two or more full backup subfile to be analyzed according to the default sentence merging rule, determine each full backup It is the execution sentence that group submits sentence that more than two to be combined in subfile.So multiple processing threads are simultaneously to each Individual full backup subfile is analyzed, and can further improve the speed for recovering database.
Optionally, the processing to global backup file can also be used the full backup file declustering as two or more Full backup subfile;As two or more database server respectively to described two above full backup subfiles according to Default sentence merges rule and analyzed, and it is that a group carries to determine in each full backup subfile that more than two to be combined Hand over the execution sentence of sentence.
Database server in the disclosure can also use the form of distributed server cluster, by distributed server Separate database server in cluster is in a manner of man-to-man respectively to two or more full backup subfile according to described pre- If sentence merges rule and analyzed, determine in each full backup subfile more than two it is to be combined be a group submission The execution sentence of sentence.
In step 203, merge rule according to the default sentence to analyze incremental backup file, determine the increasing In amount backup file more than two it is to be combined be group submission sentence the execution sentence;
Database server is analyzed incremental backup file, and it is still to belong to each increasing that the group after merging, which submits sentence, Measure backup file.In order to improve the resume speed of incremental backup file, database server first can start at two or more Reason thread merges rule according to the default sentence to two or more incremental backup file respectively and analyzed, and determines respectively each It is the execution sentence that group submits sentence that more than two to be combined in the incremental backup file;Then according to described pre- If sentence merges the regular analysis that tried again to two or more incremental backup file, described two above incremental backup files are determined In it is to be combined be that group submits the group of sentence to submit sentence, most each incremental backup Piece file mergence is one normalized at last Incremental backup file.
Optionally, the processing to incremental backup file can also be used by two or more database server respectively to two Incremental backup file described above merges rule according to the default sentence and analyzed, and determines each incremental backup respectively It is the execution sentence that group submits sentence that more than two to be combined in file;The server is according to the default sentence Merge rule to analyze described two incremental backup files described above, determine described two incremental backup texts described above To be combined in part is that a group submits the group of sentence to submit sentence.
Database server in the disclosure can equally use the form of above-mentioned distributed server cluster, by distribution Separate database server in server cluster is in a manner of man-to-man respectively to two or more incremental backup file according to institute State default sentence and merge rule and analyzed, it is that a group carries to determine in each incremental backup file that more than two to be combined The execution sentence of sentence is handed over, then submits sentence that merging is normalized the group of two or more incremental backup file.
In step 204, according to described more than two it is to be combined be that group submits the execution sentence of sentence to generate Described group of submission sentence;
Database server will be analyzed for full backup file and incremental backup file respectively determine it is to be combined Perform sentence and merge generation group submission sentence.
In step 205, described group of submission sentence is added into database message queue according to preset order;
In step 206, by the execution sentence not merged in the backup file according to described in preset order addition Database message queue;
Database server is except submitting sentence to add database message queue the group for merging generation, also by backup text The execution sentence not merged in part also adds database message queue, could so be formed in database message queue complete Backup file.If not having the execution sentence not merged in backup file, step 206 can not perform.Step 205 and step 206 be that database performs respectively for full backup file and incremental backup file.
In step 207, described group of submission sentence in the database message queue and the execution sentence are performed.
Database server perform all sentences in database message queue most at last all backup file access patterns to number According to storehouse.If there is no the execution sentence not merged in backup file, do not include in the message queue that database server performs Perform sentence.
The method of the recovery database of the present embodiment, by the way that fractionation analysis will be carried out to the full backup file of database, Analysis is merged to the incremental backup file of database, more than two sentences to be combined that perform are merged into a group submission language Sentence, the disposable execution of multiple identical operations in two kinds of backup files is realized, further speeds up the time for recovering database, contracting The time of service disruption in short recovery data base procedure, lift Consumer's Experience.
As an example, Fig. 3 is the process schematic of the recovery database of Fig. 2 exemplary embodiments, as shown in figure 3, data The multiple processing threads of storehouse startup of server, wherein, a processing thread is used to analyze full backup file, by full backup file In the two or more sentence to be combined that performs merge generation group commit sentences, include the texts of the group commit sentences For part to merge full backup file, group commit sentences are added database message team by the processing thread according to preset order Row;Another or multiple processing threads are used to analyze one or more incremental backup files, processing thread and incremental backup file Correspond, the sentence to be combined that performs of the two or more in an incremental backup file is merged generation by a processing thread Group commit sentences, to merge incremental backup file, right the latter is handled the file comprising the group commit sentences Thread merges incremental backup file to one or more and analyzed again, and group commit sentences to be combined are merged into generation normalizing The group commit sentences of change, the file comprising the normalized group commit sentences merge incremental backup for normalization Normalized group commit sentences are added database message queue by file, processing thread according to preset order.Database Server performs the group commit sentences of the merging full backup file in database message queue and normalization merging increases The normalized group commit sentences of backup file are measured, recover database.
Fig. 4 is a kind of device block diagram of recovery database according to an exemplary embodiment.Reference picture 4, the device Including analytic unit 11, combining unit 12 and execution unit 13.
The analytic unit 11 is configured as being analyzed according to backup file of the default sentence merging rule to database, institute Stating backup file includes one or more execution sentence, determine more than two it is to be combined be group submission sentence the execution language Sentence.
The combining unit 12 be configured as being determined according to analytic unit 11 described more than two to be combined are one Group submits the execution sentence of sentence to generate described group of submission sentence.
The described group of submission sentence that the execution unit 13 is configured as generating combining unit 12 adds according to preset order Database message queue, perform described group of submission sentence in the database message queue.
Further, the backup file includes full backup file and incremental backup file.
Further, the execution sentence that the execution unit 13 is configured as in the backup file not merging is according to institute State preset order and add the database message queue, perform the execution sentence in the database message queue.
The device of the recovery database of the present embodiment, passes through more than two execution to be combined in the backup file by database Sentence merges into a group and submits sentence, realizes the disposable execution of multiple identical operations, accelerates to recover the time of database, Shorten the time for recovering service disruption in data base procedure, lift Consumer's Experience.
Fig. 5 is a kind of device block diagram of recovery database according to an exemplary embodiment.Reference picture 5, the device On the basis of Fig. 4 shown device embodiments, analytic unit 11 also includes complete analysis module 111 and incremental analysis module 112.
The complete analysis module 111, it is configured as merging rule to the full backup file according to the default sentence Analyzed, determine in the full backup file more than two it is to be combined be the execution sentence that a group submits sentence.
The incremental analysis module 112, it is configured as merging rule to the incremental backup file according to the default sentence Analyzed, determine in the incremental backup file more than two it is to be combined be the execution sentence that a group submits sentence.
Fig. 6 is a kind of device block diagram of recovery database according to an exemplary embodiment.Reference picture 6, the device On the basis of Fig. 5 shown device embodiments, complete analysis module 111 also includes file declustering submodule 1111 and complete analysis Module 1112.
This document splits submodule 1111 and is configured as the full backup file declustering being two or more full backup Subfile.
The complete analysis submodule 1112 is configured as starting two or more processing thread respectively to file declustering submodule The 1111 described two above full backup subfiles splitted out merge rule according to the default sentence and analyzed, it is determined that It is the execution sentence that group submits sentence that more than two to be combined in each full backup subfile.
The device of the recovery database of the present embodiment, further splits to full backup file, passes through multiple processing threads Each full backup subfile is analyzed simultaneously, can further improve the speed for recovering database.
Optionally, the recovery database in the disclosure can also be server cluster in a distributed manner form, by being distributed The full backup file declustering is two or more full backup Ziwen by separate database server in formula server cluster Part;Two or more database server merges rule to described two above full backup subfiles according to the default sentence respectively Then analyzed, determine in each full backup subfile more than two it is to be combined be that a group submits the described of sentence holding Line statement.
Fig. 7 is a kind of device block diagram of recovery database according to an exemplary embodiment.Reference picture 7, the device On the basis of Fig. 5 shown device embodiments, incremental analysis module 112 also includes the first incremental analysis submodule 1121 and second and increased Amount analysis submodule 1122.
The first incremental analysis submodule 1121 is configured as starting two or more processing thread respectively to two or more institute State incremental backup file to be analyzed according to the default sentence merging rule, determine respectively in each incremental backup file It is the execution sentence that a group submits sentence that more than two to be combined.
The second incremental analysis submodule 1122 merges rule to described two increasings described above according to the default sentence Amount backup file is analyzed, and determines that to be combined in described two incremental backup files described above is that a group submits sentence Group submits sentence.
The device of the recovery database of the present embodiment, incremental backup file is analyzed and closed by multiple processing threads And then multiple incremental backup files after merging are analyzed again, most at last each incremental backup Piece file mergence be one normalization Incremental backup file, improve incremental backup file resume speed.
Optionally, the recovery database in the disclosure can also be server cluster in a distributed manner form, by being distributed Two or more separate database server in formula server cluster is respectively to incremental backup file described in two or more according to institute State default sentence merging rule to be analyzed, it is one that more than two to be combined in each incremental backup file of determination respectively Group submits the execution sentence of sentence;The server merges rule to described two described above according to the default sentence Incremental backup file is analyzed, and determines that to be combined in described two incremental backup files described above is that a group submits sentence Group submit sentence.
Fig. 8 is a kind of device block diagram of recovery database according to an exemplary embodiment.Reference picture 8, the device On the basis of Fig. 4 shown device embodiments, in addition to filter out unit 14.
This filters out unit 14, is configured as the execution that will do not had an impact in the backup file to recovering the database Sentence filters out.
The device of the recovery database of the present embodiment, by will be held in backup file to what recovery database did not had an impact Line statement filters out, and further speeds up the time for recovering database, shortens the time for recovering service disruption in data base procedure, carries Rise Consumer's Experience.
Device shown in Fig. 4-Fig. 8, for realizing the method flow shown in above-mentioned Fig. 1-Fig. 2.On in above-described embodiment Device, wherein modules perform operation concrete mode carried out retouching in detail in the embodiment about this method State, explanation will be not set forth in detail herein.
Fig. 9 is a kind of block diagram of database server according to an exemplary embodiment.Reference picture 9, database clothes Business device 900 includes processing component 901, and it further comprises one or more processors, and as depositing representated by memory 902 Memory resource, for storing the instruction that can be can perform by processing component 901, such as application program.What is stored in memory 902 should With program can include it is one or more each correspond to the module of one group of instruction.It can also be deposited in memory 902 Store up the full backup file and incremental backup file of database.In addition, processing component 901 is configured as execute instruction, to perform The method of above-mentioned recovery database.
Database server 900 can also include a power supply module 903 and be configured as performing database server 900 Power management, a wired or wireless network interface 904 are configured as database server 900 being connected to network, and one Input and output (I/O) interface 905.Database server 900 can be operated based on the operating system for being stored in memory 902, example Such as Microsft Windows server OS (Windows Server), Apple Macintosh operating system (Mac OS), You Nisi operating systems (Unix), (SuSE) Linux OS, Unix operating systems (FreeBSD) or similar.
A kind of non-transitorycomputer readable storage medium, when the instruction in the storage medium is by database server During computing device so that database server is able to carry out a kind of method for recovering database, and methods described includes:According to pre- If sentence merges rule, the backup file to database is analyzed, and the backup file includes one or more execution sentence, really Fixed more than two to be combined be a group submission sentence the execution sentence;According to described more than two it is to be combined be a group The execution sentence of sentence is submitted to generate described group of submission sentence;Described group of submission sentence is added into data according to preset order Storehouse message queue, perform described group of submission sentence in the database message queue.
Those skilled in the art will readily occur to the present invention its after considering specification and putting into practice invention disclosed herein Its embodiment.The application be intended to the present invention any modification, purposes or adaptations, these modifications, purposes or Person's adaptations follow the general principle of the present invention and including the undocumented common knowledges in the art of the disclosure Or conventional techniques.Description and embodiments are considered only as exemplary, and true scope and spirit of the invention are by following Claim is pointed out.
It should be appreciated that the invention is not limited in the precision architecture for being described above and being shown in the drawings, and And various modifications and changes can be being carried out without departing from the scope.The scope of the present invention is only limited by appended claim.

Claims (17)

  1. A kind of 1. method for recovering database, it is characterised in that including:
    Merge backup file of the rule to database according to default sentence to analyze, the backup file is held including one or more Line statement, determine more than two it is to be combined be the execution sentence that group submits sentence;
    According to described more than two it is to be combined be that group submits the execution sentence of sentence to generate described group of submission sentence;
    Described group of submission sentence is added into database message queue according to preset order, performed in the database message queue Described group of submission sentence.
  2. 2. according to the method for claim 1, it is characterised in that the backup file includes full backup file and increment is standby Part file.
  3. 3. according to the method for claim 2, it is characterised in that the basis presets sentence and merges rule to the standby of database Part file is analyzed, determine more than two it is to be combined be a group submission sentence the execution sentence, including:
    Merge rule according to the default sentence to analyze the full backup file, determine in the full backup file It is the execution sentence that a group submits sentence that more than two to be combined;
    Merge rule according to the default sentence to analyze the incremental backup file, determine in the incremental backup file It is the execution sentence that a group submits sentence that more than two to be combined.
  4. 4. according to the method for claim 3, it is characterised in that described that rule is merged to described complete according to the default sentence Amount backup file is analyzed, determine in the full backup file more than two it is to be combined be the described of group submission sentence Sentence is performed, including:
    It is two or more full backup subfile by the full backup file declustering;
    Start two or more processing thread respectively to merge described two above full backup subfiles according to the default sentence Rule is analyzed, determine in each full backup subfile more than two it is to be combined be that a group submits the described of sentence Perform sentence.
  5. 5. according to the method for claim 3, it is characterised in that described that rule is merged to described complete according to the default sentence Amount backup file is analyzed, determine in the full backup file more than two it is to be combined be the described of group submission sentence Sentence is performed, including:
    It is two or more full backup subfile by the full backup file declustering;
    Two or more database server merges to described two above full backup subfiles according to the default sentence respectively Rule is analyzed, determine in each full backup subfile more than two it is to be combined be that a group submits the described of sentence Perform sentence.
  6. 6. according to the method for claim 3, it is characterised in that described that rule is merged to the increasing according to the default sentence Amount backup file is analyzed, determine in the incremental backup file more than two it is to be combined be the described of group submission sentence Sentence is performed, including:
    Start two or more processing thread and rule are merged according to the default sentence to incremental backup file described in two or more respectively Then analyzed, it is that a group submits the described of sentence that more than two to be combined in each incremental backup file of determination respectively Perform sentence;
    Merge rule according to the default sentence to analyze described two incremental backup files described above, determine described two To be combined in individual incremental backup file described above is that a group submits the group of sentence to submit sentence.
  7. 7. according to the method for claim 3, it is characterised in that described that rule is merged to the increasing according to the default sentence Amount backup file is analyzed, determine in the incremental backup file more than two it is to be combined be the described of group submission sentence Sentence is performed, including:
    Two or more database server merges rule to incremental backup file described in two or more according to the default sentence respectively Then analyzed, it is that a group submits the described of sentence that more than two to be combined in each incremental backup file of determination respectively Perform sentence;
    Described two data above storehouses server merges regular standby to described two increments described above according to the default sentence Part file is analyzed, and determines that to be combined in described two incremental backup files described above is that a group submits the group of sentence to carry Hand over sentence.
  8. 8. according to method according to any one of claims 1 to 7, it is characterised in that the basis presets sentence and merges rule Before backup file to database is analyzed, in addition to:
    The execution sentence not had an impact in the backup file to recovering the database is filtered out.
  9. 9. according to the method for claim 1, it is characterised in that methods described also includes:
    The execution sentence not merged in the backup file is added into the database message queue according to the preset order, held The execution sentence in the row database message queue.
  10. A kind of 10. device for recovering database, it is characterised in that including:
    Analytic unit, it is configured as being analyzed according to backup file of the default sentence merging rule to database, the backup File includes one or more execution sentence, determine more than two it is to be combined be group submission sentence the execution sentence;
    Combining unit, be configured as according to described more than two it is to be combined be that group submits the execution sentence of sentence to generate Described group of submission sentence;
    Execution unit, it is configured as described group of submission sentence adding database message queue according to preset order, described in execution Described group of submission sentence in database message queue.
  11. 11. device according to claim 10, it is characterised in that the backup file includes full backup file and increment Backup file.
  12. 12. device according to claim 11, it is characterised in that the analytic unit includes:
    Complete analysis module, it is configured as analyzing the full backup file according to the default sentence merging rule, Determine in the full backup file more than two it is to be combined be the execution sentence that a group submits sentence;
    Incremental analysis module, it is configured as analyzing the incremental backup file according to the default sentence merging rule, Determine in the incremental backup file more than two it is to be combined be the execution sentence that a group submits sentence.
  13. 13. device according to claim 12, it is characterised in that the complete analysis module includes:
    File declustering submodule, it is two or more full backup subfile to be configured as the full backup file declustering;
    Complete analysis submodule, it is configured as starting two or more processing thread respectively to described two above full backup Ziwens Part merges rule according to the default sentence and analyzed, determine in each full backup subfile more than two it is to be combined The execution sentence of sentence is submitted for a group.
  14. 14. device according to claim 12, it is characterised in that the incremental analysis module includes:
    First incremental analysis submodule, it is configured as starting two or more processing thread respectively to incremental backup described in two or more File merges rule according to the default sentence and analyzed, and determines to treat for more than two in each incremental backup file respectively Merge into the execution sentence that a group submits sentence;
    Second incremental analysis submodule, rule is merged to described two incremental backup files described above according to the default sentence Analyzed, determine that to be combined in described two incremental backup files described above is that a group submits the group of sentence to submit language Sentence.
  15. 15. the device according to any one of claim 10~14, it is characterised in that also include:
    Unit is filtered out, is configured as filtering out the execution sentence not having an impact to recovering the database in the backup file Fall.
  16. 16. device according to claim 10, it is characterised in that the execution unit, be configured as the backup text The execution sentence not merged in part adds the database message queue according to the preset order, performs the database message The execution sentence in queue.
  17. A kind of 17. database server, it is characterised in that including:Processor and it is configured as storing backup file and the place Manage the memory of device executable instruction;
    Wherein, the processor is configured as execute instruction, merges backup of the rule to database according to default sentence to perform File is analyzed, and the backup file includes one or more execution sentence, determine more than two it is to be combined be the submission of group The execution sentence of sentence;According to described more than two it is to be combined be that group submits the execution sentence of sentence to generate institute State a group submission sentence;Described group of submission sentence is added into database message queue according to preset order, the database is performed and disappears Cease described group of submission sentence in 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 CN104991836A (en) 2015-10-21
CN104991836B true 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)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106970855B (en) * 2016-01-14 2021-04-20 华为技术有限公司 Method and apparatus for data recovery
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
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
CN114090609B (en) * 2021-10-26 2024-11-29 福建天泉教育科技有限公司 Data synchronization method and terminal

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

Also Published As

Publication number Publication date
CN104991836A (en) 2015-10-21

Similar Documents

Publication Publication Date Title
CN104991836B (en) Recover the method, apparatus and database server of database
US12189806B2 (en) Method and system for a distributed computing system
US10397328B2 (en) Method and system for providing a robust blockchain with an integrated proof of storage
CN108805570B (en) Data processing method, device and storage medium
Xue et al. Autore: Document-level relation extraction with large language models
CN107679863B (en) Block chain system and method for quickly verifying block
CN110245145A (en) Structure synchronization method and device from relational database to Hadoop database
US9600514B2 (en) Methods and systems for detecting data divergence and inconsistency across replicas of data within a shared-nothing distributed database
US8458710B2 (en) Scheduling jobs for execution on a computer system
Tan et al. Hadoop framework: impact of data organization on performance
CN106899654A (en) A kind of sequence value generation method, apparatus and system
CN106844550A (en) Method and device is recommended in a kind of virtual platform operation
WO2019111188A1 (en) Job management in data processing system
CN107562703A (en) Dictionary tree reconstructing method and system
CN106991314A (en) A kind of date storage method and device
CN112527765B (en) Data migration method and device
CN106933834A (en) A kind of data matching method and device
CN111179062B (en) Certificate repair method and device
CN116860882B (en) Cloud storage resource management and control method and system based on blockchain
CN107832352A (en) Daily record automatic processing method, device, storage medium and equipment
CN107958414B (en) Method and system for eliminating long transactions of CICS (common integrated circuit chip) system
CN104199689A (en) Method and device for installing comprehensive front end system
Okutan et al. A Novel Regression Method for Software Defect Prediction with Kernel Methods.
Madan Systemization and Evaluation for Data deduplication by deploying competitive chunking algorithm in polymorphic thread environment and avant-garde hashing techniques
CN114491666A (en) File verification method, device, and computer-readable 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