CN103678396A - Data backup method and device based on data models - Google Patents

Data backup method and device based on data models Download PDF

Info

Publication number
CN103678396A
CN103678396A CN201210353330.XA CN201210353330A CN103678396A CN 103678396 A CN103678396 A CN 103678396A CN 201210353330 A CN201210353330 A CN 201210353330A CN 103678396 A CN103678396 A CN 103678396A
Authority
CN
China
Prior art keywords
data
current
data model
sql
database
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
CN201210353330.XA
Other languages
Chinese (zh)
Other versions
CN103678396B (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.)
Advanced New Technologies Co Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201210353330.XA priority Critical patent/CN103678396B/en
Publication of CN103678396A publication Critical patent/CN103678396A/en
Application granted granted Critical
Publication of CN103678396B publication Critical patent/CN103678396B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • G06F16/212Schema design and management with details for data modelling support

Abstract

The invention provides a data backup method and device based on data models. The method comprises establishing data model identities and corresponding current data models according to current data to be backed up in a database; receiving the identities of the current data; analyzing the corresponding current data models according to the current data models to obtain current structured query language (SQL) of the current data models; triggering the current SQL to be executed in the current database; taking the executing result of the current SQL as the data backup files corresponding to the data to be backed up. The data backup method and device based on the data models can solve the problems of inaccuracy and incompletion of data to be backed up during the data backup process in the prior art and guarantee the accuracy and completion of data.

Description

