Database migration method, server and computer storage medium

By creating new isomorphic tables and performing partition processing during the database migration process, the database migration task is efficiently completed, the problem of long import time in enterprise-level database migration is solved, and migration efficiency and data security are improved.

CN110659259BActive Publication Date: 2024-09-24GUANGDONG GAOHANG INTELLECTUAL PROPERTY OPERATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910826448.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-03
Publication Date
2024-09-24
Estimated Expiration
2039-09-03

AI Technical Summary

Technical Problem

During the enterprise-level database migration process, the large amount of table data results in a long import time, affecting migration efficiency and data security.

Method used

By creating a new isomorphic table on the first server, importing the table data of the database to be migrated, and performing partition processing in the temporary file storage area, the partitioned table can be imported into the target database in parallel, and multi-concurrency methods can be used to shorten the import time.

Benefits of technology

It significantly shortens the time required to import table data into the target database, improves the efficiency of database migration tasks, and reduces risks and waiting times during the migration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110659259B
    Figure CN110659259B
Patent Text Reader

Abstract

The present application provides a database migration method, a server, and a computer storage medium, which are used to shorten the time required to import table data into a target database and improve the migration efficiency of the task of migrating a database to be migrated. The method includes: a first server receives an indication message sent by a second server, the indication message is used to indicate the data table structure of the database to be migrated, and the database to be migrated is a database located on the second server and waiting to be migrated to the first server; the first server creates a new isomorphic table with the same data table structure as the database to be migrated; the first server imports the table data of the database to be migrated sent by the second server into the isomorphic table; the first server partitions the isomorphic table with the imported table data in a temporary file storage area to obtain a partition table; the first server imports the partition table into a local target database in parallel to complete the migration of the database to be migrated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of databases, and in particular to a database migration method, a server, and a computer storage medium. Background Art

[0002] Database (DB) is a warehouse that organizes, stores and manages data according to data structure. There are many types of databases, from the simplest tables that store various data to large database systems that can store massive amounts of data, which have been widely used in various aspects. In the information society, fully and effectively managing and utilizing various information resources is a prerequisite for scientific research and decision-making management. Database technology is the core part of various information systems such as management information systems, office automation systems, and decision support systems. It is an important technical means for scientific research and decision-making management. Obviously, the application of databases is extremely important.

[0003] Database maintenance is an important part of database management. In database maintenance, system data can be backed up so that the system can be restored in case of abnormal situations such as system paralysis and failure to ensure data security. In actual database maintenance, the database can be migrated to back up the data of the local database on a remote server, further avoiding the adverse effects of hardware problems on the server to which the local database belongs.

[0004] In enterprise-level databases, the amount of table data is often measured in TBs. When the server performs a database migration task, it imports the table data sent from other servers into the local target database. This takes a long time to complete the database migration task, which in turn brings inconvenience to the application of database migration. Summary of the invention

[0005] The present application provides a database migration method, a server and a computer storage medium for shortening the time required to import table data into a target database and improving the migration efficiency of database migration tasks.

[0006] In a first aspect, the present application provides a database migration method, the method comprising:

[0007] The first server receives the indication information sent by the second server, where the indication information is used to indicate the data table structure of the database to be migrated, where the database to be migrated is a database located on the second server and waiting to be migrated to the first server;

[0008] The first server creates a new isomorphic table with the same data table structure as the database to be migrated;

[0009] The first server imports the table data of the database to be migrated sent by the second server into the isomorphic table;

[0010] The first server partitions the homogeneous table into which the table data has been imported in the temporary file storage area to obtain a partition table;

[0011] The first server imports the partition table into the local target database in parallel to complete the migration of the database to be migrated.

[0012] In combination with the first aspect of the present application, in a first possible implementation manner of the first aspect of the present application, the method further includes:

[0013] The first server obtains the data type of the database to be migrated and the data type of the target database respectively;

[0014] The first server detects whether the data type of the database to be migrated and the data type of the target database are the same;

[0015] If they are different, the first server converts the data type of the partition table into the data type of the target database in the temporary file storage area.

[0016] In combination with the first aspect of the present application, in a second possible implementation manner of the first aspect of the present application, the first server importing the partition table into the target database specifically includes:

