CN106897332A - Data-base capacity-enlarging method and device - Google Patents

Data-base capacity-enlarging method and device Download PDF

Info

Publication number
CN106897332A
CN106897332A CN201610424077.0A CN201610424077A CN106897332A CN 106897332 A CN106897332 A CN 106897332A CN 201610424077 A CN201610424077 A CN 201610424077A CN 106897332 A CN106897332 A CN 106897332A
Authority
CN
China
Prior art keywords
data
tables
newly
increased
base
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.)
Pending
Application number
CN201610424077.0A
Other languages
Chinese (zh)
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
Advantageous 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 CN201610424077.0A priority Critical patent/CN106897332A/en
Publication of CN106897332A publication Critical patent/CN106897332A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types

Abstract

The invention discloses a kind of data-base capacity-enlarging method and device, it is related to areas of information technology.Present invention is mainly used for solving the problems, such as the less efficient of data-base capacity-enlarging in the prior art.Methods described includes:When needing to carry out data-base capacity-enlarging, the first tables of data is obtained from initial data base, the data that data attribute information is the first attribute are preserved in first tables of data, the second tables of data is also preserved in the initial data base, the data that data attribute information is the second attribute are preserved in second tables of data;First tables of data is saved in newly-increased database and first tables of data is deleted in the initial data base;The 3rd tables of data corresponding with second attribute information is set up in the initial data base and the 4th tables of data corresponding with first attribute information is set up in the newly-increased database.

Description