A kind of data back up method and device based on data model
Technical field
The application relates to database field, particularly a kind of data back up method and device based on data model.
Background technology
Database (Database) be according to data structure organize, the warehouse of store and management data, database has number of different types, from the form that the most simply stores various data to the large-scale database system that can carry out mass data storage, be all widely used in all fields.Along with the raising of the development of data bank service and the system complexity of employing database, the backup of database is just more and more common.In complication system, for maintainability and the efficiency of system, often the data that belong to an entity (as user profile, user's order, subscriber's account, users' personal allocation etc.) can be stored in respectively in the difference table of database.Data corresponding to independent community in these tables are just called data model.
In currently available technology, in database, the backup of data is mainly derived the data in Relational database table by data base administrator (DBA), and then all imports in another database.Concrete, data backup and the follow-up mode that imports to another database of at present common current database, complex situations according to application scenarios are divided into following two kinds: the first is for data, not need to do the scene of complicated conversion process, now data to be backed up are first exported to SQL (Structured Query Language from current database, Structured Query Language (SQL)) file, then in target database table, carry out SQL to import the data of backup; Another kind is to do to data the scene of complicated conversion, now first data are exported to SQL file from current database, on data service platform, change, after obtaining new SQL file, newer SQL file is imported in target database and carries out to import the data of backup.
But inventor finds in research process, the backup that this is traditional and the process of follow-up importing can run into variety of issue: the scheme of above-mentioned two kinds of DB Backup, capital is easily misused data to be backed up and distorts, because may carry out data-switching in the process of backup and follow-up importing, and if the method for operating providing with database or third party's assembly are realized, can there is the problem of data maloperation unavoidably, cause the data of backup to be made mistakes; And, data backup operation is very complicated, conventionally the mass data storehouse table that will deposit data to be backed up is done respectively query manipulation, but also need operating personnel according to the definition of data model, write different query SQL, this process is not only complicated, and easily occurs the situation of most certificates or minority certificate, affects the correctness of data to be backed up; Further, the process of data-switching of the prior art is more complicated also, and if data are carried out to complicated operation, particularly relate to some correlation logics of data model inside, database is not processed, must be undertaken by third-party data processing platform (DPP), like this data backup and follow-up importing process have not only involved a plurality of operation sides, more easily introduce the inaccurate and imperfect of data.
In a word, need at present the urgent technical matters solving of those skilled in the art to be exactly: a kind of data back up method based on data model of proposition how can innovate, to solve the inaccurate and incomplete problem of the data to be backed up that exist in the data backup process of prior art.
Summary of the invention
The application's technical matters to be solved is to provide a kind of data back up method based on data model, in order to solve the inaccurate and incomplete problem of the data to be backed up that exist in the data backup process of prior art.
The application also provides a kind of data backup device based on data model, in order to guarantee said method implementation and application in practice.
In order to address the above problem, the application discloses a kind of data back up method based on data model, comprising:
Sign and corresponding current data model according to data creation data model to be backed up in current database; The method comprises:
Receive the sign of described current data model;
According to the current data model corresponding to identification (RNC-ID) analytic of described current data model, to obtain the current structure query language SQL of described current data model;
Trigger described current SQL carries out in described current database;
Using the execution result of carrying out described current SQL as the backup data file corresponding with described data to be backed up.
Optionally, the described sign according to data creation data model to be backed up in current database and corresponding current data model, specifically comprise:
Receive the keyword of the data to be backed up of user's input;
In described current database, search all associated data tables that are associated with described keyword;
Judge that whether described associated data table exists outer table reference, if so, is directed into appearance in initial data model;
Described associated data table is directed in described initial data model, to set up described current data model.
Optionally, the current data model that the identification (RNC-ID) analytic of the described current data model of described foundation is corresponding, specifically comprises:
Sign according to described current data model is obtained corresponding current data model;
Judge whether described current data model quotes other data models, if so, all associated data tables described in obtaining in other data models and current data model are as target matrix; If not, obtain all associated data tables in described current data model as target matrix;
Described target matrix is generated to a SQL corresponding with described target matrix;
Judge whether described target matrix quotes appearance, if so, described appearance is generated to two SQL corresponding with described appearance;
By described the 2nd SQL, or a described SQL and the 2nd SQL are as the current SQL of described current data model.
Optionally, described using the execution result of carrying out described current SQL after the backup data file corresponding with described data to be backed up, also comprise:
Different business scenario according to current application carries out format conversion to the data in described backup data file.
Optionally, described using the execution result of carrying out described current SQL after the backup data file corresponding with described data to be backed up, also comprise:
Described backup data file is directed into described target database according to the data layout of target database.
Optionally, described described backup data file is directed into described target database according to the data layout of target database, is specially:
In same affairs, described backup data file is directed into described target database according to the data layout of target database.
The application discloses a kind of data backup device based on data model, comprising:
Creation module, for the sign according to current database data creation data model to be backed up and corresponding current data model;
Receiver module, for receiving the sign of described current data model;
Parsing module, for current data model corresponding to identification (RNC-ID) analytic according to described current data model, to obtain the current structure query language SQL of described current data model;
Carry out SQL module, for triggering described current SQL, at described current database, carry out;
Backup module, for using the execution result of carrying out described current SQL as the backup data file corresponding with described data to be backed up.
Optionally, described creation module specifically comprises:
Receive submodule, for receiving the keyword of the data to be backed up of user's input;
Search submodule, for search all associated data tables that are associated with described keyword at described current database;
The first judgement submodule, for judging whether described associated data table exists outer table reference;
First imports submodule, in the situation that the result of described judgement submodule is to be, appearance is directed in initial data model;
Second imports submodule, for described associated data table is directed into described initial data model, to set up described current data model.
Optionally, described parsing module specifically comprises:
First obtains submodule, for the sign according to described current data model, obtains corresponding current data model;
The second judgement submodule, for judging whether described current data model quotes other data models;
Second obtains submodule, in the situation that the result of described the second judgement submodule is to be, obtains all associated data tables in described other data models and current data model as target matrix;
The 3rd obtains submodule, in the situation that the result of described the second judgement submodule is to obtain all associated data tables in described current data model as target matrix;
First generates submodule, for described target matrix is generated to a SQL corresponding with described target matrix;
The 3rd judgement submodule, for judging whether described target matrix quotes appearance;
Second generates submodule, in the situation that the result of described the 3rd judgement submodule is to be, described appearance is generated to two SQL corresponding with described appearance;
Determine submodule, for by described the 2nd SQL, or a described SQL and the 2nd SQL are as the current SQL of described current data model.
Optionally, also comprise:
Format converting module, carries out format conversion for the different business scenario according to current application to the data of described backup data file.
Optionally, also comprise:
Import module, for described backup data file is directed into described target database according to the data layout of target database.
Optionally, described importing module specifically for: in same affairs, described backup data file is directed into described target database according to the data layout of target database.
Compared with prior art, the application comprises following advantage:
In the embodiment of the present application, a plurality of tables that relate to due to the data for to be backed up only create a data model, and, the process of follow-up this data model of parsing is all carried out according to unique sign of this data model, so can not make data backup process occur mistake, therefore just guarantee the accurate parsing of data model in data backup process, also just improved correctness and the integrality of data in data backup process.Further, can also make follow-up importing backup data file to time other databases, also can guarantee correctness and the integrality of data.Further, the data model in the embodiment of the present application is isolated data in data plane, so the backup of data model and follow-up importing process can carry out by multithreading, thereby improves backup and follow-up importing efficiency.
Further, the enforcement of the embodiment of the present application does not need data to be backed up to write SQL yet, as long as the sign according to data model is provided, will generate SQL according to data model, has greatly reduced the complicacy of data backup operation.
Further, in the process of data importing, the data importing flow process of same entity completes in affairs, has guaranteed the integrality of data.And data importing does not need to write SQL yet, as long as can automatically import to target database by backup data file.
Certainly, arbitrary product of enforcement the application might not need to reach above-described all advantages simultaneously.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme in the embodiment of the present application, below the accompanying drawing of required use during embodiment is described is briefly described, apparently, accompanying drawing in the following describes is only some embodiment of the application, for those of ordinary skills, do not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the process flow diagram of a kind of data back up method embodiment 1 based on data model of the application;
Fig. 2 is the process flow diagram of step 101 in the application's embodiment of the method 1;
Fig. 3 is the process flow diagram of step 103 in the application's embodiment of the method 1;
Fig. 4 is the process flow diagram of a kind of data back up method embodiment 2 based on data model of the application;
Fig. 5 is the structured flowchart of a kind of data backup device embodiment 1 based on data model of the application;
Fig. 6 is the structured flowchart of creation module 501 in the application's device embodiment 1;
Fig. 7 is the structured flowchart of parsing module 503 in the application's device embodiment 1;
Fig. 8 is the structured flowchart of a kind of data backup device embodiment 2 based on data model of the application.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only the application's part embodiment, rather than whole embodiment.Embodiment based in the application, those of ordinary skills are not making the every other embodiment obtaining under creative work prerequisite, all belong to the scope of the application's protection.
The application is mainly used in software or the general calculation element environment of internet development or configuration.For example: personal computer, server computer multi-processor device, comprise distributed computing environment of above any device or equipment etc.
The application can describe in the general context of the computer executable instructions of being carried out by computing machine, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract data type, program, object, assembly, data structure etc.Also can in distributed computing environment, put into practice the application, in these distributed computing environment, by the teleprocessing equipment being connected by communication network, be executed the task.In distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
With reference to figure 1, show the process flow diagram of a kind of data back up method embodiment 1 based on data model of the application, can comprise the following steps:
Step 101: according to sign and the corresponding current data model of data creation data model to be backed up in current database.
In the embodiment of the present application, need the first sign according to data creation data model to be backed up in current database and corresponding current data model, concrete, the database table structure of preserving according to business demand and data to be backed up carrys out configuration data model, and defines its sign for the data model of configuration.It should be noted that, in the present embodiment, the database table structure that the data model of definition and data to be backed up are preserved should be corresponding.
Shown in figure 2, step 101 can comprise the steps: in the specific implementation
Step 201: the keyword that receives the data to be backed up of user's input.
First, need in current database, get data to be backed up, can first obtain the keyword of the data to be backed up of user's input, for example the keyword of user's input is " i Phone ", so in the tables of data in current data model, according to model ID, all data that can match with this keyword, are all the data to be backed up in the embodiment of the present application.
Step 202: search all associated data tables that are associated with described keyword in described current database.
This step is in current database, to search all database tables that can match with keyword, and using the tables of data matching all as associated data table, be data to be backed up.
Step 203: judge according to data model whether described associated data table exists outer table reference, if so, enters step 204, if not, enters step 205.
Whether the associated data table that judgement finds there is outer table reference, if there is outer table reference, needs first according to appearance, to create data model.Wherein, while there is foreign key reference in database, by the table definition at external key place, be appearance, if there is no outer table reference, directly enters step 205.
Step 204: appearance is directed in initial data model.
In the present embodiment, the process that creates data model is that all associated data tables are all associated and form a data model, and unlike in prior art when data are backed up, tables of data needs a corresponding SQL script independently.
Step 205: described associated data table is directed in described initial data model, to set up described current data model.
After appearance is imported to initial data model, the more all associated data tables that obtain in step 202 have been imported to associated in the initial data model of appearance, the current data model that has finally obtained all associated data tables and appearance associated.
It should be noted that, in step 201~step 205, carry out in the constructive process of data model, before carrying out the database table importing of (comprising appearance or associated data table), also can check in data model whether had identical database table, can carry out iteration with its data model of quoting by ergodic data model itself.And for the table of quoting external key, also need to check whether external key and appearance corresponding to this external key quoted exist in data model.Therefore, in the embodiment of the present application, when importing database table in data model, need to first import appearance and import associated data table again, be first to import the table being cited.Meanwhile, in the embodiment of the present application, it is upper that model ID is arranged on each table, in model analyzing process, the ID in each table can be pulled out to the ID that is used as whole model.Each ID has a style number (such as USER_ID), and model just knows with the ID of model interaction be which like this, as long as go the data in Query Database one by one according to this ID.ID is arranged on to each table upper, is also convenient to process the situation that has a plurality of ID in a model.
In order to facilitate the implication of those skilled in the art's clearer understanding data model in concrete application; to data model, the critical field in constructive process is introduced below; but those skilled in the art all know; following critical field is just signal for example also, and other modes that can realize the application also belong to the application's protection domain.
The critical field of data model when realizing at least can comprise: " tables " refers to the table in data model, and adopts " refs " to represent another data model that current data model is quoted.In the embodiment of the present application, for the ease of the maintenance of data model, a data model can be quoted other data models.The uniqueness that can adopt " uniqKeys, sequence " field to realize the list structure in data model is controlled, and uniquely when resolution data model carries out data reduction to be backed up is reduced into a database table; " foreignTable " represents appearance, is that while there is foreign key reference in database, the table definition at external key place is " foreignTable ".Adopt " ids " to represent the sign (ID) of data model, be generally that main several tables in whole data model all comprise and be used for data of description and belong to the ID of same data model, table auxiliary in a data model can carry out data of description model by external key in addition, is to be defined in the adduction relationship of " foreignTable ".
Then return to Fig. 1, in step 102: the sign that receives described current data model.
After being pre-created data model, the current data model creating can save, if user carries out the backup of the database table of same keyword more next time, can use the last data model of preserving, so just saved each process that all must create data model, be more conducive to economize on resources.Therefore,, although step 102, after step 101, in actual applications, might not be execution step 101 certain execution step 102 afterwards, also can when carrying out data backup, needs perform step again 102.
In this step, be when getting data to be backed up and backing up, for the sign of the current data model of data creation to be backed up.
Step 103: according to the current data model corresponding to identification (RNC-ID) analytic of described current data model, to obtain the current SQL of described current data model.
After obtaining the sign of current data model, then this is identified to corresponding current data model resolving, thereby obtain the current SQL corresponding with current data model, is that the process of resolving finally can generate executable SQL.Wherein, can comprise that SQL describes the object set of (Description) class, for example, the attribute (whether allowing for sky) of the SQL of Query Database (DB), the major key of tables of data and Sequence, table etc.
Concrete, shown in figure 3, resolve corresponding current data model and specifically can comprise:
Step 301: the sign according to described current data model is obtained corresponding current data model.
First according to the sign of current data model, obtain the current data model being pre-created.
Step 302: judge that whether described current data model quotes other data models, if so, enters step 303; If not, enter step 304.
Judge again whether current data model quotes other data models, if quote other data models,, in the process of resolving, also need other data models to resolve together.
Step 303: all associated data tables described in obtaining in other data models and current data model, as target matrix, enter step 305.
In this step, be all associated data tables that obtain in current data model and its other data models of quoting, and using all associated data tables that obtain as the target matrix that generates current SQL.
Step 304: obtain all associated data tables in described current data model as target matrix.
And if current data model is not quoted other data models, all associated data tables that now directly obtain in current data model are just passable.
Step 305: described target matrix is generated to a SQL corresponding with described target matrix.
In this step, by acquiring target matrix in step 303 or step 304, generate a SQL corresponding with it, concrete, the process prior art that generates SQL according to tables of data also can realize, and in the embodiment of the present application, does not limit.
Step 306: judge whether described target matrix quotes appearance, if so, enter step 307, if not, enter step 308.
After obtaining the SQL that target matrix is corresponding, then judge whether target matrix quotes appearance, if target data table reference appearance, the appearance of quoting so also should generate corresponding SQL.
Step 307: described appearance is generated to two SQL corresponding with described appearance.
Step 308: by a described SQL, or a described SQL and the 2nd SQL are as the current SQL of described current data model.
Finally, at target matrix, do not exist quote appearance in the situation that, the direct current SQL using a SQL corresponding to target matrix as current data model, and outside target matrix exists table reference in the situation that, a SQL corresponding to target matrix and the 2nd SQL corresponding to appearance are made to the current SQL as current data model.
Having introduced after resolution data model obtains SQL, return to Fig. 1, step 104: trigger described current SQL and carry out in described current database.
After obtaining the current SQL of current data model, the current SQL obtaining is passed in current database and is carried out, in the embodiment of the present application, also no longer the implementation of current SQL is described in detail, prior art all can realize, and carries out one by one SQL.
But the embodiment of the present application is different from data backup process of the prior art, implementation is to carry out one by one according to the current SQL of data model, rather than carries out one by one by the SQL of database table.Therefore, the application, just can be according to the attribute of SQL when backing up for data model, and the data that execution SQL is obtained do certain verification and control (for example shows whether to allow for sky, the number of data etc.), thus check in the database table obtain whether have dirty data.
Step 105: using the execution result of carrying out described current SQL as the backup data file corresponding with described data to be backed up.
Finally, then using the execution result of carrying out current SQL as the backup data file corresponding with described data to be backed up, wherein, backup data file can be XML (extend markup language, Extensible Markup Language) file layout.Concrete, after obtaining the execution result of SQL, add the attribute of each database table, just formed complete backup data file.
Be understandable that, in different running environment, can realize by different XML read-write schemes establishment and the parsing of data model.The DOM of PHP (English hypertext pre-service language, Hypertext Preprocessor) for example, the Xerces-C++ of C Plus Plus etc., in different running environment, can be used different template contral classes.
In the embodiment of the present application, a plurality of tables that relate to due to the data for to be backed up only create a data model, and, the process of follow-up this data model of parsing is all carried out according to unique sign of this data model, so can not make data backup process occur mistake, therefore just guarantee the accurate parsing of data model in data backup process, also just improved correctness and the integrality of data in data backup process.Further, can also make follow-up importing backup data file to time other databases, also can guarantee correctness and the integrality of data.Further, the data model in the embodiment of the present application is isolated data in data plane, so the backup of data model and follow-up importing process can carry out by multithreading, thereby improves backup and follow-up importing efficiency.
With reference to figure 4, show the process flow diagram of a kind of data back up method embodiment 2 based on data model of the application, except step 101~105, after obtaining backup data file, the present embodiment can also comprise the following steps:
Step 401: the different business scenario according to current application carries out format conversion to the data in described backup data file.
Because according to different business scenarios, the form of backup data file may not mate with the business scenario of actual needs, for example, may be because the upgrading of database need to increase newer field; Also be likely to do unified format conversion to data.The definition of format conversion logic is interface, the interface that can provide according to the application according to the different business scenario of current application is described, and carries out the definition of the data switching logic of different-format, is backup data file to be applicable to the format conversion of current business scene.Conversion logic is wherein according to interface and the actual self-defined realization of business scenario.Then, the execution of format conversion is Templated, and the application provides unified execution template, and the format conversion logic having configured is carried out one by one.In different applied environments, can realize described template and interface by diverse ways and describe, as the function pointer in C, the abstract function in C++, the interface in Java etc.
Step 402: described backup data file is directed into described target database according to the data layout of target database.
In the embodiment of the present application, because backup data file can persistence, for example backup data file is saved to server with XML or other document format datas, for follow-up, repeatedly this backup data file is carried out to data importing, be backup data file is directed into target database after, as the data in target database.
It should be noted that, for the data importing simultaneously in batches of same data model, wherein any SQL goes wrong and will produce the phenomenon of rollback.In the prior art, while importing one by one according to the SQL of backup data file, cannot realize according to data model and do clerical control, once therefore go wrong in data importing process, just must solve by strict rollback mode, and can not simply re-execute, this will increase risk and the complexity of data importing process greatly.
Being understandable that, when reality is implemented the application, if do not need to carry out data-switching, can directly after step 105, performing step 402, is must after step 401, could not perform step 402.
And this embodiment of the present application is performing step at 402 o'clock, can in same affairs, described backup data file be directed into described target database according to the data layout of target database, so just can guarantee integrality and the correctness of data, avoid the data division that occurs a data model to import and the situation of generation dirty data.
In addition, from whole importing process, the data of each entity are relatively independent (because in affairs), and there is multiple extendible self-defining pattern to solve the problem of data collision, therefore if there are some unpredictable problems (as incompatible in database collapse, data layout etc.) in importing process, as long as re-execute after doing certain correction.
The present embodiment not only can guarantee correctness and the integrality of data backup, can also be follow-up when backup data file is imported, also can avoid the appearance of dirty data, guarantee integrality and the correctness of the data of importing database, also improve the performance of database.
For aforesaid each embodiment of the method, for simple description, therefore it is all expressed as to a series of combination of actions, but those skilled in the art should know, the application is not subject to the restriction of described sequence of movement, because according to the application, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and related action and module might not be that the application is necessary.
Corresponding with the method that a kind of data back up method embodiment 1 based on data model of above-mentioned the application provides, referring to Fig. 5, the application also provides a kind of data backup device embodiment 1 based on data model, and in the present embodiment, this device can comprise:
Creation module 501, for the sign according to current database data creation data model to be backed up and corresponding current data model.
Shown in figure 6, described creation module 501 specifically can comprise:
Receive submodule 601, for receiving the keyword of the data to be backed up of user's input;
Search submodule 602, for search all associated data tables that are associated with described keyword at described current database;
The first judgement submodule 603, for judging whether described associated data table exists outer table reference;
First imports submodule 604, in the situation that the result of described judgement submodule is to be, appearance is directed in initial data model;
Second imports submodule 605, for described associated data table is directed into described initial data model, to set up described current data model.
Receiver module 502, for receiving the sign of described current data model.
Parsing module 503, for current data model corresponding to identification (RNC-ID) analytic according to described current data model, to obtain the current structure query language SQL of described current data model.
Shown in figure 7, described parsing module 503 specifically can comprise:
First obtains submodule 701, for the sign according to described current data model, obtains corresponding current data model;
The second judgement submodule 702, for judging whether described current data model quotes other data models;
Second obtains submodule 703, in the situation that the result of described the second judgement submodule is to be, obtains all associated data tables in described other data models and current data model as target matrix;
The 3rd obtains submodule 704, in the situation that the result of described the second judgement submodule is no, obtains all associated data tables in described current data model as target matrix;
First generates submodule 705, for described target matrix is generated to a SQL corresponding with described target matrix;
The 3rd judgement submodule 706, for judging whether described target matrix quotes appearance;
Second generates submodule 707, in the situation that the result of described the 3rd judgement submodule is to be, described appearance is generated to two SQL corresponding with described appearance;
Determine submodule 708, for by described the 2nd SQL, or a described SQL and the 2nd SQL are as the current SQL of described current data model.
Carry out SQL module 504, for triggering described current SQL, at described current database, carry out.
Backup module 505, for using the execution result of carrying out described current SQL as the backup data file corresponding with described data to be backed up.
In the embodiment of the present application, a plurality of tables that relate to due to the data for to be backed up only create a data model, and, the process of follow-up this data model of parsing is all carried out according to unique sign of this data model, so can not make data backup process occur mistake, therefore just guarantee the accurate parsing of data model in data backup process, also just improved correctness and the integrality of data in data backup process.Further, can also make follow-up importing backup data file to time other databases, also can guarantee correctness and the integrality of data.Further, the data model in the embodiment of the present application is isolated data in data plane, so the backup of data model and follow-up importing process can carry out by multithreading, thereby improves backup and follow-up importing efficiency.
Corresponding with the method that a kind of data back up method embodiment 2 based on data model of above-mentioned the application provides, referring to Fig. 8, the application also provides a kind of data backup device embodiment 2 based on data model, and in the present embodiment, this device can comprise:
Format converting module 801, carries out format conversion for the different business scenario according to current application to the data of described backup data file.
Import module 802, for described backup data file is directed into described target database according to the data layout of target database.
Described importing module 802 specifically can be for: in same affairs, described backup data file is directed into described target database according to the data layout of target database.
The present embodiment not only can guarantee correctness and the integrality of data backup, can also be follow-up when backup data file is imported, also can avoid the appearance of dirty data, guarantee integrality and the correctness of the data of importing database, also improve the performance of database.
It should be noted that, each embodiment in this instructions all adopts the mode of going forward one by one to describe, and each embodiment stresses is the difference with other embodiment, between each embodiment identical similar part mutually referring to.For device class embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, relevant part is referring to the part explanation of embodiment of the method.
Finally, also it should be noted that, in this article, relational terms such as the first and second grades is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply and between these entities or operation, have the relation of any this reality or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thereby the process, method, article or the equipment that make to comprise a series of key elements not only comprise those key elements, but also comprise other key elements of clearly not listing, or be also included as the intrinsic key element of this process, method, article or equipment.The in the situation that of more restrictions not, the key element being limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
A kind of data back up method and the device based on data model above the application being provided is described in detail, applied specific case herein the application's principle and embodiment are set forth, the explanation of above embodiment is just for helping to understand the application's method and core concept thereof; Meanwhile, for one of ordinary skill in the art, the thought according to the application, all will change in specific embodiments and applications, and in sum, this description should not be construed as the restriction to the application.

Claims (12)

1. the data back up method based on data model, is characterized in that, according to sign and the corresponding current data model of data creation data model to be backed up in current database; The method comprises:
Receive the sign of described current data model;
According to the current data model corresponding to identification (RNC-ID) analytic of described current data model, to obtain the current structure query language SQL of described current data model;
Trigger described current SQL carries out in described current database;
Using the execution result of carrying out described current SQL as the backup data file corresponding with described data to be backed up.
2. method according to claim 1, is characterized in that, the described sign according to data creation data model to be backed up in current database and corresponding current data model, specifically comprise:
Receive the keyword of the data to be backed up of user's input;
In described current database, search all associated data tables that are associated with described keyword;
Judge that whether described associated data table exists outer table reference, if so, is directed into appearance in initial data model;
Described associated data table is directed in described initial data model, to set up described current data model.
3. method according to claim 2, is characterized in that, the current data model corresponding to identification (RNC-ID) analytic of the described current data model of described foundation, specifically comprises:
Sign according to described current data model is obtained corresponding current data model;
Judge whether described current data model quotes other data models, if so, all associated data tables described in obtaining in other data models and current data model are as target matrix; If not, obtain all associated data tables in described current data model as target matrix;
Described target matrix is generated to a SQL corresponding with described target matrix;
Judge whether described target matrix quotes appearance, if so, described appearance is generated to two SQL corresponding with described appearance;
By described the 2nd SQL, or a described SQL and the 2nd SQL are as the current SQL of described current data model.
4. method according to claim 1, is characterized in that, described using the execution result of carrying out described current SQL after the backup data file corresponding with described data to be backed up, also comprise:
Different business scenario according to current application carries out format conversion to the data in described backup data file.
5. method according to claim 1, is characterized in that, described using the execution result of carrying out described current SQL after the backup data file corresponding with described data to be backed up, also comprise:
Described backup data file is directed into described target database according to the data layout of target database.
6. method according to claim 5, is characterized in that, described described backup data file is directed into described target database according to the data layout of target database, is specially:
In same affairs, described backup data file is directed into described target database according to the data layout of target database.
7. the data backup device based on data model, is characterized in that, this device comprises:
Creation module, for the sign according to current database data creation data model to be backed up and corresponding current data model;
Receiver module, for receiving the sign of described current data model;
Parsing module, for current data model corresponding to identification (RNC-ID) analytic according to described current data model, to obtain the current structure query language SQL of described current data model;
Carry out SQL module, for triggering described current SQL, at described current database, carry out;
Backup module, for using the execution result of carrying out described current SQL as the backup data file corresponding with described data to be backed up.
8. device according to claim 7, is characterized in that, described creation module specifically comprises:
Receive submodule, for receiving the keyword of the data to be backed up of user's input;
Search submodule, for search all associated data tables that are associated with described keyword at described current database;
The first judgement submodule, for judging whether described associated data table exists outer table reference;
First imports submodule, in the situation that the result of described judgement submodule is to be, appearance is directed in initial data model;
Second imports submodule, for described associated data table is directed into described initial data model, to set up described current data model.
9. device according to claim 7, is characterized in that, described parsing module specifically comprises:
First obtains submodule, for the sign according to described current data model, obtains corresponding current data model;
The second judgement submodule, for judging whether described current data model quotes other data models;
Second obtains submodule, in the situation that the result of described the second judgement submodule is to be, obtains all associated data tables in described other data models and current data model as target matrix;
The 3rd obtains submodule, in the situation that the result of described the second judgement submodule is to obtain all associated data tables in described current data model as target matrix;
First generates submodule, for described target matrix is generated to a SQL corresponding with described target matrix;
The 3rd judgement submodule, for judging whether described target matrix quotes appearance;
Second generates submodule, in the situation that the result of described the 3rd judgement submodule is to be, described appearance is generated to two SQL corresponding with described appearance;
Determine submodule, for by described the 2nd SQL, or a described SQL and the 2nd SQL are as the current SQL of described current data model.
10. device according to claim 7, is characterized in that, also comprises:
Format converting module, carries out format conversion for the different business scenario according to current application to the data of described backup data file.
11. devices according to claim 7, is characterized in that, also comprise:
Import module, for described backup data file is directed into described target database according to the data layout of target database.
12. devices according to claim 11, is characterized in that, described importing module specifically for: in same affairs, described backup data file is directed into described target database according to the data layout of target database.
CN201210353330.XA 2012-09-20 2012-09-20 A kind of data back up method and device based on data model Active CN103678396B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210353330.XA CN103678396B (en) 2012-09-20 2012-09-20 A kind of data back up method and device based on data model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210353330.XA CN103678396B (en) 2012-09-20 2012-09-20 A kind of data back up method and device based on data model

Publications (2)

Publication Number Publication Date
CN103678396A true CN103678396A (en) 2014-03-26
CN103678396B CN103678396B (en) 2017-06-13

Family

ID=50315977

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210353330.XA Active CN103678396B (en) 2012-09-20 2012-09-20 A kind of data back up method and device based on data model

Country Status (1)

Country Link
CN (1) CN103678396B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106055427A (en) * 2016-05-23 2016-10-26 平安科技(深圳)有限公司 SAS-based data backup method and apparatus
CN106294776A (en) * 2016-08-12 2017-01-04 北京东方车云信息技术有限公司 A kind of data processing method and device
CN106713032A (en) * 2016-12-21 2017-05-24 瑞斯康达科技发展股份有限公司 Method and apparatus for managing network management business
CN109257404A (en) * 2017-07-14 2019-01-22 迈普通信技术股份有限公司 Data back up method, apparatus and system
CN111459907A (en) * 2020-03-04 2020-07-28 石化盈科信息技术有限责任公司 Method, system and storage medium for configuring master data through model
CN113204376A (en) * 2021-04-27 2021-08-03 网银在线(北京)科技有限公司 File analysis method and device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549128A (en) * 2003-05-15 2004-11-24 深圳市中兴通讯股份有限公司南京分公 Databank back-up method
CN101989305A (en) * 2010-11-09 2011-03-23 福州星网视易信息系统有限公司 Data incremental backup method and system
CN102096669A (en) * 2009-12-14 2011-06-15 深圳速浪数字技术有限公司 Data backup method and data backup device
US20120179655A1 (en) * 2011-01-07 2012-07-12 Beatty Louis J Method and system of performing incremental sql server database backups

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549128A (en) * 2003-05-15 2004-11-24 深圳市中兴通讯股份有限公司南京分公 Databank back-up method
CN102096669A (en) * 2009-12-14 2011-06-15 深圳速浪数字技术有限公司 Data backup method and data backup device
CN101989305A (en) * 2010-11-09 2011-03-23 福州星网视易信息系统有限公司 Data incremental backup method and system
US20120179655A1 (en) * 2011-01-07 2012-07-12 Beatty Louis J Method and system of performing incremental sql server database backups

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106055427A (en) * 2016-05-23 2016-10-26 平安科技(深圳)有限公司 SAS-based data backup method and apparatus
CN106055427B (en) * 2016-05-23 2019-07-30 平安科技(深圳)有限公司 Data back up method and device based on SAS
CN106294776A (en) * 2016-08-12 2017-01-04 北京东方车云信息技术有限公司 A kind of data processing method and device
CN106713032A (en) * 2016-12-21 2017-05-24 瑞斯康达科技发展股份有限公司 Method and apparatus for managing network management business
CN106713032B (en) * 2016-12-21 2019-09-17 瑞斯康达科技发展股份有限公司 A kind of method and device for realizing network management service management
CN109257404A (en) * 2017-07-14 2019-01-22 迈普通信技术股份有限公司 Data back up method, apparatus and system
CN109257404B (en) * 2017-07-14 2022-04-05 迈普通信技术股份有限公司 Data backup method, device and system
CN111459907A (en) * 2020-03-04 2020-07-28 石化盈科信息技术有限责任公司 Method, system and storage medium for configuring master data through model
CN111459907B (en) * 2020-03-04 2023-07-18 石化盈科信息技术有限责任公司 Method, system and storage medium for configuring main data through model
CN113204376A (en) * 2021-04-27 2021-08-03 网银在线(北京)科技有限公司 File analysis method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN103678396B (en) 2017-06-13

Similar Documents

Publication Publication Date Title
CN107480198B (en) Distributed NewSQL database system and full-text retrieval method
CN110908997A (en) Data blood margin construction method and device, server and readable storage medium
CN110795455A (en) Dependency relationship analysis method, electronic device, computer device and readable storage medium
US10936625B2 (en) Progressive optimization for implicit cast predicates
CN103678396A (en) Data backup method and device based on data models
CN107357593A (en) Source code file construction method, device, electric terminal and readable storage medium storing program for executing
CN101609531A (en) Data processing method in a kind of enterprise resource planning and device
CN111125064B (en) Method and device for generating database schema definition statement
CN106951254B (en) Method and device for multiplexing similar service function modules in payment system
CN111125496A (en) Price query method, device and system
CN107102995B (en) Method and device for determining SQL execution plan
US10289620B1 (en) Reporting and data governance management
CN110109893A (en) The method and apparatus of data modeling and operation
CN111427577A (en) Code processing method and device and server
US10318524B2 (en) Reporting and data governance management
CN115292313A (en) Pseudo-column implementation method and device, electronic equipment and storage medium
CN115390936A (en) Unified verification method, device, equipment and storage medium
CN113609128A (en) Method and device for generating database entity class, terminal equipment and storage medium
CN115617773A (en) Data migration method, device and system
CN112825068B (en) Data blood margin generation method and device
US20170161359A1 (en) Pattern-driven data generator
US10402391B2 (en) Processing method, device and system for data of distributed storage system
CN111400396A (en) Method and device for generating data synchronization script and computer readable storage medium
CN116450682B (en) Model generation method, device, equipment and medium based on data combination
US20220198301A1 (en) Method and apparatus for update processing of question answering system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20191217

Address after: P.O. Box 31119, grand exhibition hall, hibiscus street, 802 West Bay Road, Grand Cayman, British Cayman Islands

Patentee after: Innovative advanced technology Co., Ltd

Address before: Cayman Islands Grand Cayman capital building, a four storey No. 847 mailbox

Patentee before: Alibaba Group Holding Co., Ltd.