Data migration method and device, electronic equipment and storage medium

By extracting database migration requirements characteristics, establishing labels and filtering data objects, the problem of useless information migration in existing database migration is solved, efficient data migration and personalized strategies are realized, and user experience is improved.

CN118939634APending Publication Date: 2024-11-12CHINA CONSTRUCTION BANK +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411078073.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

Existing database migration methods will lead to the migration of useless information, increase the cost of effective data migration, and lack personalized migration strategies, affecting the user experience.

Method used

By obtaining user migration requirements, extracting features, establishing migration tags, filtering candidate data migration objects collections from the source database, and writing them to the target database according to preset policies, avoiding useless data migration, saving storage space, and realizing personalized migration.

Benefits of technology

It effectively avoids the migration of useless information, saves the storage space of the target database, improves the user experience, and meets different migration needs through personalized strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939634A_ABST
    Figure CN118939634A_ABST
Patent Text Reader

Abstract

The invention provides a data migration method and device, electronic equipment and a storage medium. The data migration method comprises the steps of obtaining a source database, a target database and a migration demand corresponding to data migration; performing feature extraction on the migration demand, and establishing a migration label based on a target feature; screening out a candidate data migration object set from the source database based on the migration label; and writing the candidate data migration object set into a target database according to the migration label and a preset migration strategy. The migration tag is generated according to the migration demand of the user, and the data needing to be migrated is determined from the source database based on the migration tag, so that compared with the prior art that all data in the database are migrated, the migration of useless information can be avoided, the storage space of the target database is saved, and the subsequent utilization of the target database is facilitated; and meanwhile, by setting the migration strategy, different migration requirements can be met, personalized migration is realized, and the use experience of the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of big data technology, and in particular to a data migration method, device, electronic device and storage medium. Background Art

[0002] With the continuous development of database technology, more and more database products have emerged in the market, such as centralized databases such as MySQL and PostgreSQL, and distributed databases such as OceanBase, TiDB, and openGauss. However, in the process of continuous technological development and iteration, enterprises will choose different technical routes at different times, and the same is true for database selection.

[0003] The migration method currently provided by database vendors is to migrate the entire database, which may result in the migration of useless information and increase the cost of effective data migration. Summary of the invention

[0004] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.

[0005] To this end, an objective of the present disclosure is to provide a data migration method.

[0006] A second objective of the present disclosure is to provide a data migration device.

[0007] A third objective of the present disclosure is to provide an electronic device.

[0008] A fourth object of the present disclosure is to provide a non-transitory computer-readable storage medium.

[0009] A fifth object of the present disclosure is to provide a computer program product.

[0010] To achieve the above-mentioned purpose, the first aspect of the present disclosure proposes a data migration method, including: obtaining a source database and a target database corresponding to the data migration, and obtaining the migration requirements of the user; performing feature extraction on the migration requirements to obtain at least one target feature, and establishing the migration label based on the target feature; filtering out a set of candidate data migration objects from the source database based on the migration label; and writing the set of candidate data migration objects into the target database according to the migration label and a preset migration strategy.

[0011] According to an embodiment of the present disclosure, the step of selecting a set of candidate data migration objects from the source database based on the migration label includes: matching the migration label with the source code of the source database, and taking the point where the match is successful as the matching point; establishing a migration annotation at the matching point based on the migration label, and generating the set of candidate data migration objects from the data having the migration annotation.

[0012] According to an embodiment of the present disclosure, writing the set of candidate data migration objects into the target database according to the migration label and the preset migration strategy includes: in response to the migration strategy being the first migration strategy, writing all data in the source database into the target database; and deleting the data marked as empty in the target database.

[0013] According to an embodiment of the present disclosure, writing the candidate data migration object set into the target database according to the migration label and the preset migration strategy includes: in response to the migration strategy being the second migration strategy, mapping the data of the candidate data migration object set to obtain a mapped target mapping object, and writing the target mapping object into the target database.