Data-base capacity-enlarging method and device
Technical field
The present invention relates to areas of information technology, more particularly to a kind of data-base capacity-enlarging method and device.
Background technology
As information technology is continued to develop, various operation systems occur therewith.Over time and business The increase of amount, the data volume of the corresponding database of operation system is also increasing, correspondingly, data manipulation, additions and deletions change look into be System expense is also increasing, causes the pressure of database also increasing.In order to mitigate the pressure of database, it usually needs carry out Data-base capacity-enlarging, that is, increase database or tables of data, then carries out data and deposits according to the database or tables of data for newly increasing Storage.
At present, when data-base capacity-enlarging is carried out, it usually needs by the data in legacy data database data table to newly-increased data In database data table.For example, legacy data table has 3, the data storage in the way of the major key mould 3 of tables of data, with data volume Increase, increased 2 tables of data, in the way of the major key mould 3 of tables of data, will be changed in the way of the major key mould 5 of tables of data Data storage, it is therefore desirable to which, by some of legacy data table Data Migration to newly-increased tables of data, such as script major key is 9 number According to, more than 0 in the way of the major key mould 3 of tables of data, during data are stored in tables of data 1, it is being changed to the major key mould 5 of tables of data Mode mores than 4, and data are stored in tables of data 5, and major key is that 9 data need to be moved to from tables of data 1 tables of data 5.However, Due to existing database dilatation be by Data Migration complete, and the process of Data Migration can exist data increment, full dose, when Between point, the problems such as data are inconsistent, therefore also need to verify data during data-base capacity-enlarging is carried out, cause data Storehouse dilatation complex operation, so as to cause the less efficient of data-base capacity-enlarging.
The content of the invention
In view of this, the embodiment of the present invention provides a kind of data-base capacity-enlarging method and device, and main purpose is that solution is existing The less efficient problem of data-base capacity-enlarging in technology.
To reach above-mentioned purpose, the present invention provides following technical scheme:
The embodiment of the present invention provides a kind of data-base capacity-enlarging method, including:
When needing to carry out data-base capacity-enlarging, the first tables of data is obtained from initial data base, in first tables of data The data that data attribute information is the first attribute are preserved, the second tables of data, described are also preserved in the initial data base The data that data attribute information is the second attribute are preserved in two tables of data;
First tables of data is saved in newly-increased database and deletes described first in the initial data base and is counted According to table;
The 3rd tables of data corresponding with second attribute information is set up in the initial data base and described newly-increased The 4th tables of data corresponding with first attribute information is set up in database.
The embodiment of the present invention provides a kind of data-base capacity-enlarging device, including:
Acquiring unit, it is described for when needing to carry out data-base capacity-enlarging, obtaining the first tables of data from initial data base The data that data attribute information is the first attribute are preserved in first tables of data, the second number is also preserved in the initial data base According to table, the data that data attribute information is the second attribute are preserved in second tables of data;
Storage unit, first tables of data for the acquiring unit to be obtained is saved in newly-increased database;
Unit is deleted, for deleting first tables of data in the initial data base;
Unit is set up, for setting up the 3rd tables of data corresponding with second attribute information in the initial data base And the 4th tables of data corresponding with first attribute information is set up in the newly-increased database.
By above-mentioned technical proposal, technical scheme provided in an embodiment of the present invention at least has following advantages:
A kind of data-base capacity-enlarging method and device provided in an embodiment of the present invention, obtains the first data from initial data base Table, preserves the data that data attribute information is the first attribute in first tables of data, also preserved in the initial data base There is the second tables of data, the data that data attribute information is the second attribute are preserved in second tables of data;By the described first number It is saved in newly-increased database according to table and first tables of data is deleted in the initial data base;In the initial data base It is middle to set up the 3rd tables of data corresponding with second attribute information and set up in the newly-increased database and the described first category Property corresponding 4th tables of data of information.With at present when data-base capacity-enlarging is carried out, it usually needs by legacy data database data table Data Migration to comparing in newly-increased database data table, the embodiment of the present invention is by by the first tables of data in initial data base Be saved in newly-increased database and first tables of data deleted in the initial data base, in initial data base set up with Corresponding 3rd tables of data of second attribute information is simultaneously set up and first attribute information pair in the newly-increased database The 4th tables of data answered, it is to avoid appearance the problems such as data increment, full dose, time point, inconsistent data, enters without to data Row verification, so as to simplify the operation of data-base capacity-enlarging, and then improves the efficiency of data-base capacity-enlarging.
Described above is only the general introduction of technical solution of the present invention, in order to better understand technological means of the invention, And can be practiced according to the content of specification, and in order to allow the above and other objects of the present invention, feature and advantage can Become apparent, below especially exemplified by specific embodiment of the invention.
Brief description of the drawings
By reading the detailed description of hereafter preferred embodiment, various other advantages and benefit is common for this area Technical staff will be clear understanding.Accompanying drawing is only used for showing the purpose of preferred embodiment, and is not considered as to the present invention Limitation.And in whole accompanying drawing, identical part is denoted by the same reference numerals.In the accompanying drawings:
Fig. 1 shows a kind of flow chart of data-base capacity-enlarging method provided in an embodiment of the present invention;
Fig. 2 shows the flow chart of another data-base capacity-enlarging method provided in an embodiment of the present invention;
Fig. 3 shows a kind of structural representation of data-base capacity-enlarging device provided in an embodiment of the present invention;
Fig. 4 shows the structural representation of another data-base capacity-enlarging device provided in an embodiment of the present invention.
Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in accompanying drawing Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here Limited.Conversely, there is provided these embodiments are able to be best understood from the disclosure, and can be by the scope of the present disclosure Complete conveys to those skilled in the art.
A kind of data-base capacity-enlarging method is the embodiment of the invention provides, as shown in figure 1, methods described includes:
101st, when needing to carry out data-base capacity-enlarging, the first tables of data is obtained from initial data base.
Wherein, the data that data attribute information is the first attribute, the primary data are preserved in first tables of data The second tables of data is also preserved in storehouse, the data that data attribute information is the second attribute are preserved in second tables of data.The One attribute can be the corresponding attribute information of major key of tables of data where data, be specifically as follows the major key of tables of data where data Parity attribute, prime number closes number attribute etc., and the embodiment of the present invention is not limited.Second attribute can also be data where data The corresponding attribute information of major key of table, the second attribute can be different from the first attribute.
For example, initial data base is DB0, there are 2 tables of data in DB0:T0 tables of data, t1 tables of data, t0 tables of data Major key id%2=0 (id is the key assignments of major key), the major key id%2=1 of t1 tables of data, therefore preserve major key in t0 tables of data Attribute is the data of even number, t1 tables of data preserves the data that primary key attribute is odd number, such as table 1:
Table 1
It should be noted that newly-increased database can be foundation when it is determined that needing to carry out data-base capacity-enlarging.Newly-increased number It can be one according to the number in storehouse, it is also possible to multiple.For example, the data volume of current data is 20M, the corresponding appearance of initial data base It is 10M to measure, and the capacity of each database is 10M, then it can be 1 to increase database newly, and the data volume of current data is 40M, The corresponding capacity of initial data base is 10M, then it can be 4 to increase database newly.The capacity of initial data base can be according to initial The capacity of each tables of data is configured in database, specifically, if there are 3 tables of data, each data in initial data base The capacity of table is 5M datas, then the capacity of initial data base can be 15M datas, if there are 4 numbers in initial data base According to table, the capacity of each tables of data is 5M datas, then the capacity of initial data base can be 20M datas.
102nd, the first tables of data is saved in newly-increased database and deletes in initial data base the first tables of data.
For example, initial data base is DB0, there are 2 tables of data in DB0:T0 tables of data, t1 tables of data, by t0 tables of data It is saved in newly-increased database D B1 and t0 tables of data is deleted in initial data base.
103rd, the 3rd tables of data corresponding with the second attribute information is set up in initial data base and in newly-increased database Set up the 4th tables of data corresponding with the first attribute information.
For example, setting up t0_1 tables of data in initial data base DB0, t1_1 tables of data is set up in newly-increased database D B1, Wherein, t0_1 tables of data is used to preserve the data of major key id%2=0, therefore primary key attribute is preserved in t0_1 tables of data for occasionally Several data, preserve the data attribute information of data and the data attribute information of preservation data in t0 tables of data in t0_1 tables of data Identical, t1_1 tables of data is used to preserve the data of major key id%2=1, therefore t1_1 tables of data preserves primary key attribute for odd number Data, in t1_1 tables of data preserve data attribute information with t1 tables of data preservation data attribute information it is identical, dilatation Database afterwards can be as shown in table 2:
Table 2
At present, when carrying out data-base capacity-enlarging, generally by t0 tables of data, t1 tables of data in initial data base DB0 some Data are individually moved in the t1 tables of data of newly-increased database D B1=1, t1_1 tables of data, for example, the major key of tables of data is 18 Data are stored in t1 tables of data before data-base capacity-enlarging, in data-base capacity-enlarging, there are 4 tables of data, the major key of tables of data It is 2 after 18 moulds 4, then the major key of tables of data is that 18 data need to be moved in t0_1 tables of data from t0 tables of data, therefore Needed to being again that 18 data are verified to major key during data-base capacity-enlarging, and the embodiment of the present invention, by inciting somebody to action T0 tables of data is integrally saved in newly-increased database D B1, and being not in that data increment, full dose, time point, data are inconsistent etc. asks Topic, because of t0 tables of data in all data verified in data-base capacity-enlarging first, when carrying out data-base capacity-enlarging again, nothing Data need to be verified, therefore simplify the operating procedure of data-base capacity-enlarging, so as to improve the efficiency of data-base capacity-enlarging.
A kind of data-base capacity-enlarging method provided in an embodiment of the present invention, obtains the first data from initial data base first Table, preserves the data that data attribute information is the first attribute in first tables of data, also preserved in the initial data base There is the second tables of data, the data that data attribute information is the second attribute are preserved in second tables of data;Then by described One tables of data is saved in newly-increased database and first tables of data is deleted in the initial data base;Finally described first The 3rd tables of data corresponding with second attribute information is set up in beginning database and is set up and institute in the newly-increased database State corresponding 4th tables of data of the first attribute information.With at present when data-base capacity-enlarging is carried out, it usually needs by legacy data storehouse To comparing in newly-increased database data table, the embodiment of the present invention is by by initial data base for Data Migration in tables of data One tables of data is saved in newly-increased database and first tables of data is deleted in the initial data base, in initial data base It is middle to set up the 3rd tables of data corresponding with second attribute information and set up in the newly-increased database and the described first category Property corresponding 4th tables of data of information, it is to avoid appearance the problems such as data increment, full dose, time point, inconsistent data, without Data are verified, so as to simplify the operation of data-base capacity-enlarging, and then the efficiency of data-base capacity-enlarging is improved.
Another data-base capacity-enlarging method is the embodiment of the invention provides, as shown in Fig. 2 methods described includes:
201st, when needing to carry out data-base capacity-enlarging, the first tables of data is obtained from initial data base.
Wherein, the data that data attribute information is the first attribute, the primary data are preserved in first tables of data The second tables of data is also preserved in storehouse, the data that data attribute information is the second attribute are preserved in second tables of data.
For the embodiment of the present invention, before step 201, methods described can also include:Obtain the initial data base In remaining data capacity;When the remaining data capacity is less than or equal to preset threshold value, it is determined that needing to carry out database Dilatation.
Wherein, the preset threshold value can be configured according to the demand of user, it is also possible to according to the default mode of system It is configured, the embodiment of the present invention is not limited.For example, preset threshold value can be 10 datas, 20 datas etc..
It should be noted that when the remaining data capacity is less than or equal to preset threshold value, it is determined that needing into line number According to storehouse dilatation.Now, newly-increased database is set up.When the residual capacity is more than preset threshold value, in illustrating initial data base Capacity is sufficient.When there are newly-increased data, continuation will be saved in newly-increased data the initial data base the first tables of data or In the tables of data of person second.For example, when preset threshold value is 100 datas, and remaining data capacity in initial data base is 99 When, it is determined that need to carry out data-base capacity-enlarging.Now, newly-increased database is set up.When preset threshold value is 10 datas, and initial number During according to the remaining data capacity in storehouse for 5M bars, illustrate that the capacity in initial data base is sufficient.When there are newly-increased data, then may be used To continue to be saved in newly-increased data in the first tables of data of the initial data base or the second tables of data.
For the embodiment of the present invention, the remaining data capacity in the acquisition initial data base can include:Obtain The remaining data capacity of the first tables of data described in the initial data base or second tables of data.
If for example, initial data base is DB0, there are 2 tables of data in DB0:T0 tables of data, t1 tables of data, t0 tables of data Remaining data capacity be 1000, the remaining data amount of t1 tables of data is 500, then the remaining data of initial data base DB0 Capacity is 1500.
202nd, the first tables of data is saved in newly-increased database and deletes in initial data base first tables of data.
For example, initial data base is DB0, DB1, the capacity of DB0 and DB1 is 20M, preserved in DB0 t0 tables of data, T0_1 tables of data;T1 tables of data, t1_1 tables of data are preserved in DB1, it is DB2, DB3 to increase database newly, and t0_1 tables of data is protected It is stored to delete t0_1 tables of data in newly-increased database D B2 and in initial data base DB0;T1_1 tables of data is saved in newly-increased number T1_1 tables of data is deleted according in the DB3 of storehouse and in initial data base DB1, specifically can be as shown in table 3:
Table 3
203rd, the 3rd tables of data corresponding with the second attribute information is set up in initial data base and in newly-increased database Set up the 4th tables of data corresponding with the first attribute information.
For example, preserving data, the t0_1 tables of data that primary key attribute is even number in the t0 tables of data of initial data base DB0 In preserve primary key attribute be even number data, after t0_1 tables of data is saved in into newly-increased database D B2, in initial data base T0_2 tables of data is set up in DB0, t0_2 tables of data is used to preserve the data that primary key attribute is even number, in newly-increased database D B2 T2_2 tables of data is set up, t2_2 tables of data is used to preserve the data that primary key attribute is even number.In the t1 data of initial data base DB1 Table preserve primary key attribute be the data of odd number, t1_1 tables of data it is equal in preserve the data that primary key attribute is odd number, by t1_1 After tables of data is saved in newly-increased database D B3, t1_2 tables of data is set up in initial data base DB1, t1_2 tables of data is used to protect The data that primary key attribute is odd number are deposited, t3_2 tables of data is set up in newly-increased database D B2, t3_2 tables of data is used to preserve major key Attribute is the data of odd number, specifically can be as shown in table 4:
Table 4
204th, when there are newly-increased data, attribute information and sequence number identification information according to newly-increased data determine newly-increased data Storage location.
For the embodiment of the present invention, the attribute information and sequence number identification information of the newly-increased data of the basis determine newly-increased data Storage location the step of include:If the attribute information of the newly-increased data is for the first attribute and the sequence number identification information is small In or equal to predetermined threshold value, then the newly-increased data are stored in the first tables of data of the newly-increased database;If or institute The attribute information of newly-increased data is stated for the first attribute and the sequence number identification information is more than the predetermined threshold value, then will be described new Increase data to be stored in the 4th tables of data of the newly-increased database.
Wherein, the predetermined threshold value can be configured according to the demand of user, it is also possible to according to the default mode of system It is configured, the embodiment of the present invention is not limited.Specifically, can be set according to the data capacity of initial data base.As initially The data capacity of database is 10M bars, and predetermined threshold value could be arranged to 10M;The data capacity of initial data base is 20M bars, in advance If it can be 20M that threshold value is set.
If for example, the data capacity of initial data base be 40M, by preset threshold value be 40M.The data where newly-increased data When the major key of table is 40M-10, illustrate that initial data base is not filled with, the primary key attribute for increasing tables of data where data newly is even number, Then newly-increased data are saved in the t0_1 tables of data of newly-increased database D B2, the major key of tables of data is 40M where newly-increased data When+10, illustrate that initial data base is filled with, the primary key attribute for increasing tables of data where data newly is even number, then preserve newly-increased data To in the t2_1 tables of data of newly-increased database D B3.
For the embodiment of the present invention, the attribute information and sequence number identification information of the newly-increased data of the basis determine newly-increased data Storage location the step of include:If the attribute information of the newly-increased data is for the second attribute and the sequence number identification information is small In or equal to predetermined threshold value, then the newly-increased data are stored in the second tables of data of the initial data base;If or institute The attribute information of newly-increased data is stated for the second attribute and the sequence number identification information is more than the predetermined threshold value, then will be described new Increase data to be stored in the 3rd tables of data of the initial data base.
Further, it is if attribute information and sequence number identification information according to newly-increased data determine the storage location of newly-increased data Multiple storage locations, then the major key of tables of data carries out the size of the remainder after modulo operation with default value according to where newly-increased data Information, preserves newly-increased data, wherein, default value can be initial data base total with the tables of data of foundation in newly-increased database Number.
For example, predetermined threshold value is 40M, if the major key of tables of data is 40M+1 where newly-increased data, it is determined that newly-increased data can To be saved in the t1_2 tables of data of initial data base DB1, or the t3_2 tables of data that newly-increased database D B3 can be saved in. At this point it is possible to the remainder after the major key and 4 moulds of tables of data according to where newly-increased data, preserves newly-increased data.If newly-increased data , then be saved in newly-increased data in the t1_2 tables of data of initial data base DB1 by the major key id%4=1 of place database, specifically may be used With such as table 5:
Table 5
It should be noted that initial data base is the primary data and newly-increased number existed during last data dilatation According to storehouse, with the continuous dilatation of database, newly-increased database gradually becomes the initial data base during follow-up data storehouse.
For the embodiment of the present invention, concrete application scene can be not limited to this with as follows, including:In the presence of a use Family table user, when a data is increased in user's table newly, the major key of tables of data increases one,
In order to avoid the data of tables of data are excessive, initial data base can be set up and 2 numbers are created in initial data base According to table, the entitled alipay0 of initial data base, the title of tables of data be respectively user_0,
The primary key attribute of user's table user is the data Cun Chudao tables of data user_0 of even number by user_1, by user's table The primary key attribute of user is the data Cun Chudao tables of data user_1 of odd number.
When the increased quantity of user is more than 10000, the additions and deletions for carrying out data by two tables of data are looked into and change operation, The processing requirement of discontented pedal system, it is thus determined that needing to carry out data-base capacity-enlarging, such as sets up a newly-increased database, increases data newly The entitled alipay1 in storehouse.
Tables of data user_1 in initial data base alipay0 is saved in newly-increased database alipay1 and initial Tables of data user_1 is deleted in database alipay0, primary key attribute is then set up in initial data base alipay0 for even number Tables of data user0_1 and the tables of data user1_1 that primary key attribute is odd number is set up in newly-increased database alipay1, its In, tables of data user0_1 be used for preserve primary key attribute for even number and sequence number be in 1001-11000 data, for preserving major key Attribute is the data that odd number and sequence number are in 1001-11000.
When the major key that there is user's table user is 1001 newly-increased data, it is determined that the attribute information of newly-increased data is user The primary key attribute of table user is for odd number and sequence number is in 1001-11000, then newly-increased data are saved in user1_1, works as presence When the major key of user's table user is 1002 newly-increased data, it is determined that being the major key of user's table user with the attribute information of newly-increased data Attribute is for even number and sequence number is in 1001-11000, then newly-increased data are saved in user0_1, the like, by user's table 10000 data increased newly in user are saved in tables of data user0_1 and user1_1 respectively.
At present, when carrying out data-base capacity-enlarging, generally by tables of data user_0, tables of data in initial data base alipay0 Some datas of user_1 are individually moved in the tables of data user0_1 of newly-increased database alipay1, tables of data user1_1, For example, the major key of user's table user be 23 data before data-base capacity-enlarging, be stored in tables of data user_1, database expand , there are 4 tables of data, for 3, it is necessary to be 23 by major key in primary data table after the mould 4 of major key 23 of user's table user in Rong Shi The storage of data needs in the tables of data user1_1 of newly-increased database alipay1 during data-base capacity-enlarging is carried out It is again that 23 data are verified to the major key of user's table user, and the embodiment of the present invention, by the way that tables of data user_1 is whole Body is saved in newly-increased database alipay1, the problems such as be not in data increment, full dose, time point, inconsistent data, nothing Data need to be verified, therefore simplify the operating procedure of data-base capacity-enlarging, so as to improve the efficiency of data-base capacity-enlarging.
Another data-base capacity-enlarging method provided in an embodiment of the present invention, obtains the first data from initial data base first Table, preserves the data that data attribute information is the first attribute in first tables of data, also preserved in the initial data base There is the second tables of data, the data that data attribute information is the second attribute are preserved in second tables of data;Then by described One tables of data is saved in newly-increased database and first tables of data is deleted in the initial data base;Finally described first The 3rd tables of data corresponding with second attribute information is set up in beginning database and is set up and institute in the newly-increased database State corresponding 4th tables of data of the first attribute information.With at present when data-base capacity-enlarging is carried out, it usually needs by legacy data storehouse To comparing in newly-increased database data table, the embodiment of the present invention is by the first number in initial data base for Data Migration in tables of data It is saved in newly-increased database according to table and first tables of data is deleted in the initial data base, is built in initial data base Found the 3rd tables of data corresponding with second attribute information and set up in the newly-increased database and believe with first attribute Corresponding 4th tables of data is ceased, it is to avoid appearance the problems such as data increment, full dose, time point, inconsistent data, without logarithm According to being verified, so as to simplify the operation of data-base capacity-enlarging, and then the efficiency of data-base capacity-enlarging is improved.
Further, implementing as method shown in Fig. 1, the embodiment of the present invention provides a kind of data-base capacity-enlarging dress Put, as shown in figure 3, described device can include:Acquiring unit 31, storage unit 32, delete unit 33, set up unit 34.
Acquiring unit 31, for when needing to carry out data-base capacity-enlarging, obtaining the first tables of data, institute from initial data base State and preserve the data that data attribute information is the first attribute in the first tables of data, second is also preserved in the initial data base Tables of data, preserves the data that data attribute information is the second attribute in second tables of data.
Storage unit 32, first tables of data for the acquiring unit 31 to be obtained is saved in newly-increased database In.
Unit 33 is deleted, for deleting first tables of data in the initial data base.
Unit 34 is set up, for setting up the 3rd data corresponding with second attribute information in the initial data base Table simultaneously sets up the 4th tables of data corresponding with first attribute information in the newly-increased database.
It should be noted that the device embodiment is corresponding with preceding method embodiment, and for ease of reading, present apparatus embodiment No longer the detail content in preceding method embodiment is repeated one by one, it should be understood that the device in the present embodiment can Correspondence realizes the full content in preceding method embodiment.
A kind of data-base capacity-enlarging device provided in an embodiment of the present invention, obtains the first data from initial data base first Table, preserves the data that data attribute information is the first attribute in first tables of data, also preserved in the initial data base There is the second tables of data, the data that data attribute information is the second attribute are preserved in second tables of data;Then by described One tables of data is saved in newly-increased database and first tables of data is deleted in the initial data base;Finally described first The 3rd tables of data corresponding with second attribute information is set up in beginning database and is set up and institute in the newly-increased database State corresponding 4th tables of data of the first attribute information.With at present when data-base capacity-enlarging is carried out, it usually needs by legacy data storehouse To comparing in newly-increased database data table, the embodiment of the present invention is by by initial data base for Data Migration in tables of data One tables of data is saved in newly-increased database and first tables of data is deleted in the initial data base, in initial data base It is middle to set up the 3rd tables of data corresponding with second attribute information and set up in the newly-increased database and the described first category Property corresponding 4th tables of data of information, it is to avoid appearance the problems such as data increment, full dose, time point, inconsistent data, without Data are verified, so as to simplify the operation of data-base capacity-enlarging, and then the efficiency of data-base capacity-enlarging is improved.
Further, implementing as method shown in Fig. 2, the embodiment of the present invention provides another data-base capacity-enlarging dress Put, as shown in figure 4, described device can include:Acquiring unit 41, storage unit 42, delete unit 43, set up unit 44.
Acquiring unit 41, for when needing to carry out data-base capacity-enlarging, obtaining the first tables of data, institute from initial data base State and preserve the data that data attribute information is the first attribute in the first tables of data, second is also preserved in the initial data base Tables of data, preserves the data that data attribute information is the second attribute in second tables of data.
Storage unit 42, first tables of data for the acquiring unit 41 to be obtained is saved in newly-increased database In.
Unit 43 is deleted, for deleting first tables of data in the initial data base.
Unit 44 is set up, for setting up the 3rd data corresponding with second attribute information in the initial data base Table simultaneously sets up the 4th tables of data corresponding with first attribute information in the newly-increased database.
Further, described device also includes:Determining unit 45.
The acquiring unit 41, is additionally operable to obtain the remaining data capacity in the initial data base.
The determining unit 45, for when the remaining data capacity is less than or equal to preset threshold value, it is determined that needing Carry out data-base capacity-enlarging.
The acquiring unit 41, specifically for obtaining the first tables of data or described second described in the initial data base The remaining data capacity of tables of data.
Determining unit 45, for when there are newly-increased data, attribute information and sequence number according to the newly-increased data to be identified Information determines the storage location of the newly-increased data.
The determining unit 45, if being the first attribute and the sequence number specifically for the attribute information of the newly-increased data Identification information is less than or equal to predetermined threshold value, then the newly-increased data are stored in the first tables of data of the newly-increased database In;Or
The determining unit 45, if being the first attribute and the sequence number specifically for the attribute information of the newly-increased data Identification information is more than the predetermined threshold value, then the newly-increased data are stored in the 4th tables of data of the newly-increased database.
The determining unit 45, if being the second attribute and the sequence number specifically for the attribute information of the newly-increased data Identification information is less than or equal to predetermined threshold value, then the newly-increased data are stored in the second tables of data of the initial data base In;Or
The determining unit 45, if being the second attribute and the sequence number specifically for the attribute information of the newly-increased data Identification information is more than the predetermined threshold value, then the newly-increased data are stored in the 3rd tables of data of the initial data base.
It should be noted that the device embodiment is corresponding with preceding method embodiment, and for ease of reading, present apparatus embodiment No longer the detail content in preceding method embodiment is repeated one by one, it should be understood that the device in the present embodiment can Correspondence realizes the full content in preceding method embodiment.
Another data-base capacity-enlarging device provided in an embodiment of the present invention, obtains the first data from initial data base first Table, preserves the data that data attribute information is the first attribute in first tables of data, also preserved in the initial data base There is the second tables of data, the data that data attribute information is the second attribute are preserved in second tables of data;Then by described One tables of data is saved in newly-increased database and first tables of data is deleted in the initial data base;Finally described first The 3rd tables of data corresponding with second attribute information is set up in beginning database and is set up and institute in the newly-increased database State corresponding 4th tables of data of the first attribute information.With at present when data-base capacity-enlarging is carried out, it usually needs by legacy data storehouse To comparing in newly-increased database data table, the embodiment of the present invention is by by initial data base for Data Migration in tables of data One tables of data is saved in newly-increased database and first tables of data is deleted in the initial data base, in initial data base It is middle to set up the 3rd tables of data corresponding with second attribute information and set up in the newly-increased database and the described first category Property corresponding 4th tables of data of information, it is to avoid appearance the problems such as data increment, full dose, time point, inconsistent data, without Data are verified, so as to simplify the operation of data-base capacity-enlarging, and then the efficiency of data-base capacity-enlarging is improved.
The data-base capacity-enlarging device include processor and memory, above-mentioned acquiring unit, storage unit, delete unit, Set up unit and determining unit etc. to be stored in memory as program unit, stored in memory by computing device Said procedure unit realizes corresponding function.
Kernel is included in processor, is gone in memory to transfer corresponding program unit by kernel.Kernel can set one Or more, the asking in the presence of display interim card when the figure being selected in chart shows is solved by adjusting kernel parameter Topic.
Memory potentially includes the volatile memory in computer-readable medium, random access memory (RAM) and/ Or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory, memory is deposited including at least one Storage chip.
Present invention also provides a kind of computer program product, when being performed on data processing equipment, it is adapted for carrying out just The program code of beginningization there are as below methods step:The first tables of data is obtained from initial data base, is protected in first tables of data There are the data that data attribute information is the first attribute, the second tables of data, described second are also preserved in the initial data base The data that data attribute information is the second attribute are preserved in tables of data;First tables of data is saved in newly-increased database And first tables of data is deleted in the initial data base;Set up in the initial data base and believed with second attribute Cease corresponding 3rd tables of data and the 4th tables of data corresponding with first attribute information is set up in the newly-increased database.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system or computer program Product.Therefore, the application can be using the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware Apply the form of example.And, originally can use and be can use in one or more computers for wherein including computer usable program code The computer program product implemented on storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) Form.
The application is with reference to according to the display methods of figure, device and computer program product in the chart of the present embodiment Flow chart and/or block diagram describe.It should be understood that during flow chart and/or block diagram can be realized by computer program instructions The combination of flow and/or square frame in each flow and/or square frame and flow chart and/or block diagram.These calculating can be provided Treatment of the machine programmed instruction to all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices Device is producing a machine so that produced by the instruction of computer or the computing device of other programmable data processing devices For the function realizing being specified in one flow of flow chart or multiple one square frame of flow and/or block diagram or multiple square frames Device.
These computer program instructions may be alternatively stored in can guide computer or other programmable data processing devices with spy In determining the computer-readable memory that mode works so that instruction of the storage in the computer-readable memory is produced and include finger Make the manufacture of device, the command device realize in one flow of flow chart or multiple one square frame of flow and/or block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that in meter Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented treatment, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, net Network interface and internal memory.
Memory potentially includes the volatile memory in computer-readable medium, random access memory (RAM) and/ Or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory.Memory is that computer-readable is situated between The example of matter.
Computer-readable medium includes that permanent and non-permanent, removable and non-removable media can be by any method Or technology realizes information Store.Information can be computer-readable instruction, data structure, the module of program or other data. The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moves State random access memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electric erasable Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM), Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus Or any other non-transmission medium, can be used to store the information that can be accessed by a computing device.Defined according to herein, calculated Machine computer-readable recording medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
Embodiments herein is these are only, the application is not limited to.To those skilled in the art, The application can have various modifications and variations.All any modifications made within spirit herein and principle, equivalent, Improve etc., within the scope of should be included in claims hereof.

