CN115357559A - Data migration method and device, computer equipment and storage medium - Google Patents

Data migration method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115357559A
CN115357559A CN202210976937.7A CN202210976937A CN115357559A CN 115357559 A CN115357559 A CN 115357559A CN 202210976937 A CN202210976937 A CN 202210976937A CN 115357559 A CN115357559 A CN 115357559A
Authority
CN
China
Prior art keywords
main
data
data set
associated data
target storage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210976937.7A
Other languages
Chinese (zh)
Inventor
张金锋
李坤镇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN202210976937.7A priority Critical patent/CN115357559A/en
Publication of CN115357559A publication Critical patent/CN115357559A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/214Database migration support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a data migration method, a data migration device and computer equipment. The method comprises the following steps: acquiring a main data set to be migrated, generating a main data batch storage execution statement based on the main data set to be migrated, and sending the main data batch storage execution statement to a target storage end according to a target storage address so that the target storage end stores the main data set to be migrated; acquiring main data main key information corresponding to a main data set to be migrated, searching associated data main key information corresponding to the main data main key information from preset main key associated information based on the main data main key information, and acquiring an associated data set corresponding to the main data set to be migrated by using the main data main key information and the associated data main key information; and generating an associated data batch storage execution statement based on the associated data set, and sending the associated data batch storage execution statement to the target storage terminal according to the target storage address so that the target storage terminal stores the associated data set. The method can ensure the integrity of the migration data.

Description