[0014] According to one embodiment of the present disclosure, mapping the target data migration object to obtain the mapped target mapping object, and writing the target mapping object into the target database includes: obtaining a preset data object mapping strategy, wherein the data object mapping strategy is constructed based on JPA; mapping the target data migration object according to the data object mapping strategy to obtain the mapped target mapping object; obtaining a target write address of the target mapping object in the target database, and writing the target mapping object into the target database based on the target write address.

[0015] According to one embodiment of the present disclosure, obtaining the target write address of the target mapping object in the target database, and writing the target mapping object into the target database based on the target write address, includes: obtaining the mapping table position of the target mapping object in the target database as the target write address; mapping and writing the target mapping object to the target write address through a preset mapping object write strategy, so as to write the target mapping object into the target database.

[0016] According to an embodiment of the present disclosure, the method further includes: obtaining a migration order of each candidate data migration object in the candidate data migration object set; and writing the candidate data migration object set into the target database based on the migration order.

[0017] According to one embodiment of the present disclosure, obtaining the migration order of each candidate data migration object in the candidate data migration object set includes: obtaining the source data objects of the source database at each source data address in the source data address set, and determining each source data object as a candidate data migration object to be migrated; obtaining the data level of each candidate data migration object, and determining the migration order of each candidate data migration object according to the data level.

[0018] According to one embodiment of the present disclosure, the method further includes: performing migration sorting on each candidate data migration object in the candidate data object set according to the migration order to obtain a migration object sequence corresponding to the candidate data migration object set; and obtaining, from the migration object sequence, a candidate data migration object that meets a preset migration condition as the target data migration object in the candidate data migration object set.

[0019] According to an embodiment of the present disclosure, after writing the candidate data migration object set to the target database according to the migration tag and the preset migration strategy, the method includes: in response to identifying that there are remaining data migration objects in the candidate data migration object set that have not been written to the target database, continuing the data migration from the source database to the target database; in response to identifying that there are no remaining data migration objects in the candidate data migration object set that have not been written to the target database, closing the data object interaction link between the source database and the target database.

[0020] To achieve the above-mentioned purpose, the second aspect embodiment of the present disclosure proposes a data migration device, including: an acquisition module, used to acquire a source database and a target database corresponding to the data migration, and acquire the user's migration requirements; an establishment module, used to perform feature extraction on the migration requirements to obtain at least one target feature, and establish the migration label based on the target feature; a screening module, used to screen out a set of candidate data migration objects from the source database based on the migration label; and a migration module, used to write the set of candidate data migration objects into the target database according to the migration label and a preset migration strategy.

[0021] To achieve the above-mentioned purpose, the third aspect embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to implement the data migration method as described in the first aspect embodiment of the present disclosure.

[0022] To achieve the above-mentioned purpose, the fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to implement the data migration method as described in the first aspect embodiment of the present disclosure.

[0023] To achieve the above-mentioned purpose, the fifth aspect of the present disclosure proposes a computer program product, including a computer program, which is used to implement the data migration method as described in the first aspect of the present disclosure when executed by a processor.

[0024] Generate migration labels according to the user's migration requirements, and determine the data to be migrated from the source database based on the migration labels. Compared with the current technology of migrating all data in the database, it can avoid the migration of useless information, save the storage space of the target database, facilitate the subsequent use of the target database, and improve the user experience. At the same time, by setting migration policies, different migration requirements can be met, personalized migration can be achieved, and the user experience can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 is a schematic diagram of a data migration method according to an embodiment of the present disclosure;

[0026] Figure 2 is a schematic diagram of another data migration method according to an embodiment of the present disclosure;

[0027] Figure 3 is a schematic diagram of another data migration method according to an embodiment of the present disclosure;

[0028] Figure 4 is a schematic diagram of a data migration device according to an embodiment of the present disclosure;

[0029] Figure 5 is a schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] Embodiments of the present disclosure are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0031] The information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data comply with the relevant provisions of relevant laws and regulations.