Claims (12)

1. a kind of data-base capacity-enlarging method, it is characterised in that including:
When needing to carry out data-base capacity-enlarging, the first tables of data is obtained from initial data base, preserved in first tables of data There are the data that data attribute information is the first attribute, the second tables of data, second number are also preserved in the initial data base According to preserving the data that data attribute information is the second attribute in table;
First tables of data is saved in newly-increased database and first tables of data is deleted in the initial data base;
The 3rd tables of data corresponding with second attribute information is set up in the initial data base and in the newly-increased data The 4th tables of data corresponding with first attribute information is set up in storehouse.
2. method according to claim 1, it is characterised in that described when needing to carry out data-base capacity-enlarging, from initial number According to before obtaining the first tables of data in storehouse, methods described also includes:
Obtain the remaining data capacity in the initial data base;
When the remaining data capacity is less than or equal to preset threshold value, it is determined that needing to carry out data-base capacity-enlarging.
3. method according to claim 2, it is characterised in that the remaining data in the acquisition initial data base holds Amount includes:
Obtain the remaining data capacity of the first tables of data described in the initial data base or second tables of data.
4. method according to claim 1, it is characterised in that described to be set up in the initial data base and described second Corresponding 3rd tables of data of attribute information is simultaneously set up and first attribute information the corresponding 4th in the newly-increased database After tables of data, methods described also includes:
When there are newly-increased data, attribute information and sequence number identification information according to the newly-increased data determine the newly-increased data Storage location.
5. method according to claim 4, it is characterised in that the attribute information and sequence number according to the newly-increased data Identification information determines that the storage location of the newly-increased data includes:
If the attribute information of the newly-increased data is for the first attribute and the sequence number identification information is less than or equal to predetermined threshold value, Then the newly-increased data are stored in the first tables of data of the newly-increased database;Or
If the attribute information of the newly-increased data is for the first attribute and the sequence number identification information is more than the predetermined threshold value, The newly-increased data are stored in the 4th tables of data of the newly-increased database.
6. method according to claim 4, it is characterised in that the attribute information and sequence number according to the newly-increased data Identification information determines that the storage location of the newly-increased data includes:
If the attribute information of the newly-increased data is for the second attribute and the sequence number identification information is less than or equal to predetermined threshold value, Then the newly-increased data are stored in the second tables of data of the initial data base;Or
If the attribute information of the newly-increased data is for the second attribute and the sequence number identification information is more than the predetermined threshold value, The newly-increased data are stored in the 3rd tables of data of the initial data base.
7. a kind of data-base capacity-enlarging device, it is characterised in that including:
Acquiring unit, for when needing to carry out data-base capacity-enlarging, obtaining the first tables of data, described first from initial data base The data that data attribute information is the first attribute are preserved in tables of data, the second data are also preserved in the initial data base Table, preserves the data that data attribute information is the second attribute in second tables of data;
Storage unit, first tables of data for the acquiring unit to be obtained is saved in newly-increased database;
Unit is deleted, for deleting first tables of data in the initial data base;
Set up unit, for set up in the initial data base the 3rd tables of data corresponding with second attribute information and The 4th tables of data corresponding with first attribute information is set up in the newly-increased database.
8. device according to claim 7, it is characterised in that described device also includes:Determining unit,
The acquiring unit, is additionally operable to obtain the remaining data capacity in the initial data base;
The determining unit, for when the remaining data capacity is less than or equal to preset threshold value, it is determined that needing into line number According to storehouse dilatation.
9. device according to claim 8, it is characterised in that
The acquiring unit, specifically for obtaining the first tables of data or second tables of data described in the initial data base Remaining data capacity.
10. device according to claim 7, it is characterised in that described device also includes:
Determining unit, for when there are newly-increased data, the attribute information and sequence number identification information according to the newly-increased data to be true The storage location of the fixed newly-increased data.
11. devices according to claim 10, it is characterised in that
The determining unit, if being the first attribute and sequence number mark letter specifically for the attribute information of the newly-increased data Breath is less than or equal to predetermined threshold value, then the newly-increased data are stored in the first tables of data of the newly-increased database;Or
The determining unit, if being the first attribute and sequence number mark letter specifically for the attribute information of the newly-increased data Breath is more than the predetermined threshold value, then the newly-increased data are stored in the 4th tables of data of the newly-increased database.
12. devices according to claim 10, it is characterised in that
The determining unit, if being the second attribute and sequence number mark letter specifically for the attribute information of the newly-increased data Breath is less than or equal to predetermined threshold value, then the newly-increased data are stored in the second tables of data of the initial data base;Or
The determining unit, if being the second attribute and sequence number mark letter specifically for the attribute information of the newly-increased data Breath is more than the predetermined threshold value, then the newly-increased data are stored in the 3rd tables of data of the initial data base.
CN201610424077.0A 2016-06-14 2016-06-14 Data-base capacity-enlarging method and device Pending CN106897332A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610424077.0A CN106897332A (en) 2016-06-14 2016-06-14 Data-base capacity-enlarging method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610424077.0A CN106897332A (en) 2016-06-14 2016-06-14 Data-base capacity-enlarging method and device