Data migration method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of data processing, and in particular, to a data migration method, apparatus, computer device, storage medium, and computer program product.
Background
In a business system, a large number of data forms can be accumulated in an original database along with the increase of the use time, a large amount of storage space is occupied, and the forms of partial business data need to be transferred to a new database. The existing data migration method is single table migration, and migration of a single data table is executed at a time. However, the migration speed of the single table migration is slow and long, the integrity of the data is affected during the data migration, and the integrity of the service data cannot be guaranteed.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a data migration method, apparatus, computer device, computer readable storage medium and computer program product for implementing service data integrity.
In a first aspect, the present application provides a data migration method. The method comprises the following steps:
acquiring a main data set to be migrated and a target storage address, generating a main data bulk storage execution statement based on the main data set to be migrated, and sending the main data bulk storage execution statement to a target storage end according to the target storage address so that the target storage end executes the main data bulk storage execution statement to store the main data set to be migrated;
acquiring main data main key information corresponding to a main data set to be migrated, searching associated data main key information corresponding to the main data main key information from preset main key associated information based on the main data main key information, and acquiring an associated data set corresponding to the main data set to be migrated by using the main data main key information and the associated data main key information;
and generating an associated data batch storage execution statement based on the associated data set, and sending the associated data batch storage execution statement to a target storage end according to a target storage address so that the target storage end executes the associated data batch storage execution statement to store the associated data set.
In a second aspect, the present application further provides a data migration apparatus. The device comprises:
the main data migration module is used for acquiring a main data set to be migrated and a target storage address, generating a main data batch storage execution statement based on the main data set to be migrated, and sending the main data batch storage execution statement to a target storage end according to the target storage address so that the target storage end executes the main data batch storage execution statement to store the main data set to be migrated;
the associated information module is used for acquiring main data main key information corresponding to the main data set to be migrated, searching associated data main key information corresponding to the main data main key information from preset main key associated information based on the main data main key information, and acquiring an associated data set corresponding to the main data set to be migrated by using the main data main key information and the associated data main key information;
and the associated data migration module is used for generating an associated data bulk storage execution statement based on the associated data set, and sending the associated data bulk storage execution statement to the target storage end according to the target storage address so that the target storage end executes the associated data bulk storage execution statement to store the associated data set.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
acquiring a main data set to be migrated and a target storage address, generating a main data bulk storage execution statement based on the main data set to be migrated, and sending the main data bulk storage execution statement to a target storage end according to the target storage address so that the target storage end executes the main data bulk storage execution statement to store the main data set to be migrated;
acquiring main data main key information corresponding to a main data set to be migrated, searching associated data main key information corresponding to the main data main key information from preset main key associated information based on the main data main key information, and acquiring an associated data set corresponding to the main data set to be migrated by using the main data main key information and the associated data main key information;
and generating an associated data batch storage execution statement based on the associated data set, and sending the associated data batch storage execution statement to a target storage end according to a target storage address so that the target storage end executes the associated data batch storage execution statement to store the associated data set.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring a main data set to be migrated and a target storage address, generating a main data bulk storage execution statement based on the main data set to be migrated, and sending the main data bulk storage execution statement to a target storage end according to the target storage address so that the target storage end executes the main data bulk storage execution statement to store the main data set to be migrated;
acquiring main data main key information corresponding to a main data set to be migrated, searching associated data main key information corresponding to the main data main key information from preset main key associated information based on the main data main key information, and acquiring an associated data set corresponding to the main data set to be migrated by using the main data main key information and the associated data main key information;
and generating an associated data batch storage execution statement based on the associated data set, and sending the associated data batch storage execution statement to a target storage end according to a target storage address so that the target storage end executes the associated data batch storage execution statement to store the associated data set.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
acquiring a main data set to be migrated and a target storage address, generating a main data bulk storage execution statement based on the main data set to be migrated, and sending the main data bulk storage execution statement to a target storage end according to the target storage address so that the target storage end executes the main data bulk storage execution statement to store the main data set to be migrated;
acquiring main data main key information corresponding to a main data set to be migrated, searching associated data main key information corresponding to the main data main key information from preset main key associated information based on the main data main key information, and acquiring an associated data set corresponding to the main data set to be migrated by using the main data main key information and the associated data main key information;
and generating an associated data batch storage execution statement based on the associated data set, and sending the associated data batch storage execution statement to the target storage terminal according to the target storage address so that the target storage terminal executes the associated data batch storage execution statement to store the associated data set.
According to the data migration method, the data migration device, the computer equipment, the storage medium and the computer program product, the main data set to be migrated and the target storage address are obtained, the main data batch storage execution statement is generated based on the main data set to be migrated, the main data batch storage execution statement is sent to the target storage end according to the target storage address, so that the target storage end executes the main data batch storage execution statement to store the main data set to be migrated, then the associated main key information associated with the main key information of the main data is inquired through the preset main key associated information, the associated data associated with the main data can be obtained according to the main key information of the main data and the associated data main key information, the associated data associated with the main data are migrated to the target storage, the synchronous migration of the main data and the associated data is completed, and the integrity of the data migration is guaranteed.
Drawings
FIG. 1 is a diagram of an application environment for a data migration method in one embodiment;
FIG. 2 is a flow diagram that illustrates a method for data migration in one embodiment;
FIG. 3 is a diagram of primary key association information in one embodiment;
FIG. 4 is a schematic flow chart diagram illustrating data migration in one embodiment;
FIG. 5 is a flow diagram that illustrates the processing of a data migration interrupt in one embodiment;
FIG. 6 is a flow diagram illustrating deletion of data in one embodiment;
FIG. 7 is a schematic diagram illustrating the overall flow of data migration in one embodiment;
FIG. 8 is a block diagram that illustrates the structure of a data migration apparatus in one embodiment;
FIG. 9 is a diagram showing an internal structure of a computer device in one embodiment;
fig. 10 is an internal structural view of a computer device in another embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad application.
The data migration method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the server 104 communicates with the target storage 102 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104, or may be located on the cloud or other network server. The target storage 102 may be a terminal or a server. The server 104 acquires a main data set to be migrated and a target storage address, generates a main data bulk storage execution statement based on the main data set to be migrated, and sends the main data bulk storage execution statement to a target storage end according to the target storage address, so that the target storage end executes the main data bulk storage execution statement to store the main data set to be migrated; the server 104 acquires main data key information corresponding to the main data set to be migrated, searches for associated data key information corresponding to the main data key information from preset main key associated information based on the main data key information, and acquires an associated data set corresponding to the main data set to be migrated by using the main data key information and the associated data key information; the server 104 generates an associated data bulk storage execution statement based on the associated data set, and sends the associated data bulk storage execution statement to the target storage terminal according to the target storage address, so that the target storage terminal executes the associated data bulk storage execution statement to store the associated data set. The terminal may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and the like. The server 104 may be implemented as a stand-alone server or a server cluster comprised of multiple servers.
In an embodiment, as shown in fig. 2, a data migration method is provided, which is described by taking the method as an example of being applied to the server in fig. 1, and it is understood that the method may also be applied to a terminal, and may also be applied to a system including a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step 202, obtaining a main data set to be migrated and a target storage address, generating a main data bulk storage execution statement based on the main data set to be migrated, and sending the main data bulk storage execution statement to a target storage end according to the target storage address, so that the target storage end executes the main data bulk storage execution statement to store the main data set to be migrated.
The Master Data set to be migrated refers to a set of Master Data to be migrated, and the Master Data (Master Data) is shared basic Data, is a Data set to be preferentially migrated, and may be entity Data. The target memory address refers to a memory address after data migration. The main data bulk storage execution statement refers to a statement for storing a main data set to be migrated in a target storage. The target storage end refers to a target storage space corresponding to the target storage address, and can be a terminal or a server.
Specifically, the server establishes communication connection with a target storage end, performs connection test on the communication connection, responds to a data migration instruction after the connection test is completed, acquires a main data set to be migrated and a target storage address in the migration instruction, and generates a main data batch storage execution statement according to the main data set to be migrated through a preset execution statement template. And then the server sends the main data bulk storage execution statement to the target storage end according to the target storage address, so that the target storage end executes the main data bulk storage execution statement and stores the main data to be migrated to the local.
And 204, acquiring main data main key information corresponding to the main data set to be migrated, searching associated data main key information corresponding to the main data main key information from preset main key associated information based on the main data main key information, and acquiring an associated data set corresponding to the main data set to be migrated by using the main data main key information and the associated data main key information.
The main data main key information refers to main key information corresponding to a main data set to be migrated, the main data main key information is associated with associated attribute information of an associated data set, the associated attribute information of the associated data set is associated with the main key information of the associated data set, the main key information refers to unique identification information of the data set, the associated attribute information is information representing the data set to which the associated data set belongs, and the associated attribute information can be the same as the main key information of the associated data set. The preset primary key association information refers to preset information of association relations among the data sets, and the association relations among the data sets can be embodied through the association relations between the primary key information and the association attribute information. The associated data primary key information refers to primary key information corresponding to a data set associated with a primary data set to be migrated. The associated data set refers to a data set associated with the primary data to be migrated.
Specifically, the server may obtain, through the data migration instruction, primary data primary key information corresponding to the primary data set to be migrated, then obtain, by the server, locally stored configuration information in which preset primary key association information is stored, and search, by the server, association attribute information and associated data primary key information of corresponding associated data in the primary key association information according to the primary data primary key information. And then the server takes the main key information of the main data, the associated attribute information of the associated data and the main key information of the associated data as query conditions, and queries and acquires an associated data set corresponding to the main data set to be migrated in a data storage space.
In one embodiment, the configuration information stores preset primary key association information, and the primary key association information stores an association relationship between primary data primary key information and an associated data set and an association relationship between primary key information of the associated data set and a sub-associated data set. The terminal obtains main data main key information corresponding to the main data set to be migrated, and can directly obtain the associated data set corresponding to the main data set to be migrated through the main key associated information according to the main data main key information. And then the terminal can directly acquire the sub-associated data set through the main key associated information according to the associated data main key information corresponding to the associated data set.
And step 206, generating a batch storage execution statement of the associated data based on the associated data set, and sending the batch storage execution statement of the associated data to the target storage terminal according to the target storage address, so that the target storage terminal executes the batch storage execution statement of the associated data to store the associated data set.
The associated data bulk storage execution statement refers to a statement for storing an associated data set in a target storage.
Specifically, the server generates an associated data bulk storage execution statement according to the associated data set, and then sends the associated data bulk storage execution statement to the target storage end through communication connection according to the target storage address, so that the target storage end executes the associated data bulk storage execution statement to store the associated data set to the local.
In this embodiment, associated main key information associated with main data main key information can be queried by presetting main key associated information, associated data to be migrated can be acquired according to the main data main key information and the associated data main key information, so that the associated data associated with the main data is migrated to a target storage, synchronous migration of the main data and the associated data is completed, and integrity of data migration is ensured.
In one embodiment, in step 206, after generating an associated data bulk storage execution statement based on the associated data set, and sending the associated data bulk storage execution statement to the target storage end according to the target storage address, so that the target storage end executes the associated data bulk storage execution statement to store the associated data set, the method further includes:
when detecting that the associated data set has a sub-associated data set, searching sub-associated data main key information corresponding to the associated data main key information from preset main key associated information, and acquiring the sub-associated data set based on the associated data main key information and the sub-associated data main key information;
and taking the sub-associated data set as an associated data set, returning to the associated data batch storage execution statement generated based on the associated data set, and sending the associated data batch storage execution statement to the target storage end according to the target storage address so that the target storage end executes the step of storing the associated data set by the associated data batch storage execution statement until the traversal of the sub-associated data set is completed.
Wherein a sub-associated data set refers to a data set associated with an associated data set. The sub-associated data primary key information refers to primary key information corresponding to a data set associated with the associated data set.
Specifically, after the server migrates the associated data set to the target storage end, it detects whether there is a sub-associated data set corresponding to the associated data set in the data storage space. And when detecting that no sub-associated data set corresponding to the associated data set exists, the server determines that the migration of the main data set to be migrated and the associated data set is completed, and the data migration is finished.
And when detecting that the sub-associated data set corresponding to the associated data set exists, the server searches the corresponding sub-associated data main key information and the associated attribute information of the sub-associated data set in the main key associated information according to the associated data main key information. And then the server takes the associated data main key information, the associated attribute information of the sub-associated data set and the sub-associated data main key information as query conditions, and queries and acquires the sub-associated data set in the data storage space. And then the server takes the sub-associated data set as an associated data set, returns to the step of generating an associated data bulk storage execution statement based on the associated data set, and sends the associated data bulk storage execution statement to the target storage end according to the target storage address, so that the target storage end executes the step of storing the associated data set by the associated data bulk storage execution statement, and at the moment, the server migrates the sub-associated data set to the target storage end. And then the server detects whether the associated data set corresponding to the sub-associated data set exists or not, when the existence is detected, the steps are implemented, and if the nonexistence is detected, the migration of the sub-associated data set is determined to be completed.
In this embodiment, whether the associated data set has the sub-associated data set is detected, and when the associated data set has the sub-associated data set, the sub-associated data set is synchronously migrated to the target storage, so that the data integrity of the main data set to be migrated, the associated data set, and the sub-associated data set is ensured, and the target storage can perform service processing according to the main data set to be migrated, the associated data set, and the sub-associated data set, thereby improving the service processing efficiency.
In one embodiment, step 202, acquiring a primary data set to be migrated includes the steps of:
acquiring at least two target main data sets, determining a current main data set from the at least two target main data sets, and taking the current main data set as a main data set to be migrated;
after step 206, after generating an associated data bulk storage execution statement based on the associated data set, and sending the associated data bulk storage execution statement to the target storage end according to the target storage address, so that the target storage end executes the associated data bulk storage execution statement to store the associated data set, the method further includes the steps of:
and returning to determine the current main data set from the at least two target main data sets, and executing the step of taking the current main data set as the main data set to be migrated until the traversal of the at least two target main data sets is completed.
Wherein, the target primary data set refers to a primary data set to be migrated. The current primary data set refers to the primary data set that currently needs to be migrated.
In particular, the association data set may be service table data in the service data. Because the multiple service table data have an association relationship, the target master data set may be header data of the multiple associated service table data, and store the total service association information of the multiple associated service table data. For example, the target master data set may store important information fields of the order, including an order id (identification) field, an order time field, an order amount field, and the like, wherein the order number field may be used as the master data master key information corresponding to the target master data set. The main data main key information corresponding to different target main data sets is different.
The associated data set may include an extended main data set and an entry data set corresponding to the main data set to be migrated, where the extended main data set is a data set that supplements the main data set to be migrated, and the main data set to be migrated and the extended main data set may be obtained by splitting data of the same original service table, so that the main data set to be migrated and the extended main data set have a one-to-one entity association relationship. The extended main data set includes, for example, an order number field, a customer name field, a customer address field, and the like, where the order number field may serve as associated data main key information and associated attribute information corresponding to the extended main data set. The entry dataset refers to lower-level service data corresponding to a main dataset to be migrated, and includes, for example, an order id field, a commodity number field, a commodity quantity field, and the like, where a commodity number may be used as associated data main key information corresponding to the entry dataset, and an order id is used as associated attribute information corresponding to the entry dataset and indicates an order to which commodity information of the entry dataset belongs. And the associated data main key information corresponding to different entry data sets is different. The main data set to be migrated and the main data set to be expanded have one-to-many entity incidence relation. And the related data set corresponding to the main data set to be migrated has a corresponding extended related data set, which represents a data set for supplementing the related data set, and the related data set and the extended related data set have the same main key information.
When the server checks that at least two target main data sets exist in the data storage space, main data main key information corresponding to at least two target main data sets and a main key sequence corresponding to the main data main key information are obtained. And the server determines a current main data set in at least two target main data sets according to the main key sequence corresponding to the main data main key information, and then performs data migration by taking the current main data set as a main data set to be migrated. And then the server searches the associated attribute information and the associated data main key information of the extended main data set corresponding to the current main data set and the associated attribute information and the associated data main key information of the recorded data set corresponding to the current main data set in the main key associated information according to the main data main key information corresponding to the current main data set, and the server takes the extended main data set and the recorded data set as the associated data sets respectively to carry out data migration. And when the server detects that the sub-association data set corresponding to the entry data set exists, performing data migration by taking the sub-association data set as an association data set until detecting that the association data set corresponding to the sub-association data set does not exist. And when the server detects that the sub-associated data set corresponding to the recorded data set does not exist, determining that the migration of the current main data set, the extended main data set and the recorded data set is completed. And then the server returns to the step of determining the current main data set from at least two target main data sets, executes the step of taking the current main data set as the main data set to be migrated, and migrates each target main data set and the corresponding associated data set thereof to the target storage in sequence according to the main key sequence.
In one embodiment, as shown in FIG. 3, a schematic diagram of primary key association information is provided; the header data represents the main data set to be migrated; the header extension table data represents an extension main data set; the entry table data represents lower-level service data corresponding to the extended main data set and comprises an entry data set; the sub entry table data represents the lower-level service data corresponding to the entry data set, that is, the sub-associated data set corresponding to the entry data set. fid represents the primary key information corresponding to the header data and the header extended table data; fentryid represents the main key information corresponding to the entry table data and the entry expansion table data; fdeitailid represents the main key information corresponding to the sub entry table data and the sub entry extension table data. fid and fentryid association, fentryid and fdetailid association, fid of header data and fid of header extension table data, fentryid of entry table data and fentryid of entry extension table data, and fdetailid of sub entry table data and fdetailid of sub entry extension table data. The header data, the header extension table data, the entry extension table data, the sub entry table data and the sub entry extension table data all have corresponding table names. The primary key of the superior service data can be directly associated with the inferior service data, and the inferior service data can be directly obtained through the primary key of the superior service data.
In one embodiment, as shown in FIG. 4, a flow diagram of data migration is provided; the server responds to a query-by-page instruction for header data, such as:
select top 10000fid, field1.. FieldN from t _ cbsxdb _ mvtest where fbzdate >' 2022-01-00. Where lastpk is the last row data primary key fid value of the previous page of data. Representing the query 2022-01-01 00. And then the server generates a main data batch storage execution script according to the inquired page table header data, and sends the main data batch storage execution script to the target storage end, so that the target storage end executes the main data batch storage execution script and stores a plurality of sub-data in the page table header data into a target storage end database in batches. For example, the execution script for storing the header data in the target storage segment is: insert _ t _ cbsxdb _ mvtest (fid, field1 \8230; field N) values (1, \8230; (n, \8230;), wherein t _ cbsxdb _ mvtest is header data.
And then the server acquires a primary key value corresponding to the head data of the page table according to the primary key association information, and generates a head intermediate table according to the primary key value, wherein the head intermediate table is used for storing the primary key value corresponding to the head data of the page table and inquiring the associated data. The server stores the header intermediate table to the local, such as: insert _ to t _ cbsxdb _ mvtest $ m (fit) values (1) \ 8230; (n), t _ cbsxdb _ mvtest $ m is a table header intermediate table, and a field, namely a primary key value corresponding to the table header data, is stored.
Then, generating a page-by-page query instruction of the associated data according to the associated attribute information and the associated data main key information of the table head intermediate table and the associated table data, for example, a page-by-page query instruction for querying entry table data in the associated table data: select top 10000B, fentryid, B.field1 \8230, B.fieldn from t _ cbsxdb _ mvtest $ m air ner join t _ cbsxdb _ mvtest _ entry B on A.fid = B.fid and B.fentryid > lasttryid order by B.fentryid, wherein fentryid is the main key of the data of the sorting table, lasttryid is the main key fentryid value of the last line of data of the previous page, A.fid represents the main key information of the data A, and B.fid represents the associated attribute information of the data B of the sorting table. Indicating that a page of entry table data associated with the primary key fid of the header data is queried according to the primary key fid in the header intermediate table.
The server inquires a page of association table data to be migrated currently according to the association attribute information and the main key of the table head intermediate table and the association table data, wherein the page of association table data comprises table head extension table data and entry table data, and the table head extension table data and the entry table data of each page comprise a plurality of subdata. And then the server generates an associated data batch storage execution script according to the queried page associated table data, and sends the associated data batch storage execution script to the target storage end, so that the target storage end executes the associated data batch storage execution script and stores a plurality of subdata of the page associated table data into a target storage end database in batch. The server may respectively migrate the extension table data and the entry table data to the target storage end through the associated data bulk storage execution script, for example, store the entry table data to an execution statement of the target storage end: insert _ int _ cbsxdb _ mvtest _ entry (fentryid, field1 \8230; field N) values (1, \8230;) \8230; (n, \8230;).
When detecting that the association table data has the sub-association table data, the server executes a data migration process of taking the sub-association table data as the association table data to recurse to the association table data, generates a node intermediate table corresponding to the association data according to the main key of the association table data, wherein the node intermediate table is used for storing the main key value corresponding to the association table data and inquiring the sub-association table data, and acquires the main key and the association attribute information of the sub-association table data associated with the main key of the association table data from the main key association information. And then the server queries the data of the sub-association table according to the main key and the association attribute information of the intermediate node table and the data of the sub-association table by pages, performs the steps by taking the data of the sub-association table as the data of the association table, and migrates the data of the sub-association table to a target storage terminal. If the fact that the corresponding associated data exist in the sub-associated table data is not detected, returning to the step that the main key and the associated attribute information of the node intermediate table and the sub-associated table data are used for inquiring the sub-associated table data according to pages to inquire whether the sub-associated table data of the next page exist or not, and if the sub-associated table data of the next page exist, migrating the sub-associated table data of the next page to a target storage end until all the sub-associated table data are migrated. And then the server returns to the step of inquiring the data of the current page of the association table to be migrated according to the main key and the association attribute information of the head intermediate table and the association table data, checks whether the data of the association table of the next page exists or not, if so, migrates the data of the association table of the next page and all the data of the sub-association tables to the target storage end until all the data of the association table and all the data of the sub-association tables migrate to the target storage end, determines that the inquired data of the head of the current page and all the data of the association table corresponding to the head of the current page are migrated, and updates the last line of data of the head of the page as lastpk to the migration log information. If the associated table data of the next page does not exist, directly updating the last line of data of the page table header data as lastpk into the migration log information, then querying the next page table header data and circularly executing the steps, and migrating the next page table header data and all the associated table data corresponding to the next page table header data to the target storage end until all the table header data are migrated completely.
In this embodiment, by gradually migrating the header data, the association table data, and the sub-association table data of the current page to the target storage end according to the primary key association information, and then migrating the header data and all the association table data of the next page, not only can the data integrity of the header data and all the association table data of the current page be achieved, but also the maximum delay of data migration is the header data and all the association table data of the current page being migrated, and the target storage end can directly use the migrated header data and all the association table data of the current page, thereby improving the integrity and the use efficiency of the migrated data.
In one embodiment, the method further comprises:
and acquiring main data main key information corresponding to the traversed target main data set, and generating migration log information based on the main data main key information corresponding to the traversed target main data set.
The migration log information is log information for recording migration progress of all the main data sets to be migrated.
Specifically, the server queries a target main data set of a first page according to the page, migrates the target main data set of the first page and all associated data sets thereof to a target storage end, and updates migration log information according to a main key value of the last row of data in the target main data set of the first page after detecting that the migration of the target main data set of the first page and all associated data sets thereof are completed. Then the server inquires the target main data set of the next page according to the page and migrates the target main data set and the related data sets of the page until the migration of all the target main data sets and the related data sets is completed. When the terminal detects that the data volume in a target main data set of a page to be migrated currently does not meet the data full volume of the page, the terminal judges that the target main data set of the page is the target main data set of the last page, and migrates the next target main data set.
And after the target main data set and the associated data set of each page are migrated, the server updates the migration log information according to the main key value corresponding to the target main data set of each page. The server may delete all local target master data sets and their associated data sets after migration of all target master data sets and their associated data sets is complete.
In this embodiment, the migration progress of the target main data set can be monitored in real time by generating the migration log information, so that the migration integrity of the target main data set is ensured.
In one embodiment, as shown in FIG. 5, a flow diagram of a process for data migration interruption is provided; the method further comprises the following steps:
step 502, when migration interruption is detected, determining an interruption main data set and interruption main data main key information corresponding to the interruption main data set from at least two target main data sets based on migration log information;
step 504, generating a main data deleting execution statement based on the interrupted main data set, and sending the main data deleting execution statement to the target storage end, so that the target storage end deletes the interrupted main data set based on the main data deleting execution statement;
step 506, searching interruption associated data main key information corresponding to the interruption main data main key information from preset main key associated information, acquiring an interruption associated data set corresponding to the interruption main data set based on the interruption main data main key information and the interruption associated data main key information, generating an associated data deletion execution statement based on the interruption associated data set, and sending the associated data deletion execution statement to a target storage end according to a target storage address so as to enable the target storage end to execute the associated data deletion execution statement and delete the interruption associated data set;
and step 508, acquiring deletion completion information returned by the target storage terminal, taking the interrupted main data set as a main data set to be migrated based on the deletion completion information, returning a main data batch storage execution statement generated based on the main data set to be migrated, and sending the main data batch storage execution statement to the target storage terminal according to the target storage address, so that the target storage terminal executes the step of storing the main data set to be migrated by the main data batch storage execution statement to execute until at least two target main data sets are traversed and completed.
The interruption main data set refers to a target main data set with migration interruption in the migration process. The interruption main data main key information refers to main key information corresponding to the interruption main data set. The main data deletion execution statement refers to a statement for executing deletion interruption of the main data set on the target storage side. The interruption associated data primary key information refers to primary key information of an associated data set associated with the interruption primary data primary key information. An interrupt associated data set refers to an associated data set associated with an interrupt master data set. The associated data deletion execution statement refers to a statement that the deletion of the associated data set is interrupted in the target storage end.
Specifically, the server acquires migration log information when data migration is interrupted, determines an interrupted main data set in which migration interruption occurs according to main key information corresponding to a migrated target main data set in the migration log information, generates a main data deletion execution statement according to the interrupted data set, and sends the main data deletion execution statement to the target storage end, so that the target storage end deletes the migrated interrupted main data set based on the main data deletion execution statement. And then the server searches the interruption associated data main key information and the associated attribute information corresponding to the interruption main data main key information from the preset main key associated information, acquires an interruption associated data set corresponding to the interruption main data set according to the interruption main data main key information, the interruption associated data main key information and the associated attribute information, generates an associated data deletion execution statement according to the interruption associated data set, and sends the associated data deletion execution statement to the target storage end according to the target storage address so that the target storage end executes the associated data deletion execution statement to delete the migrated associated data set. And returning deletion completion information to the server after the target storage terminal confirms that deletion is completed, wherein the server takes the interrupted main data set as a main data set to be migrated according to the deletion completion information, returns to generate a main data batch storage execution statement according to the main data set to be migrated, sends the main data batch storage execution statement to the target storage terminal according to a target storage address so that the target storage terminal executes the step of storing the main data set to be migrated by the main data batch storage execution statement, migrates the interrupted main data set and all associated data sets thereof to the target storage terminal, determines a current main data set in at least two target main data sets, and then executes data migration of the current main data set and all associated data sets thereof until all the target main data sets and all associated data sets thereof are migrated.
In this embodiment, when it is detected that data migration is interrupted, the interruption main data set is determined through migration log information, and then the migrated interruption main data set and the associated data set are removed in the target storage side, so that it is avoided that the interruption main data set and the associated data set cannot be normally migrated to the target storage side due to a main key collision occurring in a re-migration process, and the integrity of data migration is ensured.
In one embodiment, the interruption main data main key information includes current page main data main key information, and the method further includes:
generating a current page main data deletion execution statement based on a current page main data set corresponding to the current page main data main key information, and sending the current page main data deletion execution statement to a target storage terminal so that the target storage terminal deletes the current page main data set based on the current page main data deletion execution statement;
searching each associated page data main key information corresponding to the current page main data main key information from the preset main key associated information, respectively obtaining corresponding associated page data sets based on each associated page data main key information, respectively generating associated page data deletion execution statements based on the associated page data sets corresponding to each associated page data main key information, and sending the associated page data deletion execution statements to a target storage end according to a target storage address so that the target storage end executes the associated page data deletion execution statements to delete the associated page data sets corresponding to each associated page data main key information.
The main key information of the main data of the current page refers to the main key information corresponding to the main data set of the page with the migration interruption in the interruption main data set. Pages refer to the basic unit of data storage, interrupting the storage of the main data set on a page-by-page basis. The current page main data set refers to a page of sub data set in the interrupt main data set, wherein migration interrupt occurs. The current page main data deleting execution statement is a statement for deleting the current page main data set at the target storage end. The associated page data main key information refers to main key information corresponding to each page sub data set obtained after the associated data set is stored according to pages. The associated page data set refers to each page sub-data set obtained after the associated data set is stored according to pages. The associated page data deletion execution statement is a statement for executing deletion of the associated page data set at the target storage terminal.
Specifically, the server determines main key information of current page main data of migration interruption according to the migration log information, acquires a main data set of the current page according to the main key information of the current page main data, generates a main data deletion execution statement of the current page according to the main data set of the current page, and sends the main data deletion execution statement of the current page to the target storage terminal, so that the target storage terminal deletes the main data set of the current page based on the main data deletion execution statement of the current page.
When the server detects that the associated data set corresponding to the main data set of the current page does not have the sub-associated data set, at least one associated page data main key information corresponding to the main key information of the main data of the current page is searched from the preset main key associated information, and the corresponding associated page data set is obtained according to each associated page data main key information. And the server generates corresponding associated page data deletion execution statements according to the associated page data sets, and sends the associated page data deletion execution statements to the target storage end according to the target storage address, so that the target storage end executes the associated page data deletion execution statements to delete the associated page data sets corresponding to the main key information of the associated page data.
When detecting that a sub-associated data set exists in an associated data set corresponding to a current page main data set, a server determines current associated page data main key information needing to be processed currently according to a main key sequence corresponding to each associated page data main key information, then searches each sub-associated page data main key information corresponding to the current associated page data main key information in preset main key associated information according to the current associated page data main key information, the sub-associated page data main key information represents main key information corresponding to each page sub-data set obtained after the sub-associated data set is stored according to pages, and deletes the sub-associated page data set in a target storage according to the steps and according to each sub-associated page data main key information. And then the server returns to the step of determining the current associated page data main key information needing to be processed currently according to the main key sequence corresponding to each associated page data main key information, and the step is executed until the traversal of each associated page data main key information is completed. At this time, the deletion of the current page main data set, the associated data set corresponding to the current page main data set, and the sub-associated data set in the target storage end is completed.
In one embodiment, as shown in fig. 6, a flow diagram of data deletion is provided; when the server detects that data migration is interrupted, for example, power is off in the process of performing migration of the associated data set, the server acquires a migration recording point of the latest migration log information after restarting, and according to page information in the migration log information, for example, main key information of header data of a previous page, the server determines main key information corresponding to the header data of the current page being migrated, that is, main key information of the main data of the current page corresponding to the main data set of the current page, according to the main key sequence. And then the server acquires the header data of the current page according to the main key information of the main data of the current page, generates a main data deleting execution script of the current page according to the header data of the current page, and sends the main data deleting execution script to the target storage end, so that the target storage end deletes the header data of the migrated current page.
And then the server generates a header intermediate table according to the main key of the header data of the current page, acquires the main key and the associated attribute information of the associated table data corresponding to the main key of the header data of the current page from the main key associated information, and performs paging query according to the main key and the associated attribute information of the header intermediate table and the associated table data and acquires at least one page of associated data corresponding to the associated table data. When the server detects that the association table data does not have corresponding sub-association table data, the server respectively generates an association page data deletion execution script according to at least one page of association data and sends the association page data deletion execution script to the target storage end, so that the target storage end deletes the migrated association table data. And after detecting that the header data of the current page and all the migrated associated table data in the target storage end are deleted, the server determines that the dirty data cleaning is interrupted, and re-executes the data migration of the header data and all the associated table data of the current page according to the migration log information.
And when detecting that the associated table data has corresponding sub-associated table data, the server takes the sub-associated table data as the associated table data to execute the step of deleting the associated table data, deletes the migrated sub-associated table data at the target storage end until the header data of the current page of the target storage end, all the migrated associated table data and the sub-associated table data are deleted, and re-executes the data migration of the header data of the current page and all the associated table data according to the migration log information.
In this embodiment, when it is detected that data migration is interrupted, the interruption main data set is determined through migration log information, and then the migrated interruption main data set and the associated data set are removed in the target storage side, so that it is avoided that the interruption main data set and the associated data set cannot be normally migrated to the target storage side due to a main key collision occurring in a re-migration process, and the integrity of data migration is ensured.
In one embodiment, the associated data sets include at least two; step 206, generating a batch storage execution statement of the associated data based on the associated data set, and sending the batch storage execution statement of the associated data to the target storage end according to the target storage address, so that the target storage end executes the batch storage execution statement of the associated data to store the associated data set, including:
determining a current associated data set from at least two associated data sets, generating a current associated data batch storage execution statement based on the current associated data set, and sending the current associated data batch storage execution statement to a target storage end according to a target storage address so that the target storage end executes the current associated data batch storage execution statement to store the current associated data set;
and when the corresponding sub-association data set does not exist in the current association data set, returning to the step of determining the current association data set from the at least two association data sets to be executed until the traversal of the at least two association data sets is completed.
The current associated data set refers to an associated data set to be currently migrated.
Specifically, after the main data set to be migrated is migrated to the target storage end, the server searches for corresponding at least two pieces of associated data main key information in the main key associated information according to the main data main key information, the server determines associated data main key information corresponding to the current associated data set according to the main key sequence of the associated data main key information corresponding to the at least two associated data sets, then the server generates a current associated data batch storage execution script according to the current associated data set, and sends the current associated data batch storage execution script to the target storage end according to the target storage address, so that the target storage end executes the current associated data batch storage execution script to store the current associated data set.
When the server detects that the current associated data set does not have the corresponding sub-associated data set, determining the next associated data set to be migrated according to the main key sequence, performing data migration by taking the next associated data set to be migrated as the current associated data set until migration of all associated data sets corresponding to the main data set to be migrated is completed, and updating the migration log information.
When the server detects that the current associated data set has a single corresponding sub-associated data set, the sub-associated data set is taken as the current associated data set for data migration, and when the sub-associated data set does not have a corresponding associated data set, the step of determining the current associated data set from at least two associated data sets is returned to be executed until migration of all associated data sets and sub-associated data sets thereof is completed, and migration log information is updated.
When the server detects that the current associated data set has a plurality of corresponding sub associated data sets, the sub associated data main key information and the associated attribute information corresponding to the plurality of sub associated data sets are searched in the main key associated information according to the associated data main key information corresponding to the current associated data set, the sub associated data set to be currently migrated is determined in the plurality of sub associated data sets according to the main key sequence of the sub associated data main key information, the sub associated data set to be currently migrated is taken as the current associated data set for data migration, when the fact that the sub associated data set to be currently migrated does not have the corresponding associated data set is detected, the step of determining the current associated data set in the plurality of sub associated data sets according to the main key sequence of the sub associated data main key information is returned until all the sub associated data sets corresponding to the current associated data set are migrated, the step of determining the current associated data set from at least two associated data sets is returned and executed until all the associated data sets and the sub associated data sets are migrated, and migration log information is updated.
In this embodiment, when the number of the associated data sets is at least two, it is determined that the current associated data set performs data migration through the primary key sequence of the associated data set, and then it is detected whether the current associated data set has a corresponding sub-associated data set, and if so, the data migration of the next associated data set and all sub-associated data sets thereof is executed after the migration of all sub-associated data sets corresponding to the current associated data set is completed, so that the integrity of the data migration of the associated data set and the sub-associated data sets corresponding to the associated data set is ensured, and the integrity of the data migration is realized.
In one embodiment, as shown in FIG. 7, an overall flow diagram of data migration is provided; before data migration, the server stores the entity association relationship which is configured in advance, namely the primary key association information. The entity association relationship comprises a one-to-one entity association relationship between the parent table and the parent table splitting table, a one-to-N entity association relationship between the parent table and the child table, a one-to-one entity association relationship between the child table and the child table splitting table and the like. The parent table may be a main data set to be migrated, or an associated data set, etc. The sub-table may be a related data set corresponding to the main data set to be migrated, or a sub-related data set corresponding to the related data set.
Then the server responds to the data migration instruction and starts to perform data migration, the server executes migration service in local storage, and the migration service comprises header data extraction, namely, the header data is written into a target storage end; extracting entity associated data, namely acquiring entity associated data corresponding to the header data according to the entity associated relation; and assembling the entity associated data batch write script, generating the entity associated data batch write script by the server through the migration service, writing the header data and the entity associated data in the local storage into the target storage end, and finishing the data migration process.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a data migration apparatus for implementing the above-mentioned data migration method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the method, so specific limitations in one or more embodiments of the data migration device provided below may refer to the limitations on the data migration method in the foregoing, and details are not described here.
In one embodiment, as shown in fig. 8, there is provided a data migration apparatus 800 comprising: a master data migration module 800, an associated information module 802, and an associated data migration module 804, wherein:
the main data migration module 802 is configured to obtain a main data set to be migrated and a target storage address, generate a main data bulk storage execution statement based on the main data set to be migrated, and send the main data bulk storage execution statement to a target storage end according to the target storage address, so that the target storage end executes the main data bulk storage execution statement to store the main data set to be migrated;
the associated information module 804 is configured to obtain primary data primary key information corresponding to the primary data set to be migrated, search, based on the primary data primary key information, associated data primary key information corresponding to the primary data primary key information from preset primary key associated information, and obtain, using the primary data primary key information and the associated data primary key information, an associated data set corresponding to the primary data set to be migrated;
and the associated data migration module 806 is configured to generate an associated data bulk storage execution statement based on the associated data set, and send the associated data bulk storage execution statement to the target storage end according to the target storage address, so that the target storage end executes the associated data bulk storage execution statement to store the associated data set.
In one embodiment, the data migration apparatus 800 further includes:
the sub-association data set traversing unit is used for searching sub-association data main key information corresponding to the association data main key information from preset main key association information when detecting that the association data set has the sub-association data set, and acquiring the sub-association data set based on the association data main key information and the sub-association data main key information; and taking the sub-associated data set as an associated data set, returning to the associated data batch storage execution statement generated based on the associated data set, and sending the associated data batch storage execution statement to the target storage end according to the target storage address so that the target storage end executes the step of storing the associated data set by the associated data batch storage execution statement until the traversal of the sub-associated data set is completed.
In one embodiment, the primary data migration module 802, includes:
a current master data set determining unit, configured to obtain at least two target master data sets, determine a current master data set from the at least two target master data sets, and use the current master data set as a master data set to be migrated; after generating the associated data bulk storage execution statement based on the associated data set and sending the associated data bulk storage execution statement to the target storage end according to the target storage address so that the target storage end executes the associated data bulk storage execution statement to store the associated data set, the method further includes: and returning to determine the current main data set from the at least two target main data sets, and executing the step of taking the current main data set as the main data set to be migrated until the traversal of the at least two target main data sets is completed.
In one embodiment, the data migration apparatus 800 further includes:
and the migration log generation unit is used for acquiring the main data main key information corresponding to the traversed target main data set and generating the migration log information based on the main data main key information corresponding to the traversed target main data set.
In one embodiment, the data migration apparatus 800 further includes:
the data cleaning unit is used for determining an interruption main data set and interruption main data main key information corresponding to the interruption main data set from at least two target main data sets based on the migration log information when the migration interruption is detected; generating a main data deleting execution statement based on the interrupted main data set, and sending the main data deleting execution statement to the target storage end so that the target storage end deletes the interrupted main data set based on the main data deleting execution statement; searching interruption associated data main key information corresponding to the interruption main data main key information from preset main key associated information, acquiring an interruption associated data set corresponding to the interruption main data set based on the interruption main data main key information and the interruption associated data main key information, generating an associated data deleting execution statement based on the interruption associated data set, and sending the associated data deleting execution statement to a target storage end according to a target storage address so that the target storage end executes the associated data deleting execution statement to delete the associated data set; and acquiring deletion completion information returned by the target storage terminal, taking the interrupted main data set as a main data set to be migrated based on the deletion completion information, returning a main data batch storage execution statement generated based on the main data set to be migrated, and sending the main data batch storage execution statement to the target storage terminal according to a target storage address so that the target storage terminal executes the step of storing the main data set to be migrated by the main data batch storage execution statement to execute until at least two target main data sets are traversed and completed.
In one embodiment, the data migration apparatus 800 further includes:
a paging clearing unit, configured to generate a current page main data deletion execution statement based on a current page main data set corresponding to the current page main data main key information, and send the current page main data deletion execution statement to the target storage end, so that the target storage end deletes the current page main data set based on the current page main data deletion execution statement; searching each associated page data main key information corresponding to the current page main data main key information from preset main key associated information, respectively acquiring corresponding associated page data sets based on each associated page data main key information, respectively generating associated page data deletion execution statements based on the associated page data sets corresponding to each associated page data main key information, and sending the associated page data deletion execution statements to the target storage end according to the target storage address, so that the target storage end executes the associated page data deletion execution statements to delete the associated page data sets corresponding to each associated page data main key information.
In one embodiment, the association data migration module 806 includes:
the current associated data set determining unit is used for determining a current associated data set from at least two associated data sets, generating a current associated data batch storage execution statement based on the current associated data set, and sending the current associated data batch storage execution statement to a target storage end according to a target storage address so that the target storage end executes the current associated data batch storage execution statement to store the current associated data set; and when the corresponding sub-association data set does not exist in the current association data set, returning to the step of determining the current association data set from the at least two association data sets to be executed until the traversal of the at least two association data sets is completed.
The modules in the data migration apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure thereof may be as shown in fig. 9. The computer device includes a processor, a memory, an Input/Output interface (I/O for short), and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and the computer program to run on the non-volatile storage medium. The database of the computer device is used for storing a main data set to be migrated, an associated data set, main key associated information and the like. The input/output interface of the computer device is used for exchanging information between the processor and an external device. The communication interface of the computer device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a data migration method.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 10. The computer apparatus includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input device. The processor, the memory and the input/output interface are connected by a system bus, and the communication interface, the display unit and the input device are connected by the input/output interface to the system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The input/output interface of the computer device is used for exchanging information between the processor and an external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a data migration method. The display unit of the computer equipment is used for forming a visual and visible picture, and can be a display screen, a projection device or a virtual reality imaging device, the display screen can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the configurations shown in fig. 9-10 are only block diagrams of some configurations relevant to the present disclosure, and do not constitute a limitation on the computing devices to which the present disclosure may be applied, and a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, carries out the steps in the method embodiments described above.
It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) referred to in the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with the relevant laws and regulations and standards of the relevant countries and regions.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, databases, or other media used in the embodiments provided herein can include at least one of non-volatile and volatile memory. The nonvolatile Memory may include a Read-Only Memory (ROM), a magnetic tape, a floppy disk, a flash Memory, an optical Memory, a high-density embedded nonvolatile Memory, a resistive Random Access Memory (ReRAM), a Magnetic Random Access Memory (MRAM), a Ferroelectric Random Access Memory (FRAM), a Phase Change Memory (PCM), a graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), for example. The databases involved in the embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
All possible combinations of the technical features in the above embodiments may not be described for the sake of brevity, but should be considered as being within the scope of the present disclosure as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A method of data migration, the method comprising:
acquiring a main data set to be migrated and a target storage address, generating a main data bulk storage execution statement based on the main data set to be migrated, and sending the main data bulk storage execution statement to a target storage end according to the target storage address so that the target storage end executes the main data bulk storage execution statement to store the main data set to be migrated;
acquiring main data main key information corresponding to the main data set to be migrated, searching associated data main key information corresponding to the main data main key information from preset main key associated information based on the main data main key information, and acquiring an associated data set corresponding to the main data set to be migrated by using the main data main key information and the associated data main key information;
and generating an associated data batch storage execution statement based on the associated data set, and sending the associated data batch storage execution statement to the target storage end according to the target storage address so that the target storage end executes the associated data batch storage execution statement to store the associated data set.
2. The method of claim 1, wherein after the generating an associated data bulk storage execution statement based on the associated data set and sending the associated data bulk storage execution statement to the target storage according to the target storage address, so that the target storage executes the associated data bulk storage execution statement to store the associated data set, the method further comprises:
when detecting that the associated data set has a sub-associated data set, searching sub-associated data main key information corresponding to the associated data main key information from preset main key associated information, and acquiring the sub-associated data set based on the associated data main key information and the sub-associated data main key information;
and taking the sub-associated data set as the associated data set, returning to the associated data bulk storage execution statement generated based on the associated data set, and sending the associated data bulk storage execution statement to the target storage end according to the target storage address, so that the target storage end executes the step of storing the associated data set by the associated data bulk storage execution statement until the traversal of the sub-associated data set is completed.
3. The method of claim 1, wherein the obtaining the primary data set to be migrated comprises:
acquiring at least two target main data sets, determining a current main data set from the at least two target main data sets, and taking the current main data set as the main data set to be migrated;
after the generating an associated data bulk storage execution statement based on the associated data set and sending the associated data bulk storage execution statement to the target storage end according to the target storage address so that the target storage end executes the associated data bulk storage execution statement to store the associated data set, the method further includes:
and returning to determine a current main data set from the at least two target main data sets, and executing the step of taking the current main data set as the main data set to be migrated until the traversal of the at least two target main data sets is completed.
4. The method of claim 3, further comprising:
acquiring main data main key information corresponding to the traversed target main data set, and generating migration log information based on the main data main key information corresponding to the traversed target main data set.
5. The method of claim 4, further comprising:
when migration interruption is detected, determining an interruption main data set and interruption main data main key information corresponding to the interruption main data set from the at least two target main data sets based on the migration log information;
generating a main data deleting execution statement based on the interrupted main data set, and sending the main data deleting execution statement to the target storage terminal so that the target storage terminal deletes the interrupted main data set based on the main data deleting execution statement;
searching interruption associated data main key information corresponding to the interruption main data main key information from preset main key associated information, acquiring an interruption associated data set corresponding to the interruption main data set based on the interruption main data main key information and the interruption associated data main key information, generating an associated data deletion execution statement based on the interruption associated data set, and sending the associated data deletion execution statement to the target storage end according to the target storage address so that the target storage end executes the associated data deletion execution statement to delete the interruption associated data set;
and acquiring deletion completion information returned by the target storage terminal, taking the interrupted main data set as a main data set to be migrated based on the deletion completion information, returning a main data batch storage execution statement generated based on the main data set to be migrated, and sending the main data batch storage execution statement to the target storage terminal according to the target storage address so that the target storage terminal executes the step of storing the main data set to be migrated by the main data batch storage execution statement until the at least two target main data sets are traversed and completed.
6. The method of claim 5, wherein the interruption main data main key information comprises current page main data main key information, the method further comprising:
generating a current page main data deletion execution statement based on a current page main data set corresponding to the current page main data main key information, and sending the current page main data deletion execution statement to the target storage terminal so that the target storage terminal deletes the current page main data set based on the current page main data deletion execution statement;
searching each associated page data main key information corresponding to the current page main data main key information from preset main key associated information, respectively acquiring corresponding associated page data sets based on each associated page data main key information, respectively generating associated page data deletion execution statements based on the associated page data sets corresponding to each associated page data main key information, and sending the associated page data deletion execution statements to the target storage end according to the target storage address, so that the target storage end executes the associated page data deletion execution statements to delete the associated page data sets corresponding to each associated page data main key information.
7. The method of claim 1, wherein the associated data set comprises at least two;
the generating of the associated data batch storage execution statement based on the associated data set, and sending the associated data batch storage execution statement to the target storage end according to the target storage address, so that the target storage end executes the associated data batch storage execution statement to store the associated data set includes:
determining a current associated data set from the at least two associated data sets, generating a current associated data batch storage execution statement based on the current associated data set, and sending the current associated data batch storage execution statement to the target storage end according to the target storage address, so that the target storage end executes the current associated data batch storage execution statement to store the current associated data set;
and when the current associated data set does not have the corresponding sub-associated data set, returning to the step of determining the current associated data set from the at least two associated data sets and executing until the traversal of the at least two associated data sets is completed.
8. An apparatus for data migration, the apparatus comprising:
the main data migration module is used for acquiring a main data set to be migrated and a target storage address, generating a main data bulk storage execution statement based on the main data set to be migrated, and sending the main data bulk storage execution statement to a target storage end according to the target storage address so that the target storage end executes the main data bulk storage execution statement to store the main data set to be migrated;
the associated information module is used for acquiring main data main key information corresponding to the main data set to be migrated, searching associated data main key information corresponding to the main data main key information from preset main key associated information based on the main data main key information, and acquiring an associated data set corresponding to the main data set to be migrated by using the main data main key information and the associated data main key information;
and the associated data migration module is used for generating an associated data bulk storage execution statement based on the associated data set, and sending the associated data bulk storage execution statement to the target storage end according to the target storage address, so that the target storage end executes the associated data bulk storage execution statement to store the associated data set.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202210976937.7A 2022-08-15 2022-08-15 Data migration method and device, computer equipment and storage medium Pending CN115357559A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210976937.7A CN115357559A (en) 2022-08-15 2022-08-15 Data migration method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210976937.7A CN115357559A (en) 2022-08-15 2022-08-15 Data migration method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115357559A true CN115357559A (en) 2022-11-18