[0032] It should be noted that in the embodiments of the present disclosure, certain software, components, models and other existing solutions in the industry may be mentioned, which should be regarded as exemplary. Their purpose is only to illustrate the feasibility of the technical solution embodiments of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0033] Figure 1 is a schematic diagram of a data migration method according to an embodiment of the present disclosure. Figure 1 As shown, the data migration method includes the following steps:

[0034] S101, obtaining a source database and a target database corresponding to data migration, and obtaining a user's migration requirements.

[0035] The data migration method of the embodiment of the present application can be applied to the scenario of database data migration. The executor of the data migration of the embodiment of the present application can be the data migration device of the embodiment of the present application, and the data migration device can be set on an electronic device.

[0036] In the embodiment of the present disclosure, the source database is a database storing source data, and the target database is a database of all or part of the source data to be migrated.

[0037] It should be noted that the source database and the target database may be databases of the same type or databases of different types, and no limitation is made here.

[0038] In the embodiment of the present disclosure, the migration requirement is generated by the user, and is used to limit data such as the object, scope, and size of the current migration operation. The migration requirement may include a variety of data, for example, the type of data to be migrated, the location of the migration data, etc.

[0039] In the disclosed embodiment, the migration requirement may be input by the user, or may be selected by the user based on migration requirement options set in advance.

[0040] S102: extract features of the migration requirement to obtain at least one target feature, and establish a migration label based on the target feature.

[0041] In the embodiments of the present disclosure, it should be noted that there may be multiple methods for feature extraction, and no limitation is made herein.

[0042] In a possible implementation, the feature extraction algorithm can be used to extract features of the migration requirements. There are many types of feature extraction algorithms, which are not limited here. In a possible implementation, the feature extraction algorithm can be a natural language algorithm designed in advance.

[0043] It should be noted that the target feature can be various, and no limitation is given here. For example, the target feature can be an image, a specific storage location, etc.

[0044] In the disclosed embodiment, the migration requirement is firstly feature extracted to obtain at least one target feature, and then a migration label is established based on the target feature. Thus, by extracting the features of the migration requirement, an accurate migration label can be established, providing a data basis for subsequent data screening of the source database.

[0045] S103: Filter out a set of candidate data migration objects from the source database based on the migration labels.

[0046] In the embodiment of the present disclosure, after the migration label is obtained, there may be multiple methods for screening the source database, which are not limited here.

[0047] In a possible situation, when the migration tag is an image, filtering may be performed based on the data type of all the data in the source database to filter out data whose data type is an image.

[0048] In another possible situation, when the migration tag is a specific storage location, the data of the storage location can be marked and selected.

[0049] In another possible situation, when the migration tag is an image of a specific storage location, the image of the storage location can be marked and selected.

[0050] It should be noted that after the migration tag is obtained, the data in the source database may be marked according to the migration tag to determine the data to be migrated, and all the data to be migrated may be generated into a candidate data migration object set.

[0051] S104: writing the candidate data migration object set into the target database according to the migration label and the preset migration strategy.

[0052] It should be noted that the preset migration strategy may be designed in advance, or may be designed and implemented by the operator according to actual design needs, thereby meeting different migration needs and realizing personalized migration.

[0053] In a possible implementation, the migration strategy may be to migrate data in order according to their priority.

[0054] In another possible implementation, the migration strategy may also include data transmission speed, transmission time, etc. during data migration. For example, the migration time may be set to a certain time period, and data migration is performed within the time period, and data migration is stopped outside the time period, thereby ensuring the normal use of the database.

[0055] In the disclosed embodiment, the source database and the target database corresponding to the data migration are first obtained, and the migration requirements of the user are obtained, and then the migration requirements are feature extracted to obtain at least one target feature, and a migration label is established based on the target feature, and then a set of candidate data migration objects is screened out from the source database based on the migration label, and finally, the set of candidate data migration objects is written into the target database according to the migration label and the preset migration strategy. Thus, a migration label is generated according to the migration requirements of the user, and the data to be migrated is determined from the source database based on the migration label. Compared with the current technology of migrating all the data in the database, the migration of useless information can be avoided, the storage space of the target database can be saved, the subsequent use of the target database can be facilitated, and the user experience can be improved. At the same time, by setting the migration strategy, different migration requirements can be met, personalized migration can be achieved, and the user experience can be improved.