Publications (1)

Publication Number Publication Date
CN106897332A true CN106897332A (en) 2017-06-27

Family

ID=59191238

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610424077.0A Pending CN106897332A (en) 2016-06-14 2016-06-14 Data-base capacity-enlarging method and device

Country Status (1)

Country Link
CN (1) CN106897332A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109213825A (en) * 2017-06-29 2019-01-15 北京微影时代科技有限公司 A kind of data-base capacity-enlarging method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100555282C (en) * 2006-10-09 2009-10-28 中兴通讯股份有限公司 A kind of method of EMS memory data-base capacity-enlarging
CN102262626A (en) * 2010-05-24 2011-11-30 阿里巴巴集团控股有限公司 Method and device for storing data in database
CN104598459A (en) * 2013-10-30 2015-05-06 阿里巴巴集团控股有限公司 Database processing method and system and data access method and system
CN104750774A (en) * 2014-12-15 2015-07-01 北京星网锐捷网络技术有限公司 Database upgrading method and device
CN104794249A (en) * 2015-05-15 2015-07-22 乐得科技有限公司 Realization method and realization device of database

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100555282C (en) * 2006-10-09 2009-10-28 中兴通讯股份有限公司 A kind of method of EMS memory data-base capacity-enlarging
CN102262626A (en) * 2010-05-24 2011-11-30 阿里巴巴集团控股有限公司 Method and device for storing data in database
CN104598459A (en) * 2013-10-30 2015-05-06 阿里巴巴集团控股有限公司 Database processing method and system and data access method and system
CN104750774A (en) * 2014-12-15 2015-07-01 北京星网锐捷网络技术有限公司 Database upgrading method and device
CN104794249A (en) * 2015-05-15 2015-07-22 乐得科技有限公司 Realization method and realization device of database

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李占卫: ""一种可以避免数据迁移的分库分表scale-out扩容方式"", 《博客园HTTPS://WWW.CNBLOGS.COM/TOMMYLI/P/3767362.HTML》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109213825A (en) * 2017-06-29 2019-01-15 北京微影时代科技有限公司 A kind of data-base capacity-enlarging method and device