Family

ID=84033231

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210976937.7A Pending CN115357559A (en) 2022-08-15 2022-08-15 Data migration method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115357559A (en)

Similar Documents

Publication Publication Date Title
CN107301214B (en) Data migration method and device in HIVE and terminal equipment
CN105224528B (en) Big data processing method and device based on graph calculation
CN102955792A (en) Method for implementing transaction processing for real-time full-text search engine
US10762068B2 (en) Virtual columns to expose row specific details for query execution in column store databases
WO2017161540A1 (en) Data query method, data object storage method and data system
CN108628885B (en) Data synchronization method and device and storage equipment
CN110083579A (en) Incremental data synchronous method, apparatus, computer equipment and computer storage medium
CN104636401A (en) Data rollback method and device for SCADA system
CN108140022B (en) Data query method and database system
CN113821573A (en) Mass data rapid retrieval service construction method, system, terminal and storage medium
US9213759B2 (en) System, apparatus, and method for executing a query including boolean and conditional expressions
CN104035822A (en) Low-cost efficient internal storage redundancy removing method and system
CN115470235A (en) Data processing method, device and equipment
CN111008198A (en) Service data acquisition method and device, storage medium and electronic equipment
CN116414935A (en) Method for distributed Search space vector data based on Elastic Search
CN115357559A (en) Data migration method and device, computer equipment and storage medium
CN115543918A (en) File snapshot method, system, electronic equipment and storage medium
JP2018109898A (en) Data migration system
CN104850548A (en) Method and system used for implementing input/output process of big data platform
CN114297196A (en) Metadata storage method and device, electronic equipment and storage medium
CN108021562A (en) Deposit method, apparatus and distributed file system applied to distributed file system
CN112699177A (en) Method, system, computing device and storage medium for synchronizing traffic ticket data
CN117290302B (en) Directory separation method, apparatus, computer device and storage medium
CN112084141A (en) Full-text retrieval system capacity expansion method, device, equipment and medium
CN116821102B (en) Data migration method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination