CN1492362A - Data back up and recovering method of embedded data bank - Google Patents

Data back up and recovering method of embedded data bank Download PDF

Info

Publication number
CN1492362A
CN1492362A CNA021459592A CN02145959A CN1492362A CN 1492362 A CN1492362 A CN 1492362A CN A021459592 A CNA021459592 A CN A021459592A CN 02145959 A CN02145959 A CN 02145959A CN 1492362 A CN1492362 A CN 1492362A
Authority
CN
China
Prior art keywords
data
file
database
backup
index
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
CNA021459592A
Other languages
Chinese (zh)
Other versions
CN100399325C (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.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CNB021459592A priority Critical patent/CN100399325C/en
Publication of CN1492362A publication Critical patent/CN1492362A/en
Application granted granted Critical
Publication of CN100399325C publication Critical patent/CN100399325C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

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

Abstract

The present invention relates to data back-up and recovering process for embedded data bank with less resource and less storing space. The data back-up process includes dividing the data bank back-up file into head information region, data region and tail information region; writing the original data bank information and the information of forms in the head information region and recording the specific positions of the original data bank data files and index files under the forms in the data bank back-up file; storing the data of original data bank file in the data region in the data bank back-up file and in the position specified by the information in the head information region; and inquiring the data bank data dictionary to write all the index information of the data bank file into the tail information region of the data bank back-up file. The data recovering process is one inverse process of the data back-up process. The process of the present invention is atomic, and based on single file architecture data combination and splitting.

Description

A kind of data backup of embedded database and restoration methods
Technical field
The present invention relates to a kind of database technology, relate to a kind of data backup and restoration methods or rather based on similar embedded database (as SharkBase).
Background technology
Embedded system be a kind of application-centered, based on the dedicated computer system of computer technology, but be characterized in the software and hardware cutting, and can be suitable for the strict demand of application system to function, reliability, cost, power consumption etc., be used to realize control, supervision or management to other equipment.Because embedded system is normally towards application-specific, thereby compares with general purpose type computer system and to have the strong characteristics of customization.
The embedded product of existing employing embedded system, comprise information appliance class, mobile computing device class, network equipment class, industry control emulation Medical Instruments class, as mobile phone, PDA (Personal Digital Assistant) (PDA), VCD, set-top box, numerically-controlled machine, router, network home appliance etc.
Most important two aspect technology are in the embedded system development: exchanges data and applications exchange.
Embedded database has crucial meaning to embedded product, in application solution based on embedded database, Embedded Application is directly to use the first order of embedded database to use, present embedded architecture, embedded type database system can organically be combined with embedded OS, for application and development provides effective local data ladder of management, provide various customization conditions and method simultaneously.
Requirement to the embedded product database is: visit other should be unblocked during as the data of electronic equipments such as PC, database server; Simultaneously, require its data freely between embedded platform, to transplant.
The multifile data storage method that is based on bibliographic structure of embedded database (SharkBase) The data, data recording in the list leaves in respectively in the different files with index, thereby they leave in and represent under the same catalogue that these files belong to a list.These lists are managed by the list index file of an overall situation, to the searching of database list, these list catalogues and list index file, concern that other index information files such as index file, Log Directory have formed a SharkBase embedded database integral body jointly with convenient.
Because embedded device has than advantages of higher stability and reliability requirement running software, the operation of data can produce mistake again at any time or lose, be to guarantee the stability of embedded product, to manage and adopt corresponding backup be to improve a good method stable and reliability with recovering to being kept at data in the embedded product.
At present existing a variety of embedded database products, the function that provides also has their own characteristics each, but lacks the design to the data security, does not just provide the operation of data backup and recovery as " spirit of people's size gold " database etc.We can say that existing various embedded databases are handled with the security of recovery aspect data backups relates to seldom, relates to regard to still less at the backup and the restoration methods of this Database Systems based on the multifile structure of similar SharkBase.
Because embedded device system resource is limited, bigger data backup district can not be provided, can not offer various resources such as too much CPU of data backup and recovery operation and internal memory, therefore, need under the prerequisite of few occupying system resources of trying one's best, design speed DB Backup very fast, easy to maintenance and restoration methods.At present, how general data backup and restoration methods do not mention embedded device, and promptly the applicability of these methods in embedded device is not strong.
Summary of the invention
The objective of the invention is to design a kind of data backup and restoration methods of embedded database, under the prerequisite of few occupying system resources of trying one's best, it is very fast to design speed, easy to maintenance, based on the data backup and the restoration methods of the Database Systems of multifile structure, to improve the security of embedded device data level.
The technical scheme that realizes the object of the invention is such: a kind of data backup of embedded database and restoration methods is characterized in that:
Described data back up method comprises:
A. database backup file is divided into header information district, data field and trailer information district;
B. former database information and a plurality of form information are filled the header information district that writes database backup file, put down in writing the particular location of each index file in database backup file under former database datafile and each list;
C. in the data field of database backup file, the concrete data storage in the former database file is arrived by information appointed positions place, database backup file header information district;
D. Query Database data dictionary writes all index informations of each list in the database file in the trailer information district of database backup file;
Described data reconstruction method comprises:
E. read the database information and a plurality of form information that are documented in database backup file header information district;
F. according to the particular location of each index file in database backup file under data file and each list, from the data field reading of data of database backup file;
G. set up or recover former database datafile and index file, the state when making former database information return to DB Backup;
H. write again in the database data dictionary according to the index information of all index informations that are recorded in database backup file trailer information district former database.
The present invention is directed to this Database Systems of SbarkBase embedded database based on the multifile structure, designed the method that aggregates into single backup file by file directory, and the method that is split into a plurality of files and catalogue according to this single backup file head descriptor, backup file addressing method with suitable embedded system, can effectively reduce the shared system resource of backup rejuvenation, the security that improves arithmetic speed.
Data backup and restoration methods based on the SharkBase embedded database of the present invention, both satisfied based on the SharkBase embedded database data backup of file storage pattern and the needs of recovery, the system performance that can adapt to again simultaneously that the embedded device resource is few, storage space is little etc., be a kind ofly be easy to safeguard, efficiently, have the atomicity operability and based on the data backup and the restoration methods of data combination of monofile framework and disassemble technique.
The inventive method is in conjunction with the storage mode of SharkBase database data, designed data storage format hereof is reasonable, can reduce rubbish space, the quickening computing velocity of backup data files, the operational efficiency and the security that improve the SharkBase embedded database.
Description of drawings
Fig. 1 is that embodiment backup file header information is filled FB(flow block);
Fig. 2 is that embodiment backup file data field data are filled flow process and the backup file trailer information is filled FB(flow block);
Fig. 3 is a database recovery flow process breviary block diagram of the present invention.
Embodiment
For the SharkBase embedded database, the atomicity of data backup operation is a very important link, and any one link is made mistakes in the data backup process, all will date back to the virgin state of data and operate again, to guarantee the integrality of data.Consider based on this point, should adopt the form of monofile that data are backed up, so that the backup file of deletion error easily occurs when unusual in backup.
The purpose of carrying out data backup is in order to preserve data, so as follow-up generation to the faulty operation of database the time carry out using when data are recovered.Backed up data is not carried out direct control, the user also needn't understand the actual storage mode of backup file, therefore adopt binary mode when in database backup file, the information of backup database being write down, the time that this form can reduce data storage and read and carry out data parsing, save the shared disk space of backup file.
When carrying out a data backup, must carry out record to BACKUP TIME, promptly backup file is carried out timestamp and handle, to make things convenient for the user same database is repeatedly backed up, compares the version of backup file and select backup file when recovering.
Adopt the mode of compression can save disk space, but the load of can extend BACKUP TIME and CPU, and increase, and, the restriction of disk or CPU is had nothing in common with each other for different embedded devices to the expending of the energy.In order to strengthen adaptability to different embedded devices, the standby system of SharkBase embedded database adopts the partial compression mode of both combinations, at the data of database feature, to the data library backup time, data file and the index file that is easy to generate high compression rate compressed processing, describe code for the scale-of-two of data of description library information and then do not do the compression processing.Do like this and not only can effectively reduce the shared disk space of backup file, relatively complete again compress mode has reduced the CPU computing.
Because SharkBase data of database storage mode adopts the data storage of multifile, Backup Data then is that backup is in same data file, in order accurately to split the data of backup file when the restore data library file, head at backup file will have an information of describing the backup file data block in detail, indicate what meaning is each data block in the backup file all represent, and these information are write on the head of backup file, to make things convenient for the recovery of database.
Because the SbarkBase database has adopted the index information of list in the data dictionary mode database of record, and database itself does not write down these contents, therefore must search data dictionary, all index informations relevant with this database are taken passages in the backup file, and when restore database, these index informations are recovered.Because the index number of database is unfixing, therefore the size of this part information is unfixing yet, if this part content is put into the head of Backup Data, then database datafile can't accurately be navigated in the backup file, therefore this part content is put into the afterbody of backup file.
At last, when restore database,, all dictionary information of relevant this database in the data dictionary must be recovered, so that make that the information in the data dictionary is consistent with former database because database structure may be destroyed.
Above each point is to the present invention is based on backup of SharkeBase database data and the gordian technique analysis that recovers.
According to the above, the present invention has formulated its internal format for SharkBase database data backup file, is made up of header information district, data field and trailer information district three parts.
The header information district of database data backup file is stored in the starting position of backup file, be used for describing the framework information of source SharkBase database and source SharkBase data of database concrete storage side-play amount and the size of data block, i.e. database information at backup file.By this part header information, program can be recovered the file directory framework of source SharkBase database, and locatees the concrete data of SharkBase database file fast.
Because may there be a plurality of lists in the SharkBase database, may there be a plurality of index files in each list again, then form information must write down the specifying information of all lists position in backup file, and must write down the specifying information of all index files of this list position in backup file in each form information.
Therefore the head of backup file comprises a plurality of index informations under a data library information, a plurality of form information and each list.
Theing contents are as follows shown in the table 1 of the database information that database (db) header information district comprises illustrates respectively with database information description and length two parts thereof:
Database information is described Length
Dbpath: the path, which database what write down this backup file backup is, so that can correctly find the position of database when restore database 256 bytes
Timestamp: time stamp, write down the BACKUP TIME of current backup database, this time and each file modifying time of former database are compared, if find that former database is newer, just can back up again 8 bytes
Comp_flag: the compression sign, 1 expression data are through overcompression, and 0 expression is not through overcompression 2
Tablecount: write down the list number of former database, the form information buffering number and the size of traversal backup file can be set by it 4 bytes
Tableidx_off: the side-play amount of data in backup file of database of record list index file, can navigate to the relevant position of backup file very soon by this side-play amount, find corresponding data 4 bytes
Tableidx_len: the size of database of record list index file data can be provided with the buffer size of extracting list index file data by these data 4 bytes
Relate_off: the side-play amount of data in backup file of record data base relation index file, can navigate to the relevant position of backup file very soon by this side-play amount, find corresponding data 4 bytes
Relate_len: the size of record data base relation index file data can be provided with the buffer size that extraction concerns the index file data by these data 4 bytes
Query_off: the side-play amount of data in backup file of database of record search index file, can navigate to the relevant position of backup file very soon by this side-play amount, find corresponding data 4 bytes
Query_len: the size of database of record search index file data can be provided with the buffering of extracting the search index file data by these data 4 bytes
Table 1
Because the maximum territory number of each list of SharkBase database is 20, and these 20 territories all have index.Therefore, backup file head form information is described part and is reserved 20 positions of describing its index for the descriptor of each list, and these positions are enough to hold all index informations in the list.List the sample of a list descriptor below, if, then there be N such list descriptor at N list in a data stock in backup file.
Theing contents are as follows shown in the table 2 of the form information that database (db) header information district comprises illustrates respectively with form information description and length two parts thereof:
Form information is described Length
Tablename: the list name, what write down this form information record is which list of former database 20 bytes
Has_idx: whether the index mark position, writing down this list has index 4 bytes
Idx_count: the index number, if this list has index, then use this recording indexes number 4 bytes
Dat_off: the side-play amount of data in backup file of record form data file, can navigate to the relevant position of backup file very soon by this side-play amount, find corresponding data 4 bytes
Dat_len: the size of record sheet forms data file data can be provided with the buffer size of extracting the data file data by these data 4 bytes
Idxname1: index-name 1, the name of the 1st index file of record list makes things convenient for data to recover 20 bytes
Idx_off1: the side-play amount of index 1 in backup file, can navigate to the relevant position of backup file very soon by this side-play amount, find corresponding data 4 bytes
Idx_len1: the size of index 1 in backup file can be provided with the buffering of extracting the index file data by these data 4 bytes
Idxname20: index-name 20, the 20th index file name of record list makes things convenient for data to recover 20 bytes
Idx_off20: the side-play amount of index 20 in backup file, can navigate to the relevant position of backup file very soon by this side-play amount, find corresponding data 4 bytes
Idx_len20: the size of index 20 in backup file can be provided with the buffering of extracting the index file data by these data 4 bytes
Table 2
Suspension points in the table is represented the Idxname of index 2 to 19: index-name, Idx_off: the side-play amount of index in backup file, and Idx_len: the size of index in backup file.
Concrete data in the data area stores SharkBase database file of backup file, these data position and the size in backup file determines that by the header information district their position can not arbitrarily be changed.
The deposit data form of backup file data field is as shown in table 3 below, illustrates respectively with data description and big or small two parts thereof:
Data description Size
The data of list index file Specify by header information
The data that concern index file Specify by header information
The data of search index file Specify by header information
The data of list 1 data file Specify by header information
The data of list 1 index file 1 Specify by header information
????…
The data of list 1 index file N Specify by header information
The concrete data of list 2
The concrete data of list M
Table 3
In the table 2 is to 4 row parts, and expression is used to write down the concrete data of former SharkBase database index file; 5 to 8 row part expressions are used to write down the concrete data of first form data file of SharkBase database, index file, the data of total N index file; 9 to 11 line displays are used to write down the concrete data of SharkBase database second to M form data file, index file, and it is the data of a plurality of index files of N that maximal value can respectively be arranged, and M and N can be the same or different.
According to above content as can be known, because the uncertainty of SharkBase database list index file size, can't in backup file, mark off fixing zone and deposit index information, therefore the end that the index information of each list of SharkBase database is write backup file.The concrete file layout of the list index information in backup file trailer information district is listed with following table 4, illustrates respectively with data description and big or small two parts thereof:
Data description Size
Tablename: the list name, what write down this index information description is the index information of which list 20 bytes
Indexname[0]: the 1st index-name of record list 20 bytes
Indexname[N]: N index-name of record list 20 bytes
Uniquename[0]: record the 1st unique of list (unique) index-name 20 bytes
Uniquename[N]: record N unique of list (unique) index-name 20 bytes
Pkeyname: if list has master index, this is used to write down list master index name 20 bytes
Table 4
When carrying out concrete SharkBase DB Backup,, only the backup procedure that does not adopt compress technique is described owing to adopt the backup of compress technique and do not adopt the difference of backup in whole backup/restoration process of compress technique very little.DB Backup says that on the whole can be divided into five steps carries out:
The first step: stand-by program is searched the backup file path that the user provides, if backup file does not exist, then sets up backup file, jumps to for second step and continues to carry out; If backup file exists, then the nearest modification time with data file in the creation-time of backup file and each list of former database compares, if the creation-time of backup file is all newer than the nearest modification time of the arbitrary form data file of former database, then illustrate after Last Backup, former database was not done any change, then withdraw from backup operation, otherwise continue to carry out;
Second step: stand-by program is filled the database information part (but table of comparisons 1) in the backup file header information district, and write in the backup file, comprise that the path of former database, current time, sign compress contained list number in zone bit and the former database, fill six of tableidx_off, tableidx_len, relate_off, relate_len, query_off, query_len then, the algorithmic formula of this six item numbers certificate is as follows:
Establish earlier:
Dbinfo_Size: backup file header information district database information structure size;
Tableinfo_Size: backup file header information district form information structure size;
Ntable: the single number of former database table;
TableIdx_Len: the size of former database list index file;
RelateIdx_Len: the size of former database relation index file;
QueryIdx_Len: the size of former data base querying index file.
According to SharkBase database backup file internal format (table of comparisons 3) described, then:
Tableidx_off=Dbinfo_Size+Ntable*Tableinfo_Size (side-play amount (tableidx_off) of the data of database list index file in backup file equals the product that backup file header information district database information structure size (Dbinfo_Size) adds single number of former database table (Ntable) and backup file header information district form information structure size (Tableinfo_Size));
Tableidx_len=TableIdx_len (size of data (tableidx_len) of database list index file equals the size (TableIdx_Len) of former database list index file);
Relate_off=tableidx_off+tableidx_len (side-play amount (tableidx_off) of data in backup file that the side-play amount (relate_off) of the data of database relation index file in backup file equals former database list index file adds the size of data (tableidx_len) of former database list index file);
Relate_len=RelateIdx_len (size of data of database relation index file (relate_len) equals the size (RelateIdx_Len) of former database relation index file);
Query_off=tableidx_off+RelateIdx_len (side-play amount (tableidx_off) of data in backup file that the side-play amount (query_off) of the data of data base querying index file in backup file equals database list index file adds the size (RelateIdx_Len) of former database relation index file);
Query_len=QueryIdx_Len (size of data of data base querying index file (query_len) equals the size (QueryIdx_Len) of former data base querying index file).
The 3rd step: stand-by program is filled each form information (with reference to table 2), and write backup file, form information Dat_off, the Dat_len of X list, Idx_off1, Idx_len1, Idx_off2, Idx_len2 ..., Idx_off20, Idx_len20 computing formula be:
If X list of this former database has 3 index files, then:
TDat_Len: form data file size;
TIdx0_Len: the size of first index file;
TIdx1_Len: the size of second index file;
TIdx2_Len: the size of the 3rd index file.
Describe according to SbarkBase database backup file internal format (with reference to table 3), then:
(M is the list number to Dat_off=query_off+QueryIdx_Len+ (M-1) * Tableinfo_Size, the side-play amount (Dat_off) of the data of form data file in backup file, the side-play amount (query_off) of data in backup file that equals the data base querying index file adds that the size (QueryIdx_Len) of former data base querying index file adds (M-1) backup file header information district form information structure size (Tableinfo_Size) doubly);
Dat_len=hDat_len (size of form data file data (Dat_len) equals the size (hDat_Len) of the form data file of this h list);
The side-play amount (Dat_off) of data in backup file that the side-play amount (Idx_off) of first index file of Idx_off0=Dat_off+tDat_len in backup file equals this form data file adds t form data file size (Dat_Len));
Idx_len0=tIdx0_Len (size (Idx_len) of first index file in backup file equals the size of first index file in backup file));
Idx_off1=Idx_off0+tIdx0_Len
Idx_len1=tIdx0_Len
Idx_off2=Idx_off1+tIdx1_Len
(side-play amount (Idx_off) of an index file in backup file such as index file side-play amount (Idx_off) in backup file behind second index file etc. thereon adds the size of an index file in backup file on it to Idx_len2=tIdx1_Len; Size of index file behind second index file etc. is the size of an index file in backup file thereon).T indicates to extract list that list before of data in the formula, therefore can add that certain side-play amount obtains desired data by this list of t.
Because this list has only three index files (0-2), then Idx_off3, Idx_len3 are changed to 0 to Idx_off19, Idx_len19, represent that this list does not have index since the 3rd territory, then in the form information of backup file head is described, all be changed to zero since the 3rd territory with offset information, promptly corresponding field does not have index file;
The 4th step: stand-by program is described (table 3) according to SharkBase database backup file internal format, successively each index file of former database, data file data is write backup file;
The 5th step: stand-by program inquiry SharkBase database data dictionary, from data dictionary, read the index information and the constraint information of former all lists of database, and describe according to SharkBase database backup file internal format (table 3), the method that the index information utilization of each list is identical with step 3, write the end of backup file successively, finish a SharkBase DB Backup operation.
With respect to the DB Backup method, the restoration methods of SharkBase database is fairly simple.Determine former data base directory document architecture by SbarkBase database recovery program from backup database header information district; According to header information each index file of former database, the data file particular location in backup file is described, data field reading of data from backup file, set up or recover original database index, data file, the state when making former database information return to DB Backup; At last, SharkBase database recovery program is according to being recorded in the index information of index area, backup file end, the index information of former database write in the SharkBase database data dictionary again get final product.The SharkBase database has write former database again with the information such as data in the backup file like this, make former data of database information, index information, data dictionary information all return to the state of former database when backing up, guaranteed the integrality and the consistance of data.
Below in conjunction with an embodiment and accompanying drawing 1,2,3, further specify backup of the present invention and restoration methods.Suppose that a database db comprises two list t1 and t2, list t1 has three territories (field), and wherein territory field1 and field2 have index, promptly have index file; List t2 has four territories, and wherein territory field3 has index.This Database Backup flow process is provided by Fig. 1, Fig. 2, the recovery flow process of this database is provided by Fig. 3.
Referring to Fig. 1, the header information of backup file shown in the figure is filled flow process, comprising:
Step 101 is to 107, finish the filling (realizing table 1 structure) of backup file header information district database information, wherein step 101 is filled into routing information (dbpath), local zone time (timestamp), compression sign (Comp_flag) and the list number (tablecount) of backup database db the head of backup file set by step to 104; Step 105 is to 107, the list index file positional information (tableidx_off of formula after will calculating by aforementioned second step, tableidx_len), concern index file positional information (relate_off, relate_len) and search index file location information (query_off, query_len) be filled into the head of backup file, positional information comprises the side-play amount and the size of data of data in backup file of each file;
Step 108 is to 115, finish the filling and the setting (realizing table 2 structure) of backup file header information district form information, wherein step 108 is to 110, write down set by step list t1 list name (Tablename), index mark position (Has_idx) and recording indexes number (Idx_off) are set; Step 111, form data file positional information (the Dat_off of the list t1 of formula after will calculating by aforementioned the 3rd step, Dat_len) be filled into the head of backup file, positional information comprises the side-play amount and the size of data of data in backup file of form data file; Step 112 is to 113, successively write down set by step list t1 index file 1, index file 2 index-name (Idxname1) and will calculate by the aforementioned the 3rd formula that goes on foot after index file 1, the positional information (Idx_off1 of index file 2, Idx_len1, Idx_off2, Idx_len2) be filled into the head of backup file, positional information comprises the side-play amount and the size of data of data in backup file of index file; Step 114, form data file positional information (the Dat_off of the list t2 of formula after will calculating by aforementioned the 3rd step, Dat_len) be filled into the head of backup file, positional information comprises the side-play amount and the size of data of data in backup file of form data file; Step 115, the index-name (Idxname1) of the index file 3 of record list t2 and will calculate by the aforementioned the 3rd formula that goes on foot after the positional information (Idx_off3 of index file 3, Idx_len3) be filled into the head of backup file, positional information comprises the side-play amount and the size of data of data in backup file of index file.
Referring to Fig. 2, map interlinking 1 operation, after finishing backup file header information filling flow process, carry out backup file data field data by step 201 to 208 and fill flow process (pressing table 3 structure), carry out the backup file trailer information by step 209 to 214 and fill flow process (pressing table 4 structure).
Step 201 is to 203, set by step the data in the database list index file, the data in the database relation index file, the data in the data base querying index file are filled into the backup file data field according to header information, promptly write down the concrete data of former database index file;
Step 204 is filled into the relevant position of backup file data field and relevant position that priority be filled into data in list t1 index file 1, index file 2 backup file data field according to header information with the data in the list t1 data file to 206;
Step 207 is to 208, the data in the list t2 data file is filled into the relevant position of backup file data field and the data in the list t2 index file 3 is filled into the relevant position of backup file data field according to header information;
Step 209 is to 211, and the list name of list t1 is filled into the relevant position of backup file afterbody and the index file 1 of list t1, the filename of index file 2 are filled into the relevant position of backup file afterbody;
Step 212 is to 213, the list name of list t2 is filled into the relevant position of backup file afterbody and the filename of the index file 3 of list t2 is filled into the relevant position of backup file afterbody;
Step 214 is so far finished backup, closes backup file.
Referring to Fig. 3, the database recovery flow process is the inverse process of backup flow process, no longer describes in detail, only provides the breviary process of recovery among the figure.Comprise:
Step 301 reads the Backup Data library information to 303 from the backup file head, judges whether former database exists, if exist, then deletes former database execution in step 304, if there is no then direct execution in step 304;
Step 304 is set up former database according to database information, and this database at this moment is an empty database;
Step 305 is to 307, priority is according to the index file of the database information restore database of putting down in writing in backup file header area and the data field, according to the list of the form information restore database of putting down in writing in backup file header area and the data field and the database list index information restore database list index of putting down in writing according to backup file tailer information set by step;
Step 308 is so far finished recovery, closes backup file.
DB Backup of the present invention and restoration methods, be characteristics such as, security requirement height few at SharkBase embedded database data volume, the situation of having only limited system resource simultaneously at embedded device, employing is based on the security algorithm of file-level, and the atomicity of strengthening operation simultaneously designs.Its algorithm is easy to safeguard, safe, speed fast, simple and convenient user operation.The SharkBase embedded database of feasible employing the inventive method occupies very big advantage compared with similar products aspect security, improved the competitive power of SharkBase embedded database and like product.Simultaneously, data backup of the present invention and restoration methods do not require substantially to system platform, to CPU, internal memory require lowly, can be transplanted to easily in other built-in application programs, thereby the comparison application prospects is arranged.