[0017] The first server detects whether there is table data with a dependency relationship in the partition table;

[0018] If so, the first server detects whether the table data with the dependency relationship has been completely imported into the target database according to a preset detection period during the process of importing the table data with the dependency relationship into the target database;

[0019] If the data is not completely imported into the target database, the first server waits until the table data with the dependency relationship is completely imported into the target database, and then imports the remaining table data in the partition table into the target database.

[0020] In combination with the first aspect of the present application, in a third possible implementation manner of the first aspect of the present application, the method further includes:

[0021] The first server receives a database migration request sent by the second database;

[0022] The first server establishes a temporary data transmission connection between the first server and the second server according to the database migration request;

[0023] After the first server receives the table data of the database to be migrated sent by the second server according to the temporary data transmission connection, the first server closes the temporary data transmission connection.

[0024] In combination with the third possible implementation of the first aspect of the present application, in a fourth possible implementation of the first aspect of the present application, the first server partitions the isomorphic table of the imported table data in the temporary file storage area, and the partition table obtained includes:

[0025] The first server obtains the partitioning rule carried in the database migration request;

[0026] The first server partitions the isomorphic table of the imported table data in the temporary file storage area according to the partitioning rule to obtain a partition table.

[0027] In combination with the fourth possible implementation of the first aspect of the present application, in a fifth possible implementation of the first aspect of the present application, the partitioning rules include event information, physical object information, virtual object information and date information.

[0028] In combination with the first aspect of the present application, in a sixth possible implementation manner of the first aspect of the present application, the method further includes:

[0029] When the first server imports the partition table into the target database, the first server sends feedback information to the second server, where the feedback information is used to indicate that the first server has completed the database migration task of the database to be migrated.

[0030] In a second aspect, the present application provides a first server, the first server comprising:

[0031] A receiving unit, configured to receive indication information sent by the second server, where the indication information is used to indicate a data table structure of a database to be migrated, where the database to be migrated is a database located on the second server and waiting to be migrated to the first server;

[0032] A construction unit constructs an isomorphic table corresponding to the data table structure of the database to be migrated;

[0033] An import unit, used to import the table data of the database to be migrated sent by the second server into the isomorphic table;

[0034] A partition unit is used to partition the homogeneous table of the imported table data in the temporary file storage area to obtain a partition table;

[0035] The import unit is also used to import the partition table into the local target database in parallel to complete the migration of the database to be migrated.

[0036] In conjunction with the second aspect of the present application, in a first possible implementation manner of the second aspect of the present application, the first server further includes:

[0037] An acquisition unit, used to respectively acquire the data type of the database to be migrated and the data type of the target database;

[0038] A detection unit, used to detect whether the data type of the database to be migrated and the data type of the target database are the same, and if they are different, triggering the conversion unit;

[0039] The conversion unit is used to convert the data type of the partition table into the data type of the target database in the temporary file storage area.

[0040] In conjunction with the second aspect of the present application, in a second possible implementation of the second aspect of the present application, the import unit is specifically used to:

[0041] Check whether the partition table has table data with dependencies;

[0042] If so, in the process of importing the table data with the dependency relationship into the target database, it is detected according to a preset detection cycle whether the table data with the dependency relationship has been completely imported into the target database;

[0043] If the data is not completely imported into the target database, wait until the data of the tables with dependencies are completely imported into the target database, and then import the remaining table data in the partition table into the target database.

[0044] In combination with the second aspect of the present application, in a third possible implementation manner of the second aspect of the present application, the receiving unit is further configured to:

[0045] receiving a database migration request sent by the second database;

[0046] The first server also includes:

[0047] an establishing unit, configured to establish a temporary data transmission connection between the first server and the second server according to the database migration request;

[0048] The closing unit is used to close the temporary data transmission connection after the first server receives the table data of the database to be migrated sent by the second server according to the temporary data transmission connection.

[0049] In combination with the third possible implementation of the second aspect of the present application, in a fourth possible implementation of the second aspect of the present application, the partition unit is specifically used to:

[0050] Get the partitioning rules carried in the database migration request;

[0051] In the temporary file storage area, the isomorphic table of the imported table data is partitioned according to the partitioning rules to obtain a partition table.

