CN103714097B - A kind of method and apparatus for accessing database - Google Patents
A kind of method and apparatus for accessing database Download PDFInfo
- Publication number
- CN103714097B CN103714097B CN201210380786.5A CN201210380786A CN103714097B CN 103714097 B CN103714097 B CN 103714097B CN 201210380786 A CN201210380786 A CN 201210380786A CN 103714097 B CN103714097 B CN 103714097B
- Authority
- CN
- China
- Prior art keywords
- database
- sub
- index
- data
- library
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 62
- 230000003068 static effect Effects 0.000 claims abstract description 57
- 238000001514 detection method Methods 0.000 claims description 16
- 238000004891 communication Methods 0.000 claims description 14
- 238000013507 mapping Methods 0.000 claims description 13
- 238000004458 analytical method Methods 0.000 claims description 10
- 238000012423 maintenance Methods 0.000 abstract description 8
- 230000008569 process Effects 0.000 description 17
- 238000010586 diagram Methods 0.000 description 10
- 238000000638 solvent extraction Methods 0.000 description 9
- 238000004590 computer program Methods 0.000 description 7
- 238000013508 migration Methods 0.000 description 7
- 230000005012 migration Effects 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 5
- 238000007726 management method Methods 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 230000001360 synchronised effect Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000004044 response Effects 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
- G06F16/211—Schema design and management
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
This application provides a kind of method and apparatus for accessing database, method therein is specifically included:The create-rule of preset point of storehouse point table mark;Receive database write access request;Data to be written are carried in database write access request;According to the database write access request, the data table information under the currently available database of dynamic access and the database, and obtain corresponding storehouse index and table index;Divide the storehouse point create-rule that table is identified according to described, assembly is carried out together with static bit to storehouse index and table index, obtain and described corresponding point of storehouse of database write access request point table is identified;The create-rule of described point of storehouse point table mark of foundation, pair storehouse index divided with described corresponding point of storehouse of database write access request in table mark and table index are route;The data to be written are write into the tables of data under database corresponding with route results.The application can improve the convenience of database maintenance, and, the physical resource of Database Systems can be saved.
Description
Technical Field
The present application relates to the field of database technologies, and in particular, to a method and an apparatus for accessing a database.
Background
At present, with the development of society, a large amount of data in an application system needs to be stored, and a certain data access method is applied to the stored data according to the requirements of different users, the database is a technology adapted to the requirements, and in a simple way, the database is a data set in which data can be stored persistently and can be stored in an operable manner.
When the data volume to be stored reaches a certain degree (for example, hundred million level), the data storage management is carried out by using a single database, the problems of capacity bottleneck, performance bottleneck and the like can occur, the improvement of the processing capacity of an application system is influenced, and the rapid development of services is influenced; meanwhile, a single database is also a single point in the whole application system, and once a fault occurs, the availability of the service is directly influenced.
The database division table is a method for storing and managing mass data by a database, and the database division refers to dividing the mass data into a plurality of database storage management by one database storage management; the table division means that mass data is divided into a plurality of data tables for storage management by one data table storage management.
The problems of the single database can be well solved by adopting database and table division, and the method for database and table division in the prior art comprises the following steps:
the database and table dividing rule is determined by a parameter, such as the user ID, the database number is determined by the last bit of the user ID, and the data table number in the database is determined by the last bit. For example: the rules of database division and table division are that the last bit of the user ID is 1,3, 5, 7 and 9 to enter the database A, 0,2, 4, 6 and 8 to enter the database B, and the last bit 0-9 respectively corresponds to different tables in the database, so that when the user ID is 123456789, data is written into the 9 th table in the database B.
By using the database and table dividing method in the prior art, when the scale of the existing database cannot meet the increasing data volume and needs to meet the requirements in a manner of adding a new database, the database and table dividing rule also needs to be changed. For most application systems at present, because fixed parameters are used for performing database division and table division, corresponding data in an old database needs to be synchronously migrated to a newly added database for normal use.
For example: the rule of database division and table division is that the user ID is the second last, and 1,3, 5, 7 and 9 enter a database A; 0. 2,4, 6 and 8 enter a B library; when a C library is newly added to manage data, the rules of library division and table division are changed into 1,3 and 5 for the A library, 0,2 and 4 for the B library and 6, 7, 8 and 9 for the C library. After the sub-database and sub-table rule is modified, all data with the penultimate digits of 6, 7, 8 and 9 of the user ID in the original database A and the original database B must be migrated to the database C, otherwise, a new sub-database and sub-table rule is used, so that some data in the old database cannot be read; the data migration undoubtedly increases the difficulty of database maintenance, and consumes a large amount of CPU resources or memory resources.
In summary, one of the technical problems that needs to be urgently solved by those skilled in the art is: how to improve the convenience of database maintenance and save the physical resources of a database system.
Disclosure of Invention
The technical problem to be solved by the application is to provide a method and a device for accessing a database, which can improve the convenience of database maintenance and save the physical resources of a database system.
In order to solve the above problem, the present application discloses a method for accessing a database, comprising:
presetting a generation rule of a sub-database sub-table identifier;
receiving a database write access request; the database write access request carries data to be written;
dynamically acquiring a currently available database and data table information under the database according to the database write access request, and acquiring a corresponding database index and a corresponding table index;
according to the generation rule of the sub-database sub-table identification, the database index and the table index are assembled together with the static bit to obtain the sub-database sub-table identification corresponding to the database write access request;
according to the generation rule of the sub-database sub-table identifier, routing the database index and the table index in the sub-database sub-table identifier corresponding to the database write access request;
and writing the data to be written into a data table under a database corresponding to the routing result.
Preferably, the step of dynamically acquiring a currently available database and data table information under the database according to the database write access request includes:
and when receiving the database write access request, randomly acquiring a currently available database from a plurality of databases connected with the application system, and randomly acquiring a data table from a plurality of data tables under the database.
Preferably, the database is checked for availability by:
when the database write access request is received, detecting whether the database is available or not through communication with the database; or,
when the database write access request is received, judging whether the database is available according to the available marks of the database; the available marks are determined by a database administrator according to the state of the database, the available marks corresponding to the fault database are unavailable, and the available marks corresponding to the normal operation database are available.
Preferably, the static bits include at least one or more of the following bits: date, serial number, and ID.
Preferably, the step of assembling the library index and the table index together with the static bit according to the generation rule of the sub-library and sub-table identifier includes:
and assembling the library index and the table index together with the static bit according to the static bit, the library index and the position of the table index in the sub-library and sub-table identifier defined in the generation rule of the sub-library and sub-table identifier to obtain the sub-library and sub-table identifier corresponding to the database write access request.
Preferably, the step of routing the repository index and the table index in the sub-repository sub-table identifier corresponding to the database write access request according to the generation rule of the sub-repository sub-table identifier includes:
analyzing the library index and the table index in the sub-library sub-table identifier corresponding to the database write access request according to the static bit, the library index and the position of the table index in the sub-library sub-table identifier defined in the generation rule of the sub-library sub-table identifier;
and searching and obtaining a database and a data table corresponding to the database write access request according to the library index and the table index obtained by analysis.
Preferably, the method further comprises:
and after the data to be written is successfully written, storing the mapping relation between the successfully written data and the corresponding sub-library sub-table identifier.
Preferably, the method further comprises:
receiving a database read access request; the database read access request carries data to be read;
according to the mapping relation between the successfully written data and the corresponding sub-database sub-table identifier, searching to obtain a sub-database sub-table identifier corresponding to the data to be read carried in the database read access request;
routing the database index and the table index in the sub-database sub-table identifier corresponding to the database read access request according to the generation rule of the sub-database sub-table identifier;
and reading the data to be read from a data table under the database corresponding to the routing result.
There is also provided, in accordance with another embodiment of the present application, apparatus for accessing a database, including:
the preset module is used for presetting the generation rule of the sub-database and sub-table identifiers; (ii) a
The write receiving module is used for receiving a database write access request; the database write access request carries data to be written;
the dynamic database table acquisition module is used for dynamically acquiring a currently available database and data table information under the database according to the database write access request and acquiring a corresponding database index and a corresponding table index;
the assembling module is used for assembling the library index and the table index together with the static bit according to the generation rule of the sub-library and sub-table identification to obtain the sub-library and sub-table identification corresponding to the database write access request;
the write routing module is used for routing the database index and the table index in the sub-database sub-table identifier corresponding to the database write access request according to the generation rule of the sub-database sub-table identifier; and
and the data writing module is used for writing the data to be written into a data table under the database corresponding to the routing result.
Preferably, the dynamic obtaining base table module includes:
the random database fetching submodule is used for randomly obtaining a currently available database from a plurality of databases connected with an application system when the database writing access request is received;
and the random table-fetching submodule is used for randomly obtaining a data table from a plurality of data tables under the obtained database.
Preferably, the apparatus further includes a detection module for detecting whether the database is available, and the detection module includes:
the communication detection submodule is used for detecting whether the database is available or not through communication with the database when the database write access request is received; or,
the mark judgment submodule is used for judging whether the database is available or not according to the available marks of the database when the database write access request is received; the available marks are determined by a database administrator according to the state of the database, the available marks corresponding to the fault database are unavailable, and the available marks corresponding to the normal operation database are available.
Preferably, the static bits include at least one or more of the following bits: date, serial number, and ID.
Preferably, the assembly module includes:
and the position corresponding assembling submodule is used for assembling the library index and the table index together with the static bit according to the static bit, the library index and the position of the table index in the database sub-table identifier, which are defined in the generation rule of the database sub-table identifier, so as to obtain the database sub-table identifier corresponding to the database write access request.
Preferably, the write routing module includes:
the writing analysis submodule is used for analyzing the library index and the table index in the sub-library sub-table identifier corresponding to the database writing access request according to the static bit, the library index and the position of the table index in the sub-library sub-table identifier, which are defined in the generation rule of the sub-library sub-table identifier;
and the writing and searching submodule is used for searching and obtaining a database and a data table corresponding to the database writing and accessing request according to the library index and the table index obtained by analysis.
Preferably, the apparatus further comprises:
and the storage module is used for storing the mapping relation between the successfully written data and the corresponding sub-library sub-table identifier after the data to be written is successfully written.
Preferably, the apparatus further comprises:
the read receiving module is used for receiving a database read access request; the database read access request carries data to be read;
the identification bit searching module is used for searching and obtaining a sub-database sub-table identification corresponding to the data to be read carried in the database read access request according to the mapping relation between the write-in successful data and the corresponding sub-database sub-table identification;
the read routing module is used for routing the library index and the table index in the sub-library sub-table identifier corresponding to the database read access request according to the generation rule of the sub-library sub-table identifier;
and the reading module is used for reading the data to be read from a data table under the database corresponding to the routing result.
Compared with the prior art, the method has the following advantages:
in the prior art, fixed parameters are used for database partitioning and table partitioning, so when the scale of the existing database cannot meet the increasing data volume and needs to meet the requirements in a way of adding a new database, the rule of database partitioning and table partitioning also needs to be changed, and therefore, the corresponding data in the old database needs to be synchronously migrated to the new database for normal use;
firstly, according to the database-based and table-based rule, the database index and the table index in the database-based and table-based identifier corresponding to the database access request are routed, and the database index and the table index in the database-based and table-based identifier can be used for routing to a unique database and data table information under the database; thus, when the scale of the existing database can not meet the increasing data quantity and the requirement needs to be met by a new database, the sub-database sub-table identification of the written data (old data) can be uniquely routed to the corresponding old database, and the sub-database sub-table identification of the data (new data) to be written can be uniquely routed to the corresponding new database (new database); therefore, the method and the device can absolutely avoid the problems of writing the new data into the old database and reading the old data from the new database under the conditions of not changing the database-dividing and table-dividing rules and not migrating the corresponding data in the old database to the new database; therefore, compared with the difficulty of database maintenance and the consumed physical resources increased by data migration in the prior art, the method and the system for data migration can improve the convenience of database maintenance and save the physical resources of a database system.
Secondly, the database index in the sub-database and sub-table identification can be an index of a currently available database which is dynamically acquired according to a database write access request, wherein the currently available database is used for representing the currently normally operating database; therefore, in the data writing process, the data can only be written into the database which normally operates at present, and the database which has a fault is automatically eliminated; for an application system, the failure of the database is not sensed at all, so that a plurality of databases accessed by the same application system can be backed up mutually, seamless switching between a main database and a standby database is realized, and service interruption is avoided; moreover, when the main library fails, the cooperative switching of the application system can be avoided,
in addition, the method and the device can effectively avoid the problems that data is lost in the process of switching the main data and the standby data are inconsistent, so that data migration is needed; in addition, the backup library and the corresponding main library have no synchronous relation, and the data does not need to be consistent, so that the master-backup switching can be controlled and flexible.
Drawings
FIG. 1 is a flow chart of embodiment 1 of a method for accessing a database according to the present application;
FIG. 2 is a flow chart of embodiment 2 of a method for accessing a database according to the present application;
FIG. 3 is a schematic flow chart illustrating an application system accessing a database according to the present application;
FIG. 4 is a block diagram of an embodiment of an apparatus for accessing a database according to the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.
Referring to fig. 1, a flowchart of embodiment 1 of a method for accessing a database according to the present application is shown, which may specifically include:
step 101, presetting a generation rule of sub-database and sub-table identifiers;
in the prior art, the sub-library and sub-table rules are defined by a parameter, for example: and determining a database and table dividing rule by using the user ID, determining a database number by using the last bit of the user ID, and determining a data table number in the database by using the last bit.
The present application follows this way of defining the rules of sub-base and sub-table by one parameter, except that the present application does not use the parameter fixed as such in the data bits in the user ID in the prior art, but uses the sub-base and sub-table identifier including static bits and dynamic bits, wherein the dynamic bits may further include the base index and the table index.
In the embodiment of the application, the library index and the table index in the sub-library and sub-table identification can be used for routing to a unique database and data table information under the database. For example: the number of databases connected with the application system is 4, and indexes are 0,1,2 and 3 respectively; the table to be accessed is tableA, the tableA is divided into 5 parts in each database, and the index of the data table is 0,1,2,3 and 4; assuming that for a piece of data of the application system, the database index and the table index in the sub-database and sub-table identification are 24, the piece of data is stored in the data table with the database table index of 2 and the table index of 4.
Static bits in the sub-warehouse and sub-table identification can be used for avoiding the duplication of the sub-warehouse and sub-table identification; because one piece of data usually corresponds to one sub-library and sub-table identifier, if the sub-library and sub-table identifier only comprises a library index and a table index, but a certain data table under a certain database cannot only store one piece of data, the same sub-library and sub-table identifier corresponds to a plurality of pieces of data, thereby causing data reading errors.
In this way, the preset generation rule of the sub-library and sub-table identifier in the embodiment of the present application is mainly used for defining the structural composition of the sub-library and sub-table identifier, the position of each structure in the sub-library and sub-table identifier, and the like. Specifically, the preset generation rule of the sub-library and sub-table identifier should define: the sub-base and sub-table identifier may specifically include a static bit and a dynamic bit, and the dynamic bit may further include a base index and a table index; in addition, what static bits are used, and the locations of the static bits, the bin index, and the table index in the sub-bin sub-table identification, and so on.
In an example application of the present application, the static bits may include a sequence number. For example, if a business system uses a sub-library and sub-table to store business data, when the library index and the table index in the sub-library and sub-table identifier are the same, static bits such as sequence numbers can be used to distinguish different pieces of data, for example, in the sub-library and sub-table identifier such as 24001,24002,24003, 24 is used to represent the library index and the table index, and 001-; in practice, the sequence numbers may be sorted according to the storage time.
In another example application of the present application, the static bits may include a date and a sequence number. For example, if a business system uses a sub-library sub-table to store business data, when the library index and the table index in the sub-library sub-table identifier are the same, static bits such as date and sequence number can be used to distinguish different pieces of data, for example, in the sub-library sub-table identifier such as 2012010124001,2012010124002,2012010124003, 20120101 is used to represent date, 24 is used to represent library index and table index, and 001-; in practice, the date may be the date of data written into the corresponding data table, and the sequence number may be sorted according to the storage time.
Of course, the date and the serial number are only an example of the static bit, and those skilled in the art may preset other static bits, such as the user ID, according to actual requirements, in short, the static bit in the sub-library and sub-table identifier is mainly used to avoid the repeated effect of the sub-library and sub-table identifier, and the application does not limit the specific static bit.
Meanwhile, it should be noted that the static bits in the embodiment of the present application may be generated randomly by the system, or may be one or more specified fields in the data that are automatically read by the system, such as a date, a serial number, a user ID, and the like. The generation rule of the sub-database and sub-table identification also comprises a static bit generation rule.
In the embodiment of the application, the generation rule of the sub-warehouse and sub-table identification defines the structural composition of the sub-warehouse and sub-table identification and the position of each structure in the sub-warehouse and sub-table identification; therefore, in the process of routing the write data, the database sub-table identification can be analyzed according to the generation rule of the database sub-table identification, and the database index and the table index in the database sub-table identification can be accurately positioned, so that accurate routing can be performed, and an accurate routing result can be obtained. For example, for the 2012010124001 database and table identifiers, 1 st to 8 th bits in the database and table rule are defined to indicate dates, 9 th bits indicate database indexes, 10 th bits indicate table indexes, and 11 th to 13 th bits indicate sequence numbers, so that the database indexes and the table indexes in the database and table identifiers can be accurately located according to the database and table identifiers.
102, receiving a database write access request; the database write access request carries data to be written;
step 103, dynamically acquiring a currently available database and data table information under the database according to the database write access request, and acquiring a corresponding database index and a corresponding table index;
in the embodiment of the present application, the currently available database is used to represent the currently normally operating database, and the present application may provide the following scheme for detecting whether the database is available:
the method comprises the following steps that 1, when a database write access request is received, whether a database is available or not is detected through communication with the database;
the step of detecting whether the database is available or not through communication with the database may specifically be to send a detection data packet to the database, and if a response data packet of the database is received within a preset time, determine that the database is in normal operation, that is, the database is available; otherwise, if the response data packet of the database is not received within the preset time, the database is judged to be incapable of normal operation, namely the database is unavailable.
Of course, besides the communication modes of the detection data packet and the response data packet, other communication mode detection databases may be used, and the application is not limited to a specific communication mode. For example, whether the database is available or not can be detected based on a communication mode of heartbeat detection; for example: heartbeat detection is performed every preset period of time (e.g. 1 minute), detecting whether the connected database is available: the database sends a heartbeat detection data frame every 1 minute, and the received data frame indicates that the database is available, otherwise, the received data frame indicates that the database is unavailable.
The detection scheme 2 is that when the database write access request is received, whether the database is available or not is judged according to the available marks of the database; the available marks are determined by a database administrator according to the state of the database, the available marks corresponding to the fault database are unavailable, and the available marks corresponding to the normal operation database are available.
In practical application, the available flag of the database can be stored in a state table, and the state table is specific to the database and only comprises one data field, namely the available flag, the value of which is available or unavailable; and accessing the state table to obtain the available mark of the corresponding database.
In a preferred embodiment of the present application, the step of dynamically acquiring a currently available database and data table information under the database according to the database write access request may further include:
and when the database write access request is received, randomly acquiring a data table from a plurality of data tables under the database.
In the database and table partitioning technology, an application system is usually connected with a plurality of databases, and the process of randomly acquiring one currently available database from the plurality of databases connected with the application system may be as follows: firstly, randomly selecting one from all currently available databases; or randomly acquiring one database from the plurality of databases, detecting whether the database can be available or not, selecting the database if the database is available, randomly acquiring one database from the rest databases if the database cannot be available, continuously detecting whether the database is available or not, and the like until one currently available database is selected.
Similarly, in the database-dividing and table-dividing technology, a plurality of data tables are also arranged under one database, and one database can be randomly acquired to store data to be written.
This is illustrated here with reference to example 3: the number of databases connected with the application system is 4, and indexes are 0,1,2 and 3 respectively; the table to be accessed is tableA, the tableA is divided into 5 parts in each database, and the index of the data table is 0,1,2,3 and 4; assuming a piece of data for the application system; dynamically acquiring the currently available database and the data table information under the database according to the database write access request, wherein the obtained result can be a permutation combination, such as 24, 31, 32, 33, 34, 35, 11, 12, 13, 14, 15 and the like; taking 24 as an example, 2 denotes an index (bank index) of an available database, and 4 denotes an index (table index) of a data table (table index) in which data can be written in this database, with the index being 2.
104, according to the generation rule of the sub-database sub-table identifier, assembling the database index and the table index together with a static bit to obtain a sub-database sub-table identifier corresponding to the database write access request;
the generation rule of the sub-warehouse and sub-table identification defines the structural composition of the sub-warehouse and sub-table identification and the position of the structure in the sub-warehouse and sub-table identification; and step 103 has obtained the structure library index and the table index therein, then step 104 assembles the library index and the table index together with the static bit according to the generation rule of the sub-library sub-table identifier, and obtains the sub-library sub-table identifier corresponding to the database write access request.
The process of acquiring static bits is described herein. And because what static bit is used is defined in the generation rule of the sub-library and sub-table identification, the static bit is obtained according to the relevant definition. Assuming that the static bits include one or more of a date, a serial number, and an ID, the process of obtaining the date may be: and acquiring a corresponding date according to the receiving time of the database write access request, wherein the process of acquiring the sequence number can be as follows: numbering the database write access requests of the date according to the receiving sequence, wherein the number corresponding to the current database write access request is a serial number; the process of obtaining the ID may be: and acquiring a user ID corresponding to the current database write access request.
Because the generation rule of the sub-library and sub-table identifier defines the positions of the static bit, the library index and the table index in the sub-library and sub-table identifier, the library index and the table index together with the static bit can be assembled according to the respective positions.
An example of a splice is provided herein:
assuming that static bits include dates and sequence numbers according to the generation rule of the sub-library and sub-table identifiers, and the positions of the dates, the library indexes, the table indexes and the sequence numbers in the sub-library and sub-table identifiers are respectively as follows: 1-8,9,10, 11-13; and the date, the library index, the table index and the sequence number corresponding to the current database write access request are 20120101, 2,4 and 001 respectively, so that 2012010124001 sub-library and sub-table identifiers can be obtained by splicing.
105, routing the library index and the table index in the sub-library sub-table identifier corresponding to the database write access request according to the generation rule of the sub-library sub-table identifier;
and the routing is a process of searching the table and the library corresponding to the sub-library sub-table identifier corresponding to the database write access request.
In a specific implementation, the sub-database sub-table identifier corresponding to the database write access request may be analyzed according to the generation rule of the sub-database sub-table identifier to obtain the database index and the table index therein, and then the database and the data table corresponding to the database write access request may be obtained by searching according to the library index and the table index obtained by the analysis. Since routing is well known in the art, it is not described herein.
And 106, writing the data to be written into a data table under a database corresponding to the routing result.
The advantages of the present application are illustrated here by comparing the prior art with the present application:
firstly, because fixed parameters are used for database partitioning and table partitioning in the prior art, when the scale of the existing database cannot meet the increasing data volume and needs to meet the requirements in a manner of adding a new database, the rules of database partitioning and table partitioning also need to be changed, and therefore, corresponding data in the old database needs to be synchronously migrated to the new database to be normally used.
Example 1: the rule of database division and table division is that the user ID is the second last, and 1,3, 5, 7 and 9 enter a database A; 0. 2,4, 6 and 8 enter a B library; when a new C library is added to manage data, the rules of database division and table division need to be changed into 1,3 and 5 for the A library, 0,2 and 4 for the B library, and 6, 7, 8 and 9 for the C library in the prior art. After the sub-database and sub-table rule is modified, all data with the penultimate digits of 6, 7, 8 and 9 of the user ID in the original database A and the original database B must be migrated to the database C, otherwise, a new sub-database and sub-table rule is used, so that some data in the old database cannot be read; the data migration undoubtedly increases the difficulty of database maintenance, and consumes a large amount of CPU resources or memory resources.
In the embodiment of the application, both writing data and reading data are routed to the database sub-table identifier, and the database index and the table index in the database sub-table identifier can be used for routing to a unique database and data table information under the database; thus, when the scale of the existing database can not meet the increasing data quantity and the requirement needs to be met by a new database, the sub-database sub-table identification of the written data (old data) can be uniquely routed to the corresponding old database, and the sub-database sub-table identification of the data (new data) to be written can be uniquely routed to the corresponding new database (new database); therefore, the problems of writing the new data into the old database and reading the old data from the new database can be absolutely avoided under the conditions that the database-dividing and table-dividing rules do not need to be changed and the corresponding data in the old database does not need to be migrated to the new database; therefore, the method and the device can improve the convenience of database maintenance and save the physical resources of the database system.
Assume that the library indexes of the library a and the library B in example 1 are 1 and 2, respectively, and the library index of the newly added library C is 3; because the database sub-table identification is routed when data is written, old data is written into the database with the database index of 1 or 2, and only new data can be written into the database C with the database index of 3; and when the old data is read, the database sub-table identification is also routed, and the condition that the data of the A library is read from the C library does not exist, so that the data migration is not needed when the database is expanded.
Second, there are many backup technologies for the database at present, such as dual-computer hot standby, and one purpose of the backup is to enable the standby database immediately and maintain the operation of the application system when the main database fails. For example: the application system is connected with 4 databases, and indexes are respectively 0,1,2 and 3; the traditional database backup method is as follows: corresponding standby banks 0 ', 1 ', 2 ', 3 ' are respectively established for the main banks with indexes of 0,1,2,3, so that when the 0 bank fails, the 0 ' bank is enabled, when the 1 bank fails, the 1 ' bank is enabled, when the 2 bank fails, the 2 ' bank is enabled, and the like.
The conventional database backup method has the following disadvantages:
1. when the main library fails, the switching to the standby library needs application matching switching;
in the technical field, the process of switching the master library to the standby library specifically comprises the following steps: and modifying a DNS (Domain name System) of a main library to point to the standby library, and setting the standby library as the main library so as to achieve the aim of switching the databases through the DNS modification. Because a network needs a period of time to identify DNS address update, a database connection pool of an application system also needs to cache database address information; therefore, in order to achieve the database switching effect quickly and reduce the service impact generated during the switching, the application system needs to be restarted.
2. When the database fails, if the standby database cannot be started normally in a short time, the service is interrupted;
3. when the database is switched to the standby database, if data in the original main database is not synchronized to the standby database in time, data inconsistency of the main database and the standby database occurs, and the data which are not synchronized in the original main database need to be migrated to the standby database.
In the embodiment of the application, the database index in the sub-database and sub-table identification is an index of a currently available database which is dynamically acquired according to a database write access request, wherein the currently available database is used for representing the currently and normally operating database; therefore, in the data writing process, the data can only be written into the database which normally operates at present, and the database which has a fault is automatically eliminated; for an application system, the failure of the database is not sensed at all, so that a plurality of databases accessed by the same application system can be backed up mutually, seamless switching between a main database and a standby database is realized, and service interruption is avoided; moreover, when the main library fails, the cooperative switching of the application system can be avoided,
in addition, the method and the device can effectively avoid the problems that data is lost in the process of switching the main data and the standby data are inconsistent, so that data migration is needed; in addition, the backup library and the corresponding main library have no synchronous relation, and the data does not need to be consistent, so that the master-backup switching can be controlled and flexible.
This is illustrated here by example 2: the application system is connected with 4 databases, and indexes are respectively 0,1,2 and 3; the application mutually uses 4 databases of 0,1,2 and 3 as standby databases, and the standby database of 0 database is 1,2 and 3; 1 backup of library is 0,2, 3; the stock of the 2 stocks is 1,3, 0; the 3 library backup is 0,1, 2.
The database index in the sub-database and sub-table identification is the index of the currently available database which is dynamically acquired according to the database write access request, so that in the data writing process, the data can only be written into the currently normally operated database, and the database with the fault is automatically eliminated; if the 1 bank fails, the data of the application system will not be written into the 1 bank. The scheme for detecting whether the current database is available will be described in detail later.
In a word, the method and the device can realize seamless switching of the main and standby databases and can ensure that the new service continuously operates when the database fails.
It should be noted that, while using the present application, a person skilled in the art may also use a conventional dual hot standby method, for example, in example 2, corresponding standby libraries 0 ', 1', 2 ', 3' and the like are respectively established for the main libraries with indexes of 0,1,2, and 3.
In a preferred embodiment of the present application, the method may further include: and after the data to be written is successfully written, storing the mapping relation between the successfully written data and the corresponding sub-library sub-table identification bits.
Referring to fig. 2, a flowchart of embodiment 2 of a method for accessing a database according to the present application is shown, which may specifically include:
step 201, presetting a generation rule of sub-database and sub-table identifiers;
step 202, after the data to be written is successfully written, storing the mapping relation between the successfully written data and the corresponding sub-library sub-table identifier;
step 203, receiving a database read access request; the database read access request carries data to be read;
step 204, according to the mapping relation between the successfully written data and the corresponding sub-database sub-table identifier, searching to obtain a sub-database sub-table identifier corresponding to the data to be read carried in the database read access request;
step 205, routing the library index and the table index in the sub-library sub-table identifier corresponding to the database read access request according to the generation rule of the sub-library sub-table identifier;
and step 206, reading the data to be read from the data table under the database corresponding to the routing result.
Compared with the embodiment 1, the embodiment 2 introduces the technical scheme of accessing the database according to the database read access request, wherein the database branch table identification needs to be routed in the data reading process. In practical application, after the application system successfully writes data, the sub-database and sub-table identifiers of corresponding data can be stored, so that when data is read from a database, the recorded sub-database and sub-table flag bits can be used as screening conditions to read the data.
In a preferred embodiment of the present application, the step of routing the repository index and the table index in the sub-repository sub-table identifier corresponding to the database read access request according to the generation rule of the sub-repository sub-table identifier may specifically include:
analyzing the library index and the table index in the sub-library sub-table identifier corresponding to the database read access request according to the static bit, the library index and the position of the table index in the sub-library sub-table identifier defined in the generation rule of the sub-library sub-table identifier;
and searching and obtaining a database and a data table corresponding to the database read access request according to the library index and the table index obtained by analysis.
For example, if the sub-database and sub-table identifier of the data to be read is 24, the routing result may be: and data is read from the 5 th tableA under the 3 rd database, so that the data reading process can be smoothly completed.
For better understanding of the present application, referring to a schematic flow chart of the application system accessing the database shown in fig. 3, when the application system 301 accesses the database a, the database B, the database C, and the data D, the application system will perform routing according to the database-splitting rule through the database-splitting component 302; the sub-library and sub-table component 302 can be used as an independent component, and can also be deployed in the application system 301; the process of the application system accessing the database may specifically include:
step S1, the database and table dividing component 302 presets database and table dividing identification which accords with the database and table dividing rule; the sub-database and sub-table identifier may specifically include a static bit and a dynamic bit; the dynamic bits may further include a bank index and a table index;
step S2, the application system 301 receives the service request, prepares to write the service request into the database, and then sends a database write access request to the sub-database and sub-table component 302, where the database write access request carries data to be written;
step S3, the database-dividing and table-dividing component 302 dynamically acquires the currently available database and the data table information under the database according to the database write access request, and obtains the corresponding database index and table index;
step S4, the sub-database sub-table component 302 assembles the static bit, the database index and the table index to obtain a sub-database sub-table identifier which accords with a sub-database sub-table rule and corresponds to the database write access request;
step S5, the database and table dividing component 302 writes the data to be written into a data table under a database corresponding to the routing result;
step S6, the application system 301 receives the service request, prepares to read data from the database according to the service request, and then sends a database read access request to the sub-repository sub-table component 302; the database read access request carries a database sub-table identifier of data to be read;
step S7, the database and table dividing component 302 routes the database index and the table index in the database and table dividing identification corresponding to the database access request according to the database and table dividing rule;
step S8, the database and table dividing component 302 reads the data to be read from the data table under the database corresponding to the routing result.
Corresponding to the foregoing method embodiment, the present application further discloses a device for accessing a database, and with reference to the structure diagram shown in fig. 4, the device may specifically include:
the presetting module 401 is used for presetting the generation rule of the sub-database and sub-table identifiers; (ii) a
A write receiving module 402, configured to receive a database write access request; the database write access request carries data to be written;
a dynamic database table obtaining module 403, configured to dynamically obtain a currently available database and data table information in the database according to the database write access request, and obtain a corresponding database index and a corresponding table index;
an assembling module 404, configured to assemble the library index and the table index together with a static bit according to a generation rule of the sub-library and sub-table identifier, to obtain a sub-library and sub-table identifier corresponding to the database write access request;
a write routing module 405, configured to route the bank index and the table index in the sub-bank sub-table identifier corresponding to the database write access request according to the generation rule of the sub-bank sub-table identifier; and
and a data writing module 406, configured to write the data to be written into a data table in the database corresponding to the routing result.
In a preferred embodiment of the present application, the dynamic library table acquiring module 403 may specifically include:
the random database fetching submodule is used for randomly obtaining a currently available database from a plurality of databases connected with an application system when the database writing access request is received;
and the random table-fetching submodule is used for randomly obtaining a data table from a plurality of data tables under the obtained database.
In another preferred embodiment of the present application, the method further includes a detection module for detecting whether the database is available, where the detection module includes:
the communication detection submodule is used for detecting whether the database is available or not through communication with the database when the database write access request is received; or,
the mark judgment submodule is used for judging whether the database is available or not according to the available marks of the database when the database write access request is received; the available marks are determined by a database administrator according to the state of the database, the available marks corresponding to the fault database are unavailable, and the available marks corresponding to the normal operation database are available.
In yet another preferred embodiment of the present application, the static bits may include at least one or more of the following bits: date, serial number, and ID.
In a preferred embodiment of the present application, the assembling module 404 may specifically include:
and the position corresponding assembling submodule is used for assembling the library index and the table index together with the static bit according to the static bit, the library index and the position of the table index in the database sub-table identifier, which are defined in the generation rule of the database sub-table identifier, so as to obtain the database sub-table identifier corresponding to the database write access request.
In another preferred embodiment of the present application, the write routing module 405 may specifically include:
the writing analysis submodule is used for analyzing the library index and the table index in the sub-library sub-table identifier corresponding to the database writing access request according to the static bit, the library index and the position of the table index in the sub-library sub-table identifier, which are defined in the generation rule of the sub-library sub-table identifier;
and the writing and searching submodule is used for searching and obtaining a database and a data table corresponding to the database writing and accessing request according to the library index and the table index obtained by analysis.
In still another preferred embodiment of the present application, the apparatus may further include:
and the storage module is used for storing the mapping relation between the successfully written data and the corresponding sub-library sub-table identifier after the data to be written is successfully written.
In a preferred embodiment of the present application, the apparatus may further include:
the read receiving module is used for receiving a database read access request; the database read access request carries data to be read;
the identification bit searching module is used for searching and obtaining the database sub-table identification of the database read access request according to the mapping relation between the write-in success data and the corresponding database sub-table identification;
the read routing module is used for routing the library index and the table index in the sub-library sub-table identifier corresponding to the database read access request according to the generation rule of the sub-library sub-table identifier;
and the reading module is used for reading the data to be read from a data table under the database corresponding to the routing result.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
The method and the apparatus for accessing a database provided by the present application are described in detail above, and specific examples are applied herein to illustrate the principles and embodiments of the present application, and the description of the above embodiments is only used to help understand the method and the core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.
Claims (16)
1. A method of accessing a database, comprising:
presetting a generation rule of a sub-database sub-table identifier; the sub-library and sub-table identification comprises a static bit and a dynamic bit, and the dynamic bit comprises a library index and a table index; the database index and the table index in the sub-database and sub-table identification can be used for routing to a unique database and data table information under the database; wherein, the newly added database also has a library index and a table index;
receiving a database write access request; the database write access request carries data to be written;
dynamically acquiring a currently available database and data table information under the database according to the database write access request, and acquiring a corresponding database index and a corresponding table index;
according to the generation rule of the sub-database sub-table identification, the database index and the table index are assembled together with the static bit to obtain the sub-database sub-table identification corresponding to the database write access request;
according to the generation rule of the sub-database sub-table identifier, routing the database index and the table index in the sub-database sub-table identifier corresponding to the database write access request;
and writing the data to be written into a data table under a database corresponding to the routing result.
2. The method of claim 1, wherein the step of dynamically obtaining the currently available database and the table information under the database according to the database write access request comprises:
and when receiving the database write access request, randomly acquiring a currently available database from a plurality of databases connected with the application system, and randomly acquiring a data table from a plurality of data tables under the database.
3. A method according to claim 1 or 2, characterized by detecting whether a database is available by:
when the database write access request is received, detecting whether the database is available or not through communication with the database; or,
when the database write access request is received, judging whether the database is available according to the available marks of the database; the available marks are determined by a database administrator according to the state of the database, the available marks corresponding to the fault database are unavailable, and the available marks corresponding to the normal operation database are available.
4. The method of claim 1 or 2, wherein the static bits comprise at least one or more of: date, serial number, and ID.
5. The method as claimed in claim 1 or 2, wherein the step of assembling the bin index and the table index together with the static bits according to the generation rule of the sub-bin sub-table identifier comprises:
and assembling the library index and the table index together with the static bit according to the static bit, the library index and the position of the table index in the sub-library and sub-table identifier defined in the generation rule of the sub-library and sub-table identifier to obtain the sub-library and sub-table identifier corresponding to the database write access request.
6. The method according to claim 1 or 2, wherein the step of routing the bin index and the table index in the sub-bin sub-table identifier corresponding to the database write access request according to the generation rule of the sub-bin sub-table identifier comprises:
analyzing the library index and the table index in the sub-library sub-table identifier corresponding to the database write access request according to the static bit, the library index and the position of the table index in the sub-library sub-table identifier defined in the generation rule of the sub-library sub-table identifier;
and searching and obtaining a database and a data table corresponding to the database write access request according to the library index and the table index obtained by analysis.
7. The method of claim 1 or 2, further comprising:
and after the data to be written is successfully written, storing the mapping relation between the successfully written data and the corresponding sub-library sub-table identifier.
8. The method of claim 7, further comprising:
receiving a database read access request; the database read access request carries data to be read;
according to the mapping relation between the successfully written data and the corresponding sub-database sub-table identifier, searching to obtain a sub-database sub-table identifier corresponding to the data to be read carried in the database read access request;
routing the database index and the table index in the sub-database sub-table identifier corresponding to the database read access request according to the generation rule of the sub-database sub-table identifier;
and reading the data to be read from a data table under the database corresponding to the routing result.
9. An apparatus for accessing a database, comprising:
the preset module is used for presetting the generation rule of the sub-database and sub-table identifiers; the sub-library and sub-table identification comprises a static bit and a dynamic bit, and the dynamic bit comprises a library index and a table index; the database index and the table index in the sub-database and sub-table identification can be used for routing to a unique database and data table information under the database; wherein, the newly added database also has a library index and a table index;
the write receiving module is used for receiving a database write access request; the database write access request carries data to be written;
the dynamic database table acquisition module is used for dynamically acquiring a currently available database and data table information under the database according to the database write access request and acquiring a corresponding database index and a corresponding table index;
the assembling module is used for assembling the library index and the table index together with the static bit according to the generation rule of the sub-library and sub-table identification to obtain the sub-library and sub-table identification corresponding to the database write access request;
the write routing module is used for routing the database index and the table index in the sub-database sub-table identifier corresponding to the database write access request according to the generation rule of the sub-database sub-table identifier; and
and the data writing module is used for writing the data to be written into a data table under the database corresponding to the routing result.
10. The apparatus of claim 9, wherein the dynamic acquisition library table module comprises:
the random database fetching submodule is used for randomly obtaining a currently available database from a plurality of databases connected with an application system when the database writing access request is received;
and the random table-fetching submodule is used for randomly obtaining a data table from a plurality of data tables under the obtained database.
11. The apparatus of claim 9 or 10, further comprising a detection module that detects whether a database is available, the detection module comprising:
the communication detection submodule is used for detecting whether the database is available or not through communication with the database when the database write access request is received; or,
the mark judgment submodule is used for judging whether the database is available or not according to the available marks of the database when the database write access request is received; the available marks are determined by a database administrator according to the state of the database, the available marks corresponding to the fault database are unavailable, and the available marks corresponding to the normal operation database are available.
12. The apparatus of claim 9 or 10, wherein the static bits comprise at least one or more of: date, serial number, and ID.
13. The apparatus of claim 9 or 10, wherein the mosaic module comprises:
and the position corresponding assembling submodule is used for assembling the library index and the table index together with the static bit according to the static bit, the library index and the position of the table index in the database sub-table identifier, which are defined in the generation rule of the database sub-table identifier, so as to obtain the database sub-table identifier corresponding to the database write access request.
14. The apparatus of claim 9 or 10, wherein the write routing module comprises:
the writing analysis submodule is used for analyzing the library index and the table index in the sub-library sub-table identifier corresponding to the database writing access request according to the static bit, the library index and the position of the table index in the sub-library sub-table identifier, which are defined in the generation rule of the sub-library sub-table identifier;
and the writing and searching submodule is used for searching and obtaining a database and a data table corresponding to the database writing and accessing request according to the library index and the table index obtained by analysis.
15. The apparatus of claim 9 or 10, further comprising:
and the storage module is used for storing the mapping relation between the successfully written data and the corresponding sub-library sub-table identifier after the data to be written is successfully written.
16. The apparatus of claim 15, further comprising:
the read receiving module is used for receiving a database read access request; the database read access request carries data to be read;
the identification bit searching module is used for searching and obtaining a sub-database sub-table identification corresponding to the data to be read carried in the database read access request according to the mapping relation between the write-in successful data and the corresponding sub-database sub-table identification;
the read routing module is used for routing the library index and the table index in the sub-library sub-table identifier corresponding to the database read access request according to the generation rule of the sub-library sub-table identifier;
and the reading module is used for reading the data to be read from a data table under the database corresponding to the routing result.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210380786.5A CN103714097B (en) | 2012-10-09 | 2012-10-09 | A kind of method and apparatus for accessing database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210380786.5A CN103714097B (en) | 2012-10-09 | 2012-10-09 | A kind of method and apparatus for accessing database |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103714097A CN103714097A (en) | 2014-04-09 |
CN103714097B true CN103714097B (en) | 2017-08-08 |
Family
ID=50407081
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210380786.5A Active CN103714097B (en) | 2012-10-09 | 2012-10-09 | A kind of method and apparatus for accessing database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103714097B (en) |
Families Citing this family (42)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104408174B (en) * | 2014-12-12 | 2018-06-19 | 用友网络科技股份有限公司 | Database route device and method |
CN105989015B (en) * | 2015-01-28 | 2021-01-29 | 创新先进技术有限公司 | Database capacity expansion method and device and method and device for accessing database |
CN106202084A (en) * | 2015-04-30 | 2016-12-07 | 阿里巴巴集团控股有限公司 | Date storage method and data storage device |
CN106294423A (en) * | 2015-05-25 | 2017-01-04 | 阿里巴巴集团控股有限公司 | Data base divides wiring method and the device of table |
CN106294421B (en) * | 2015-05-25 | 2020-02-04 | 阿里巴巴集团控股有限公司 | Data writing and reading method and device |
CN106528579A (en) * | 2015-09-15 | 2017-03-22 | 阿里巴巴集团控股有限公司 | Search method, device and system based on sharding structure databases |
CN106557486A (en) * | 2015-09-25 | 2017-04-05 | 阿里巴巴集团控股有限公司 | A kind of storage method and device of data |
CN105335477B (en) * | 2015-10-10 | 2019-09-20 | 北京京东尚科信息技术有限公司 | A kind of operating method and device of database |
CN105426487A (en) * | 2015-11-20 | 2016-03-23 | 北京京东尚科信息技术有限公司 | Distributed database access control method and equipment, distributed database system and expansion method of distributed database system |
CN106980615B (en) * | 2016-01-15 | 2020-09-01 | 阿里巴巴集团控股有限公司 | Service processing method and system |
CN105893466B (en) * | 2016-03-28 | 2019-09-20 | 中国建设银行股份有限公司 | A kind of data processing method and system applied to database |
CN106055587A (en) * | 2016-05-21 | 2016-10-26 | 乐视控股(北京)有限公司 | Partitioning database system and routing method thereof |
CN106909597B (en) * | 2016-06-30 | 2020-07-03 | 阿里巴巴集团控股有限公司 | Database migration method and device |
CN106202441A (en) | 2016-07-13 | 2016-12-07 | 腾讯科技(深圳)有限公司 | Data processing method based on relevant database, device and system |
CN106294565A (en) * | 2016-07-27 | 2017-01-04 | 中国农业银行股份有限公司 | A kind of data bank access method and system |
CN107818115B (en) * | 2016-09-14 | 2022-04-26 | 南京星云数字技术有限公司 | Method and device for processing data table |
CN107038077B (en) * | 2016-11-17 | 2021-07-27 | 创新先进技术有限公司 | Message flood storage method and device |
CN106777031A (en) * | 2016-12-08 | 2017-05-31 | 腾讯音乐娱乐(深圳)有限公司 | A kind of data-base capacity-enlarging method and device |
CN108268517B (en) * | 2016-12-30 | 2021-11-26 | 希姆通信息技术(上海)有限公司 | Method and system for managing labels in database |
CN108737586B (en) * | 2017-04-20 | 2021-09-28 | 互联网域名系统北京市工程研究中心有限公司 | Disaster recovery switching method and device for domain name query service |
CN110069484A (en) * | 2017-08-29 | 2019-07-30 | 苏宁云商集团股份有限公司 | A kind of database divides library method and device |
CN107729402A (en) * | 2017-09-22 | 2018-02-23 | 努比亚技术有限公司 | One kind divides table method, apparatus and computer-readable recording medium |
CN108108434A (en) * | 2017-12-19 | 2018-06-01 | 福建中金在线信息科技有限公司 | A kind of method and device for managing database |
CN108319679B (en) * | 2018-01-30 | 2021-03-23 | 杭州迪普科技股份有限公司 | Method and device for generating primary key |
CN108415797A (en) * | 2018-03-05 | 2018-08-17 | 山东超越数控电子股份有限公司 | A method of avoid server failure switching according to library loss of data |
CN111309471B (en) * | 2018-12-11 | 2024-02-09 | 迈普通信技术股份有限公司 | Data processing method, device and distributed system |
CN111813772B (en) * | 2019-04-12 | 2024-05-07 | 阿里巴巴集团控股有限公司 | Data processing method and device |
CN110750513A (en) * | 2019-09-17 | 2020-02-04 | 福建天泉教育科技有限公司 | Dynamic database capacity expansion method and storage medium |
CN110955666B (en) * | 2019-12-17 | 2023-10-03 | 用友网络科技股份有限公司 | Data processing method and data processing device |
CN111797102A (en) * | 2020-07-06 | 2020-10-20 | 亿度慧达教育科技(北京)有限公司 | Data writing method and device and electronic equipment |
CN112000641B (en) * | 2020-07-31 | 2022-08-30 | 新华三大数据技术有限公司 | Data storage method, device and system |
CN114116699A (en) * | 2020-09-01 | 2022-03-01 | 深圳市珍爱捷云信息技术有限公司 | Data processing method, apparatus, electronic device and computer-readable storage medium |
CN112632085A (en) * | 2021-01-05 | 2021-04-09 | 南方电网深圳数字电网研究院有限公司 | Dynamic sub-table method and device, electronic equipment and storage medium |
CN113094262B (en) * | 2021-03-29 | 2022-10-18 | 四川新网银行股份有限公司 | Method for testing production data based on database and table division |
CN113220691B (en) * | 2021-05-31 | 2024-02-06 | 北京互金新融科技有限公司 | Database table creation method, database table creation device and electronic equipment |
CN113810466B (en) * | 2021-08-12 | 2024-04-09 | 北京科东电力控制系统有限责任公司 | Middleware for multi-source heterogeneous data, system and method for applying the middleware |
CN114238313B (en) * | 2021-11-30 | 2025-07-11 | 上海绚显科技有限公司 | Group database sub-library and sub-table and group information query method and device |
CN114443650A (en) * | 2021-12-31 | 2022-05-06 | 航天信息软件技术有限公司 | Method and device for dividing database and table according to time |
CN114637744A (en) * | 2022-02-18 | 2022-06-17 | 深圳联想懂的通信有限公司 | Database processing method and device, electronic equipment and storage medium |
CN114817331A (en) * | 2022-05-11 | 2022-07-29 | 浪潮软件股份有限公司 | Warehouse-dividing and table-dividing routing method and system |
CN115016985A (en) * | 2022-06-27 | 2022-09-06 | 平安付科技服务有限公司 | Data sub-database method and system |
CN118916343A (en) * | 2024-06-03 | 2024-11-08 | 华能信息技术有限公司 | Dynamic library and table dividing method based on business requirements |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7464072B1 (en) * | 2001-06-18 | 2008-12-09 | Siebel Systems, Inc. | Method, apparatus, and system for searching based on search visibility rules |
TW591441B (en) * | 2003-07-28 | 2004-06-11 | Accton Technology Corp | Database system and data access method thereof |
CN102053982B (en) * | 2009-11-02 | 2017-03-01 | 阿里巴巴集团控股有限公司 | A kind of database information management method and equipment |
CN102262626B (en) * | 2010-05-24 | 2013-08-07 | 阿里巴巴集团控股有限公司 | Method and device for storing data in database |
CN102567399B (en) * | 2010-12-31 | 2014-06-11 | 北京新媒传信科技有限公司 | Method and device for accessing database |
-
2012
- 2012-10-09 CN CN201210380786.5A patent/CN103714097B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN103714097A (en) | 2014-04-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103714097B (en) | A kind of method and apparatus for accessing database | |
CN106294421B (en) | Data writing and reading method and device | |
CN104202375A (en) | Method and system for synchronous data | |
US20150143065A1 (en) | Data Processing Method and Apparatus, and Shared Storage Device | |
CN106934048A (en) | Online data moving method, agent node | |
CN106855871B (en) | Data migration method and device | |
CN102955845A (en) | Data access method and device as well as distributed database system | |
CN111212111A (en) | Object storage service management method and electronic equipment | |
CN107590019B (en) | A method and device for data storage | |
CN107085546B (en) | Data management method and device based on fault domain technology | |
CN109597903B (en) | Image file processing apparatus and method, file storage system, and storage medium | |
CN111638853A (en) | Data storage method and device, storage cluster, gateway equipment and main equipment | |
CN105740049B (en) | A kind of control method and device | |
CN113297171A (en) | Database migration method and device and database cluster | |
CN110008197A (en) | A kind of data processing method, system and electronic equipment and storage medium | |
CN109981569B (en) | Network system access method, device, computer equipment and readable storage medium | |
CN113970998B (en) | Information processing method, device, terminal and storage medium | |
CN107357691B (en) | Method and device for processing mirror image file | |
CN105656665A (en) | Switch port configuring method and switch | |
CN109039939B (en) | Load sharing method and device | |
CN113434470B (en) | Data distribution method and device and electronic equipment | |
US10970285B2 (en) | Grid topology change in a distributed data grid when iterating on the contents of the data grid | |
CN118170783A (en) | Data processing method, equipment and storage medium of distributed storage system | |
CN105718539A (en) | Database application method and apparatus | |
CN114764403A (en) | Data migration method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20191210 Address after: P.O. Box 31119, grand exhibition hall, hibiscus street, 802 West Bay Road, Grand Cayman, Cayman Islands Patentee after: Innovative advanced technology Co., Ltd Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands Patentee before: Alibaba Group Holding Co., Ltd. |
|
TR01 | Transfer of patent right |