[0056] In the embodiment of the present disclosure, after it is determined to perform data migration, a data object interaction link may be constructed between the source database and the target database, and then data transmission and migration may be performed through the data object interaction link.

[0057] In a possible implementation, in response to identifying that there are remaining data migration objects that have not been written to the target database in the candidate data migration object set, data migration from the source database to the target database is continued, or in response to identifying that there are no remaining data migration objects that have not been written to the target database in the candidate data migration object set, the data object interaction link between the source database and the target database is closed. Thus, by identifying whether there are remaining data migration objects in the target database and closing the data object interaction link, automatic control of stopping the database migration action can be achieved.

[0058] In the above embodiment, based on the migration label, the candidate data migration object set is screened out from the source database. First, the migration label is matched with the source code of the source database, and the matching point is used as the matching point. Then, based on the migration label, a migration annotation is established at the matching point, and the data with the migration annotation is used to generate the candidate data migration object set. Therefore, by establishing a migration annotation for the data in the source database, the data in the source database can be screened, and the data that needs to be migrated and the useless data can be accurately distinguished, providing a data basis for subsequent data migration.

[0059] It should be noted that the migration annotations corresponding to different migration labels may be the same or different, and no limitation is imposed herein. For example, the migration annotation corresponding to the migration label X1 may be 1, and the migration annotation corresponding to the migration label X2 may be 1 or 2.

[0060] In the above embodiment, according to the migration label and the preset migration strategy, the candidate data migration object set is written into the target database. In response to the migration strategy being the first migration strategy, all the data in the source database may be first written into the target database, and then the data marked as empty in the target database may be deleted. Thus, by writing all the data in the source database into the target database and deleting the useless data at the target database end according to the migration label, the storage space of the target database may be saved, the subsequent use of the target database may be facilitated, and the user experience may be improved.

[0061] In the above embodiment, according to the migration label and the preset migration strategy, the candidate data migration object set is written into the target database. In response to the migration strategy being the second migration strategy, the data of the candidate data migration object set can be mapped to obtain the mapped target mapping object, and the target mapping object is written into the target database. Thus, by writing all the data in the source database into the target database and deleting the useless data at the source database end according to the migration label, the storage space of the target database can be saved, the subsequent use of the target database can be facilitated, and the user experience can be improved.

[0062] In the above embodiment, the data of the candidate data migration object set is mapped to obtain the mapped target mapping object, and the target mapping object is written into the target database. Figure 2 Explaining further, the method includes:

[0063] S201, obtaining a preset data object mapping strategy, wherein the data object mapping strategy is constructed based on JPA.

[0064] In the embodiment of the present disclosure, the data object mapping strategy is a mapping between different database languages, which is used to translate the data in the source database into data that can be recognized, stored or read by the target database.

[0065] It should be noted that Java Persistence API (JPA) is an object-relational mapping (ORM) standard for managing persistent data in relational databases on the Java platform. JPA defines a set of application programming interfaces (APIs) for managing and manipulating persistent data, allowing developers to process database data in an object-oriented manner without having to directly write structured query language (SQL) statements.

[0066] S202: Map the target data migration object according to the data object mapping strategy to obtain a mapped target mapping object.

[0067] S203, obtaining a target write address of the target mapping object in the target database, and writing the target mapping object into the target database based on the target write address.

[0068] In an embodiment of the present disclosure, the mapping table position of the target mapping object in the target database can be first obtained as the target write address, and then the target mapping object can be mapped and written to the target write address through a preset mapping object write strategy to write the target mapping object into the target database.

[0069] It should be noted that the strategy designed in advance is the strategy for the source database and the target database when performing data migration, which is used to control the data migration process. The strategy may include multiple strategies, which are not limited here. For example, it may include strategies for data transmission direction, transmission speed, and data storage location, etc. Therefore, by controlling the mapping object write strategy, the progress storage location of data migration, etc. can be flexibly controlled.