[0052] In combination with the fourth possible implementation of the second aspect of the present application, in a fifth possible implementation of the second aspect of the present application, the partitioning rules include event information, physical object information, virtual object information and date information.

[0053] In combination with the second aspect of the present application, in a sixth possible implementation manner of the second aspect of the present application, the first server further includes:

[0054] The sending unit is used to send feedback information to the second server when the importing unit imports the partition table into the target database, where the feedback information is used to indicate that the first server has completed the database migration task of the database to be migrated.

[0055] In a third aspect, the present application provides a server, which includes a processor and a memory, the memory is used to store program code, and the processor is used to call the program code stored in the memory to execute the database migration method as described in the first aspect.

[0056] In a fourth aspect, the present application provides a computer storage medium, which includes instructions, and when the instructions are executed on a computer, the computer executes the database migration method as described in the first aspect.

[0057] From the above, it can be seen that the beneficial effects that can be achieved by this application include:

[0058] After the first server obtains the isomorphic table of the database to be migrated and imports the table data of the database to be migrated into the isomorphic table, the first server first partitions the isomorphic table in the temporary file storage area to obtain a partition table, so that the partition table can be imported into the target database in parallel to complete the migration task of the database to be migrated. Among them, since a multi-concurrency mode is implemented, the time required for importing data into the target database can be greatly shortened, thereby improving the migration efficiency of the database to be migrated task. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 A flowchart of the database migration method of this application;

[0060] Figure 2 This is another flowchart of the database migration method of this application;

[0061] Figure 3 This is another flowchart of the database migration method of this application;

[0062] Figure 4 This is another flowchart of the database migration method of this application;

[0063] Figure 5 This is another flowchart of the database migration method of this application;

[0064] Figure 6 A schematic diagram of the structure of the server of this application;

[0065] Figure 7 This is another structural diagram of the server of this application. DETAILED DESCRIPTION

[0066] The present application provides a database migration method, a server and a computer storage medium for shortening the time required to import table data into a target database and improving the migration efficiency of database migration tasks.

[0067] First, the server (including the first server and the second server) and the database (including the database to be migrated and the target database) involved in the present application are introduced.

[0068] In the present application, the server is used to provide computing servers with high-speed computing processing capabilities. The relevant database is configured under the setting of the staff. The server can be an independently running server device, or it can also be a server device cluster.

[0069] The database is configured in the server through program code to provide database data storage services. The data in the database is managed through the data structure of the table. The staff can add, intercept, update or delete operations on the database. The data storage structure of the database can be divided into relational and non-relational, specifically Oracle, MySQL, SQL Server, DB2 or Sybas and other database products.

[0070] In the present application, when the first server migrates the database to be migrated from the second server to the local server, by applying the database migration method of the present application and adopting a multi-concurrency mode, the migration efficiency of the database to be migrated can be improved.

[0071] Next, the specific content of this application will be introduced in detail.

[0072] See also Figure 1 , Figure 1 A schematic diagram of a process flow of the database migration method of the present application is shown. Specifically, the database migration method of the present application may include the following steps:

[0073] Step S101, the first server receives instruction information sent by the second server;

[0074] The indication information is used to indicate the data table structure of the database to be migrated, and the database to be migrated is a database located in the second server and waiting to be migrated to the first server.

[0075] In the present application, the migration task of the database to be migrated can be triggered by the first server or the second server. The task information of the migration task identifies the original address of the database to be migrated (the second server) and the target migration address (the first server).

[0076] After triggering or determining the migration task of the database to be migrated, the second server can send the above-mentioned indication information to the first server according to the address of the first server pointed to by the task, so as to indicate the data table structure of the database to be migrated locally on the second server, and trigger the first server to perform subsequent processing of the database migration method of the present application.

[0077] Step S102, the first server creates a new isomorphic table with the same data table structure as the database to be migrated;

[0078] After receiving the indication information sent by the second server, the first server may extract identification information indicating the data table structure of the database to be migrated from the reserved field in the indication information.

[0079] It is understandable that in actual applications, the same database product will have different data table structures during the specific data storage process due to differences in storage information, management methods, etc., in order to adapt to actual data storage needs.

[0080] Therefore, in the present application, the first server first creates a new isomorphic table locally with the same data table structure as that of the database to be migrated.

[0081] It should be noted that the isomorphic table at this time is a newly created table, that is, a new table in which no specific data is written.

[0082] Step S103, the first server imports the table data of the database to be migrated sent by the second server into the isomorphic table;

[0083] During the database migration process, the second server, in addition to sending the above instruction information to the first server, also sends the table data of the database to be migrated to the first server.

[0084] It can be understood that the essence of database migration is to migrate the table data in the database, and the establishment of the above-mentioned isomorphic tables is to accommodate, store and encapsulate these table data.

[0085] Therefore, after receiving the table data of the database to be migrated sent by the second server, the first server can import the table data of the database to be migrated into the newly created isomorphic table in the above step S102.

[0086] Step S104, the first server partitions the isomorphic table of the imported table data in the temporary file storage area to obtain a partition table;

[0087] In the present application, it can be understood that when the isomorphic table with imported table data is obtained, the database migration task is not completed yet, and the isomorphic table needs to be imported into the target database of the database migration task.

[0088] In the prior art, when executing a database migration task, the first server directly imports the table data sent by the second server into the local target database. During the import process, if the amount of table data is large, it means a longer import time. In an enterprise-level database, the amount of table data is often in TB. Therefore, the database migration method in the prior art requires a longer import time, and business services and related staff need to wait for a long time. Moreover, for important data, a longer import time is often accompanied by greater variables, such as power outages, downtime, or accidental touch by personnel, which also leads to a certain degree of risk of database migration failure.

[0089] In the present application, the table data sent by the second server is first imported into a newly created isomorphic table, and then the isomorphic table is partitioned in a temporary file storage area configured for this database migration task to obtain a differentiated table.

[0090] It can be understood that the partition table includes different table partitions, which are scattered in discontinuous physical storage locations and can provide multiple different input / output (I / O) interfaces. Therefore, the first server can read and write different table partitions separately at the same time, thereby improving the access performance upper limit of homogeneous tables.

[0091] When the database is partitioned, you can add identifiers to facilitate retrieval of data from different partitions and locate the corresponding physical storage locations.

[0092] Step S105: The first server imports the partition table into the local target database in parallel to complete the migration of the database to be migrated.

[0093] After obtaining the partition table corresponding to the isomorphic table, the first server can now take advantage of the partition table to access the I / O interfaces of different table partitions, and import the table data of different table partitions in parallel into the target database of this database migration task in a relatively short time, thereby completing the migration of the database to be migrated.

[0094] After the partition table is imported into the target database in parallel, the first server can perform operations such as data reading and writing or update maintenance through the operation of the target database.

[0095] From the above, it can be seen that after the first server obtains the isomorphic table of the database to be migrated and imports the table data of the database to be migrated into the isomorphic table, the first server first partitions the isomorphic table in the temporary file storage area to obtain a partition table, so that the partition table can be imported into the target database in parallel to complete the migration task of the database to be migrated. Among them, since a multi-concurrency mode is implemented, the time required to import the table data into the target database can be greatly shortened, thereby improving the migration efficiency of the database migration task.

[0096] In an optional embodiment, to improve the compatibility of the database migration method of the present application, refer to Figure 2 Another flow chart of the database migration method of the present application is shown in FIG. Figure 1 In the corresponding embodiment, the following steps may also be included:

[0097] Step S201, the first server obtains the data type of the database to be migrated and the data type of the target database respectively;

[0098] Specifically, the first server retrieves the database name from the data in the database to be migrated and the target database. For example, if a large number of "oralce" keywords are retrieved, the database can be identified as an Oracle database; or, the attribute information of the database can be retrieved. It can be understood that when the database is deployed on the server, configuration files such as the registry and version information will be configured. These configuration files contain the attribute information of the database, and the attribute information can carry information about the database type of the database.

[0099] Step S202, the first server detects whether the data type of the database to be migrated and the data type of the target database are the same, if they are different, triggering step S203;

[0100] After obtaining the database types of the database to be migrated and the target database, the first server may perform a comparison, and if the two are databases of different types, the subsequent step S203 is executed.

