Database migration method and device, electronic equipment, storage medium and program product

By building database detection scripts and container image files, database migration is automated, solving compatibility issues during relational database upgrades and improving migration efficiency.

CN120910020APending Publication Date: 2025-11-07INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511035633.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-25
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

In existing technologies, there are incompatibility issues between old and new versions when upgrading relational databases, which makes it impossible to migrate data directly. In addition, manual testing and compatibility modification are time-consuming and have low migration efficiency.

Method used

By building a database detection script, the base image of the old version database is obtained, a transformation image is generated, container startup parameters are set, transformation statements are generated, and the transformation statements are written into the migration script to automatically migrate data to the new version database.

Benefits of technology

No manual inspection of discrepancies is required; the database migration is automated, improving migration efficiency and reducing manual intervention time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120910020A_ABST
    Figure CN120910020A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a database migration method and device, electronic equipment, a storage medium and a program product, and relates to the field of big data. The method comprises the steps of obtaining a basic mirror image of an old version database; generating a transformation mirror image of the database according to the database detection script and the basic mirror image of the old version database; setting starting parameters of the container according to the transformation mirror image of the database, and generating a transformation statement of the database; writing the transformation statement of the database into a database migration script; obtaining a mirror image file of the new version database; and running the database migration script, and importing the to-be-migrated data into the mirror image file of the new version database to complete database migration. According to the method, the database migration efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of big data, and in particular to a database migration method and device, an electronic device, a storage medium and a program product. BACKGROUND

[0002] A relational database is a database system based on a relational model to organize data. In a relational database, data is organized in the form of a table composed of rows and columns, and each table stores structured information of a specific entity, and has the characteristics of high compatibility and reliability and stability. At present, relational databases are widely deployed and applied in enterprises. The relational database is updated every certain period of time, and the old version of the database no longer provides error fixes and security patches. Therefore, in order to ensure data security, the enterprise needs to update the database to the latest version in time.

[0003] In the prior art, when the old version of the database is upgraded to the new version of the database, the new and old versions of the database are incompatible in some functions, which causes the data to be unable to be directly migrated in its entirety. The developer needs to manually detect incompatible items and perform compatibility modification on the incompatible items. After the modification is completed, the data is migrated.

[0004] However, in the prior art, the manual detection and modification of incompatible items requires a large amount of time, and in the migration process, multiple clients need to be used as a jump machine for the new and old versions of the database to migrate data, which reduces the efficiency of database migration. SUMMARY

[0005] The present application provides a database migration method, device, electronic device, storage medium and program product to solve the technical problem of low database migration efficiency in the prior art.

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

[0007] obtaining a base image of an old version of a database;

[0008] generating a modified image of the database according to a database detection script and the base image of the old version of the database;

[0009] setting a start parameter of a container according to the modified image of the database to generate a modified statement of the database;

[0010] writing the modified statement of the database into a database migration script;

[0011] obtaining an image file of a new version of the database;

[0012] running the database migration script to import the data to be migrated into the image file of the new version of the database to complete the database migration.

[0013] In a second aspect, the present application provides a database migration device, comprising:

[0014] a first obtaining module, configured to obtain a base image of an old version database;

[0015] a first generating module, configured to generate a refitting image of the database according to a database detection script and the base image of the old version database;

[0016] a second generating module, configured to set a start parameter of a container according to the refitting image of the database, and generate refitting statements of the database;

[0017] a writing module, configured to write the refitting statements of the database into a database migration script;

[0018] a second obtaining module, configured to obtain an image file of a new version database;

[0019] a running module, configured to run the database migration script, and import data to be migrated into the image file of the new version database, so as to complete the database migration.

[0020] In a third aspect, an electronic device is provided, comprising a memory and a processor.

[0021] The memory stores computer execution instructions.

[0022] The processor executes the computer execution instructions stored in the memory, so that the processor executes the first aspect and / or various possible implementation manners of the first aspect.