[0070] In the disclosed embodiment, firstly, a preset data object mapping strategy is obtained, wherein the data object mapping strategy is constructed based on JPA, then the target data migration object is mapped according to the data object mapping strategy to obtain the mapped target mapping object, and finally the target write address of the target mapping object in the target database is obtained, and the target mapping object is written into the target database based on the target write address. Thus, through the data object mapping strategy, the data in the source database is translated into data that can be recognized, stored or read by the target database, and data transmission between different databases can be realized.

[0071] In the above embodiment, the candidate data migration object set is written into the target database, and the Figure 3 Explaining further, the method includes:

[0072] S301: Obtain the migration order of each candidate data migration object in the candidate data migration object set.

[0073] In the embodiment of the present disclosure, the source data objects at each source data address in the source data address set of the source database can be first obtained, and each source data object can be determined as each candidate data migration object to be migrated, and then the data level of each candidate data migration object can be obtained, and the migration order of each candidate data migration object can be determined according to the data level. Determining the migration order by level can ensure that data with a higher level is transmitted first.

[0074] It should be noted that the importance of different levels may be different, and the data on the higher-importance level has a higher priority for transmission. It should be noted that the level of data may be marked in advance in the database source code, and may also be confirmed based on the storage location and type of the data, and no limitation is made here.

[0075] S302: Write the candidate data migration object set into the target database based on the migration order.

[0076] In an embodiment of the present disclosure, each candidate data migration object in the candidate data object set can be sorted according to the migration order to obtain a migration object sequence corresponding to the candidate data migration object set, and then the candidate data migration object that meets the preset migration conditions is obtained from the migration object sequence as the target data migration object in the candidate data migration object set.

[0077] In an embodiment of the present disclosure, the migration order of each candidate data migration object in the candidate data migration object set is first obtained, and then the candidate data migration object set is written into the target database based on the migration order, thereby ensuring that data with a higher level is transmitted first, thereby improving the effect of database migration.

[0078] Corresponding to the data migration methods provided in the above-mentioned embodiments, an embodiment of the present disclosure also provides a data migration device. Since the data migration device provided in the embodiment of the present disclosure corresponds to the data migration methods provided in the above-mentioned embodiments, the implementation methods of the above-mentioned data migration methods are also applicable to the data migration device provided in the embodiment of the present disclosure and will not be described in detail in the following embodiments.

[0079] Figure 4 is a schematic diagram of a data migration device according to an embodiment of the present disclosure. Figure 4 As shown, the data migration device 400 includes: an acquisition module 410, a creation module 420, a screening module 430 and a migration module 440.

[0080] The acquisition module 410 is used to acquire the source database and the target database corresponding to the data migration, and acquire the migration requirements of the user.

[0081] Establishing module 420, for performing feature extraction on the migration requirement to obtain at least one target feature, and establishing a migration label based on the target feature;

[0082] The screening module 430 is used to screen out a set of candidate data migration objects from the source database based on the migration tags.

[0083] The migration module 440 is used to write the candidate data migration object set into the target database according to the migration label and the preset migration strategy.

[0084] In a possible implementation, the screening module 430 is further used to: match the migration tag with the source code of the source database, and use the successfully matched points as matching points; establish migration annotations at the matching points based on the migration tags, and generate a candidate data migration object set for the data with the migration annotations.

[0085] In a possible implementation, the screening module 430 is further configured to: in response to the migration strategy being the first migration strategy, write all data in the source database into the target database; and delete the data marked as empty in the target database.

[0086] In one possible implementation, writing a set of candidate data migration objects into a target database according to a migration tag includes: in response to a migration strategy being a second migration strategy, mapping data of the set of candidate data migration objects to obtain a mapped target mapping object, and writing the target mapping object into the target database.