[0101] Step S203: the first server converts the data type of the partition table into the data type of the target database in the temporary file storage area.

[0102] The first server can change the table structure according to different database types, and perform operations such as keyword replacement, addition and deletion, etc. to convert the data type of the partition table into the data type of the target database to adapt to the data storage structure of the target database.

[0103] It can be understood that the first server can directly convert the data type of the table data sent from the second server. However, in the present application, since the table data is also partitioned, as mentioned above, multiple partition tables can provide multiple I / O interfaces. For this reason, a parallel data type conversion can also be performed in parallel, which greatly improves the conversion efficiency of data conversion. Therefore, when the database type of the database to be migrated and the target database are different, the setting of the partition table not only improves the compatibility, but also shortens the conversion time required for data conversion and improves the migration efficiency. This setting is more suitable for application scenarios in which database system upgrades are performed in actual applications.

[0104] In yet another optional embodiment, see Figure 3 , Figure 3 Another schematic diagram of the process flow of the database migration method of the present application is shown. Figure 1 In step S105 of the corresponding embodiment, the following optimization settings may be further included:

[0105] Step S301, the first server detects whether there is table data with a dependency relationship in the partition table, and if so, triggers step S302;

[0106] It can be understood that in some table data, there are dependencies between the table data, and the dependencies need to be kept intact to achieve the use effect.

[0107] In order to ensure the preservation of the dependency relationships of these table data and protect the integrity of the dependency relationships, the first server may also periodically monitor the import status of these table data during the process of importing the partition tables into the target database in parallel.

[0108] First, the first server identifies whether there is table data with a dependency relationship in the partition table. It can be understood that the table data with a dependency relationship can be identified through dependency identification, mapping relationship information, and the like.

[0109] Step S302, during the process of importing the table data with dependency relationship into the target database, the first server detects whether the table data with dependency relationship has been completely imported into the target database according to a preset detection period, and if it has not been completely imported into the target database, step S303 is triggered;

[0110] After identifying the table data with dependencies, when the table data starts to be imported into the target database, the first server can regularly monitor their import progress. If it is not completed, step S303 is executed; if it is completed, the remaining table data in the partition table continues to be imported.

[0111] Step S303: the first server waits until the table data with dependency relationship has been completely imported into the target database, and then imports the remaining table data in the partition table into the target database.

[0112] To ensure the integrity of table data with dependencies, in the present application, the first server distinguishes these table data from other table data. When importing these table data with dependencies, new table data is no longer imported at the same time. After these table data with dependencies are imported, the remaining table data in the partition table is imported to complete the migration of the database to be migrated.

[0113] Therefore, when importing these table data with dependency relationships, interference from other table data is avoided, thereby ensuring the integrity of the dependency relationships.

[0114] In practical applications, the above monitoring period, or scanning period, can be set to 2 minutes, 3 minutes or 5 minutes, without specific limitation.

[0115] In yet another embodiment, see Figure 4 , Figure 4 Another schematic diagram of the process flow of the database migration method of the present application is shown in Figure 1 In the corresponding embodiment, the following steps may be specifically included:

[0116] Step S401, the first server receives a database migration request sent by the second database;

[0117] It can be understood that in this scenario, the second server triggers the current database migration task according to the database migration request.

[0118] Furthermore, the database migration request may also carry the above Figure 1 The indication information mentioned in step S101 in the corresponding embodiment is used to save the sending cost of the signaling message.

[0119] Step S402: the first server establishes a temporary data transmission connection between the first server and the second server according to the database migration request;

[0120] Next, after the first server triggers the current database migration task, the first server may establish a dedicated connection for the current database migration task.

[0121] It can be understood that there may originally be some connections between the first server and the second server for signaling interaction for normal work. In order to avoid occupying too many network resources of the original connection or affecting the normal work involved in the original connection, and to facilitate the division of this database migration task from the original work tasks of the server, a dedicated connection for this database migration task can be used. The dedicated connection can also be configured with a larger bandwidth to ensure that the table data can be transmitted in the first time, saving computing pressure and processing events.

[0122] Step S403: After the first server receives the table data of the database to be migrated sent by the second server according to the temporary data transmission connection, the first server closes the temporary data transmission connection.

