Data migration method, device and equipment
By automatically identifying the dependencies between database objects and applications and dividing the migration collection, the problem of low migration efficiency in the existing technology is solved and efficient database migration is achieved.
Patent Information
- Application Number
- CN202310149771.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-14
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2043-02-14
AI Technical Summary
During the migration of enterprise databases, the existing technology requires manual sorting out object dependencies and application dependencies, resulting in low migration efficiency.
By obtaining the object creation information of the database to be migrated and the operation information of the application, the object dependencies and application dependencies are automatically identified, and the migration collection is divided for database migration.
Improves the efficiency of database migration, reduces migration difficulty and risk, and avoids the impact on other migration collections or applications.
Smart Images

Figure CN115982136B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data migration method, apparatus, and device. Background Art
[0002] In some business scenarios, an enterprise may need to migrate a database to another database, for example, a cloud database.
[0003] In related technologies, enterprises have complex businesses, potentially involving dozens or even hundreds of applications operating multiple objects across multiple databases. Migration requires determining the object dependencies between multiple objects in multiple databases, as well as the application dependencies between applications and multiple objects. Databases can then be migrated based on these object and application dependencies. However, in this process, object dependencies and application dependencies are often manually sorted, resulting in inefficient database migration. Summary of the Invention
[0004] Various aspects of the present application provide a data migration method, apparatus, and device for improving the efficiency of migrating a database.
[0005] In a first aspect, an embodiment of the present application provides a data migration method, the method comprising:
[0006] Get object creation information for multiple databases to be migrated;
[0007] determining object dependency relationships among a plurality of objects in the database according to the object creation information;
[0008] determining, based on operation information of the multiple applications on the multiple objects, application dependency relationships between the multiple applications and the multiple objects;
[0009] At least one migration set is determined from the multiple objects according to the object dependency and the application dependency, and migration processing is performed on the multiple databases according to the at least one migration set.
[0010] In a possible implementation, determining at least one migration set from the multiple objects according to the object dependency and the application dependency includes:
[0011] Determining, according to the object dependency, at least one object group among the plurality of objects, and a unidirectional dependency relationship between the at least one object group, wherein the object group includes at least one object or at least two circularly dependent objects;
[0012] The at least one object group is divided into at least one migration set according to the at least one object group, the unidirectional dependency relationship, and the application dependency relationship.
[0013] In a possible implementation, determining the at least one object group from the multiple objects according to the object dependency includes:
[0014] Perform closed-loop dependency identification based on the object dependencies to obtain at least one closed-loop dependency, where the closed-loop dependency includes M objects, the i-th object depends on the i+1-th object, and the M-th object depends on the 1-th object, where i is 1, 2, ..., M-1, and M is an integer greater than 1;
[0015] For any closed-loop dependency relationship, objects in the closed-loop dependency relationship are determined as an object group.
[0016] In a possible implementation, determining the unidirectional dependency relationship between the at least one object group according to the object dependency relationship includes:
[0017] For any object group, determining the dependency relationship between objects in the object group and objects in other object groups;
[0018] According to the dependency relationship between the objects in the object group and the objects in other object groups, a unidirectional dependency relationship between the object group and the other object groups is determined.
[0019] In a possible implementation, dividing the at least one object group into at least one migration set according to the at least one object group, the unidirectional dependency, and the application dependency includes:
[0020] Dividing the plurality of object groups into at least one to-be-selected migration set according to the unidirectional dependency relationship;
[0021] The at least one migration set to be selected is merged according to the application dependency to obtain the at least one migration set.
[0022] In a possible implementation, dividing the multiple object groups into at least one to-be-selected migration set according to the unidirectional dependency relationship includes:
[0023] determining an object group dependency graph between the plurality of object groups according to the unidirectional dependency relationship;
[0024] According to the object group dependency graph, the object groups having dependency relationships are determined as a candidate migration set to obtain the at least one candidate migration set.
[0025] In a possible implementation, merging the at least one candidate migration set according to the application dependency to obtain the at least one migration set includes:
[0026] For each application, if it is determined according to the application dependency relationship that the objects operated by the application are located in different candidate migration sets, the different candidate migration sets are merged to obtain a corresponding migration set.
[0027] In a possible implementation, the object creation information includes a plurality of object creation statements; and determining object dependencies between the plurality of objects according to the object creation information includes:
[0028] Performing format conversion processing on the multiple object creation statements to obtain multiple abstract syntax tree AST information;
[0029] The object dependency relationship is determined based on the AST information, where the object dependency relationship is used to indicate the objects that each object depends on and the objects that each object depends on.
[0030] In one possible implementation, for any one of the multiple applications, the operation information includes multiple initial operation statements; and determining application dependencies between the multiple applications and the multiple objects based on the operation information of the multiple applications on the multiple objects includes:
[0031] Obtaining the multiple initial operation statements corresponding to the multiple application programs;
[0032] Performing cleaning processing on the multiple initial operation statements to obtain multiple target operation statements, wherein the cleaning processing includes at least one of the following: formatting processing, desensitization processing, or deduplication processing;
[0033] The application dependency is determined according to the multiple target operation statements.
[0034] In a second aspect, an embodiment of the present application provides a data migration device, comprising: an acquisition module, a first determination module, a second determination module, a third determination module, and a migration module, wherein:
[0035] The acquisition module is used to acquire object creation information of multiple databases to be migrated;
[0036] The first determining module is used to determine object dependency relationships between multiple objects in the database according to the object creation information;
[0037] The second determining module is configured to determine application dependency relationships between the multiple applications and the multiple objects based on operation information of the multiple applications on the multiple objects;
[0038] The third determining module is configured to determine at least one migration set from the plurality of objects according to the object dependency and the application dependency;
[0039] The migration module is configured to perform migration processing on the multiple databases according to the at least one migration set.
[0040] In a possible implementation, the third determining module is specifically configured to:
[0041] Determining, according to the object dependency, at least one object group among the plurality of objects, and a unidirectional dependency relationship between the at least one object group, wherein the object group includes at least one object or at least two circularly dependent objects;
[0042] The at least one object group is divided into at least one migration set according to the at least one object group, the unidirectional dependency relationship, and the application dependency relationship.
[0043] In a possible implementation, the third determining module is specifically configured to:
[0044] Perform closed-loop dependency identification based on the object dependencies to obtain at least one closed-loop dependency, where the closed-loop dependency includes M objects, the i-th object depends on the i+1-th object, and the M-th object depends on the 1-th object, where i is 1, 2, ..., M-1, and M is an integer greater than 1;
[0045] For any closed-loop dependency relationship, objects in the closed-loop dependency relationship are determined as an object group.
[0046] In a possible implementation, the third determining module is specifically configured to:
[0047] For any object group, determining the dependency relationship between objects in the object group and objects in other object groups;
[0048] According to the dependency relationship between the objects in the object group and the objects in other object groups, a unidirectional dependency relationship between the object group and the other object groups is determined.
[0049] In a possible implementation, the third determining module is specifically configured to:
[0050] Dividing the plurality of object groups into at least one to-be-selected migration set according to the unidirectional dependency relationship;
[0051] The at least one migration set to be selected is merged according to the application dependency to obtain the at least one migration set.
[0052] In a possible implementation, the third determining module is specifically configured to:
[0053] determining an object group dependency graph between the plurality of object groups according to the unidirectional dependency relationship;
[0054] According to the object group dependency graph, the object groups having dependency relationships are determined as a candidate migration set to obtain the at least one candidate migration set.
[0055] In a possible implementation, the third determining module is specifically configured to:
[0056] For each application, if it is determined according to the application dependency relationship that the objects operated by the application are located in different candidate migration sets, the different candidate migration sets are merged to obtain a corresponding migration set.
[0057] In a possible implementation, the object creation information includes multiple object creation statements; and the first determination is specifically used to:
[0058] Performing format conversion processing on the multiple object creation statements to obtain multiple abstract syntax tree AST information;
[0059] The object dependency relationship is determined based on the AST information, where the object dependency relationship is used to indicate the objects that each object depends on and the objects that each object depends on.
[0060] In a possible implementation, for any one of the multiple applications, the operation information includes multiple initial operation statements; and the second determining module is specifically configured to:
[0061] Obtaining the multiple initial operation statements corresponding to the multiple application programs;
[0062] Performing cleaning processing on the multiple initial operation statements to obtain multiple target operation statements, wherein the cleaning processing includes at least one of the following: formatting processing, desensitization processing, or deduplication processing;
[0063] The application dependency is determined according to the multiple target operation statements.
[0064] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor;
[0065] The memory stores computer-executable instructions;
[0066] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the data migration method described in any one of the first aspects.
[0067] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the data migration method described in any one of the first aspects.
[0068] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the data migration method shown in any one of the first aspects.
[0069] The embodiments of the present application provide a data migration method, apparatus, and device. An electronic device can obtain object creation information of multiple databases to be migrated, and determine the object dependency relationship between multiple objects in the database based on the object creation information. The electronic device can determine the application dependency relationship between multiple applications and multiple objects based on the operation information of multiple applications on multiple objects. The electronic device can determine at least one migration set among multiple objects based on the object dependency relationship and the application dependency relationship, and perform migration processing on multiple databases based on the at least one migration set. Because the electronic device can automatically identify the object dependency relationship between multiple objects in the object creation information; can obtain the operation information of the application on multiple objects to automatically determine the application dependency relationship between each application and multiple objects; can divide multiple objects into at least one unrelated migration set, and perform migration processing on multiple databases based on the at least one migration set, there is no need to worry about the impact on other migration sets or applications. Compared with manually sorting out the object dependency relationship and determining the application dependency relationship, the migration difficulty and risk are reduced, and the efficiency of migrating databases is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0071] Figure 1 A schematic diagram of an application scenario provided by an exemplary embodiment of the present application;
[0072] Figure 2 A flowchart of a data migration method provided by an exemplary embodiment of the present application;
[0073] Figure 3 A flowchart of another data migration method provided by an exemplary embodiment of the present application;
[0074] Figure 4 A schematic diagram of a closed-loop dependency relationship provided for an exemplary embodiment of the present application;
[0075] Figure 5 A schematic diagram of an object group dependency graph provided by an exemplary embodiment of the present application;
[0076] Figure 6 A schematic diagram of a migration set provided for an exemplary embodiment of the present application;
[0077] Figure 7 A schematic diagram of a database provided for an exemplary embodiment of the present application;
[0078] Figure 8 A process diagram of a data migration method provided by an exemplary embodiment of the present application;
[0079] Figure 9 A schematic structural diagram of a data migration system provided by an exemplary embodiment of the present application;
[0080] Figure 10 A schematic structural diagram of a data migration device provided by an exemplary embodiment of the present application;
[0081] Figure 11 A schematic structural diagram of an electronic device provided as an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0082] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0083] Figure 1 This is a schematic diagram of an application scenario provided by an exemplary embodiment of this application. Figure 1 , including an application server, multiple databases to be migrated, and on-cloud databases. For example, an application server can include multiple applications, which can be Application 1, Application 2, ..., Application K (K is an integer greater than or equal to 1). The multiple databases to be migrated can be Database 1, Database 2, ..., Database N (N is an integer greater than or equal to 1).
[0084] For any database, the database may include multiple objects. For example, database 1 may include objects 1 and 2, database 2 may include objects 3, 4, and 5, ..., and database N may include object n.
[0085] For any application, the electronic device can determine the application dependency relationships between the application and multiple objects based on the multiple objects operated by the application in multiple databases. For example, if application 2 can operate objects 1 and 2 in database 1, and objects 3 and 4 in database 2, then the dependency relationships between application 2 and the multiple objects are: application 2 depends on objects 1, 2, 3, and 4.
[0086] The electronic device can determine object dependencies between multiple objects and determine at least one migration set based on application dependencies between the application and the multiple objects. The at least one migration set is unrelated to each other and multiple databases can be migrated based on the at least one migration set.
[0087] For example, if the object dependency is: Object 1 and Object 2 are mutually dependent, and Object 3 and Object 4 are mutually dependent, and if the application dependency is: Application 2 is dependent on Object 1, Object 2, Object 3, and Object 4, then Object 1, Object 2, Object 3, and Object 4 can be determined as Migration Set 1, and based on Migration Set 1, Object 1, Object 2, Object 3, and Object 4 in the database are synchronously migrated to the cloud database. For example, the cloud database can include multiple migration sets, and the multiple migration sets can be Migration Set 1, Migration Set 2, ..., Migration Set Q (Q is an integer greater than or equal to 1). Migration Set 1 can include Object 1, Object 2, Object 3, and Object 4.
[0088] In related technologies, enterprises have complex businesses, potentially involving dozens or even hundreds of applications operating multiple objects across multiple databases. Migration requires determining the object dependencies between multiple objects in multiple databases, as well as the application dependencies between applications and multiple objects. Databases can then be migrated based on these object and application dependencies. However, in this process, object dependencies and application dependencies are often manually sorted, resulting in inefficient database migration.
[0089] In an embodiment of the present application, the electronic device can determine the object dependency between multiple objects, and determine the application dependency between each application and multiple objects, and then divide the multiple objects into at least one migration set based on the object dependency and application dependency. The electronic device can perform migration processing on multiple databases based on at least one migration set. Since the electronic device can automatically determine the object dependency between multiple objects, and the application dependency between each application and multiple objects; and can divide multiple objects into at least one unrelated migration set, so as to perform migration processing on multiple databases based on at least one migration set, there is no need to worry about the impact on other migration sets or applications. Compared with manually sorting out object dependencies and determining application dependencies, the difficulty and risk of migration are reduced, and the efficiency of migrating databases is improved.
[0090] The technical solutions shown in this application are described in detail below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be repeated in different embodiments.
[0091] Figure 2 This is a flowchart of a data migration method provided by an exemplary embodiment of this application. Figure 2 , the method may include:
[0092] S201: Obtain object creation information of multiple databases to be migrated.
[0093] The execution subject of the embodiments of the present application may be an electronic device, or a data migration device provided in the electronic device. The data migration device may be implemented using software or a combination of software and hardware. The data migration device may be a processor in the electronic device. For ease of understanding, the following description will be based on an example in which the execution subject is an electronic device.
[0094] For any database, the database may include multiple objects and object creation information of multiple objects. For example, the database may include object 1, object 2, and object 3, as well as object creation information of object 1, object 2, and object 3.
[0095] Objects in a database can be tables, views, and so on. Each object can have a corresponding identifier. The object's identifier can be represented by a unique ID (Identity Document). For example, the identifier for object 1 might be 001, and the identifier for object 2 might be 002.
[0096] The object creation information may include multiple object creation statements, and the object creation statements may be database schema definition language (Data Definition Language, DDL) statements.
[0097] Optionally, the electronic device may obtain object creation statements of multiple objects in multiple databases to be migrated through a system view to obtain object creation information.
[0098] For example, if the object is a table, database 1 may include table 1, table 2, and table 3. If the object creation statement 1 of table 1 is "create table 1 from table 2 and table 3", the electronic device may obtain the object creation statement 1 of table 1 through the system view in database 1, and the object creation information may include the object creation statement 1.
[0099] S202: Determine object dependency relationships among multiple objects in the database based on object creation information.
[0100] Object dependency relationships can be used to indicate the objects that each object depends on, and the objects that each object depends on. For example, an object dependency relationship may be: object 1 depends on object 2 and object 3, and object 1 is dependent on object 4.
[0101] Object dependencies can exist between multiple objects in the same database or between multiple objects in different databases. For example, if database 1 contains objects 1, 2, and 3, the object dependency relationship could be: object 1 depends on objects 2 and 3. If database 1 contains object 4 and database 2 contains object 5, the object dependency relationship could be: object 4 depends on object 5.
[0102] In an optional embodiment, the object dependency relationship between multiple objects can be determined in the following manner, including: format conversion processing of multiple object creation statements to obtain multiple Abstract Syntax Tree (AST) information; and determining the object dependency relationship based on the AST information.
[0103] An abstract syntax tree (AST) is a tree-like representation of the grammatical structure of a programming language.
[0104] Optionally, the format conversion process may include at least one of the following: semantic analysis process and grammatical analysis process.
[0105] Because users write object creation statements in different ways when creating objects, multiple object creation statements can be formatted to obtain multiple AST information. For example, if object creation statement 1 is "create table 1 from table 2 and table 3", the object creation statement 1 can be formatted to obtain the corresponding AST information 1.
[0106] After obtaining multiple AST information, object dependencies can be determined based on the AST information. For example, if the AST information includes "the primary key of table 1 is the foreign key of table 2", the object dependency can be determined based on the AST information as: table 1 depends on table 2.
[0107] S203: Determine application dependency relationships between the multiple applications and the multiple objects based on operation information of the multiple applications on the multiple objects.
[0108] For any application, the application can operate multiple objects in the database, and the application dependency relationship between the multiple applications and the multiple objects can be determined based on the operation information of the multiple applications on the multiple objects.
[0109] The operation information may include multiple initial operation statements.
[0110] The initial operation statement may be a Structured Query Language (SQL statement). For example, the initial operation statement may be "select name from table1 where age>30".
[0111] Optionally, for any application, the application dependency relationship between multiple applications and multiple objects can be determined in the following manner: obtain multiple initial operation statements corresponding to multiple applications; clean the multiple initial operation statements to obtain multiple target operation statements; and determine the application dependency relationship based on the multiple target operation statements.
[0112] The cleaning process may include at least one of the following: formatting, desensitizing, or deduplication.
[0113] The formatting process may be to process the initial operation statement to obtain a statement in a specific standard format.
[0114] Desensitization can replace sensitive data in the initial operation statement with a preset value. For example, if the preset value is 1 and the initial operation statement is "select name from table1 where age>30", "30" can be replaced with "1", resulting in the desensitized initial operation statement being "select name from table1 where age>1".
[0115] Deduplication refers to processing duplicate initial operation statements. For example, if initial operation statement 1 is "select name from table1 where age>1" and initial operation statement 2 is "select name from table1where age>1", initial operation statement 1 can be retained and initial operation statement 2 can be deleted.
[0116] For any application, the electronic device can obtain multiple initial operation statements from the application's operation information and cleanse these initial operation statements to obtain multiple target operation statements. For example, if the electronic device can obtain 10 initial operation statements corresponding to application 1, it can format, desensitize, and remove duplicates from these 10 initial operation statements to obtain 7 target operation statements.
[0117] Optionally, after obtaining multiple target operation statements, the multiple target operation statements can be format converted, that is, semantic analysis processing and / or syntactic analysis processing, to obtain corresponding multiple AST information, and then the application dependency relationship between the application and multiple objects can be determined based on the AST information.
[0118] For example, if seven target operation statements corresponding to application 1 are available, these seven target operation statements can be formatted and processed to obtain multiple corresponding AST information. If the corresponding multiple AST information includes the identifiers of object 1, object 2, and object 3, the application dependency relationship between application 1 and the multiple objects can be determined as follows: application 1 depends on object 1, object 2, and object 3.
[0119] S204: Determine at least one migration set from multiple objects according to the object dependency and the application dependency, and perform migration processing on multiple databases according to the at least one migration set.
[0120] At least one migration set is completely unrelated. For example, if there are three migration sets, migration set 1, migration set 2, and migration set 3, then these three migration sets are completely unrelated and will not affect each other.
[0121] For any migration set, the migration set may include multiple objects that need to be migrated simultaneously. For example, migration set 1 may include object 1, object 2, and object 3.
[0122] In an optional embodiment, at least one migration set can be determined among multiple objects in the following manner: based on object dependencies, at least one object group and at least one one-way dependency between object groups are determined among the multiple objects; based on the at least one object group, the one-way dependency and the application dependency, the at least one object group is divided into at least one migration set.
[0123] An object group includes at least one object or at least two circularly dependent objects. For example, object group 1 may include object 1 and object 2, where object 1 depends on object 2 and object 2 depends on object 1; object group 2 may include object 3.
[0124] A unidirectional dependency is a one-way, non-circular dependency between object groups. For example, if object group 1 depends on object group 2, and object group 2 does not depend on object group 1, the object dependency between object groups 1 and 2 is a unidirectional dependency.
[0125] Optionally, the electronic device may determine at least one object group among the multiple objects and a unidirectional dependency relationship between at least one object group according to the object dependency relationship.
[0126] For example, if the object dependency relationship includes object 1 depending on object 2 and object 3, object 2 depending on object 4, and object 4 depending on object 1, then since the object group can include at least one object or at least two circularly dependent objects, object 1 depends on object 2, object 2 depends on object 4, and object 4 depends on object 1, and there is a circular dependency between objects 1, 2, and 4, objects 1, 2, and 4 can be determined as object group 1, and object 3 can be determined to be included in object group 2. Since object 1 is in object group 1, object 3 is in object group 2, and object 1 depends on object 3, the unidirectional dependency relationship between object group 1 and object group 2 can be determined as: object group 1 depends on object group 2.
[0127] After determining at least one object group and a one-way dependency relationship between at least one object group, the electronic device may divide the at least one object group into at least one migration set according to the at least one object group, the one-way dependency relationship, and the application dependency relationship.
[0128] Alternatively, if multiple object groups have unidirectional dependencies, they can be migrated together and grouped together in a migration set. For example, if object group 1 and object group 2 have a unidirectional dependency and need to be migrated simultaneously, both groups can be grouped together in the same migration set.
[0129] Optionally, if objects in an application dependency are in different object groups, to avoid application errors, these different object groups can be migrated together and grouped into a single migration set. For example, if the application dependency is: Application 1 depends on Object 1 and Object 2, and Object 1 is in Object Group 1 and Object 2 is in Object Group 2, and both Object Groups 1 and 2 need to be migrated simultaneously, Object Groups 1 and 2 can be grouped into the same migration set.
[0130] For example, if the application dependency is: application 1 depends on object 1 and object 5, if object group 1 includes object 1, object 2 and object 4, object group 2 includes object 3, object group 3 includes object 5 and object 6, and the unidirectional dependency is that object group 1 depends on object group 2, then based on the three object groups, the unidirectional dependency, and the application dependency, it can be determined that migration set 1 includes object group 1, object group 2 and object group 3.
[0131] After determining at least one migration set, which are completely independent of each other and do not affect each other, multiple databases can be migrated based on the at least one migration set. For example, if multiple objects in multiple databases can be divided into at least one migration set, the at least one migration set can be migration set 1, migration set 2, ..., migration set Q. If migration set 1 includes objects 1, 2, ..., and 10, then these 10 objects can be migrated synchronously based on migration set 1; similarly, multiple objects in migration set 2 can be migrated synchronously based on migration set 2; ...; and multiple objects in migration set Q can be migrated synchronously based on migration set Q, thereby implementing batch migration of multiple databases and reducing the difficulty and risk of migration.
[0132] In an embodiment of the present application, an electronic device can obtain object creation information of multiple databases to be migrated, and determine the object dependency relationship between multiple objects in the database based on the object creation information. The electronic device can determine the application dependency relationship between multiple applications and multiple objects based on the operation information of multiple applications on multiple objects. The electronic device can determine at least one migration set among multiple objects based on the object dependency relationship and the application dependency relationship, and perform migration processing on multiple databases based on the at least one migration set. Since the electronic device can automatically identify the object dependency relationship between multiple objects in the object creation information; can obtain the operation information of the application on multiple objects to automatically determine the application dependency relationship between each application and multiple objects; can divide multiple objects into at least one unrelated migration set, and perform migration processing on multiple databases based on at least one migration set, there is no need to worry about the impact on other migration sets or applications. Compared with manually sorting out object dependencies and determining application dependencies, the difficulty and risk of migration are reduced, and the efficiency of migrating databases is improved.
[0133] Below, in Figure 2 Based on the embodiment shown, Figure 3 , further detailed description of the above data migration method is given.
[0134] Figure 3 This is a flowchart of another data migration method provided by an exemplary embodiment of this application. Figure 3 , the method may include:
[0135] S301: Obtain object creation information of multiple databases to be migrated.
[0136] It should be noted that the execution process of step S301 can refer to the execution process of step S201, and will not be repeated here.
[0137] S302: Determine object dependency relationships among multiple objects in the database based on object creation information.
[0138] Optionally, format conversion processing may be performed on multiple object creation statements to obtain multiple AST information, and object dependency relationships may be determined based on the AST information.
[0139] For example, if object creation statement 1 is "create table 1 from table 2 and table 3", the object creation statement 1 can be formatted to obtain corresponding AST information 1. Based on AST information 1, the object dependency relationship can be determined: Table 1 depends on Table 2 and Table 3.
[0140] Optionally, object dependencies can be stored in an object-object mapping table. The object-object mapping table may include key-value pairs, where the key can be an object and the value can be multiple objects that the object depends on, as shown in mapping table 1:
[0141] Mapping Table 1
[0142]
[0143] From mapping table 1, it can be known that the object dependency relationship may include: object 1 depends on object 2 and object 3, object 2 depends on object 4, ... object n-1 may depend on object n.
[0144] S303: Determine application dependency relationships between the multiple applications and the multiple objects based on operation information of the multiple applications on the multiple objects.
[0145] Since all objects in the database are operated by applications, any application can operate multiple objects in the database. Based on the operation information of multiple applications on multiple objects, the application dependency relationship between multiple applications and multiple objects can be determined.
[0146] It should be noted that the execution process of step S303 can refer to step S203 and will not be repeated here.
[0147] Optionally, the application dependency relationship may be stored in an application-object mapping table.
[0148] The application-object mapping table may include key-value pairs, where the key can be the application and the value can be the object being operated on, as shown in Mapping Table 2:
[0149] Mapping Table 2
[0150]
[0151] From mapping table 2, it can be known that the application dependency relationship may include: application 1 depends on object 1 and object 2; application 2 depends on object 3, object 4 and object 5; ...; application K depends on object n-1 and object n.
[0152] S304: Determine at least one object group and a one-way dependency relationship between at least one object group among the multiple objects according to the object dependency relationship.
[0153] In an optional embodiment, at least one object group can be determined among multiple objects in the following manner: closed-loop dependency identification is performed based on object dependencies to obtain at least one closed-loop dependency; for any closed-loop dependency, the objects in the closed-loop dependency are determined as an object group.
[0154] Optionally, the electronic device may determine object dependencies in the object-object mapping table, and recursively search the objects based on the object dependencies to identify closed-loop dependencies and determine at least one closed-loop dependency.
[0155] A closed-loop dependency relationship can include M objects. The i-th object depends on the i+1-th object, and the M-th object depends on the 1st object. i can be 1, 2, ..., M-1, and M is an integer greater than 1. For example, a closed-loop dependency relationship can include objects 1, 2, and 3. Object 1 can depend on object 2, object 2 can depend on object 3, and object 3 can depend on object 1.
[0156] Next, combine Figure 4 , explaining the closed-loop dependency relationship.
[0157] Figure 4 A schematic diagram of a closed-loop dependency relationship provided by an exemplary embodiment of this application. Figure 4 If the object dependencies determined in the object-object mapping table are: object 1 depends on object 2 and object 3, object 2 depends on object 4, object 4 depends on object 1, and object 3 has no dependent objects, then object 1 can be searched according to the object dependency relationships to determine that the dependent objects of object 1 are object 2 and object 3; then object 2 can be searched to determine that the dependent object of object 2 is object 4; then object 4 can be searched to determine that the dependent object of object 4 is object 1; then object 3 can be searched to determine that object 3 has no dependent objects, then it can be identified that there is a closed-loop dependency relationship between object 1, object 2 and object 4.
[0158] Optionally, after determining the closed-loop dependency, the objects in the closed-loop dependency may be determined as an object group. Figure 4 As shown, there is a closed-loop dependency relationship among object 1 , object 2 , and object 4 , and thus object 1 , object 2 , and object 4 can be determined as object group 1 .
[0159] It should be noted that if the recursive search enters a closed loop, it can be determined whether other objects that the object depends on are in the same object group. If the other objects are already in the same object group, the recursive search for the object ends.
[0160] For example, if the object dependency relationship in the object-object mapping table includes: object 1 depends on object 2, object 2 depends on object 4, and object 4 depends on object 1, then based on the object dependency relationship, object 1 can be searched to determine that the dependent object of object 1 is object 2; then object 2 can be searched to determine that the dependent object of object 2 is object 4; then object 4 can be searched to determine that the dependent object of object 4 is object 1; then object 1 can be searched... Because a circular dependency is formed among objects 1, 2, and 4, continuing to search for object 1 will fall into a closed loop. However, in the above search process, when it is found that the dependent object of object 4 is object 1, it can be determined that object 1 is already in the same object group, and the recursive search for object 4 ends, and it can be determined that the object group includes objects 1, 2, and 4.
[0161] Optionally, after the object group is determined, a unique group identification ID may be assigned to the object group. For example, the ID of object group 1 may be 000001.
[0162] In an optional embodiment, the one-way dependency relationship between at least one object group can be determined in the following manner: for any object group, the dependency relationship of the objects in the object group on the objects in other object groups is determined; based on the dependency relationship of the objects in the object group on the objects in other object groups, the one-way dependency relationship between the object group and other object groups is determined.
[0163] For example, if object group 1 includes object 1 and object 2, and object group 2 includes object 3 and object 4, if the electronic device can determine that object 2 depends on object 3, then the electronic device can determine, based on object 2's dependence on object 3, that the one-way dependency relationship between object group 1 and object group 2 is: object group 1 depends on object group 2.
[0164] Optionally, the one-way dependency relationship may be stored in an object group-object group mapping table.
[0165] The object group-object group mapping table may include key-value pairs, where the key may be the object group ID and the value may be the ID of other object groups that the object group depends on, as shown in Mapping Table 3:
[0166] Mapping Table 3
[0167]
[0168] From mapping table 3, it can be seen that the unidirectional dependency relationship may include: object group 1 depends on object group 2 and object group 3, object group 2 depends on object group 4 and object group 5, ..., object group P-1 depends on object group P.
[0169] S305: Divide the multiple object groups into at least one candidate migration set according to the unidirectional dependency relationship.
[0170] Optionally, at least one candidate migration set can be determined based on the unidirectional dependency relationship in the following manner: based on the unidirectional dependency relationship, an object group dependency graph between multiple object groups is determined; based on the object group dependency graph, object groups with dependencies are determined as a candidate migration set to obtain at least one candidate migration set.
[0171] Optionally, the electronic device may obtain a unidirectional dependency relationship from an object group-object group mapping table, and determine an object group dependency graph between the multiple object groups based on the unidirectional dependency relationship.
[0172] Next, combine Figure 5 Describe the object group dependency graph.
[0173] Figure 5 This is a schematic diagram of an object group dependency graph provided by an exemplary embodiment of the present application. Figure 5 If the unidirectional dependencies between object groups are: object group 1 depends on object group 2 and object group 3, object group 2 depends on object group 4, and object group 3 depends on object group 5, then the object group dependency graph can be determined based on the multiple unidirectional dependencies. The object group dependency graph then includes object group 1, object group 2, object group 3, object group 4, and object 5.
[0174] Optionally, after the object group dependency graph is determined, object groups having dependency relationships may be determined as a candidate migration set according to the object group dependency graph to obtain at least one candidate migration set.
[0175] For example, if the object group dependency graph is Figure 5 As shown, the object group dependency graph includes object group 1, object group 2, object group 3, object group 4 and object group 5. According to the object group dependency graph, object group 1, object group 2, object group 3, object group 4 and object group 5 can be determined as a candidate migration set.
[0176] Optionally, after determining the candidate migration set, a unique candidate migration set ID may be assigned to the candidate migration set. For example, the ID of the candidate migration set 1 may be 0123.
[0177] Optionally, the ID of the candidate migration set and the IDs of the multiple object groups included in the candidate migration set may be correspondingly stored in a candidate migration set-object group mapping table.
[0178] The candidate migration set-object group mapping table may include key-value pairs, where the key may be the ID of the candidate migration set and the value may be the IDs of multiple object groups included in the candidate migration set, as shown in Mapping Table 4:
[0179] Mapping Table 4
[0180]
[0181] From mapping table 4, it can be known that candidate migration set 1 may include object group 1 and object group 2, candidate migration set 2 may include object group 3, ..., and candidate migration set Z may include object group P.
[0182] S306: Merge at least one candidate migration set according to the application dependency to obtain at least one migration set.
[0183] In an optional embodiment, at least one candidate migration set may be merged based on application dependencies to obtain at least one migration set: for each application, if it is determined based on the application dependencies that the objects operated by the application are located in different candidate migration sets, the different candidate migration sets are merged to obtain the corresponding migration set.
[0184] Optionally, the electronic device can obtain application dependencies in the application-object mapping table, determine at least one candidate migration set in the candidate migration set-object group mapping table, and merge at least one candidate migration set according to the application dependencies to obtain at least one migration set.
[0185] Next, combine Figure 6 Describes the migration collection.
[0186] Figure 6 A schematic diagram of a migration set provided by an exemplary embodiment of this application. Figure 6 If candidate migration set 1 includes object group 1 and object group 2, object group 1 may include circularly dependent objects 1 and 2, and object group 2 may include circularly dependent objects 3 and 4; candidate migration set 2 includes object group 3, which may include circularly dependent objects 5, 6, and 7. If the application dependency is: application 1 depends on object 1 and object 5, since object 1 is in candidate migration set 1 and object 5 is in candidate migration set 2, candidate migration set 1 and candidate migration set 2 can be merged to obtain migration set 1.
[0187] Optionally, after determining the migration set, a unique migration set ID may be assigned to the migration set. For example, the ID of migration set 1 may be 00123.
[0188] Optionally, the ID of the migration set and the IDs of multiple candidate migration sets included in the migration set may be correspondingly stored in a migration set-to-candidate migration set mapping table.
[0189] The migration set-to-select migration set mapping table may include key-value pairs, where the key may be the ID of the migration set and the value may be the IDs of multiple to-select migration sets included in the migration set, as shown in Mapping Table 5:
[0190] Mapping Table 5
[0191]
[0192] From mapping table 5, it can be known that migration set 1 may include candidate migration set 1 and candidate migration set 2, migration set 2 may include candidate migration set 3, ..., and migration set Q may include candidate migration set P.
[0193] S307: Perform migration processing on multiple databases according to at least one migration set.
[0194] Optionally, after determining at least one migration set, migration processing may be performed on each migration set to implement migration processing on multiple databases.
[0195] Next, combine Figure 7 , which explains the database migration process.
[0196] Figure 7 A schematic diagram of a database provided for an exemplary embodiment of this application. Figure 7 , objects in multiple databases to be migrated can be divided into at least one migration set. The at least one migration set is completely unrelated and does not affect each other.
[0197] For example, at least one migration set may be migration set 1, migration set 2, ..., migration set Q. If migration set 1 includes candidate migration set 1 and candidate migration set 2, candidate migration set 1 includes object group 1, object group 1 includes object 1 and object 2, and candidate migration set 2 includes object group 2 and object group 3, object group 2 includes object 3 and object 4, and object group 3 includes object 5, then migration set 1 can be migrated, i.e., objects 1, object 2, object 3, object 4, and object 5 can be migrated synchronously; migration set 2 can be migrated to synchronously migrate multiple objects in migration set 2; ..., migration set Q can be migrated to synchronously migrate multiple objects in migration set Q. This allows batch migration of multiple databases without worrying about impact on other migration sets or applications, reducing migration difficulty and risk.
[0198] In an embodiment of the present application, an electronic device can obtain object creation information for multiple databases to be migrated and determine object dependencies between multiple objects in the databases based on the object creation information. The electronic device can determine application dependencies between multiple applications and multiple objects based on operation information of multiple applications on the multiple objects. Based on the object dependencies, the electronic device can determine at least one object group and a one-way dependency between at least one object group among the multiple objects, and then, based on the one-way dependency, divide the multiple object groups into at least one migration set to be selected. Based on the application dependencies, the electronic device can merge the at least one migration set to be selected to obtain at least one migration set, and perform migration on multiple databases based on the at least one migration set. Because the electronic device can automatically identify object dependencies between multiple objects in the object creation information, obtain application operation information on multiple objects to automatically determine application dependencies between each application and multiple objects, and divide multiple objects into at least one unrelated migration set, multiple databases can be migrated based on the at least one migration set without worrying about impacting other migration sets or applications. Compared to manually sorting object dependencies and determining application dependencies, this reduces the difficulty and risk of migration and improves the efficiency of database migration.
[0199] Next, based on any of the above embodiments, Figure 8 , the above data migration method is further explained in detail through specific examples.
[0200] Figure 8 This is a process diagram of a data migration method provided by an exemplary embodiment of this application. Figure 8 , including process 1, process 2 and process 3. Process 1 may include steps ①②③, process 2 may include steps ④⑤⑥, and process 3 may include steps ⑦ and ⑧.
[0201] In process 1, assume that the databases to be migrated include database 1, database 2, and database 3. In step ①, the electronic device can obtain multiple object creation statements in database 1 through a system view. The multiple object creation statements can be object creation statement 1, object creation statement 2, ..., object creation statement j (j is an integer greater than or equal to 1). The object creation information can then include the j object creation statements.
[0202] In step ②, the electronic device can perform format conversion processing on the j object creation statements to obtain multiple AST information, and then determine the object dependency relationship between multiple objects in the database based on the multiple AST information. Assume that the determined object dependency relationship is: object 1 depends on object 2, object 2 depends on objects 3 and 4, object 3 depends on object 1, object 4 depends on object 5, and object 5 depends on object 4. Figure 8 As shown in .
[0203] In step ③, the electronic device may determine at least one migration set according to the object dependency relationship.
[0204] Specifically, the electronic device can perform closed-loop dependency identification based on object dependencies, obtain at least one closed-loop dependency, and determine the objects in the closed-loop dependency as an object group, and then determine at least one candidate migration set based on the unidirectional dependency between at least one object group.
[0205] For example, an electronic device can identify closed-loop dependencies based on object dependencies. If it finds that object 1 depends on object 2, object 2 depends on object 3, and object 3 depends on object 1, forming a circular dependency between objects 1, 2, and 3, it can conclude that closed-loop dependency relationship 1 includes objects 1, 2, and 3, and objects 1, 2, and 3 are identified as object group 1. Furthermore, if the electronic device finds that object 4 depends on object 5, and object 5 depends on object 4, forming a circular dependency between objects 4 and 5, it can conclude that closed-loop dependency relationship 2 includes objects 4 and 5, and objects 4 and 5 are identified as object group 2. If the electronic device determines that object 2 depends on object 4, it can determine, based on object 2's dependency on object 4, that the unidirectional dependency relationship between object group 1 and object group 2 is: object group 1 depends on object group 2. The electronic device can identify object group 1 and object group 2, which have a dependency relationship, as candidate transition set 1. Alternatively, the electronic device can determine at least one candidate transition set based on the object dependencies between n objects. For example, the at least one to-be-selected migration set may be respectively a to-be-selected migration set 1, a to-be-selected migration set 2, ..., a to-be-selected migration set Z.
[0206] In process 2, it is assumed that the applications that depend on database 1, database 2 and database 3 include application 1, application 2, ..., application K. Then in step ④, the electronic device can obtain multiple initial operation statements corresponding to each application. For example, the multiple initial operation statements can be initial operation statement 1, initial operation statement 2, ..., initial operation statement s (s is an integer greater than or equal to 1). In step ⑤, the electronic device can perform a cleaning process on the s initial operation statements obtained, that is, formatting, desensitizing or deduplication processing, to obtain multiple target operation statements. For example, the multiple target operation statements can be target operation statement 1, target operation statement 2, ..., target operation statement w (w is less than s, w is an integer greater than or equal to 1). In step ⑥, the electronic device can perform format conversion processing on the w target operation statements to obtain corresponding multiple AST information, and determine the application dependency relationship between multiple applications and multiple objects based on the multiple AST information. For example, the electronic device can determine the application dependency corresponding to application 1, the application dependency corresponding to application 2, ..., the application dependency corresponding to application K. Assume that the application dependency corresponding to application 1 is: application 1 depends on object 1 and object 6.
[0207] Since at least one candidate migration set is determined in process 1 and the application dependency relationship corresponding to each application is determined in process 2, then in step ⑦ of process 3, the electronic device can merge the at least one candidate migration set according to the application dependency relationship corresponding to each application to obtain at least one migration set. For example, if candidate migration set 1 includes object group 1 and object group 2, object group 1 includes object 1, object 2, and object 3, object group 2 includes object 4 and object 5, candidate migration set 2 may include object group 3, object group 3 includes object 6 and object 7, and if the application dependency relationship is that application 1 depends on object 1 and object 6, then candidate migration set 1 and candidate migration set 2 can be merged to obtain migration set 1.
[0208] After determining at least one migration set, in step ⑧, the electronic device can migrate multiple databases based on the at least one migration set. For example, if the at least one migration set includes migration sets 1, ..., and Q, then multiple objects in the database can be migrated to the cloud database in batches based on the Q migration sets, reducing the risk of migrating the database.
[0209] In an embodiment of the present application, an electronic device can obtain object creation information for multiple databases to be migrated and, based on the object creation information corresponding to the multiple databases, determine object dependencies between the multiple objects. Based on the object dependencies, the electronic device can determine at least one object group from the multiple objects, and further determine at least one candidate migration set based on the one-way dependencies between the at least one object group. The electronic device can obtain multiple initial operation statements from multiple applications, cleanse the multiple initial operation statements to obtain multiple target operation statements, and determine application dependencies corresponding to each application based on the multiple target operation statements. The electronic device can merge the at least one candidate migration set based on the application dependencies corresponding to each application to obtain at least one migration set, and migrate the multiple databases based on the at least one migration set. Because the electronic device can automatically identify object dependencies between multiple objects in the object creation information, obtain application operation information on multiple objects to automatically determine application dependencies between each application and multiple objects, and divide the multiple objects into at least one unrelated migration set, the multiple databases can be migrated based on the at least one migration set without worrying about impacting other migration sets or applications. Compared to manually sorting object dependencies and determining application dependencies, this reduces the difficulty and risk of migration and improves the efficiency of database migration.
[0210] Next, based on any of the above embodiments, Figure 9 , describing the system architecture.
[0211] Figure 9 This is a structural diagram of a data migration system provided by an exemplary embodiment of this application. Figure 9 , including databases, application servers, and electronic equipment to be migrated.
[0212] The databases to be migrated may include database 1, database 2, ..., database N.
[0213] The application server may include multiple applications, such as application 1, application 2, ..., application K.
[0214] The electronic device may include a parser, an object pool, a cleaner, a modeler, and a topological relationship analyzer. The parser may include a semantic analysis module, a grammatical analysis module, and an AST module; the cleaner may include a formatting module, a desensitization processing module, a deduplication processing module, and a data processing module; and the topological relationship analyzer may include a topological sorting module, a recursive search module, a closed loop detection module, and a workload grading module.
[0215] The electronic device can obtain multiple object creation statements from the database, and process the multiple object creation statements through the syntax analysis module and the semantic analysis module in the parser to obtain AST information. The electronic device can store the AST information in the AST module.
[0216] The electronic device can determine the object information, the objects on which the object depends, cross-library objects, and determine the object dependency relationship through the object pool based on the AST information.
[0217] The electronic device can obtain multiple initial operation statements corresponding to each application in the application server, and format the multiple initial operation statements through the formatting module in the cleaner; desensitize the multiple initial operation statements through the desensitization module; and deduplicate the multiple initial operation statements through the deduplication module to obtain multiple target operation statements.
[0218] After obtaining multiple target operation statements, the multiple target operation statements can be processed by the modeler to obtain corresponding multiple AST information, and then the application dependency corresponding to each application program can be determined based on the AST information.
[0219] The electronic device can use the topological sorting module of the topological relationship analyzer to recursively search for objects based on object dependencies; it can use the closed-loop detection module to recursively search for objects to determine closed-loop dependencies and corresponding object groups; it can use the de-loop dependency module to intervene when the recursive search falls into a closed-loop cycle, that is, when it is determined that the object on which the object depends already exists in the object group, the search for the object is terminated.
[0220] Optionally, the electronic device may use a topology relationship analyzer to determine unidirectional dependencies between multiple object groups, and based on the multiple object groups, the unidirectional dependencies, and the application dependencies, the multiple object groups may be divided into at least one migration set to determine the topology between the database and the application. Optionally, the electronic device may also use a workload grading module to perform workload grading on the migration sets based on the number of objects in the migration sets.
[0221] The electronic device may perform migration processing on multiple databases according to at least one migration set.
[0222] In an embodiment of the present application, an electronic device can obtain multiple object creation statements from a database to be migrated, process the multiple object creation statements through a parser, and determine object dependencies through an object pool. The electronic device can obtain multiple initial operation statements corresponding to each application, process the multiple initial operation statements through a cleaner, and determine the application dependencies corresponding to each application through a modeler. The electronic device can determine at least one object group through a topology relationship analyzer and divide the object group into at least one migration set based on the multiple object groups, the one-way dependencies, and the application dependencies corresponding to each application. Because the electronic device can automatically identify the object dependencies between multiple objects in object creation information; can obtain application operation information on multiple objects to automatically determine the application dependencies between each application and multiple objects; can divide multiple objects into at least one unrelated migration set, and migrate multiple databases based on the at least one migration set without worrying about impacting other migration sets or applications. Compared with manually sorting object dependencies and determining application dependencies, this reduces the difficulty and risk of migration and improves the efficiency of database migration.
[0223] Figure 10 This is a schematic diagram of the structure of a data migration device provided by an exemplary embodiment of the present application. Figure 10 The data migration device 10 may include: an acquisition module 11, a first determination module 12, a second determination module 13, a third determination module 14 and a migration module 15, wherein:
[0224] The acquisition module 11 is used to acquire object creation information of multiple databases to be migrated;
[0225] The first determining module 12 is configured to determine object dependency relationships between multiple objects in the database according to the object creation information;
[0226] The second determining module 13 is configured to determine application dependency relationships between the multiple applications and the multiple objects based on operation information of the multiple applications on the multiple objects;
[0227] The third determining module 14 is configured to determine at least one migration set from the plurality of objects according to the object dependency and the application dependency;
[0228] The migration module 15 is configured to perform migration processing on the multiple databases according to the at least one migration set.
[0229] The data migration device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0230] In a possible implementation, the third determining module 14 is specifically configured to:
[0231] Determining, according to the object dependency, at least one object group among the plurality of objects, and a unidirectional dependency relationship between the at least one object group, wherein the object group includes at least one object or at least two circularly dependent objects;
[0232] The at least one object group is divided into at least one migration set according to the at least one object group, the unidirectional dependency relationship, and the application dependency relationship.
[0233] In a possible implementation, the third determining module 14 is specifically configured to:
[0234] Perform closed-loop dependency identification based on the object dependencies to obtain at least one closed-loop dependency, where the closed-loop dependency includes M objects, the i-th object depends on the i+1-th object, and the M-th object depends on the 1-th object, where i is 1, 2, ..., M-1, and M is an integer greater than 1;
[0235] For any closed-loop dependency relationship, objects in the closed-loop dependency relationship are determined as an object group.
[0236] In a possible implementation, the third determining module 14 is specifically configured to:
[0237] For any object group, determining the dependency relationship between objects in the object group and objects in other object groups;
[0238] According to the dependency relationship between the objects in the object group and the objects in other object groups, a unidirectional dependency relationship between the object group and the other object groups is determined.
[0239] In a possible implementation, the third determining module 14 is specifically configured to:
[0240] Dividing the plurality of object groups into at least one to-be-selected migration set according to the unidirectional dependency relationship;
[0241] The at least one migration set to be selected is merged according to the application dependency to obtain the at least one migration set.
[0242] In a possible implementation, the third determining module 14 is specifically configured to:
[0243] determining an object group dependency graph between the plurality of object groups according to the unidirectional dependency relationship;
[0244] According to the object group dependency graph, the object groups having dependency relationships are determined as a candidate migration set to obtain the at least one candidate migration set.
[0245] In a possible implementation, the third determining module 14 is specifically configured to:
[0246] For each application, if it is determined according to the application dependency relationship that the objects operated by the application are located in different candidate migration sets, the different candidate migration sets are merged to obtain a corresponding migration set.
[0247] In a possible implementation, the object creation information includes multiple object creation statements; and the first determination is specifically used to:
[0248] Performing format conversion processing on the multiple object creation statements to obtain multiple abstract syntax tree AST information;
[0249] The object dependency relationship is determined based on the AST information, where the object dependency relationship is used to indicate the objects that each object depends on and the objects that each object depends on.
[0250] In a possible implementation, for any one of the multiple applications, the operation information includes multiple initial operation statements; and the second determining module 13 is specifically configured to:
[0251] Obtaining the multiple initial operation statements corresponding to the multiple application programs;
[0252] Performing cleaning processing on the multiple initial operation statements to obtain multiple target operation statements, wherein the cleaning processing includes at least one of the following: formatting processing, desensitization processing, or deduplication processing;
[0253] The application dependency is determined according to the multiple target operation statements.
[0254] The data migration device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0255] The exemplary embodiment of the present application provides a structural diagram of an electronic device, see Figure 11 The electronic device 20 may include a processor 21 and a memory 22. Exemplarily, the processor 21 and the memory 22 are interconnected via a bus 23.
[0256] The memory 22 stores computer-executable instructions;
[0257] The processor 21 executes the computer-executable instructions stored in the memory 22 , so that the processor 21 performs the data migration method as shown in the above method embodiment.
[0258] Figure 11 The electronic device shown may be a server or a computer, etc.
[0259] Accordingly, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the data migration method described in the above method embodiment.
[0260] Accordingly, an embodiment of the present application may also provide a computer program product, including a computer program, which, when executed by a processor, can implement the data migration method shown in the above method embodiment.
[0261] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0262] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0263] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0264] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0265] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0266] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0267] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0268] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0269] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A data migration method, comprising: Get object creation information for multiple databases to be migrated; determining object dependency relationships among a plurality of objects in the database according to the object creation information; determining, based on operation information of the multiple applications on the multiple objects, application dependency relationships between the multiple applications and the multiple objects; Determining at least one migration set from the multiple objects according to the object dependency and the application dependency, and performing migration processing on the multiple databases according to the at least one migration set; Determining at least one migration set from the plurality of objects according to the object dependency and the application dependency includes: Determining, according to the object dependency, at least one object group among the plurality of objects, and a unidirectional dependency relationship between the at least one object group, wherein the object group includes at least two circularly dependent objects; Dividing the at least one object group into at least one migration set according to the at least one object group, the unidirectional dependency, and the application dependency includes: Dividing the plurality of object groups into at least one candidate migration set based on the unidirectional dependency relationship includes: determining an object group dependency graph between the plurality of object groups based on the unidirectional dependency relationship; determining the object groups having the dependency relationship as a candidate migration set based on the object group dependency graph, to obtain the at least one candidate migration set; According to the application dependency, the at least one candidate migration set is merged to obtain the at least one migration set, including: for each application, if it is determined according to the application dependency that the objects operated by the application are located in different candidate migration sets, the different candidate migration sets are merged to obtain a corresponding migration set.
2. The method according to claim 1, characterized in that Determining the at least one object group from the plurality of objects according to the object dependency includes: Perform closed-loop dependency identification based on the object dependencies to obtain at least one closed-loop dependency, where the closed-loop dependency includes M objects, the i-th object depends on the i+1-th object, and the M-th object depends on the 1-th object, where i is 1, 2, ..., M-1, and M is an integer greater than 1; For any closed-loop dependency relationship, objects in the closed-loop dependency relationship are determined as an object group.
3. The method according to claim 1 or 2, characterized in that Determining, based on the object dependency, a unidirectional dependency relationship between the at least one object group, includes: For any object group, determining the dependency relationship between objects in the object group and objects in other object groups; According to the dependency relationship between the objects in the object group and the objects in other object groups, a unidirectional dependency relationship between the object group and the other object groups is determined.
4. The method according to claim 1 or 2, characterized in that The object creation information includes a plurality of object creation statements; and determining object dependency relationships between the plurality of objects according to the object creation information includes: Performing format conversion processing on the multiple object creation statements to obtain multiple abstract syntax tree AST information; The object dependency relationship is determined based on the AST information, where the object dependency relationship is used to indicate the objects that each object depends on and the objects that each object depends on.
5. The method according to claim 1 or 2, characterized in that For any one of the multiple application programs, the operation information includes multiple initial operation statements; Determining application dependency relationships between the multiple applications and the multiple objects based on operation information of the multiple applications on the multiple objects includes: Obtaining the multiple initial operation statements corresponding to the multiple application programs; Performing cleaning processing on the multiple initial operation statements to obtain multiple target operation statements, wherein the cleaning processing includes at least one of the following: formatting processing, desensitization processing, or deduplication processing; The application dependency is determined according to the multiple target operation statements.
6. A data migration device, using the method according to any one of claims 1 to 5, characterized in that: include: an acquisition module, a first determination module, a second determination module, a third determination module, and a migration module, wherein: The acquisition module is used to acquire object creation information of multiple databases to be migrated; The first determining module is used to determine object dependency relationships between multiple objects in the database according to the object creation information; The second determining module is configured to determine application dependency relationships between the multiple applications and the multiple objects based on operation information of the multiple applications on the multiple objects; The third determining module is configured to determine at least one migration set from the plurality of objects according to the object dependency and the application dependency; The migration module is configured to perform migration processing on the multiple databases according to the at least one migration set.
7. An electronic device, characterized in that: include: memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the data migration method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the data migration method according to any one of claims 1 to 5.
9. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the data migration method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Object broker database constraint-oriented backup method
CN102693174A
Data migration method and device, server and storage medium
CN108509556A