[0087] In a possible implementation, mapping a target data migration object to obtain a mapped target mapping object, and writing the target mapping object into a target database includes: obtaining a preset data object mapping strategy, wherein the data object mapping strategy is constructed based on JPA; mapping the target data migration object according to the data object mapping strategy to obtain a mapped target mapping object; mapping the target data migration object according to the data object mapping strategy to obtain a mapped target mapping object;

[0088] In one possible implementation, a target write address of a target mapping object in a target database is obtained, and the target mapping object is written to the target database based on the target write address, including: obtaining a mapping table location of the target mapping object in the target database as the target write address; and mapping and writing the target mapping object to the target write address through a preset mapping object write strategy to write the target mapping object to the target database.

[0089] In a possible implementation, the device is further used to: obtain a migration order of each candidate data migration object in the candidate data migration object set; and write the candidate data migration object set into the target database based on the migration order.

[0090] In one possible implementation, the migration order of each candidate data migration object in the candidate data migration object set is obtained, including: obtaining source data objects at each source data address in the source data address set of the source database, and determining each source data object as a candidate data migration object to be migrated; obtaining the data level of each candidate data migration object, and determining the migration order of each candidate data migration object according to the data level.

[0091] In one possible implementation, the device is also used to: sort the candidate data migration objects in the candidate data object set according to the migration order to obtain a migration object sequence corresponding to the candidate data migration object set; and obtain the candidate data migration object that meets the preset migration conditions from the migration object sequence as the target data migration object in the candidate data migration object set.

[0092] In one possible implementation, after the candidate data migration object set is written to the target database according to the migration tag and the preset migration strategy, the method includes: in response to identifying that there are remaining data migration objects in the candidate data migration object set that have not been written to the target database, continuing the data migration from the source database to the target database; or, in response to identifying that there are no remaining data migration objects in the candidate data migration object set that have not been written to the target database, closing the data object interaction link between the source database and the target database.

[0093] Generate migration labels according to the user's migration requirements, and determine the data to be migrated from the source database based on the migration labels. Compared with the current technology of migrating all data in the database, it can avoid the migration of useless information, save the storage space of the target database, facilitate the subsequent use of the target database, and improve the user experience. At the same time, by setting migration policies, different migration requirements can be met, personalized migration can be achieved, and the user experience can be improved.

[0094] In order to implement the above embodiment, the present disclosure further provides an electronic device 500, Figure 5 is a schematic diagram of an electronic device according to an embodiment of the present disclosure, such as Figure 5 As shown, the electronic device 500 includes: a processor 501 and a memory 502 that is communicatively connected to the processor, the memory 502 stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor 501 to implement the present disclosure. Figure 1-Figure 3 A data migration method according to an embodiment.

[0095] In order to implement the above embodiments, the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to implement the above embodiments. Figure 1-Figure 3 A data migration method according to an embodiment.

[0096] In order to implement the above embodiments, the present disclosure also provides a computer program product, including a computer program. When the computer program is executed by a processor, the computer program implements the above embodiments. Figure 1-Figure 3 A data migration method according to an embodiment.

[0097] It should be noted that personal information from users should be collected for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. In addition, such collection / sharing should be carried out after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign the agreement / authorization including authorization of relevant user information before the user uses the function. In addition, any necessary steps should be taken to protect and safeguard access to such personal information data and ensure that others who have access to personal information data comply with its privacy policy and procedures.

[0098] The present application is expected to provide an implementation scheme for users to selectively block the use or access of personal information data. That is, the present disclosure is expected to provide hardware and / or software to prevent or block access to such personal information data. Once the personal information data is no longer needed, the risk can be minimized by limiting data collection and deleting the data. In addition, when applicable, such personal information is de-identified to protect the privacy of the user.

[0099] In the description of the aforementioned embodiments, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0100] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0101] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0102] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that contains, stores, communicates, propagates or transmits a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0103] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0104] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0105] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0106] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. A data migration method, characterized in that: The method comprises: Obtain the source database and target database corresponding to the data migration, and obtain the user's migration requirements; Performing feature extraction on the migration requirement to obtain at least one target feature, and establishing the migration label based on the target feature; Filtering a set of candidate data migration objects from the source database based on the migration label; The candidate data migration object set is written into the target database according to the migration label and a preset migration strategy.