[0123] After the table data of the database to be migrated is transferred through the dedicated connection for this database migration - the temporary data transfer connection, the first server can close it to release network resources.

[0124] Among them, since the data transmission connection between the first server and the second server is temporarily set up, it has a high timeliness for this database migration task. Therefore, it can not only save the maintenance cost of the data transmission connection between the first server and the second server, but also promote the security and confidentiality of the data.

[0125] In addition, encryption settings can be introduced into the temporary data transmission connection to further improve the security and confidentiality of the data.

[0126] In yet another embodiment, see Figure 5 , Figure 5 Another schematic diagram of the process flow of the database migration method of the present application is shown in Figure 1 In the corresponding embodiment, step S104 may specifically include the following steps:

[0127] Step S501: The first server obtains the partition rule carried in the database migration request;

[0128] Understandably, Figure 4 In the corresponding embodiment, the database migration request sent by the second server may also carry a partition rule corresponding to the database to be migrated in the reserved field, and the partition rule is used to indicate into which blocks of data tables the homogeneous tables are divided.

[0129] Specifically, taking a database storing business information as an example, the partitioning rules can be based on the specific characteristics of the business information, including event information, physical object information, virtual object information and date information, and partition processing can be performed according to these four different information types.

[0130] Correspondingly, in the database application of the target database, during the initial search, the target database may first simplify the search scope based on the distinction between events, physical objects, virtual objects or dates; and then continue to simplify the search scope based on specific different events, different physical objects, different virtual objects or different dates, so as to quickly and accurately locate the target table data.

[0131] Step S502: the first server partitions the isomorphic table of the imported table data in the temporary file storage area according to the partitioning rule to obtain a partition table.

[0132] After extracting the partitioning rule from the database migration request, the first server partitions the homogeneous table according to the partitioning rule to obtain a partitioned table.

[0133] In yet another embodiment, Figure 1After executing step S105 in the corresponding embodiment, the first server may also send feedback information to the second server to indicate that the first server has completed the database migration task of the database to be migrated, so that the second server side can update, uninstall, maintain and other operations on the database to be migrated.

[0134] The above is a description of the database migration method of this application. The following is an introduction to the server of this application.

[0135] See also Figure 6 , Figure 6 A schematic diagram of the structure of the server of the present application is shown. Specifically, the first server may include:

[0136] The receiving unit 601 is used to receive indication information sent by the second server, where the indication information is used to indicate the data table structure of the database to be migrated, where the database to be migrated is a database located in the second server and waiting to be migrated to the first server;

[0137] A construction unit 602 constructs an isomorphic table corresponding to the data table structure of the database to be migrated;

[0138] An import unit 603 is used to import the table data of the database to be migrated sent by the second server into the isomorphic table;

[0139] Partitioning unit 604, used to partition the isomorphic table of the imported table data in the temporary file storage area to obtain a partition table;

[0140] The import unit 603 is further used to import the partition table into the local target database in parallel to complete the migration of the database to be migrated.

[0141] In a possible embodiment, the first server may further include:

[0142] An acquisition unit 605 is used to respectively acquire the data type of the database to be migrated and the data type of the target database;

[0143] A detection unit 606 is used to detect whether the data type of the database to be migrated is the same as the data type of the target database. If they are different, a conversion unit 607 is triggered;

[0144] The conversion unit 607 is used to convert the data type of the partition table into the data type of the target database in the temporary file storage area.

[0145] In another possible embodiment, the import unit 603 may be specifically configured to:

[0146] Check whether the partition table has table data with dependencies;

[0147] If so, in the process of importing the table data with the dependency relationship into the target database, it is detected according to a preset detection cycle whether the table data with the dependency relationship has been completely imported into the target database;

[0148] If the data is not completely imported into the target database, wait until the data of the tables with dependencies are completely imported into the target database, and then import the remaining table data in the partition table into the target database.

[0149] In yet another possible embodiment, the receiving unit 601 is further configured to:

[0150] receiving a database migration request sent by the second database;

[0151] The first server may further include:

[0152] An establishing unit 608 is used to establish a temporary data transmission connection between the first server and the second server according to the database migration request;

