The content of the invention
It is a primary object of the present invention to provide the index document handling method and device of a kind of analytical database, to solve
Analytical database synchronizes the resource of meeting Consumption Analysis database while dimension is carried out or index is handled, and causes to analyze number
The problem of synchronizing function carried according to storehouse is unstable.
To achieve these goals, according to an aspect of the invention, there is provided a kind of index file of analytical database
Processing method.Included according to the index document handling method of the analytical database of the present invention:To the index number in the first database
According to being handled, wherein, the first database saves the data in a time-triggered protocol cycle and is stored in analytical database,
First database includes the first subregion, and the first subregion includes the first index file, and achievement data is stored in the first index file;
The second subregion is created in the second database, wherein, the second subregion is corresponding subregion with the first subregion, and the second database is
Store the database of all historical datas in analytical database;First index file is copied to the corresponding index of the second subregion
In file;First index file is replaced to index file corresponding in the second subregion;To the index file in the second database
Metadata maintenance is carried out, updates the second database.
Further, metadata maintenance is carried out to the index file in the second database, the second database of renewal includes:Point
From the index file in the second database and the second database;Update the second database;The number of loading second in the second database
According to the index file separated in storehouse.
Further, metadata maintenance is carried out to the index file in the second database, the second database of renewal includes:Repair
Change the filename that the second subregion in the second database corresponds to file in index file;It is corresponding to update the second subregion in the second database
Lists of documents in index file, wherein, lists of documents have counted all index files in second the second subregion of database
Filename;The versions of data of second database is changed to the versions of data of the first database;Update the second database.
Further, metadata maintenance is carried out to the index file in the second database, the second database of renewal includes:Obtain
Take the version information of index file corresponding in the second database;Change the version of index file corresponding in the second database
This information;Update the second database.
Further, update the second database also includes afterwards:Data query is carried out in the second database;Judge data
Whether query process reports an error;In the case where data query process reports an error, it is relative that the first index file is copied to the second subregion
In the index file answered;First index file is replaced to index file corresponding in the second subregion;To in the second database
Index file carries out metadata maintenance, updates the second database.
To achieve these goals, according to another aspect of the present invention, there is provided a kind of index file of analytical database
Processing unit.The device includes:Processing unit, for handling the achievement data in the first database, wherein, the first number
The data in a time-triggered protocol cycle are saved according to storehouse and are stored in analytical database, and the first database includes first point
Area, the first subregion include the first index file, and achievement data is stored in the first index file;Creating unit, for second
The second subregion is created in database, wherein, the second subregion is corresponding subregion with the first subregion, and the second database is storage point
Analyse the database of all historical datas in database;Copied cells is relative for the first index file to be copied into the second subregion
In the index file answered;Replacement unit, for the first index file to be replaced to index file corresponding in the second subregion;First
Updating block, for carrying out metadata maintenance to the index file in the second database, update the second database.
Further, the first updating block includes:Separation module, for separating in the second database and the second database
Index file;First update module, for updating the second database;Load-on module, for loading second in the second database
The index file separated in database.
Further, the first updating block includes:Modified module, correspondingly refer to for changing the second subregion in the second database
Mark the filename of file in file;Second update module, corresponded to for updating the second subregion in the second database in index file
Lists of documents, wherein, lists of documents are the filenames for having counted all index files in second the second subregion of database;Change
Module, for the versions of data of the second database to be changed to the versions of data of the first database;3rd update module, for more
New second database.
Further, the first updating block includes:Acquisition module, for obtaining index text corresponding in the second database
The version information of part;Modified module, for changing the version information of index file corresponding in the second database;4th renewal
Module, for updating the second database.
Further, also include after the first updating block:Query unit, for looking into carrying out data in the second database
Ask;Judging unit, for judging whether data query process reports an error;Copied cells, for the feelings to be reported an error in data query process
Under condition, the first index file is copied in the corresponding index file of the second subregion;Replacement unit, for the first index is literary
Part replaces index file corresponding in the second subregion;Second updating block, for entering to the index file in the second database
Row metadata is safeguarded, updates the second database.
By the present invention, handled using to the achievement data in the first database;Is created in the second database
Two subregions;First index file is copied in the corresponding index file of the second subregion;First index file is replaced second
Corresponding index file in subregion;Metadata maintenance is carried out to the index file in the second database, updates the second database,
Solve the resource that analytical database synchronizes meeting Consumption Analysis database while dimension is carried out or index is handled, cause
The problem of synchronizing function that analytical database carries is unstable, synchronizing function stabilization is reached and has expended the few effect of resource.
Embodiment
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the application can phase
Mutually combination.Describe the present invention in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is the flow chart according to the first embodiment of the index document handling method of the analytical database of the present invention.Such as
Shown in Fig. 1, this method includes steps S101 to step S105:
Step S101, the achievement data in the first database is handled, wherein, when the first database saves one
Between process cycle data and be stored in analytical database, the first database includes the first subregion, and the first subregion includes the
One index file, achievement data are stored in the first index file.
Achievement data in first database is handled, i.e., according to the treatment conditions received, achievement data pressed
Handled according to treatment conditions, the result obtained after treatment is stored in the first index file in the first subregion.
Analytical database is that can data be carried out with Online statistics, online data analysis, the Information Number of the excavation such as inquiry immediately
It is one important branch of database product according to the work of value.
The fact that the first index file is exactly in analytical database table, the true each data warehouse of table editor include one
Individual or multiple fact tables.Fact table may include business sales data, as cash registers affairs.Caused number
According to fact table generally comprises substantial amounts of row.Fact table is mainly characterized by including numerical data, and these numerals
Information can collect, and to provide units concerned as the data of history, each fact table includes one by some groups
Into index, the index includes the major key of the correlation dimension table as external key, and dimension table includes the true characteristic recorded.Thing
Real data table should not include descriptive information, should not also include except digital metric field and make it is true with it is right in dimension table
Answer any data outside the relative index field of item." metric " included in fact table has two kinds:One kind is can
With accumulative metric, another kind is non-accumulative metric.Most useful metric is the metric that can add up, and it adds up
The numeral come is significantly.
In general, a fact table will be associated with one or more dimension tables, and user is utilizing true number
When creating cube according to table, one or more dimension tables can be used.
Step S102, the second subregion is created in the second database, wherein, the second subregion is corresponding with the first subregion
Subregion, the second database are the databases for storing all historical datas in analytical database.
Historical data base is to store historical data all in analytical database, according to first point in historical data base
The strategy of area identical partitions carries out creating the second subregion.
Partitions of database is a kind of Physical database design technology, and it is a kind of very common operation to create partitions of database.
Although partitioning technique can realize many effects, its main purpose is to reduce reading and writing data in specific SQL operations
Total amount to reduce the response time.Subregion mainly has two kinds of forms:Horizontal partitioning, this form subregion are that the row of table is divided
Area, combined by the data set of the physics column split inside such mode different grouping, so as to carry out individual segmentation or
Collective is split.All being listed in each data set defined in table can be found, so the characteristic of table is still maintained.Lift
Individual simple case:One table comprising 10 years invoice records can be partitioned ten different subregions, what each subregion included
It is the record of wherein 1 year.In general vertical partitioning, this partitioned mode are to reduce target by the vertical division to table
The width of table, some specific row are made to be divided into specific subregion, each subregion contains the row corresponding to row therein.
Step S103, the first index file is copied in the corresponding index file of the second subregion.
Achievement data in first database is handled, achievement data is stored in the first index file, by first
Index file is copied in the corresponding index file of the second subregion.
For example, according to the processing filter condition of reception, to being named as in the first database in the August index file of 1 day
Achievement data is handled, and processing terminates, and it is the achievement data after having handled to be named as the August index file content of 1 day.Will
It is named as the August index file of 1 day and is copied to corresponding in the second database be named as in the August index file of 1 day.
Step S104, the first index file is replaced to index file corresponding in the second subregion.
On the achievement data in the first database is handled, achievement data is stored in the first index file, by
One index file is copied in the corresponding index file of the second subregion, the first index file is replaced corresponding in the second subregion
Index file.
For example, according to the processing filter condition of reception, to being named as in the first database in the August index file of 1 day
Achievement data is handled, and processing terminates, and it is the achievement data after having handled to be named as the August index file content of 1 day.Will
It is also August 1 day that the August index file of 1 day is named as in first database and is copied to corresponding name in the second database
In index file.And replace life corresponding in the second database by the August index file of 1 day is named as in the first database
The entitled August index file of 1 day.
Step S105, metadata maintenance is carried out to the index file in the second database, updates the second database.
Metadata refers to caused relevant data source definitions, object definition, transformation rule during database establishment
Deng the critical data of correlation.For metadata also comprising the business information on data implication, all these information all should be appropriate simultaneously
It is kind to preserve, and manage well, the development and use for database provide convenient.Metadata is a kind of binary message, to
The program for being stored in CLR Portable executable file (PE) or being stored in internal memory is described.By you
When code compilation is PE files, metadata will be inserted into the part of this document, and be Microsoft by code conversion
Intermediate language (MSIL) is simultaneously inserted it into another part of this document.Defined in module or procedure set and quote each
Type and member will illustrate in the metadata.When performing code, metadata is loaded into internal memory by Runtime Library, and is drawn
The information such as the class of pertinent code, member, succession are found with it.
First index file replaces index file corresponding in the second subregion, to the finger after being replaced in the second database
Mark file and carry out metadata maintenance, update the second database.
For example, a kind of specific implementation step that metadata is safeguarded, changes info.x.xml, wherein, info.x.xml refers to
Subregion meta data file is marked, replaces the full content of subregion meta data file.The meta data file of subregion meta file is changed, its
In, meta data file represents the All Files stored in the subregion.Respective field in snapshot database is replaced data
Version is modified as the versions of data in snapshot database, wherein, versions of data is used for, object version object corresponding with data files
Version is constant, and object version is used for corresponding with the X object version in Info.X.xml.Change LastProcessed,
After the change such as EstimatedSize information, LastProcessed, EstimatedSize, metadata information is more accurate.
A kind of index document handling method of the analytical database provided in embodiments of the invention, this method are used to the
Achievement data in one database is handled;The second subregion is created in the second database;First index file is copied to
In the corresponding index file of second subregion;First index file is replaced to index file corresponding in the second subregion;To
Index file in two databases carries out metadata maintenance, updates the second database, solves analytical database and is carrying out dimension
Or the resource of meeting Consumption Analysis database is synchronized while index processing, cause the synchronizing function that analytical database carries not
The problem of stable, synchronizing function stabilization is reached and has expended the few effect of resource.
Fig. 2 is the flow chart according to the second embodiment of the index document handling method of the analytical database of the present invention.Such as
Shown in Fig. 2, this method includes steps S201 to step S208:
Step S201, the achievement data in the first database is handled.
The step is the same as above-mentioned steps S101.
Step S202, the second subregion is created in the second database.
The step is the same as above-mentioned steps S102.
Step S203, the first index file is copied in the corresponding index file of the second subregion.
The step is the same as above-mentioned steps S103.
Step S204, the first index file is replaced to index file corresponding in the second subregion.
The step is the same as above-mentioned steps S104.
Step S205, metadata maintenance is carried out to the index file in the second database.
The step is the same as above-mentioned steps S105.
Step S206, separate the index file in the second database and the second database.
Specifically, Detach operations separate index file from analytical database.Example code:
<Detach xmlns=" http://schemas.microsoft.com/analysisservices/2003/
engine">
<Object>
<DatabaseID>WebDissectorAS_000217_Snapshot</DatabaseID>
</Object>
</Detach>
By this operation, index file is separated from analytical database.
Step S207, update the second database.
A kind of index document handling method of the analytical database provided in embodiments of the invention, this method are used to the
Achievement data in one database is handled;The second subregion is created in the second database;First index file is copied to
In the corresponding index file of second subregion;First index file is replaced to index file corresponding in the second subregion;To
Index file in two databases carries out metadata maintenance, separates the index file in the second database and the second database, more
New second database, the index file separated in the second database is loaded in the second database, is solved in analytical database
After being replaced index file by duplication, fail the problem of updating, and has reached successfully analytical database is updated
Effect.
Step S208, the index file separated in the second database is loaded in the second database.
Specifically, Attach operations load the index file of separation on analytical database.Example code:
<Attach xmlns=" http://schemas.microsoft.com/analysisservices/2003/
engine">
<Folder>C:\ProgramFiles\MicrosoftSQLServer\MSAS11.MSSQLSERVER\OLAP\
Dat a\WebDissectorAS_000217_Snapshot.0.db\</Folder>
<ReadWriteModexmlns=" http://schemas.microsoft.com/analysisservices/
2008/engine/100">ReadWrite</ReadWriteMode>
</Attach>
Operated by this, the index file of separation is loaded in analytical database.After Detach operations being carried out to database
Again after Attach operations, analytical database is refreshed master.vmp main metadata files, store the overall situation of all objects only
The information such as one identification number and version number, can be to carry out data query after refresh.
Fig. 3 is the flow chart according to the second embodiment of the index document handling method of the analytical database of the present invention.Such as
Shown in Fig. 3, this method includes steps S301 to step S310:
Step S301, the achievement data in the first database is handled.
The step is the same as above-mentioned steps S101.
Step S302, the second subregion is created in the second database.
The step is the same as above-mentioned steps S102.
Step S303, the first index file is copied in the corresponding index file of the second subregion.
The step is the same as above-mentioned steps S103.
Step S304, the first index file is replaced to index file corresponding in the second subregion.
The step is the same as above-mentioned steps S104.
Step S305, metadata maintenance is carried out to the index file in the second database, updates the second database.
The step is the same as above-mentioned steps S105.
Step S306, data query is carried out in the second database.
Step S307, judges whether data query process reports an error.
Step S308, in the case where data query process reports an error, it is relative that the first index file is copied to the second subregion
In the index file answered.
Second database receives data query instruction, performs data query, if in query process, if there is inquiry
Situation about reporting an error, the first index file in the first database is copied in the corresponding index file of the second subregion.
Step S309, the first index file is replaced to index file corresponding in the second subregion.
Second database receives data query instruction, performs data query, if in query process, if there is inquiry
Situation about reporting an error, the first index file in the first database is copied in the corresponding index file of the second subregion.And by
The first index file replaces index file corresponding in the second subregion in one database.
Step S310, metadata maintenance is carried out to the index file in the second database, updates the second database.
The step is the same as above-mentioned steps S105.
A kind of index document handling method of the analytical database provided in embodiments of the invention, this method are used to the
Achievement data in one database is handled;The second subregion is created in the second database;First index file is copied to
In the corresponding index file of second subregion;First index file is replaced to index file corresponding in the second subregion;To
Index file in two databases carries out metadata maintenance, updates the second database, data query is carried out in the second database;
Judge whether data query process reports an error;In the case where data query process reports an error, the first index file is copied to second
In the corresponding index file of subregion;First index file is replaced to index file corresponding in the second subregion;Counted to second
Metadata maintenance is carried out according to the index file in storehouse, the second database is updated, solves analytical database and entering row index file
Replicate and replace and after metadata maintenance, not the problem of synchronous success, reached a kind of new synchronization side for ensureing analytical database
Method can synchronously succeed and can ensure the effect of data query stable performance.
It should be noted that can be in such as one group of computer executable instructions the flow of accompanying drawing illustrates the step of
Performed in computer system, although also, show logical order in flow charts, in some cases, can be with not
The order being same as herein performs shown or described step.
Fig. 4 is the schematic diagram according to the first embodiment of the index document handling apparatus of the analytical database of the present invention.Such as
Shown in Fig. 4, the index document handling apparatus of the analytical database includes:Processing unit 10, creating unit 20, copied cells 30,
The updating block 50 of replacement unit 40 and first.
Processing unit 10, for handling the achievement data in the first database, wherein, the first database saves
The data in one time-triggered protocol cycle and it is stored in analytical database, the first database includes the first subregion, the first subregion
Including the first index file, achievement data is stored in the first index file.
Creating unit 20, for creating the second subregion in the second database, wherein, the second subregion is phase with the first subregion
Corresponding subregion, the second database are the databases for storing all historical datas in analytical database.
Copied cells 30, for the first index file to be copied in the corresponding index file of the second subregion.
Replacement unit 40, for the first index file to be replaced to index file corresponding in the second subregion.
First updating block 50, for carrying out metadata maintenance, the number of renewal second to the index file in the second database
According to storehouse.
A kind of index document handling apparatus of the analytical database provided in embodiments of the invention, the device processing unit
10 are used to handle the achievement data in the first database;Creating unit 20 is used to create second point in the second database
The database of area second is the database for storing all historical datas in analytical database;Copied cells 30 is used for the first index text
Part is copied in the corresponding index file of the second subregion;Replacement unit 40 is used to replace the first index file in the second subregion
Corresponding index file;First updating block 50 is used to carry out metadata maintenance to the index file in the second database, more
New second database, solve analytical database and meeting Consumption Analysis data are synchronized while dimension is carried out or index is handled
The resource in storehouse, the problem of synchronizing function for causing analytical database to carry is unstable, it is stable and expend synchronizing function is reached
The few effect of resource.
Fig. 5 is the schematic diagram according to the first embodiment of the index document handling apparatus of the analytical database of the present invention.Such as
Shown in Fig. 5, the index document handling apparatus of the analytical database includes:Processing unit 10, creating unit 20, copied cells 30,
The updating block 50 of replacement unit 40 and first.First updating block 50 also includes:Separation module 501, the and of the first update module 502
Load-on module 503.
Processing unit 10, creating unit 20, copied cells 30, the updating block 50 of replacement unit 40 and first effect with it is upper
State and act on identical in embodiment, will not be repeated here.
Separation module 501, for separating the index file in the second database and the second database.
First update module 502, for updating the second database.
Load-on module 503, for loading the index file separated in the second database in the second database.
A kind of index document handling apparatus of the analytical database provided in embodiments of the invention, the device processing unit
10 are used to handle the achievement data in the first database;Creating unit 20 is used to create second point in the second database
The database of area second is the database for storing all historical datas in analytical database;Copied cells 30 is used for the first index text
Part is copied in the corresponding index file of the second subregion;Replacement unit 40 is used to replace the first index file in the second subregion
Corresponding index file;First updating block 50 is used to carry out metadata maintenance to the index file in the second database, more
New second database, separation module 501 are used to separate the index file in the second database and the second database, the first renewal mould
Block 502 is used to update the second database, and load-on module 503 is used to load the finger separated in the second database in the second database
File is marked, solve analytical database and meeting Consumption Analysis database is synchronized while dimension is carried out or index is handled
Resource, the problem of synchronizing function for causing analytical database to carry is unstable, solve in analytical database by replicate by for
After changing index file, fail the problem of updating, and has reached the effect being successfully updated to analytical database.
Fig. 6 is the schematic diagram according to the first embodiment of the index document handling apparatus of the analytical database of the present invention.Such as
Shown in Fig. 6, the index document handling apparatus of the analytical database includes:Processing unit 10, creating unit 20, copied cells 30,
Replacement unit 40, the first updating block 50, query unit 60, judging unit 70, copied cells 80, replacement unit 90 and second are more
New unit 100.
Processing unit 10, creating unit 20, copied cells 30, the updating block 50 of replacement unit 40 and first effect with it is upper
State and act on identical in embodiment, will not be repeated here.
Query unit 60, for carrying out data query in the second database.
Judging unit 70, for judging whether data query process reports an error.
Copied cells 80, in the case of being reported an error in data query process, the first index file is copied to second point
In the corresponding index file in area.
Replacement unit 90, for the first index file to be replaced to index file corresponding in the second subregion.
Second updating block 100, for carrying out metadata maintenance, the number of renewal second to the index file in the second database
According to storehouse.
A kind of index document handling apparatus of the analytical database provided in embodiments of the invention, the device processing unit
10 are used to handle the achievement data in the first database;Creating unit 20 is used to create second point in the second database
The database of area second is the database for storing all historical datas in analytical database;Copied cells 30 is used for the first index text
Part is copied in the corresponding index file of the second subregion;Replacement unit 40 is used to replace the first index file in the second subregion
Corresponding index file;First updating block 50 is used to carry out the index file in the second database metadata maintenance renewal
Second database;Query unit 60 is used for carrying out data query in the second database;Judging unit 70 is used to judge that data are looked into
Whether inquiry process reports an error;Copied cells 80 is used to the first index file is copied into the in the case where data query process reports an error
In the corresponding index file of two subregions;Replacement unit 90 is used to replacing the first index file into finger corresponding in the second subregion
Mark file;Second updating block 100 is used to carry out metadata maintenance to the index file in the second database, updates the second data
Storehouse, solve analytical database after entering row index file and replicating replacement and metadata maintenance, not the problem of synchronous success, reach
The new analytical database synchronous method of guarantee can synchronously succeed and can ensure the effect of data query stable performance.
Obviously, those skilled in the art should be understood that above-mentioned each module of the invention or each step can be with general
Computing device realize that they can be concentrated on single computing device, or be distributed in multiple computing devices and formed
Network on, alternatively, they can be realized with the program code that computing device can perform, it is thus possible to they are stored
Performed in the storage device by computing device, either they are fabricated to respectively each integrated circuit modules or by they
In multiple modules or step be fabricated to single integrated circuit module to realize.So, the present invention is not restricted to any specific
Hardware and software combines.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area
For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies
Change, equivalent substitution, improvement etc., should be included in the scope of the protection.