CN116126834A - Database migration method, device, computer equipment and storage medium - Google Patents

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

Info

Publication number
CN116126834A
CN116126834A CN202310199252.0A CN202310199252A CN116126834A CN 116126834 A CN116126834 A CN 116126834A CN 202310199252 A CN202310199252 A CN 202310199252A CN 116126834 A CN116126834 A CN 116126834A
Authority
CN
China
Prior art keywords
file
database
target platform
files
backup image
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
CN202310199252.0A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310199252.0A priority Critical patent/CN116126834A/en
Publication of CN116126834A publication Critical patent/CN116126834A/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
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • 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
    • G06F16/2282Tablespace storage structures; Management thereof
    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a database migration method, a database migration device, computer equipment and a storage medium. The method comprises the following steps: and acquiring a backup image file corresponding to the database of the host, issuing the backup image file to the target platform through a file transfer protocol, and importing the backup image file into the database of the target platform after decoding. By adopting the method, the host database and the target platform database can be connected, the file in the host database is automatically synchronized into the target platform database through the file transfer protocol, and compared with the traditional method for manually transferring the database in a cross-platform manner, the migration efficiency of the scheme is extremely high.

Description

Database migration method, device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a database migration method, apparatus, computer device, and storage medium.
Background
The data is the most core asset of each big data center, and the database is widely applied to large core devices such as industrial computers, computing centers, servers and the like in various fields as a storage tool of the data.
With transformation of an IT architecture, in order to realize data sharing, databases of a large host gradually migrate to open source databases of various platforms. At present, because various platform operating systems and configurations are different, the migration of the database of the host computer to various platform databases can only be completed manually, and in the process, the conversion of related data or files of the database also needs to be completed manually, so that the migrated database can be normally used.
However, the above database migration method has a problem of low migration efficiency.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a database migration method, apparatus, computer device, and storage medium capable of improving database migration efficiency.
In a first aspect, the present application provides a database migration method. The method comprises the following steps:
acquiring a backup image file corresponding to a database of a host;
and issuing the backup image file to the target platform through a file transfer protocol to instruct the target platform to guide the backup image file into a database of the target platform after decoding.
In one embodiment, the method for delivering the backup image file to the target platform through the file transfer protocol includes:
Splitting the backup image file into a table record file and a table structure file;
and transmitting the table record file and the table structure file to the target platform through a file transmission protocol.
In one embodiment, the method for issuing the table record file and the table structure file to the target platform through the file transfer protocol includes:
recording file names of the table record files and the table structure files into a table file list;
and serially issuing the files recorded in the list of the table files to the target platform one by one based on the file transfer protocol by scanning the list of the table files.
In one embodiment, by scanning the list of table files, the files recorded in the list of table files are serially issued to the target platform one by one based on the file transfer protocol, including:
issuing a first recorded file in the list of table files to a target platform based on a file transfer protocol by scanning the list of table files, and deleting the first recorded file in the list of table files;
determining whether a list of the table files is empty, and if so, determining that the file issuing is completed; if the file is not empty, continuing to take the file of the next record as the file of the new first record, and returning to execute the step of issuing the file of the first record in the list of the table files to the target platform based on the file transfer protocol until the list of the table files becomes the empty file.
In one embodiment, obtaining a backup image file corresponding to a database of a host includes:
obtaining backup files when the host computer routinely backs up the table data in the database;
and converting the backup file into an image file to obtain the backup image file.
In a second aspect, the present application further provides a database migration method, where the method includes:
receiving a backup image file issued by a host through a file transfer protocol;
and importing the backup image file into a database of the target platform after decoding.
In one embodiment, the backup image file includes a table record file and a table structure file, and importing the backup image file into a database of the target platform after decoding includes:
respectively decoding the table record file and the table structure file according to a preset decoding rule to obtain a decoded table record file and a decoded table structure file;
and importing the decoded table record file and the table structure file into a database of the target platform.
In one embodiment, importing the decoded table record file and the table structure file into a database of the target platform includes:
establishing a database table in a database of the target platform according to the decoded table structure file;
And importing the decoded table record file into a database table.
In a third aspect, the present application further provides a database migration apparatus. The device comprises:
the acquisition module is used for acquiring the backup image file corresponding to the database of the host;
and the issuing module is used for issuing the backup image file to the target platform through a file transfer protocol so as to instruct the target platform to guide the backup image file into a database of the target platform after decoding.
In a fourth aspect, the present application further provides a database migration apparatus. The device comprises:
the receiving module is used for receiving the backup image file issued by the host through the file transfer protocol;
and the importing module is used for importing the backup image file into the database of the target platform after decoding.
In a fifth aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring a backup image file corresponding to a database of a host;
and issuing the backup image file to the target platform through a file transfer protocol to instruct the target platform to guide the backup image file into a database of the target platform after decoding.
In a sixth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring a backup image file corresponding to a database of a host;
and issuing the backup image file to the target platform through a file transfer protocol to instruct the target platform to guide the backup image file into a database of the target platform after decoding.
The database migration method, the database migration device, the computer equipment and the storage medium acquire the backup image files corresponding to the database of the host, the backup image files are issued to the target platform through the file transfer protocol, and then the backup image files are imported into the database of the target platform after being decoded. The method links the host database and the target platform database, realizes automatic synchronization of files in the host database to the target platform database through a file transfer protocol, and has extremely high migration efficiency compared with the traditional method of manually migrating the databases across platforms; in addition, the file in the host database is decoded through the specific decoding tool to obtain the file which can be identified by the platform database, so that the problem that the backup data of the host database cannot be identified in the platform database and the problem that the backup file of the host database is continuously used in the platform database are solved.
Drawings
FIG. 1 is a diagram of an application environment for a database migration method in one embodiment;
FIG. 2 is a flow diagram of a database migration method in one embodiment;
FIG. 3 is a flowchart illustrating a step of downloading a file to a target platform in one embodiment;
FIG. 4 is a flowchart illustrating a step of downloading a file to a target platform in one embodiment;
FIG. 5 is a flowchart illustrating a step of downloading a file to a target platform in one embodiment;
FIG. 6 is a flowchart illustrating steps for obtaining a backup image file in one embodiment;
FIG. 7 is a flow diagram of a process for importing a file into a target platform in one embodiment;
FIG. 8 is a flow diagram of a process for importing a file into a target platform in one embodiment;
FIG. 9 is a flow diagram of a process for importing a file into a target platform in one embodiment;
FIG. 10 is a flow diagram of a database migration apparatus in one embodiment;
FIG. 11 is a flow diagram of a database migration apparatus in one embodiment;
FIG. 12 is a flow diagram of a database migration apparatus in one embodiment;
FIG. 13 is a flow diagram of a database migration apparatus in one embodiment;
FIG. 14 is a flow diagram of a database migration apparatus in one embodiment;
Fig. 15 is an internal structural view of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The database migration method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein a Mainframe/Mainframe (Mainframe) 101 communicates with an open platform 102 over a communications network. The mainframe 101 is a mainframe using a special processor instruction set, an operating system and application software, and is mainly used in commercial fields such as banking systems and telecommunication systems. An Open Platform (OP) 102 may package services of a website into a series of easily identifiable data interfaces of a computer for a third party developer to use, for example, a microblog Open Platform, a hundred degrees Open Platform, etc. As shown in fig. 1, in a practical application environment, a mainframe 101 may be directly connected to an open platform 102 through a communication network.
With the transformation of internet technology (Internet Technology, IT) architecture, databases of large hosts are gradually transferred to open source databases of various open platforms. Because the coding mechanisms of the large-scale host database and the open platform database are different, the backup files in the large-scale host database cannot be directly imported into the open platform database, and therefore, a set of automatic import method and device of the system are needed to realize the transfer of the backup files in the large-scale host database into the open platform database. The "mainframe" is referred to as "mainframe" in the following embodiments, and the "open platform" is referred to as "target platform" in the following embodiments.
After the application scenario of the database migration method provided in the embodiment of the present application is described above, the migration process of the database is described in the following.
In one embodiment, as shown in fig. 2, a database migration method is provided, which is illustrated by taking the application of the method to the host 103 in fig. 1 as an example, and includes the following steps:
s201, acquiring a backup image file corresponding to a database of a host.
The database of the host may include, but is not limited to, a DB2 database, an HBase database, and the like. The backup image file may be a file that the host computer maintains in its database after finishing daily routine backup of files in its database and performing image conversion.
In the embodiment of the application, the host computer carries out daily routine backup on the files in the database through the backup tool of the host computer and generates backup image files; alternatively, the host may directly read the stored file from the database and package the file to generate the backup image file. It should be noted that the extension names corresponding to the host database file and the backup image file may be different, for example, the host database file tab may generate the backup image file tab.imgcopy through a backup tool carried by the host database, and the host database file tab may generate the backup image file tab.imgcopy through a backup tool carried by the host database.
S202, the backup image file is issued to the target platform through a file transfer protocol, so that the target platform is instructed to import the backup image file into a database of the target platform after decoding.
Among them, the file transfer protocol (File Transfer Protocol, FTP) is one of the protocols in the transmission control protocol (Transmission Control Protocol, TCP)/internet protocol (Internet Protocol, IP) protocol group, and its transmission efficiency is extremely high. The target platform may be any open platform that needs to share database files with the host database, for example, a microblog open platform, a hundred degrees open platform, etc. The database of the target platform may include, but is not limited to, a DB2 database, an HBase database, etc., and the database type may be the same as or different from the database type of the host.
In this embodiment of the present application, the host may perform processing such as compression, encryption, and packaging on the backup image file obtained in S201, encapsulate the processed file according to a transmission format indicated by a file transfer protocol, and issue the encapsulated file to the target platform based on the file transfer protocol, where if the encapsulated file is formed by a plurality of data packets, the plurality of data packets may be issued to the target platform in series based on the file transfer protocol, or issued to the target platform in parallel; optionally, the host may split the backup image file into a plurality of files of different types, and then issue the plurality of files of different types to the target platform through the file transfer protocol.
After the host computer issues the backup image file to the target platform, the target platform can start the decoding tool, and decodes the backup image file through the specific decoding tool to obtain a decoded file which can be identified by the target platform, and the decoded file is imported into a database of the target platform, specifically, the decoded file can be directly copied to a corresponding folder directory in the database of the target platform, and the decoded file can also be written into the database of the target platform. It should be noted that, the target platform is pre-installed with a decoding tool, and the decoding tool may include, but is not limited to, a binary code decoder, a transcoding decoder, a display decoder, and the like. For example, if the backup image file issued to the target platform is an encrypted file, the host computer needs to decrypt the backup image file before decoding the backup image file by using a specific decoding tool, then decodes the decrypted file by using the specific decoding tool, and imports the decoded file into the database of the target platform. In another exemplary embodiment, if the backup image file issued to the target platform is in the form of a compressed file, the host computer needs to decompress the compressed file before decoding the backup image file by a specific decoding tool, and after obtaining the decompressed file, decodes the data in the decompressed file by the specific decoding tool, and guides the decoded file into the database of the target platform.
According to the database migration method, the backup image file corresponding to the database of the host is obtained, the backup image file is issued to the target platform through the file transfer protocol, and then the backup image file is imported into the database of the target platform after being decoded. The method links the host database and the target platform database, realizes automatic synchronization of files in the host database to the target platform database through a file transfer protocol, and has extremely high migration efficiency compared with the traditional method of manually migrating the databases across platforms; in addition, the file in the host database is decoded through the decoding tool to obtain the file which can be identified by the platform database, so that the problem that the backup file of the host database cannot be identified by the platform database and the problem of continuous use of the backup file of the host database in the platform database are solved.
In one embodiment, the process of delivering the backup image file to the target platform through the file transfer protocol may be described based on the embodiment shown in fig. 2, and as shown in fig. 3, the "delivering the backup image file to the target platform through the file transfer protocol" in S202 may include:
S301, splitting the backup image file into a table record file and a table structure file.
The table structure file may be a file formed by header information in the table file, for example, the header information may be gender, age, academic, income, political background, and the like. The table record file may be a file composed of specific information or specific values corresponding to the header information, for example, the specific information corresponding to the header information may be female, 26, master, 10000, group member, etc.
In the embodiment of the application, the host computer can split the backup image file through the splitting tool to obtain the split table record file and the table structure file. The splitting tool may be an Excel splitting tool, a PDF splitting tool, a form splitting tool, and the like. Illustratively, the host may split the backup image file (e.g., the backup image file is named as tab ea. Imgcopy) by a splitting tool, resulting in a split table record file (e.g., the split table record file is named as tab ea. Sysrecord) and a corresponding table structure file (e.g., the split table structure file is named as tab ea. Syspuunch). Still another exemplary, the host may split the backup image file (e.g., the backup image file is named tab eb. Imgcopy) by a splitting tool, resulting in a split table record file (e.g., the split table record file is named tab eb. Sysrecord) and a corresponding table structure file (e.g., the split table structure file is named tab eb. Syspluch). It should be noted that, the host may be pre-installed with a splitting tool, and the splitting tool may include, but is not limited to, an Excel splitting tool, a PDF splitting tool, a table splitting tool, and the like.
S302, the table record file and the table structure file are issued to the target platform through a file transfer protocol.
In the embodiment of the application, the host may first issue the table record file to the target platform based on the file transfer protocol, and then issue the table structure file to the target platform based on the file transfer protocol; optionally, the host may also simultaneously issue the table structure text and the table record file together to the target platform based on the file transfer protocol. If the backup image file corresponds to the plurality of table record files and the plurality of table structure files, or the table record files and the table structure files corresponding to the plurality of backup image files exist, the host can firstly collect all the table record files, store the backup image files in the record folder after identification, collect all the table structure files, store the backup image files in the table folder after identification, and finally send the record folder and the table folder to the target platform sequentially or simultaneously based on the file transfer protocol.
Optionally, a specific implementation manner of S302 is further provided, as shown in fig. 4, where S302 "issues the table record file and the table structure file to the target platform through a file transfer protocol", and includes:
S401, recording file names of the table record files and the table structure files into a table file list.
The list of the table files comprises file names of table record files and file names of table structure files. The list of table files is used for summarizing the file names of the table record files and the file names of the table structure files into one file list, and specifically, when recording, the table record files and the table structure files correspond to each other
In this embodiment of the present application, the host may first establish a blank table, and then add file names of the table record file and the table structure file to the blank table according to a correspondence relationship among the backup image file, the table record file and the table structure file, so as to generate a table file list; alternatively, the host may first identify the table record file and the table structure file, and then add the file names of the identified table record file and table structure file to the blank table, thereby generating the table file list. Optionally, the host may further perform classification summarization on the plurality of table record files according to file names, perform classification summarization on the plurality of table structure files, and then add the file names of the table record files and the table structure files after classification summarization to the blank table, so as to generate a table file list, for example, perform corresponding classification summarization on the file names of the table structure files respectively as TABLEA, TABLEB, TABLEC.
S402, the files recorded in the list of the table files are serially issued to the target platform one by one based on the file transfer protocol by scanning the list of the table files.
In this embodiment of the present application, the host scans the file names recorded in the table file list, finds the corresponding files from the database according to the file names in the table file list, and serially issues the files recorded in the table file list to the target platform one by one based on the file transfer protocol. It should be noted that, the host may find the files corresponding to all the file names in the table file list, and then serially issue all the files to the target platform one by one based on the file transfer protocol; optionally, the host may also issue the found file to the target platform based on the file transfer protocol when the file corresponding to the first file name in the table file list is found, and then return to the table file list to find the file corresponding to the next file name, so that the process is repeated until all the files corresponding to all the file names recorded in the table file list are issued to the target platform.
Optionally, as shown in fig. 5, further provided is S402 "by scanning the list of table files, serially issuing files recorded in the list of table files to the target platform one by one based on the file transfer protocol", including:
S501, by scanning the list of table files, the first recorded file in the list of table files is issued to the target platform based on the file transfer protocol, and the first recorded file in the list of table files is deleted.
In this embodiment of the present application, the host may scan the file name in the table file list, find the corresponding file based on the file name in the table file list, and then issue the first recorded file in the table file list to the target platform through the file transfer protocol, and delete the first recorded file in the table file list after the first recorded file in the table file list is issued. It should be noted that, if the first recorded file in the table file list is successfully issued to the target platform, the first recorded file in the table file list is deleted; if the first recorded file in the list file list fails to be issued, the first recorded file in the list file list is re-issued until the first recorded file is successfully issued to the target platform, and then the file name of the corresponding record is deleted from the list file list.
S502, determining whether the list of the table files is empty, if so, executing step S504, and if not, executing step S503.
S503, continuing to take the next recorded file as the new first recorded file, and returning to execute step S501.
S504, determining that file issuing is completed.
In this embodiment of the present application, after the first recorded file is issued to the target platform database, the host may determine whether the file name in the table file list is empty, and if the file name in the table file list is empty, it is indicated that the files corresponding to all the file names included in the table file list are successfully issued to the target platform, and at this time, it may be determined that the issuing of all the files is completed; if the file name in the table file list is not null, continuing to sequentially traverse the file names in the table file list, namely, taking the file corresponding to the file name of the next record as the file of the new first record, and returning to execute the step in the step S501 until the table file list is null. Alternatively, the host may traverse the file names in the table file list according to the preset issuing sequence, determine the file name of the next record, then use the file corresponding to the file name of the next record as the new file of the first record, and return to execute the step in S501 until the table file list is empty.
According to the method for issuing the backup image file to the target platform, the host database and the target platform database are connected, so that the file in the host database is automatically synchronized into the target platform database through the file transfer protocol, and compared with the traditional method for manually transferring the database across platforms, the migration efficiency of the method is extremely high; in addition, in the process of issuing the backup files in the host database through the file transfer protocol, if the files are issued successfully, the file names corresponding to the files are deleted one by one, so that the list file list only comprises file names which are not issued or are not issued successfully, repeated issuing of the files is avoided, and further the cross-platform migration efficiency of the data is further accelerated.
In one embodiment, the process of obtaining the backup image file corresponding to the database of the host may be described based on the embodiment shown in fig. 5, and as shown in fig. 6, the step of S201 "obtaining the backup image file corresponding to the database of the host" may include the following steps:
s601, obtaining a backup file when the host computer performs routine backup on the table data in the database.
The backup file may be a file stored in the host after the host performs daily routine backup on the data in the database. Note that the file name of the backup file may be TABLEA, TABLEB.
In this embodiment of the present application, the host may use the backup tool provided thereon to obtain a backup file when the host performs daily routine backup on data in the database, that is, the host may obtain the backup file in real time and store the backup file in the local database for later use.
S602, converting the backup file into an image file to obtain the backup image file.
In the embodiment of the application, when the host obtains the backup file of the database, the backup file can be converted into the corresponding mirror image file, so that the corresponding backup mirror image file is obtained. For example, the backup file tab lea is converted into a corresponding backup image file tab lea.imgcopy, and the backup file tab leb is converted into a corresponding backup image file tab.imgcopy, thereby obtaining the final backup image files tab.imgcopy and tab.imgcopy.
According to the method for acquiring the backup image file, the backup file in the host database is acquired first, and then the backup file is converted into the backup image file, so that the backup image file is migrated to the target platform later to provide a migrated file, and the host database and the target platform database can be further connected based on the backup image file.
In one embodiment, as shown in fig. 7, a database migration method is provided, and the method is applied to the target platform in fig. 1 for illustration, and includes the following steps:
s701, receiving the backup image file issued by the host through the file transfer protocol.
S702, the backup image file is imported into a database of the target platform after being decoded.
The above two steps correspond to the steps in the embodiment of fig. 2, and the method adopted is basically the same, and the detailed description will refer to the content of the embodiment of fig. 2, which is not repeated here.
In one embodiment, if the backup image file includes a table record file and a table structure file, when the platform performs the step of S702, as shown in fig. 8, the following steps are specifically performed:
s801, decoding the table record file and the table structure file respectively according to a preset decoding rule to obtain a decoded table record file and a decoded table structure file.
The preset decoding rule may be a decoding rule generated by the target platform by writing a field decoding program according to the field decoding function shown in the following table 1.
Table 1 field decoding function
Figure BDA0004108479060000111
/>
Figure BDA0004108479060000121
/>
Figure BDA0004108479060000131
In this embodiment of the present invention, the target platform may decode the table record file and the table structure file issued to the target platform database according to the preset decoding rule, so as to obtain a table record file and a table structure file that can be identified by the target platform database after decoding. For example, the target platform may decode the table record files tab lea, sysrecord and tab leb, sysrecord according to the above decoding rule to generate the files tab lea_pt, sysrecord and tab leb_pt, sysrecord that the target platform database can identify, and the host may also decode the table structure files tab lea, syspluch and tab leb, syspluch according to the above decoding rule to generate the files tab lea_pt, syspluch and tab_pt, syspluch that the target platform database can identify.
S802, importing the decoded table record file and the table structure file into a database of the target platform.
In this embodiment of the present application, the target platform may import the decoded table record file and the table structure file into the database of the target platform through the import tool. Optionally, the target platform may import the decoded table record file and the table structure file into the database of the target platform one by one through an import tool; alternatively, the host may import the decoded table record file and the table structure file together into the database of the target platform through the import tool. When the method is specifically imported, the target platform can directly copy the table record files and the table structure files to the corresponding folder directory, and can also directly write the table record files and the table structure files to the corresponding positions of the database.
Optionally, in the embodiment of the present application, a method for importing the decoded table record file and the table structure file into the target platform database is further provided, as shown in fig. 9, where S802 "importing the decoded table record file and the table structure file into the database of the target platform" includes:
s901, establishing a database table in a database of the target platform according to the decoded table structure file.
S902, importing the decoded table record file into a database table.
The database table may be a table with a plurality of columns and two columns built by taking the table structure file as a column, or a table with a plurality of columns and two rows built by taking the table structure file as a column.
In this embodiment of the present invention, the target platform may establish a database table in the database of the target platform according to header information of data included in the decoded table structure file, and then sequentially import specific information corresponding to header information of data included in the corresponding decoded table record file into the database table. Illustratively, tables are built in the target platform database using the decoded table structure files (e.g., decoded table structure files TABLEA_PT. SYSPUNCH and TABLEB_PT. SYSPUNCH) and the decoded table record files (e.g., decoded table record files TABLEA_PT. SYSRECORD and TABLEB_PT. SYSRECORD) are imported into the platform database tables.
According to the backup image file decoding and importing method, the backup image files in the host database are decoded through the specific decoding rules to obtain files which can be identified by the target platform database, so that the problem that backup data of the host database cannot be identified in the platform database is solved; in addition, the files which can be identified by the target platform database are imported into the target platform database in a database table establishing mode, so that the files imported into the target platform database can be orderly arranged, and further the subsequent use is more convenient.
According to the database migration method provided by the embodiment of the application, the backup image file issued by the host through the file transfer protocol is received, and the backup image file is imported into the database of the target platform after being decoded. The method links the host database and the target platform database, realizes automatic synchronization of files in the host database to the target platform database through a file transfer protocol, and has extremely high migration efficiency compared with the traditional method of manually migrating the databases across platforms; in addition, the file in the host database is decoded through the decoding tool to obtain the file which can be identified by the platform database, so that the problem that the backup file of the host database cannot be identified by the platform database and the problem of continuous use of the backup file of the host database in the platform database are solved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a database migration device for realizing the above related database migration method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in one or more embodiments of the database migration device provided below may refer to the limitation of the database migration method hereinabove, and will not be described herein.
In one embodiment, as shown in fig. 10, there is provided a database migration apparatus, including: an acquisition module 10 and a delivery module 11, wherein:
the acquisition module 10 is used for acquiring a backup image file corresponding to a database of the host;
and the issuing module 11 is used for issuing the backup image file to the target platform through a file transfer protocol so as to instruct the target platform to import the backup image file into a database of the target platform after decoding.
In one embodiment, as shown in fig. 11, the foregoing issuing module 11 includes: a splitting unit 110, a issuing unit 111, wherein:
a splitting unit 110, specifically configured to split the backup image file into a table record file and a table structure file;
The issuing unit 111 is specifically configured to issue the table record file and the table structure file to the target platform through a file transfer protocol.
In one embodiment, the foregoing issuing unit 111 is specifically configured to record file names of the table record file and the table structure file into the table file list; and serially issuing the files recorded in the list of the table files to the target platform one by one based on the file transfer protocol by scanning the list of the table files.
In one embodiment, the issuing unit 111 is specifically configured to scan the list of table files, issue the first recorded file in the list of table files to the target platform based on the file transfer protocol, and delete the first recorded file in the list of table files; determining whether a list of the table files is empty, and if so, determining that the file issuing is completed; if the file is not empty, continuing to take the file of the next record as the file of the new first record, and returning to execute the step of issuing the file of the first record in the list of the table files to the target platform based on the file transfer protocol until the list of the table files becomes the empty file.
In one embodiment, as shown in fig. 12, the acquiring module 10 includes: an acquisition unit 100, a conversion unit 101, wherein:
The obtaining unit 100 is specifically configured to obtain a backup file when the host performs routine backup on table data in the database;
the conversion unit 101 is specifically configured to convert the backup file into an image file, so as to obtain a backup image file.
In one embodiment, as shown in fig. 13, there is provided a database migration apparatus, including: a receiving module 20 and an importing module 21, wherein:
a receiving module 20, configured to receive a backup image file sent by a host through a file transfer protocol;
and the import module 21 is configured to convert the backup file into an image file, so as to obtain the backup image file.
In one embodiment, as shown in fig. 14, the importing module 21 includes: decoding section 210, importing section 211, wherein:
the decoding unit 210 is specifically configured to decode the table record file and the table structure file according to a preset decoding rule, so as to obtain a decoded table record file and a decoded table structure file;
the importing unit 211 is specifically configured to import the decoded table record file and the table structure file into the database of the target platform.
In one embodiment, the importing unit 211 is specifically configured to build a database table in a database of the target platform according to the decoded table structure file; and importing the decoded table record file into a database table.
The various modules in the database migration apparatus described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 15. The computer device includes a processor, a memory, and a network interface connected by a system bus. 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, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used to store data in the backup image file. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a database migration method.
It will be appreciated by those skilled in the art that the structure shown in fig. 15 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the computer device to which the present application is applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
acquiring a backup image file corresponding to a database of a host;
issuing the backup image file to a target platform through a file transfer protocol;
and importing the backup image file into a database of the target platform after decoding.
In one embodiment, the processor when executing the computer program further performs the steps of:
splitting the backup image file into a table record file and a table structure file;
and transmitting the table record file and the table structure file to the target platform through a file transmission protocol.
In one embodiment, the processor when executing the computer program further performs the steps of:
Recording file names of the table record files and the table structure files into a table file list;
and serially issuing the files recorded in the list of the table files to the target platform one by one based on the file transfer protocol by scanning the list of the table files.
In one embodiment, the processor when executing the computer program further performs the steps of:
issuing a first recorded file in the list of table files to a target platform based on a file transfer protocol by scanning the list of table files, and deleting the first recorded file in the list of table files;
determining whether a list of the table files is empty, and if so, determining that the file issuing is completed; if the file is not empty, continuing to take the file of the next record as the file of the new first record, and returning to execute the step of issuing the file of the first record in the list of the table files to the target platform based on the file transfer protocol until the list of the table files becomes the empty file.
In one embodiment, the processor when executing the computer program further performs the steps of:
respectively decoding the table record file and the table structure file according to a preset decoding rule to obtain a decoded table record file and a decoded table structure file;
and importing the decoded table record file and the table structure file into a database of the target platform.
In one embodiment, the processor when executing the computer program further performs the steps of:
establishing a database table in a database of the target platform according to the decoded table structure file;
and importing the decoded table record file into a database table.
In one embodiment, the processor when executing the computer program further performs the steps of:
obtaining backup files when the host computer routinely backs up the table data in the database;
and converting the backup file into an image file to obtain the backup image file.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a backup image file corresponding to a database of a host;
issuing the backup image file to a target platform through a file transfer protocol;
and importing the backup image file into a database of the target platform after decoding.
In one embodiment, the computer program when executed by the processor further performs the steps of:
splitting the backup image file into a table record file and a table structure file;
and transmitting the table record file and the table structure file to the target platform through a file transmission protocol.
In one embodiment, the computer program when executed by the processor further performs the steps of:
recording file names of the table record files and the table structure files into a table file list;
and serially issuing the files recorded in the list of the table files to the target platform one by one based on the file transfer protocol by scanning the list of the table files.
In one embodiment, the computer program when executed by the processor further performs the steps of:
issuing a first recorded file in the list of table files to a target platform based on a file transfer protocol by scanning the list of table files, and deleting the first recorded file in the list of table files;
determining whether a list of the table files is empty, and if so, determining that the file issuing is completed; if the file is not empty, continuing to take the file of the next record as the file of the new first record, and returning to execute the step of issuing the file of the first record in the list of the table files to the target platform based on the file transfer protocol until the list of the table files becomes the empty file.
In one embodiment, the computer program when executed by the processor further performs the steps of:
respectively decoding the table record file and the table structure file according to a preset decoding rule to obtain a decoded table record file and a decoded table structure file;
And importing the decoded table record file and the table structure file into a database of the target platform.
In one embodiment, the computer program when executed by the processor further performs the steps of:
establishing a database table in a database of the target platform according to the decoded table structure file;
and importing the decoded table record file into a database table.
In one embodiment, the computer program when executed by the processor further performs the steps of:
obtaining backup files when the host computer routinely backs up the table data in the database;
and converting the backup file into an image file to obtain the backup image file.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
acquiring a backup image file corresponding to a database of a host;
issuing the backup image file to a target platform through a file transfer protocol;
and importing the backup image file into a database of the target platform after decoding.
In one embodiment, the computer program when executed by the processor further performs the steps of:
splitting the backup image file into a table record file and a table structure file;
And transmitting the table record file and the table structure file to the target platform through a file transmission protocol.
In one embodiment, the computer program when executed by the processor further performs the steps of:
recording file names of the table record files and the table structure files into a table file list;
and serially issuing the files recorded in the list of the table files to the target platform one by one based on the file transfer protocol by scanning the list of the table files.
In one embodiment, the computer program when executed by the processor further performs the steps of:
issuing a first recorded file in the list of table files to a target platform based on a file transfer protocol by scanning the list of table files, and deleting the first recorded file in the list of table files;
determining whether a list of the table files is empty, and if so, determining that the file issuing is completed; if the file is not empty, continuing to take the file of the next record as the file of the new first record, and returning to execute the step of issuing the file of the first record in the list of the table files to the target platform based on the file transfer protocol until the list of the table files becomes the empty file.
In one embodiment, the computer program when executed by the processor further performs the steps of:
Respectively decoding the table record file and the table structure file according to a preset decoding rule to obtain a decoded table record file and a decoded table structure file;
and importing the decoded table record file and the table structure file into a database of the target platform.
In one embodiment, the computer program when executed by the processor further performs the steps of:
establishing a database table in a database of the target platform according to the decoded table structure file;
and importing the decoded table record file into a database table.
In one embodiment, the computer program when executed by the processor further performs the steps of:
obtaining backup files when the host computer routinely backs up the table data in the database;
and converting the backup file into an image file to obtain the backup image file.
It should be noted that, user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-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 units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (12)