[0023] In a fourth aspect, a computer readable storage medium is provided, wherein the computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by a processor to implement the first aspect and / or various possible implementation manners of the first aspect.

[0024] In a fifth aspect, a computer program product is provided, comprising a computer program, and the computer program is executed by a processor to implement the first aspect and / or various possible implementation manners of the first aspect.

[0025] The database migration method, device, electronic equipment, storage medium and program product provided by the present application can construct a database detection script, obtain a basic image of an old version database, create a modified image of the database according to the database detection script and the basic image of the old version database, set the modified image as a start parameter of a container, generate a modified statement of the database, write the modified statement into a database migration script, and run the database migration script to import the data to be migrated into an image file of a new version database. The differences of the newly created version database do not need to be manually detected, the database is automatically migrated through the script and the container image file, and the migration efficiency of the database is improved. BRIEF DESCRIPTION OF DRAWINGS

[0026] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.

[0027] Figure 1 The system structure schematic diagram of the computer equipment provided by the embodiments of the present application is shown in the following figure.

[0028] Figure 2 The flowchart of the database migration method provided by the present application is shown in the following figure.

[0029] Figure 3 The structure schematic diagram of the database migration device provided by the present application is shown in the following figure.

[0030] Figure 4 The structure schematic diagram of the electronic equipment provided by the present application is shown in the following figure.

[0031] Through the above-mentioned drawings, the specific embodiments of the present application have been shown, and more detailed descriptions will be given hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application by any means, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0032] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.

[0033] It should be noted that the 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, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards of relevant countries and regions, necessary security measures are taken, do not violate public order and good customs, and provide corresponding operation portal for user to choose authorization or refusal.

[0034] And the present application involves big data analysis of user information (including but not limited to personal biological characteristics, identity data, consumption data, asset data, electronic terminal operation data, etc.), and uses artificial intelligence technology for automatic decision making, and makes technical solutions based on automatic decision making results that have a significant impact on personal rights and interests, provides corresponding operation portal for users to choose to agree or refuse automatic decision making results; if the user chooses to refuse, enter the expert decision making process.

[0035] It should be noted that the database migration method, device, electronic equipment, storage medium and program product provided by the present application can be used in the field of big data, and can also be used in any field other than big data. The application field of the database migration method, device, electronic equipment, storage medium and program product in the present application is not limited.

[0036] A relational database is a database system based on a relational model to organize data. In a relational database, data is organized in the form of tables composed of rows and columns. Each table stores structured information about a specific entity. Relational databases are widely deployed and used in enterprises. Relational databases are updated at regular intervals. Old versions of databases no longer provide error fixes and security patches. Therefore, to ensure data security, enterprises need to update the database to the latest version in a timely manner. In the prior art, when upgrading an old version of a database to a new version, the new and old versions of the database are not compatible in some functions, which prevents the data from being directly migrated in its entirety. Developers need to manually detect incompatible items and perform compatibility modifications for the incompatible items. After the modifications are completed, the data is migrated. However, in the prior art, manually checking and modifying incompatible items requires a lot of time, and during the migration process, multiple clients are needed as jump machines for migrating data between the new and old versions of the database, which reduces the efficiency of database migration.

[0037] To solve the above technical problems, the embodiment of the present application proposes the following technical concept: the inventor considers migrating the database by using the container, the image file and the script, constructs the database detection script, obtains the base image of the old version database, creates the reconstruction image of the database according to the base image of the old version database and the database detection script, sets the reconstruction image as the container startup parameter, generates the reconstruction statement of the database, writes the reconstruction statement into the database migration script, obtains the image file of the new version database, runs the database migration script, and imports the data to be migrated into the image file of the new version database, so that the difference items of the database are detected automatically, the database is migrated automatically, and the migration efficiency of the database is improved.

[0038] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in detail in some embodiments. The embodiments of the present application will be described below with reference to the drawings.

[0039] Figure 1 The system structure schematic diagram of the computer device provided by the embodiment of the present application is shown in the figure. Figure 1 As shown, the computer device comprises a receiving device 101, a processing device 102 and a display device 103.

[0040] It can be understood that the structure shown in the embodiment of the present application does not constitute a specific limitation on the database migration method. In other possible embodiments of the present application, the above architecture can include more or fewer components than the figure, or combine certain components, or split certain components, or different component arrangement, which can be determined according to actual application scene, and is not limited here. Figure 1 The components shown in the figure can be realized by hardware, software or combination of software and hardware.

[0041] In the specific implementation process, the receiving device 101 can be an input / output interface or a communication interface, and the base image of the old version database can be obtained.

[0042] The processing device 102 can generate a database migration script and migrate the database.

[0043] The display device 103 can be used to display the results of the above migration database and the like.

[0044] The display device can also be a touch display screen, which is used to receive user instructions while displaying the above content, so as to realize the operation interaction with the user.

[0045] It should be understood that the above processing device can be realized by a processor reading instructions in a memory and executing the instructions, or by a chip circuit.

[0046] In addition, the network architecture and service scenarios described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of network architecture and the appearance of new service scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0047] Figure 2 The flowchart of the database migration method provided by the present application is shown in FIG. 1. Figure 2 The method comprises the following steps:

[0048] S201: Obtain the base image of the old version database.

[0049] In the embodiment, the base image of the old version database is obtained from a public image warehouse.

[0050] The public image warehouse is an image storage platform deployed on a public network, which stores the image files of containers.

[0051] In the embodiment, the contents recorded in the base image include but are not limited to the operating system kernel, tool chain and dependent library.

[0052] S202: Generate the reconstruction image of the database according to the database detection script and the base image of the old version database.

[0053] Specifically, the database detection script is run to detect the difference information between the new and old version databases, the running order of the detection script is defined, the image configuration file is generated, the base image of the old version database and the database detection script are packaged and written into the image configuration file, and the reconstruction image of the database is generated.

[0054] S203: Set the startup parameters of the container according to the reconstruction image of the database, and generate the reconstruction statement of the database.

[0055] Specifically, the connection information of the old version database in the reconstruction image is obtained, the connection information of the old version database is set as the startup parameters of the container, the database detection script is executed by running the startup parameters, the scanning result of the old version database is generated, and the reconstruction statement of the database is generated according to the scanning result.

[0056] S204: Write the reconstruction statement of the database into the database migration script.

[0057] In the embodiment, after the database modification statement is written into the database migration script, the application service of the old version database is stopped, and it is ensured that there is no update write operation of the application to the old version database.

[0058] S205: An image file of the new version database is acquired.

[0059] In the embodiment, the base image file of the new version database is acquired from a public image warehouse.

[0060] S206: The database migration script is run, and the data to be migrated is imported into the image file of the new version database to complete the database migration.

[0061] Specifically, the connection information of the new version database is acquired, the connection information is set as the start parameter of the container, the start parameter is run, the container is started and connected to the new database, the data is imported into the new version database by executing the logical backup tool, and the database migration is completed.

[0062] From the above embodiments, it can be known that the database detection script is constructed, the base image of the old version database is acquired, the database modification image is created according to the database detection script and the base image of the old version database, the modification image is set as the start parameter of the container, the modification statement of the database is generated, the modification statement is written into the database migration script, the data to be migrated is imported into the image file of the new version database by running the database migration script, manual detection of the difference items of the new version database is not needed, the database is automatically migrated through the script and the container image file, and the migration efficiency of the database is improved.

[0063] In an embodiment of the present application, step S202 comprises:

[0064] S2021: The database detection script is run, and the difference configuration information of the new version database and the old version database is acquired.

[0065] In the embodiment, the compatibility detection steps of each check item before the database is upgraded are recorded in the database detection script.

[0066] Specifically, the database script is run, each check item of the new and old version databases is compared, and the difference configuration information of each check item of the new and old version databases is acquired.