[0153] The closing unit 609 is configured to close the temporary data transmission connection after the first server receives the table data of the database to be migrated sent by the second server according to the temporary data transmission connection.

[0154] In yet another possible embodiment, the partition unit 604 may be specifically configured to:

[0155] Get the partitioning rules carried in the database migration request;

[0156] In the temporary file storage area, the isomorphic table of the imported table data is partitioned according to the partitioning rules to obtain a partition table.

[0157] In yet another possible embodiment, the partition rule may include event information, physical object information, virtual object information, and date information.

[0158] In yet another possible embodiment, the first server may further include:

[0159] The sending unit 610 is configured to send feedback information to the second server when the importing unit imports the partition table into the target database, where the feedback information is used to indicate that the first server has completed the database migration task of the database to be migrated.

[0160] The above is an introduction to the server in this application from the perspective of modular functional entities, and the following is an introduction to the server in this application from the perspective of hardware structure.

[0161] See also Figure 7 , Figure 7A schematic diagram of the structure of the server of the present application is shown, the server includes: a processor 701, a memory 702, the memory 702 is used to store program code, the processor 701 is used to call the program code stored in the memory 702 to execute the following Figures 1 to 5 The database migration method in the corresponding embodiment; or, the processor 701 calls the program code stored in the memory 702 to execute the above Figure 6 The functions of each unit in the corresponding embodiment.

[0162] The processor 701 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the server, and uses various interfaces and lines to connect various parts of the entire server.

[0163] The memory 702 can be used to store computer programs and / or modules. The processor 701 implements various functions of the server by running or executing the computer programs and / or modules stored in the memory 702 and calling the data stored in the memory 702. The memory 702 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the server (such as audio data, video data, etc.), etc. In addition, the memory 702 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0164] The server may further include an input-output unit, and the processor 701 , the memory 702 , and the input-output unit may be connected via a bus.

[0165] The input-output unit may also be replaced by an input unit and an output unit, which may be the same or different physical entities. When they are the same physical entities, they may be collectively referred to as input-output units. The input-output unit may be a transceiver.

[0166] The memory 702 may be integrated into the processor 701 or may be provided separately from the processor 701 .

[0167] The present application also provides a computer storage medium on which a computer program is stored, which, when executed on a computer, enables the computer to execute the following Figures 1 to 5 The database migration method in the corresponding embodiment.

[0168] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM) and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0169] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the server and its units described above can refer to Figures 1 to 5 The description of the database migration method in the corresponding embodiment will not be repeated here in detail.

[0170] In summary, the database migration method, server and computer storage medium provided by the present application, after the first server obtains the isomorphic table of the database to be migrated and imports the table data of the database to be migrated into the isomorphic table, the first server first partitions the isomorphic table in the temporary file storage area to obtain the partition table, so that the partition table can be imported into the target database in parallel to complete the migration task of the database to be migrated. Among them, since a multi-concurrency mode is implemented, the time required for importing data into the target database can be greatly shortened, thereby improving the migration efficiency of the database migration task.

[0171] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the inspiration of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims. All equivalent structures or equivalent process changes made using the contents of the specification and drawings of this application, or directly or indirectly used in other related technical fields, are protected by the present application.

Claims

1. A database migration method, It is characterized in that The method comprises: The first server receives indication information sent by the second server, where the indication information is used to indicate a data table structure of a database to be migrated, where the database to be migrated is a database located on the second server and waiting to be migrated to the first server; The first server creates a new isomorphic table with the same data table structure as that of the database to be migrated; The first server imports the table data of the database to be migrated sent by the second server into the isomorphic table; The first server partitions the isomorphic table into which the table data has been imported in a temporary file storage area to obtain a partition table, wherein the partition table includes different table partitions dispersed in discontinuous physical storage locations; The first server accesses the I / O interfaces of different table partitions according to the partition table, imports the table data of different table partitions into the local target database in parallel, and completes the migration of the database to be migrated; The first server partitions the isomorphic table imported with the table data in the temporary file storage area, and obtains a partition table including: The first server obtains a partition rule carried in the database migration request, where the partition rule includes event information, physical object information, virtual object information, and date information; The first server partitions the isomorphic table imported with the table data in the temporary file storage area according to the partitioning rule to obtain the partition table; The first server accesses I / O interfaces of different table partitions according to the partition table, imports table data of different table partitions into the local target database in parallel, and completes the migration of the database to be migrated, including: The first server detects whether the partition table has table data with a dependency relationship; If so, the first server detects whether the table data with the dependency relationship has been completely imported into the target database according to a preset detection period during the process of importing the table data with the dependency relationship into the target database; If the data is not completely imported into the target database, the first server waits until the table data with the dependency relationship is completely imported into the target database, and then imports the remaining table data in the partition table into the target database.