Claims (11)

1. the data backup of an embedded database and restoration methods is characterized in that:
Described data back up method comprises:
A. database backup file is divided into header information district, data field and trailer information district;
B. former database information and a plurality of form information are filled the header information district that writes database backup file, put down in writing the particular location of each index file in database backup file under former database datafile and each list;
C. in the data field of database backup file, the concrete data storage in the former database file is arrived by information appointed positions place, database backup file header information district;
D. Query Database data dictionary writes all index informations of each list in the database file in the trailer information district of database backup file;
Described data reconstruction method comprises:
E. read the database information and a plurality of form information that are documented in database backup file header information district;
F. according to the particular location of each index file in database backup file under data file and each list, from the data field reading of data of database backup file;
G. set up or recover former database datafile and index file, the state when making former database information return to DB Backup;
H. write again in the database data dictionary according to the index information of all index informations that are recorded in database backup file trailer information district former database.
2. the data backup of a kind of embedded database according to claim 1 and restoration methods, it is characterized in that: the header information district in the described steps A is stored in the starting position of described database backup file.
3. the data backup of a kind of embedded database according to claim 1 and restoration methods is characterized in that:
Fill among the described step B and write described former database information and further comprise:
B11. fill contained list number in the time write the path of former database, current backup database, zone bit that whether sign compresses and the former database;
B12. fill the side-play amount (tableidx_off) of data in backup file that writes database list index file, the size of data (tableidx_len) of database list index file, the side-play amount (relate_off) of the data of database relation index file in backup file, the size of data of database relation index file (relate_len), the side-play amount (query_off) of the data of data base querying index file in backup file and the size of data (query_len) of data base querying index file;
Fill among the described step B and write described form information and further comprise:
B21. fill in regular turn and write each form information, each form information comprises the list name, writes down the side-play amount (Dat_off) of data in backup file, the size (Dat_len) of form data file data that whether this list has the index mark position of index, the index number when index is arranged, form data file, fill each the index file information that writes under this list in regular turn, each index file information comprises index file name, this index file side-play amount (Idx_off) and the size (Idx_len) of this index file in backup file in backup file.
4. the data backup of a kind of embedded database according to claim 3 and restoration methods, it is characterized in that: before the described step b11, also the path searching backup file of the backup file that provides according to the user is created backup file when backup file does not exist, and carries out described step b11; When backup file exists, further that the data file of Time Created of backup file and former each list of database is nearest modification time compares, in Time Created of backup file during newly in the nearest modification time of the data file of former any list of database, withdraw from backup procedure, otherwise carry out described step b11.
5. the data backup of a kind of embedded database according to claim 3 and restoration methods, it is characterized in that the filling among the described step b12 writes every satisfied: tableidx_off=Dbinfo_Size+Ntable*Tableinfo_Size, wherein, tableidx_off is the side-play amount of data in backup file of database list index file, Dbinfo_Size is a backup file header information district database information structure size, Ntable is the single number of former database table, and Tableinfo_Size is a backup file header information district form information structure size; Tableidx_len=TableIdx_len, wherein, tableidx_len is the size of data of database list index file, TableIdx_Len is the size of former database list index file; Relate_off=tableidx_off+tableidx_len, wherein, relate_off is the side-play amount of data in backup file of database relation index file, tableidx_off is the side-play amount of data in backup file of former database list index file, and tableidx_len is the size of data of former database list index file; Relate_len=RelateIdx_len, wherein, relate_len is the size of data of database relation index file, RelateIdx_Len is the size of former database relation index file; Query_off=tableidx_off+RelateIdx_len, wherein, query_off is the side-play amount of data in backup file of data base querying index file, tableidx_off is the side-play amount of data in backup file of database list index file, and RelateIdx_Len is the size of former database relation index file; With, query_len=QueryIdx_Len, wherein query_len is the size of data of data base querying index file, QueryIdx_Len is the size of former data base querying index file.
6. the data backup of a kind of embedded database according to claim 3 and restoration methods, it is characterized in that among the described step b21, form data file that filling writes and index file information satisfy: Dat_off=query_off+QuerIdx_Len+ (M-1) * Tableinfo_Size, wherein, Dat_off is the side-play amount of data in backup file of form data file, query_off is the side-play amount of data in backup file of data base querying index file, QueryIdx_Len is the size of former data base querying index file, Tableinfo_Size is a backup file header information district form information structure size, and M is the total number that contains list in the database; Dat_len=hDat_len, wherein, Dat_len is the size of form data file data, hDat_len is the size of the form data file of this h list;
Idx_off0=Dat_off+tDat_len, wherein, Idx_off0 is the side-play amount of first index file in backup file, Dat_off is the side-play amount of data in backup file of this form data file, tDat_Len is a t form data file size, and t indicates to extract list that list before of data; The side-play amount of an index file in backup file such as index file side-play amount in backup file behind second index file etc. thereon adds the size of an index file in backup file on it; The size of first index file in backup file equals the size of first index file in backup file; Size of index file behind second index file etc. is the size of an index file in backup file thereon.
7. the data backup of a kind of embedded database according to claim 6 and restoration methods, it is characterized in that: described backup file header area form information is described part and is reserved N the position of describing its index for the descriptor of each list, the side-play amount (Dat_off) of index file in backup file of position sky all is changed to zero, and N is a positive integer.
8. the data backup of a kind of embedded database according to claim 1 and restoration methods, it is characterized in that: described step C stores by the deposit data form of backup file data field, the concrete data of the former database index file of elder generation's stored record, be the data of list index file in regular turn, concern the data of index file and the data of search index file, store each database form data file more in order, the concrete data of index file, each database form data file, the concrete data of index file, order be the data of each index file of the data of its form data file and this list.
9. the data backup of a kind of embedded database according to claim 1 and restoration methods, it is characterized in that: described step D, be that each index file name by list name, list writes the trailer information district in regular turn, when list has master index, write list master index name in the trailer information district.
10. the data backup of a kind of embedded database according to claim 1 and restoration methods, it is characterized in that described step G further comprises: according to the index file of the database information restore database of putting down in writing in backup file header area and the data field with according to the list file of the form information restore database of putting down in writing in backup file header area and the data field; Described step H further comprises, according to the database list index information restore database list index file of putting down in writing in the backup file tailer.
11. the data backup of a kind of embedded database according to claim 1 and restoration methods, it is characterized in that: when embedded database is carried out DB Backup, data file and the index file that is easy to generate high compression rate compressed processing, describe code for the scale-of-two of data of description library information and do not do the compression processing.
CNB021459592A 2002-10-25 2002-10-25 A Data Backup and Recovery Method for Embedded Database Expired - Fee Related CN100399325C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB021459592A CN100399325C (en) 2002-10-25 2002-10-25 A Data Backup and Recovery Method for Embedded Database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB021459592A CN100399325C (en) 2002-10-25 2002-10-25 A Data Backup and Recovery Method for Embedded Database