2. The method according to claim 1, characterized in that The step of selecting a set of candidate data migration objects from the source database based on the migration label includes: Matching the migration tag with the source code of the source database, and taking the point where the match succeeds as the matching point; A migration annotation is established at the matching point based on the migration tag, and the candidate data migration object set is generated from the data having the migration annotation.

3. The method according to claim 2, characterized in that The step of writing the candidate data migration object set into the target database according to the migration label and the preset migration strategy includes: In response to the migration strategy being the first migration strategy, writing all the data in the source database into the target database; Delete the data marked as empty in the target database.

4. The method according to claim 2, characterized in that: The step of writing the candidate data migration object set into the target database according to the migration label and the preset migration strategy includes: In response to the migration strategy being the second migration strategy, the data of the candidate data migration object set is mapped to obtain a mapped target mapping object, and the target mapping object is written into the target database.

5. The method according to claim 4, characterized in that The step of mapping the data of the candidate data migration object set to obtain a mapped target mapping object, and writing the target mapping object into the target database includes: Obtain a preset data object mapping strategy, wherein the data object mapping strategy is constructed based on JPA; Mapping the target data migration object according to the data object mapping strategy to obtain the mapped target mapping object; A target write address of the target mapping object in the target database is obtained, and the target mapping object is written into the target database based on the target write address.

6. The method according to claim 5, characterized in that The obtaining a target write address of the target mapping object in the target database, and writing the target mapping object into the target database based on the target write address, comprises: Obtaining a mapping table location of the target mapping object in the target database as the target write address; The target mapping object is mapped and written to the target writing address through a preset mapping object writing strategy, so as to write the target mapping object into the target database.

7. The method according to claim 1, characterized in that The method further comprises: Obtaining a migration order of each candidate data migration object in the candidate data migration object set; The candidate data migration object set is written into the target database based on the migration order.

8. The method according to claim 7, characterized in that The obtaining the migration order of each candidate data migration object in the candidate data migration object set includes: Acquire source data objects of the source database at each source data address in the source data address set, and determine each source data object as each candidate data migration object to be migrated; The data level of each candidate data migration object is obtained, and the migration order of each candidate data migration object is determined according to the data level.

9. The method according to claim 8, characterized in that The method further comprises: According to the migration order, each candidate data migration object in the candidate data object set is sorted for migration to obtain a migration object sequence corresponding to the candidate data migration object set; A candidate data migration object that meets a preset migration condition is obtained from the migration object sequence as the target data migration object in the candidate data migration object set.

10. The method according to any one of claims 1 to 9, characterized in that After the candidate data migration object set is written into the target database according to the migration label and the preset migration strategy, the method further includes: In response to identifying that there are remaining data migration objects in the candidate data migration object set that have not been written to the target database, continuing the data migration from the source database to the target database; or, In response to identifying that there are no remaining data migration objects in the candidate data migration object set that have not been written to the target database, closing a data object interaction link between the source database and the target database.

11. A data migration device, characterized in that: include: The acquisition module is used to obtain the source database and target database corresponding to the data migration and obtain the user's migration requirements; An establishment module is used to perform feature extraction on the migration requirement to obtain at least one target feature, and establish the migration label based on the target feature; A screening module, configured to screen a set of candidate data migration objects from the source database based on the migration label; The migration module is used to write the candidate data migration object set into the target database according to the migration label and the preset migration strategy.

12. An electronic device, characterized in that: Including memory and processor; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 10 when executed by a processor.

14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.

Citation Information

Patent Citations

  • Data migration method and device

    CN113868227A

  • Data migration method and device, storage medium and electronic equipment

    CN115328891A

  • Batch data migration method and system

    CN116243861A

  • Systems and methods for migrating data

    EP1857946A2

  • Method To Transfer Annotation Across Versions of the Data

    US20090249291A1