[0067] In the embodiment, the difference configuration information of each check item includes but is not limited to the primary key table, the default character set and the password plug-in.

[0068] S2022: The running order of the database detection script is configured according to the difference configuration information.

[0069] Specifically, the difference configuration information is written into the database detection script, and according to the running order configured, the old version database and the new version database are scanned.

[0070] S2023: The running order of the database detection script is written into the base image of the old version database to generate a refactored image of the database.

[0071] Specifically, an image configuration file is generated, the base image of the old version database and the database detection script are packaged and written into the image configuration file through the build image instruction of the container, and a refactored image of the database is generated.

[0072] In this embodiment, the running order of the database detection script is the script execution order after the refactored image starts the container.

[0073] In this embodiment, after the refactored image of the database is generated, the refactored image is pushed to the private image warehouse through a push command.

[0074] In this embodiment, the private image warehouse is an image storage service deployed in a private network.

[0075] As can be seen from the above embodiments, the difference configuration information of the old and new version databases is obtained by running the database detection script, the running order of the database detection script is configured, the running order and the base image of the old version database are packaged to generate a refactored image of the database, and the difference items are detected by defining the running order and using the detection script, thereby avoiding manual detection of the difference items.

[0076] In an embodiment of the present application, step S203 comprises:

[0077] S2031: Obtain the connection information of the old version database in the refactored image of the database.

[0078] In this embodiment, the connection information of the old version database includes but is not limited to a port number, a user password, and an IP address.

[0079] S2032: Set the connection information of the old version database as the startup parameter of the container.

[0080] Specifically, according to the refactored image of the database, the container service is started, the connection information of the old version database to be migrated is set as the startup parameter of the container, and the server data disk is mounted into the container to avoid data loss caused by container crash.

[0081] S2033: Run the startup parameter and execute the database detection script in the refactored image of the database to generate a scanning result of the old version database.

[0082] Specifically, the container is automatically connected to the database after starting, executes a database detection script, scans the database to generate a scan result, and records the scan result in a text document.

[0083] S2034: generating a reconstruction statement of the database according to the scan result of the old version database.

[0084] In the embodiment, the content recorded in the scan result includes, but is not limited to, a table without a primary key, garbled comments, keywords, conflicts of reserved words, character set types, and sorting rules.

[0085] It can be known from the above embodiment that, by configuring the connection information of the old version database as a starting parameter of the container, executing the detection script by the container, and generating the reconstruction statement of the database, the reconstruction statement is automatically generated, and the migration efficiency of the database is improved.

[0086] In an embodiment of the present application, after step S2034, the method further includes:

[0087] S2035: in response to a modification operation of the reconstruction statement of the database by a developer, obtaining a modified reconstruction statement.

[0088] Specifically, the developer checks the document recording the reconstruction statement, confirms whether the reconstruction statement covers the difference items between the new and old version databases, and if there are difference items not covered, manually adds the reconstruction statement of the difference items not involved.

[0089] S2036: running the modified reconstruction statement to generate a reconstructed database text.

[0090] Specifically, the old version database is logged in by using the container service, the modified reconstruction statement is executed, and the reconstructed database text is generated.

[0091] S2037: identifying the reconstructed database text according to a review script to determine whether the old version database is reconstructed.

[0092] Specifically, the review script is executed to review the database to determine whether the old version database is reconstructed.

[0093] S2038: if the old version database is reconstructed, the modified reconstruction statement is exported as a data file, and the data file is stored to a server.

[0094] Specifically, if the old version database is reconstructed, a logical backup tool is executed to export the reconstruction statement and the migrated data as a data file, and the data file is stored in a server data directory, and then the container is stopped.

[0095] From the above embodiments, it can be seen that the review script is used to retest the old version database after the modified reconstruction statement to avoid the situation that the modified reconstruction statement cannot cover the reconstruction items of the old version database.

[0096] In an embodiment of the present application, step S206 comprises:

[0097] S2061: Obtain the connection information of the new version database in the mirror file of the new version database.