Publications (2)

Publication Number Publication Date
CN1492362A true CN1492362A (en) 2004-04-28
CN100399325C CN100399325C (en) 2008-07-02

Family

ID=34232565

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB021459592A Expired - Fee Related CN100399325C (en) 2002-10-25 2002-10-25 A Data Backup and Recovery Method for Embedded Database

Country Status (1)

Country Link
CN (1) CN100399325C (en)

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1315043C (en) * 2004-06-24 2007-05-09 华为技术有限公司 Compatibility upgrading method of embedded programm
CN100338966C (en) * 2004-06-08 2007-09-19 中兴通讯股份有限公司 Embedded data base niformation inquiring method for mobile telecommunicating system
CN100359477C (en) * 2004-12-16 2008-01-02 中兴通讯股份有限公司 A data collection and restoration method for an embedded system
CN101819603A (en) * 2010-05-07 2010-09-01 中兴通讯股份有限公司 Embedded system based method and device for searching information record based on
CN101256561B (en) * 2007-03-02 2010-09-08 阿里巴巴集团控股有限公司 Method, apparatus and system for storing and accessing database data
CN101894137A (en) * 2010-06-23 2010-11-24 中兴通讯股份有限公司 Method and device for restoring data in embedded database
CN102110161A (en) * 2011-02-24 2011-06-29 中兴通讯股份有限公司 Method and device for backing up and recovering multi-service database
CN102314383A (en) * 2011-09-28 2012-01-11 成都市华为赛门铁克科技有限公司 Failure recovery method and device for data index
CN102375696A (en) * 2010-08-20 2012-03-14 英业达股份有限公司 Data storage system and data access method using virtual disk
CN102411523A (en) * 2011-11-30 2012-04-11 广东威创视讯科技股份有限公司 File backup storage method and device and file system backup method thereof
CN102546261A (en) * 2012-02-07 2012-07-04 华为技术有限公司 Network element upgrading method, network element, server and system
CN101882140B (en) * 2009-05-06 2012-07-18 和舰科技(苏州)有限公司 Method for backing up data for Lotus database
CN102663107A (en) * 2012-04-16 2012-09-12 深圳市华曦达科技股份有限公司 Method and system for managing embedded data
CN103778188A (en) * 2013-12-31 2014-05-07 网秦(北京)科技有限公司 Method and equipment for inquiring and/or maintaining data in library file
CN103914481A (en) * 2013-01-07 2014-07-09 深圳市腾讯计算机系统有限公司 Data storage method and device
CN102246163B (en) * 2008-10-27 2015-03-25 移动解决方案株式会社 Index compression in databases
CN105930228A (en) * 2016-04-06 2016-09-07 广州唯品会信息科技有限公司 Data backup method and system
CN106708830A (en) * 2015-08-03 2017-05-24 四川效率源信息安全技术有限责任公司 Data recovery method based on large database
CN108021698A (en) * 2017-12-21 2018-05-11 努比亚技术有限公司 Delet method, device and the computer-readable storage medium of storage file
CN108459930A (en) * 2018-04-02 2018-08-28 深圳臻迪信息技术有限公司 Data back up method, device and storage medium
CN105607870B (en) * 2015-12-17 2019-05-21 北京奇虎科技有限公司 The method and device of game data bundling processing
CN111104258A (en) * 2019-12-23 2020-05-05 北京金山云网络技术有限公司 MongoDB database backup method and device and electronic equipment
CN111240893A (en) * 2019-12-26 2020-06-05 曙光信息产业(北京)有限公司 Backup and recovery management method and system based on data stream fragmentation technology
CN111767171A (en) * 2020-06-29 2020-10-13 四川阵风科技有限公司 Method for file backup and restoration
CN116755940A (en) * 2023-08-15 2023-09-15 深圳市东信时代信息技术有限公司 File restoration method, device, equipment and medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
SE500656C2 (en) * 1992-12-08 1994-08-01 Ellemtel Utvecklings Ab Backup capture system in a distributed database
SE508828C2 (en) * 1992-12-08 1998-11-09 Ericsson Telefon Ab L M Relational database recovery system in case of failure
JP2000347919A (en) * 1999-06-07 2000-12-15 Nec Corp Automatic operation system for database on-line backup
US6411969B1 (en) * 1999-08-13 2002-06-25 Unisys Corporation Enhanced system and method for management of system database utilities
US7043504B1 (en) * 2000-04-10 2006-05-09 International Business Machines Corporation System and method for parallel primary and secondary backup reading in recovery of multiple shared database data sets
US20020026335A1 (en) * 2000-07-21 2002-02-28 Tadashi Honda Data security insurance system
JP2002041345A (en) * 2000-07-27 2002-02-08 Hitachi Ltd Computer system and data backup method thereof