Similar Documents

Publication Publication Date Title
CN107368259A (en) A kind of method and apparatus that business datum is write in the catenary system to block
CN107610695A (en) Driver's voice wakes up the dynamic adjusting method of instruction word weight
CN106649346A (en) Data repeatability check method and apparatus
CN105900093B (en) A kind of update method of the tables of data of KeyValue databases and table data update apparatus
CN104156407B (en) Storage method, device and the storage device of index data
CN104615594B (en) A kind of data-updating method and device
CN106897340A (en) A kind of data table updating method and device
CN107766469A (en) A kind of method for caching and processing and device
CN106933823A (en) Method of data synchronization and device
CN107302561A (en) A kind of hot spot data Replica placement method in cloud storage system
CN106095871A (en) A kind of method and device setting up data base directory structure
CN104268099A (en) Management data reading and writing method and device
CN107391544A (en) Processing method, device, equipment and the computer storage media of column data storage
CN107491674A (en) Feature based information carries out the method and device of user's checking
CN108170656A (en) Template establishment method, document creating method, rendering intent and device
CN106897342A (en) A kind of data verification method and equipment
CN109325055A (en) The screening of business association tables of data and checking method, device, electronic equipment
CN105119763A (en) RIA-based Web network management client big data rapid export method and system
CN106933705A (en) The method and apparatus of flash memory system and its quick backup LSB page
CN108021610A (en) Random walk, random walk method, apparatus and equipment based on distributed system
CN112000627A (en) Data storage method, system, electronic equipment and storage medium
CN107784027A (en) A kind of reminding method and device of judgement document's search key
CN107451036A (en) Input reminding method, device and equipment
CN106897332A (en) Data-base capacity-enlarging method and device
CN107609011A (en) The maintaining method and device of a kind of data-base recording

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20200917

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200917

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20170627

RJ01 Rejection of invention patent application after publication