[0098] In this embodiment, the connection information of the new version database includes but is not limited to port number, user password and IP address.

[0099] S2062: Set the connection information of the new version database as the start parameter of the container.

[0100] Specifically, the base image of the new version database is pulled from the public image warehouse, the connection information of the new version database is set as the start parameter, and the server data disk is mounted.

[0101] S2063: Run the start parameter to import the data to be migrated into the mirror file of the new version database to complete the database migration.

[0102] Specifically, the start parameter is run to start the container to connect to the new database, the data is imported into the new version database by executing the logical backup tool, and the database migration is completed.

[0103] From the above embodiments, it can be seen that the connection information of the new version database is set as the start parameter of the container, and the data to be migrated is imported into the mirror file of the new version database, so that manual data migration is not required, and the efficiency of database migration is improved.

[0104] In an embodiment of the present application, after step S206, it further comprises:

[0105] S207: Configure the traffic of the application program to the migrated new version database to obtain a configured database.

[0106] Specifically, the traffic of the application program is configured to the migrated new version database through the load balancer to obtain the configured database.

[0107] S208: Perform full test on the configured database to generate a test report.

[0108] In this embodiment, the content of the full test includes but is not limited to function test, performance test and security test.

[0109] S209: If the configured database test in the test report fails, a rollback operation is performed on the migrated new version database to obtain the pre-migration new version database.

[0110] Specifically, if the configured database has a functional abnormality, a rollback operation is performed on the database by a rollback instruction to obtain the pre-migration new version database.

[0111] From the above embodiments, it can be seen that by performing full-amount testing on the migrated database, a test report is generated, and if the test fails, a rollback operation is performed to support database migration rollback, thereby avoiding the situation that the database function is abnormal due to the inability to rollback and affecting the use of the database.

[0112] Figure 3 The structure diagram of the database migration device provided in the present application is shown in FIG. 1. Figure 3 As shown in FIG. 1, the database migration device 30 provided in the present embodiment comprises a first acquisition module 301, a first generation module 302, a second generation module 303, a writing module 304, a second acquisition module 305, and a running module 306.

[0113] The first acquisition module 301 is configured to acquire a base image of an old version database.

[0114] The first generation module 302 is configured to generate a refitted image of the database according to a database detection script and the base image of the old version database.

[0115] The second generation module 303 is configured to set a startup parameter of a container according to the refitted image of the database, and generate a refitting statement of the database.

[0116] The writing module 304 is configured to write the refitting statement of the database into a database migration script.

[0117] The second acquisition module 305 is configured to acquire an image file of a new version database.

[0118] The running module 306 is configured to run the database migration script, import the data to be migrated into the image file of the new version database, and complete the database migration.

[0119] In an embodiment of the present application, the first generation module 302 comprises:

[0120] The first running unit is configured to run the database detection script and acquire difference configuration information of the new version database and the old version database.

[0121] The detection unit is configured to configure a running order of the database detection script according to the difference configuration information.

[0122] The writing unit is configured to write the running order of the database detection script into the base image of the old version database, and generate a refactoring image of the database.

[0123] In an embodiment of the present application, the second generation module 303 comprises:

[0124] The first obtaining unit is configured to obtain the connection information of the old version database in the refactoring image of the database.

[0125] The first setting unit is configured to set the connection information of the old version database as the startup parameter of the container.

[0126] The second running unit is configured to run the startup parameter, and execute the database detection script in the refactoring image of the database, to generate a scanning result of the old version database.

[0127] The generation unit is configured to generate a refactoring statement of the database according to the scanning result of the old version database.

[0128] In an embodiment of the present application, the second generation module 303 further comprises:

[0129] The second obtaining unit is configured to obtain the modified refactoring statement in response to a modification operation of the refactoring statement of the database by the developer.

[0130] The third running unit is configured to run the modified refactoring statement, to generate a refactored database text.

[0131] The judging unit is configured to identify the refactored database text according to the review script, and determine whether the old version database is refactored.