Cited By (34)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100338966C (en) * 2004-06-08 2007-09-19 中兴通讯股份有限公司 Embedded data base niformation inquiring method for mobile telecommunicating system
CN1315043C (en) * 2004-06-24 2007-05-09 华为技术有限公司 Compatibility upgrading method of embedded programm
CN100359477C (en) * 2004-12-16 2008-01-02 中兴通讯股份有限公司 A data collection and restoration method for an embedded system
CN101256561B (en) * 2007-03-02 2010-09-08 阿里巴巴集团控股有限公司 Method, apparatus and system for storing and accessing database data
CN102246163B (en) * 2008-10-27 2015-03-25 移动解决方案株式会社 Index compression in databases
CN101882140B (en) * 2009-05-06 2012-07-18 和舰科技(苏州)有限公司 Method for backing up data for Lotus database
CN101819603A (en) * 2010-05-07 2010-09-01 中兴通讯股份有限公司 Embedded system based method and device for searching information record based on
CN101894137A (en) * 2010-06-23 2010-11-24 中兴通讯股份有限公司 Method and device for restoring data in embedded database
CN102375696A (en) * 2010-08-20 2012-03-14 英业达股份有限公司 Data storage system and data access method using virtual disk
CN102110161A (en) * 2011-02-24 2011-06-29 中兴通讯股份有限公司 Method and device for backing up and recovering multi-service database
CN102314383A (en) * 2011-09-28 2012-01-11 成都市华为赛门铁克科技有限公司 Failure recovery method and device for data index
WO2013044726A1 (en) * 2011-09-28 2013-04-04 华为技术有限公司 Data index failure recovery method and device
CN102314383B (en) * 2011-09-28 2013-12-04 华为数字技术(成都)有限公司 Failure recovery method and device for data index
CN102411523A (en) * 2011-11-30 2012-04-11 广东威创视讯科技股份有限公司 File backup storage method and device and file system backup method thereof
CN102411523B (en) * 2011-11-30 2014-08-20 广东威创视讯科技股份有限公司 Method and device for storing file backups and backup method for file systems
CN102546261A (en) * 2012-02-07 2012-07-04 华为技术有限公司 Network element upgrading method, network element, server and system
CN102546261B (en) * 2012-02-07 2015-04-29 华为技术有限公司 Network element upgrading method, network element, server and system
CN102663107A (en) * 2012-04-16 2012-09-12 深圳市华曦达科技股份有限公司 Method and system for managing embedded data
CN103914481A (en) * 2013-01-07 2014-07-09 深圳市腾讯计算机系统有限公司 Data storage method and device
CN103914481B (en) * 2013-01-07 2019-09-13 深圳市腾讯计算机系统有限公司 Date storage method and device
CN103778188A (en) * 2013-12-31 2014-05-07 网秦(北京)科技有限公司 Method and equipment for inquiring and/or maintaining data in library file
CN106708830B (en) * 2015-08-03 2020-08-14 四川效率源信息安全技术股份有限公司 Data recovery method based on large database
CN106708830A (en) * 2015-08-03 2017-05-24 四川效率源信息安全技术有限责任公司 Data recovery method based on large database
CN105607870B (en) * 2015-12-17 2019-05-21 北京奇虎科技有限公司 The method and device of game data bundling processing
CN105930228A (en) * 2016-04-06 2016-09-07 广州唯品会信息科技有限公司 Data backup method and system
CN108021698A (en) * 2017-12-21 2018-05-11 努比亚技术有限公司 Delet method, device and the computer-readable storage medium of storage file
CN108459930A (en) * 2018-04-02 2018-08-28 深圳臻迪信息技术有限公司 Data back up method, device and storage medium
CN108459930B (en) * 2018-04-02 2020-09-11 深圳臻迪信息技术有限公司 Data backup method, device and storage medium
CN111104258A (en) * 2019-12-23 2020-05-05 北京金山云网络技术有限公司 MongoDB database backup method and device and electronic equipment
CN111240893A (en) * 2019-12-26 2020-06-05 曙光信息产业(北京)有限公司 Backup and recovery management method and system based on data stream fragmentation technology
CN111767171A (en) * 2020-06-29 2020-10-13 四川阵风科技有限公司 Method for file backup and restoration
CN111767171B (en) * 2020-06-29 2024-03-19 四川阵风科技有限公司 File backup and restore method
CN116755940A (en) * 2023-08-15 2023-09-15 深圳市东信时代信息技术有限公司 File restoration method, device, equipment and medium
CN116755940B (en) * 2023-08-15 2024-03-22 深圳市东信时代信息技术有限公司 File restoration method, device, equipment and medium