1. A method of database migration, the method comprising:
acquiring a backup image file corresponding to a database of a host;
and issuing the backup image file to a target platform through a file transfer protocol to instruct the target platform to import the backup image file into a database of the target platform after decoding.
2. The method of claim 1, wherein the issuing the backup image file to the target platform via a file transfer protocol comprises:
Splitting the backup image file into a table record file and a table structure file;
and transmitting the table record file and the table structure file to the target platform through a file transmission protocol.
3. The method of claim 2, wherein the issuing the table record file and table structure file to the target platform via a file transfer protocol comprises:
recording the file names of the table record files and the table structure files into a table file list;
and transmitting the files recorded in the list of the table files to the target platform one by one in series based on the file transmission protocol by scanning the list of the table files.
4. The method according to claim 3, wherein the serially issuing files recorded in the list of table files to the target platform one by one based on the file transfer protocol by scanning the list of table files comprises:
issuing a first recorded file in the table file list to the target platform based on the file transfer protocol by scanning the table file list, and deleting the first recorded file in the table file list;
determining whether the list of the table files is empty, and if so, determining that file issuing is completed; and if the file is not empty, continuing to take the file of the next record as the file of the new first record, and returning to execute the step of issuing the file of the first record in the list of the table files to the target platform based on the file transfer protocol until the list of the table files becomes empty.
5. The method according to any one of claims 1-4, wherein the obtaining the backup image file corresponding to the database of the host includes:
obtaining backup files when the host computer routinely backs up the table data in the database;
and converting the backup file into an image file to obtain the backup image file.
6. A method of database migration, the method comprising:
receiving a backup image file issued by a host through a file transfer protocol;
and importing the backup image file into a database of the target platform after decoding.
7. The method of claim 6, wherein the backup image file includes a table record file and a table structure file, and the importing the backup image file into the database of the target platform after decoding includes:
according to a preset decoding rule, respectively decoding the table record file and the table structure file to obtain a decoded table record file and a decoded table structure file;
and importing the decoded table record file and the table structure file into a database of the target platform.
8. The method of claim 7, wherein importing the transcoded table record file and table structure file into the database of the target platform comprises:
Establishing a database table in a database of the target platform according to the decoded table structure file;
and importing the decoded table record file into the database table.
9. A database migration apparatus, the apparatus comprising:
the acquisition module is used for acquiring the backup image file corresponding to the database of the host;
and the issuing module is used for issuing the backup image file to a target platform through a file transfer protocol so as to instruct the target platform to import the backup image file into a database of the target platform after decoding.
10. A database migration apparatus, the apparatus comprising:
the receiving module is used for receiving the backup image file issued by the host through the file transfer protocol;
and the importing module is used for importing the backup image file into a database of the target platform after decoding.
11. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 8 when the computer program is executed.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 8.
CN202310199252.0A 2023-02-28 2023-02-28 Database migration method, device, computer equipment and storage medium Pending CN116126834A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310199252.0A CN116126834A (en) 2023-02-28 2023-02-28 Database migration method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310199252.0A CN116126834A (en) 2023-02-28 2023-02-28 Database migration method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116126834A true CN116126834A (en) 2023-05-16