[0132] The exporting unit is configured to export the modified refactoring statement as a data file if the old version database is refactored, and store the data file to a server.

[0133] In an embodiment of the present application, the running module 306 comprises:

[0134] The third obtaining unit is configured to obtain the connection information of the new version database in the image file of the new version database.

[0135] The second setting unit is configured to set the connection information of the new version database as the startup parameter of the container.

[0136] The fourth running unit is configured to run the startup parameter, and import the data to be migrated into the image file of the new version database, to complete the database migration.

[0137] In an embodiment of the present application, the database migration apparatus 30 further comprises:

[0138] The configuration module is configured to configure the traffic of the application to the migrated new version database to obtain a configured database.

[0139] The test module is configured to perform full volume testing on the configured database to generate a test report.

[0140] The rollback module is configured to perform a rollback operation on the migrated new version database to obtain the pre-migration new version database if the test report indicates that the testing of the configured database fails.

[0141] The database migration apparatus provided in the embodiment can perform the method provided in the method embodiment, and has similar implementation principles and technical effects, which will not be described here again.

[0142] Figure 4 The structure of the electronic device provided in the present application is shown in FIG. 1. Figure 4 As shown in FIG. 1, the electronic device 40 provided in the embodiment includes at least one processor 401 and a memory 402. Optionally, the electronic device 40 further includes a communication component 403. The processor 401, the memory 402 and the communication component 403 are connected through a bus.

[0143] In the specific implementation process, the at least one processor 401 executes the computer execution instructions stored in the memory 402, so that the at least one processor 401 performs the above-mentioned database migration method.

[0144] The specific implementation process of the processor 401 can refer to the method embodiment, which has similar implementation principles and technical effects, and will not be described here again.

[0145] In the above-mentioned embodiments, it should be understood that the processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC) and the like. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor and the like. The steps of the method disclosed in the present application can be directly embodied as the execution of the hardware processor, or the execution of the combination of the hardware and software modules in the processor.

[0146] The memory can include a random access memory (RAM), and can also include a non-volatile memory (NVM), for example, at least one disk memory.

[0147] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application does not limit to only one bus or one type of bus.

[0148] The present application also provides a computer program product, comprising a computer program, which, when executed by a processor, implements the database migration method described above.

[0149] The present application also provides a computer readable storage medium, which stores computer execution instructions, and when a processor executes the computer execution instructions, the database migration method described above is implemented.

[0150] The readable storage medium described above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0151] An exemplary readable storage medium is coupled to the processor, so that the processor can read information from the readable storage medium, and can write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the device.

[0152] The division of units is only a logical functional division, and in actual implementation, there can be another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0153] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e., may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment of the present application.

[0154] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0155] If the function is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part of the prior art that contributes to the technical solutions or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of each embodiment of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0156] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The aforementioned program can be stored in a computer readable storage medium. The program executes the steps including the above-mentioned method embodiments when executed; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, and various media that can store program codes.

[0157] It should be noted that for the above-mentioned method embodiments, in order to simply describe, they are all expressed as a combination of a series of actions, but those skilled in the art should know that the application is not limited by the order of the described actions, because according to the application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily necessary for the present application.

[0158] It should be understood that the device embodiments described above are merely illustrative, and the device of the present application can also be implemented in other manners. For example, the division of the units / modules in the above embodiments is merely a logical function division, and the actual implementation can be in another manner. For example, two or more units / modules can be combined, or some features can be ignored or not executed.

[0159] It should be understood that the device embodiments described above are merely illustrative, and the device of the present application can also be implemented in other manners. For example, the division of the units / modules in the above embodiments is merely a logical function division, and the actual implementation can be in another manner. For example, two or more units / modules can be combined, or some features can be ignored or not executed.

[0160] In addition, unless specifically stated, each functional unit / module in each embodiment of the present application can be integrated in one unit / module, or each unit / module can exist physically, or two or more units / modules can be integrated together. The integrated unit / module can be implemented in the form of hardware or in the form of a software program module.