Also Published As

Publication number Publication date
CN100399325C (en) 2008-07-02

Similar Documents

Publication Publication Date Title
CN1492362A (en) Data back up and recovering method of embedded data bank
KR102240557B1 (en) Method, device and system for storing data
CN107247808B (en) Distributed NewSQL database system and picture data query method
CN1203433C (en) Data storing and query combination method in a flush type system
CN106294190B (en) Storage space management method and device
CN103164490B (en) A kind of efficient storage implementation method of not fixed-length data and device
CN102591947A (en) Fast and low-RAM-footprint indexing for data deduplication
KR20200122994A (en) Key Value Append
CN103279502B (en) A kind of framework and method with the data de-duplication file system be combined with parallel file system
CN102243660A (en) Data access method and device
CN1531692A (en) Efficient collation element structure for handling large numbers of characters
CN1286053C (en) Extensible file format
JP2015518223A (en) Memory search, real-time search system and method, and computer storage medium
CN101488153A (en) Method for implementing high-capacity flash memory file system in embedded type Linux
US20140025652A1 (en) Redistribute native xml index key shipping
US20080306949A1 (en) Inverted index processing
CN1955958A (en) Sort data storage and split catalog inquiry method based on catalog tree
CN1900935A (en) Method and system for accessing sector data
JP6726690B2 (en) Performing multidimensional search, content-associative retrieval, and keyword-based retrieval and retrieval on losslessly reduced data using basic data sieves
CN1845093A (en) An Object File System with Extensible Attributes
US8190614B2 (en) Index compression
CN101075237A (en) Method for storing, fetching and indexing data
CN1200354C (en) Automatic compressing/decompressing file system and its compressing algorithm
CN1719422A (en) Virtual access method of storage document data
CN1723462A (en) Systems and methods for a large object infrastructure in a database system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20080702

Termination date: 20201025

CF01 Termination of patent right due to non-payment of annual fee