Family

ID=86301104

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310199252.0A Pending CN116126834A (en) 2023-02-28 2023-02-28 Database migration method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116126834A (en)

Similar Documents

Publication Publication Date Title
US11003646B2 (en) Data isolation in a blockchain network
KR102277289B1 (en) Blockchain World State Merkle Patricia Tree Subtree Configuration
AU2019203849B2 (en) Updating blockchain world state merkle patricia trie subtree
CN111177302B (en) Service bill processing method, device, computer equipment and storage medium
EP3776250B1 (en) Performing map iterations in blockchain-based system
US11221992B2 (en) Storing data files in a file system
CN105117378B (en) A kind of JSON files are converted to the method and device of EXCEL file
US11106633B2 (en) DNA-based data center with deduplication capability
US20120078914A1 (en) Searchable symmetric encryption with dynamic updating
US11251969B2 (en) Performing map iterations in a blockchain-based system
US10720231B1 (en) Storing genetic data in a storage system
CN105094924A (en) Import method and device of mirror image files
WO2022082891A1 (en) Big data acquisition method and system, and computer device and storage medium thereof
CN115470156A (en) RDMA-based memory use method, system, electronic device and storage medium
CN116126834A (en) Database migration method, device, computer equipment and storage medium
CN104822076A (en) Data distribution method and device thereof
CN113505153A (en) Memorandum backup method based on iOS system and related equipment
US10168909B1 (en) Compression hardware acceleration
CN115858322A (en) Log data processing method and device and computer equipment
WO2014047606A2 (en) Techniques for data synchronization using compressive sensing
CN115396687A (en) Method, device, live broadcast system and equipment for processing service data in media resource
CN116684404A (en) Resource interaction data downloading method, device, computer equipment and storage medium
CN116846600A (en) File transmission method, apparatus, computer device, storage medium, and program product
CN116775570A (en) Information query method and device and computer equipment

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