[0161] The integrated unit / module, if implemented in the form of hardware, can be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless specifically stated, the processor can be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, and an ASIC, etc. Unless specifically stated, the storage unit can be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.

[0162] If the integrated units / modules are implemented in the form of software program modules and sold or used as independent products, they can be stored in a computer readable memory. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a memory and includes a number of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the embodiments of the method of the present application. The aforementioned memory includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0163] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described, however, as long as the combinations of the technical features do not exist contradictory, they should be considered as the scope of the present application.

[0164] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The application is intended to cover any variations, uses or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice in the art to which the application pertains or can relate. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the application are indicated by the following claims.

[0165] It should be understood that the application is not limited to the precise construction that has been described above and illustrated in the accompanying drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the application is limited only by the claims that follow.

Claims

1. A database migration method characterized by, The method comprises the following steps: obtaining a base image of an old version database; generating a reconstruction image of the database according to a database detection script and the base image of the old version database; setting a start parameter of a container according to the reconstruction image of the database, and generating a reconstruction statement of the database; writing the reconstruction statement of the database into a database migration script; obtaining an image file of a new version database; running the database migration script to import the data to be migrated into the image file of the new version database, so as to complete the database migration.

2. The method of claim 1, wherein, The method comprises the following steps: running the database detection script to obtain difference configuration information of the new version database and the old version database; configuring a running order of the database detection script according to the difference configuration information; writing the running order of the database detection script into the base image of the old version database to generate the reconstruction image of the database.

3. The method of claim 1, wherein, The method comprises the following steps: obtaining connection information of the old version database in the reconstruction image of the database; setting the connection information of the old version database as the start parameter of the container; running the start parameter and executing the database detection script in the reconstruction image of the database to generate a scanning result of the old version database; generating the reconstruction statement of the database according to the scanning result of the old version database.

4. The method of claim 3, wherein, After the step of generating the reconstruction statement of the database according to the scanning result of the old version database, the method further comprises the following steps: in response to a modification operation of the reconstruction statement of the database by a developer, obtaining a modified reconstruction statement; running the modified reconstruction statement to generate a modified database text; identifying the modified database text according to a review script to determine whether the old version database is reconstructed completely; if the old version database is reconstructed completely, exporting the modified reconstruction statement into a data file, and storing the data file to a server.

5. The method of claim 1, wherein, The method comprises the following steps: obtaining connection information of the new version database in the image file of the new version database; setting the connection information of the new version database as the start parameter of the container; running the start parameter to import the data to be migrated into the image file of the new version database, so as to complete the database migration.

6. The method according to any one of claims 1 to 5, characterized in that, After the step of running the database migration script to import the data to be migrated into the image file of the new version database, so as to complete the database migration, the method further comprises the following steps: configuring traffic of an application to the migrated new version database to obtain a configured database; performing full test on the configured database to generate a test report; if the configured database in the test report fails the test, performing a rollback operation on the migrated new version database to obtain a pre-migration new version database.

7. A database migration apparatus characterized by comprising: The method comprises the following steps: a first obtaining module is configured to obtain a base image of an old version database; The first generation module is used for generating a refactoring image of the database according to the database detection script and the base image of the old version database; The second generation module is used for setting a start parameter of a container according to the refactoring image of the database, and generating refactoring statements of the database; The writing module is used for writing the refactoring statements of the database into a database migration script; The second acquisition module is used for acquiring an image file of a new version database; The running module is used for running the database migration script, importing the data to be migrated into the image file of the new version database, so as to complete the database migration.

8. An electronic device, comprising: Comprise: A processor and a memory connected with the processor in communication; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to realize the database migration method in any one of claims 1 to 6.

9. A computer readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to realize the database migration method in any one of claims 1 to 6.

10. A computer program product, characterised in that, The computer program is executed by the processor to realize the database migration method in any one of claims 1 to 6.