2. The method according to claim 1, It is characterized in that The method further comprises: The first server obtains the data type of the database to be migrated and the data type of the target database respectively; The first server detects whether the data type of the database to be migrated and the data type of the target database are the same; If they are different, the first server converts the data type of the partition table into the data type of the target database in the temporary file storage area.

3. The method according to claim 1, It is characterized in that The method further comprises: The first server receives a database migration request sent by the second database; The first server establishes a temporary data transmission connection between the first server and the second server according to the database migration request; After the first server receives the table data of the database to be migrated sent by the second server according to the temporary data transmission connection, the first server closes the temporary data transmission connection.

4. The method according to claim 1, It is characterized in that The method further comprises: When the first server imports the partition table into the target database, the first server sends feedback information to the second server, where the feedback information is used to indicate that the first server has completed the database migration task of the database to be migrated.

5. A first server, It is characterized in that The first server executes the method according to any one of claims 1 to 4, and the first server includes: A receiving unit, configured to receive indication information sent by the second server, wherein the indication information is used to indicate a data table structure of a database to be migrated, wherein the database to be migrated is a database located on the second server and waiting to be migrated to the first server; A construction unit constructs an isomorphic table corresponding to the data table structure of the database to be migrated; An importing unit, configured to import the table data of the database to be migrated sent by the second server into the isomorphic table; A partitioning unit, used for partitioning the isomorphic table into which the table data has been imported in a temporary file storage area to obtain a partition table, wherein the partition table includes different table partitions dispersed in discontinuous physical storage locations; The import unit is used to access the I / O interfaces of different table partitions according to the partition table, import the table data of different table partitions into the local target database in parallel, and complete the migration of the database to be migrated; The partition unit is specifically used for: Acquire a partition rule carried in the database migration request, where the partition rule includes event information, entity object information, virtual object information, and date information; In the temporary file storage area, the isomorphic table of the imported table data is partitioned according to the partitioning rules to obtain a partition table; The introduction unit is specifically used for: Check whether the partition table has table data with dependencies; If so, in the process of importing the table data with the dependency relationship into the target database, it is detected according to a preset detection cycle whether the table data with the dependency relationship has been completely imported into the target database; If the data is not completely imported into the target database, wait until the data of the dependent tables is completely imported into the target database, and then import the remaining table data in the partition table into the target database.

6. The first server according to claim 5, It is characterized in that The first server also includes: An acquisition unit, used to respectively acquire the data type of the database to be migrated and the data type of the target database; A detection unit, used to detect whether the data type of the database to be migrated and the data type of the target database are the same, and if they are different, triggering the conversion unit; The conversion unit is used to convert the data type of the partition table into the data type of the target database in the temporary file storage area.

7. The first server according to claim 5, It is characterized in that The first server also includes: an establishing unit, configured to establish a temporary data transmission connection between the first server and the second server according to the database migration request; The closing unit is used to close the temporary data transmission connection after the first server receives the table data of the database to be migrated sent by the second server according to the temporary data transmission connection.

8. The first server according to claim 5, It is characterized in that The first server also includes: The sending unit is used to send feedback information to the second server when the importing unit imports the partition table into the target database, where the feedback information is used to indicate that the first server has completed the database migration task of the database to be migrated.

9. A server, It is characterized in that The server includes a processor and a memory, wherein the memory is used to store program codes, and the processor is used to call the program codes stored in the memory to execute the method according to any one of claims 1 to 4.

10. A computer storage medium, It is characterized in that The method comprises instructions which, when executed on a computer, cause the computer to perform the method as claimed in any one of claims 1 to 4.