CN109684298A - Database migration method, apparatus, equipment and storage medium - Google Patents

Database migration method, apparatus, equipment and storage medium Download PDF

Info

Publication number
CN109684298A
CN109684298A CN201811041530.5A CN201811041530A CN109684298A CN 109684298 A CN109684298 A CN 109684298A CN 201811041530 A CN201811041530 A CN 201811041530A CN 109684298 A CN109684298 A CN 109684298A
Authority
CN
China
Prior art keywords
database
migration
hard disk
migrated
script
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.)
Granted
Application number
CN201811041530.5A
Other languages
Chinese (zh)
Other versions
CN109684298B (en
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811041530.5A priority Critical patent/CN109684298B/en
Publication of CN109684298A publication Critical patent/CN109684298A/en
Application granted granted Critical
Publication of CN109684298B publication Critical patent/CN109684298B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of database migration method, apparatus, equipment and storage mediums, this method comprises: obtaining the catalogue of database to be migrated in the first hard disk when the database migration equipment connects the first hard disk;Migration script is generated according to the catalogue of the database to be migrated, the migration script is backed up into default memory space;When the database migration equipment and first hard disk disconnect, and after connecting the second hard disk, the migration script for backing up to default memory space is copied to second hard disk;The migration script is run, by the database migration to be migrated to second hard disk.The present invention generates migration script by management distributed data base, to the catalogue of database to be migrated in the first hard disk, and database migration to be migrated to the second hard disk is improved the accuracy and transport efficiency of database migration according to the migration script.

Description

Database migration method, apparatus, equipment and storage medium
Technical field
The present invention relates to database management technology field more particularly to a kind of database migration method, apparatus, equipment and deposit Storage media.
Background technique
Currently, the function of computer is stronger and stronger, with computer use time with the rapid development of computer Increase, the data stored in hard disk are more and more.After hard-disk capacity is insufficient or hard disk performance reduces, need replacing new hard Disk is to meet the needs that data store.It needs to migrate the database in former hard disk when replacing hard disk, i.e., by the number in former hard disk It migrates according to library to new hard disk.Currently, the common method that database migrates between different hard disks is carried out using database connection Database migration work.And during using database connection migration, it needs to be manually entered execution migration in multiple windows Command statement, to realize parallel migration.But this method error probability is big, be easy to cause missing data or repeats to migrate, and And it is long the time required to completing database migration, transport efficiency is not high.
Summary of the invention
The present invention provides a kind of database migration method, apparatus, equipment and storage medium, it is intended to improve database migration Accuracy and transport efficiency.
To achieve the above object, the present invention provides a kind of database migration method, and the method is applied to database migration Equipment, the database migration equipment are connect with the first hard disk or the second hard disk, which comprises
When the database migration equipment connects the first hard disk, the catalogue of database to be migrated in the first hard disk is obtained;
Migration script is generated according to the catalogue of the database to be migrated, it is empty that the migration script is backed up to default storage Between;
When the database migration equipment and first hard disk disconnect, and after connecting the second hard disk, will back up to The migration script of default memory space is copied to second hard disk;
The migration script is run, by the database migration to be migrated to second hard disk.
Optionally, before described the step of obtaining the catalogue of database to be migrated in the first hard disk further include:
It checks database to be migrated in first hard disk, disconnects access of the application program to the database to be migrated.
Optionally, described to check database to be migrated in first hard disk, application program is disconnected to the number to be migrated According to library access the step of after further include:
Read the first state information of database to be migrated in first hard disk;
It is generated according to the first state information of the database to be migrated and checks script, and saved to default memory space, For checking the migration script whether by the database Successful migration to be migrated.
Optionally, the operation migration script, by the database migration to be migrated to the step of second hard disk After rapid further include:
Read the second status information of database after migrating in second hard disk;
The inspection script backed up is called, second status information is compared with first state information;
If comparing successfully, database migration success is determined;
If comparing failure, determine that database migration fails, is re-executed to migration script and or after checking script debugging Step: running the migration script, by the database migration to be migrated to second hard disk.
Optionally, described that migration script is generated according to the catalogue of database to be migrated, the migration script is saved to pre- If after the step of memory space further include:
By Full Backuping to be migrated in the first hard disk to default memory space.
Optionally, after the second hard disk of the connection, the migration script for backing up to default memory space is copied to described The step of two hard disks includes:
The second hard disk is connected by the user interface of database migration equipment;
Examine whether second hard disk is compatible with the database migration equipment;
If second hard disk is compatible with the database migration equipment, the migration foot of default memory space will be backed up to Originally it is copied to second hard disk;
If second hard disk is incompatible in the database migration equipment, reselects and be compatible with the database and move Second hard disk of moving device, or stop the database migration method.
Optionally, the operation migration script, by the database migration to be migrated to the step of second hard disk Suddenly include:
The migration script is explained by interpreter;
It is executed according to explanation results by the database migration to be migrated to the order of second hard disk;Or
Executable permission is set in migration script;
After obtaining executable permission, the execution defined according to migration script is sequentially by the database migration to be migrated to institute State the second hard disk.
In addition, to achieve the above object, the present invention also provides a kind of database migration device, the database migration device Include:
Module is obtained, for obtaining to be migrated in the first hard disk when the database migration equipment connects the first hard disk The catalogue of database;
Generation module, it is for generating migration script according to the catalogue of the database to be migrated, the migration script is standby Part to default memory space;
Module is copied, for disconnecting when the database migration equipment with first hard disk, and it is hard to connect second After disk, the migration script for backing up to default memory space is copied to second hard disk;
Module is run, for running the migration script, by the database migration to be migrated to second hard disk.
In addition, to achieve the above object, the present invention also provides a kind of database migration equipment, the database migration equipment Including processor, the database migration program of memory and storage in the memory, the database migration program quilt When the processor is run, the step of realizing database migration method as described above.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium It is stored with database migration program on storage medium, is realized when the database migration program is run by processor as described above The step of database migration method.
The embodiment of the present invention also proposes a kind of computer readable storage medium, stores on the computer readable storage medium There is the step of database migration program, the database migration program realizes method as described above when being run by processor.
Compared with prior art, a kind of database migration method proposed by the present invention, device, equipment and storage medium, the party Method includes: to obtain the catalogue of database to be migrated in the first hard disk when the database migration equipment connects the first hard disk;Root Migration script is generated according to the catalogue of the database to be migrated, the migration script is backed up into default memory space;When described Database migration equipment is disconnected with first hard disk, and after the second hard disk of connection, will back up to default memory space Migration script is copied to second hard disk;The migration script is run, by the database migration to be migrated to described second Hard disk.As a result, by management distributed data base, migration script is generated to the catalogue of database to be migrated in the first hard disk, and According to the migration script by database migration to be migrated to the second hard disk, the accuracy and migration effect of database migration are improved Rate.
Detailed description of the invention
Fig. 1 is the real hardware structural diagram for respectively applying the database migration equipment that example is related to of the invention;
Fig. 2 is the flow diagram of database migration method first embodiment of the present invention;
Fig. 3 is the flow diagram of database migration method second embodiment of the present invention;
Fig. 4 is the flow diagram of database migration method 3rd embodiment of the present invention;
Fig. 5 is the flow diagram of database migration method fourth embodiment of the present invention;
Fig. 6 is the functional block diagram of database migration device first embodiment of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The present embodiments relate to database migration method be mainly used in database migration equipment, the database moves Moving device, which can be PC (personal computer personal computer), portable computer, tablet computer etc., store function Equipment.
Referring to Fig.1, Fig. 1 is the hardware structural diagram of database migration equipment involved in the embodiment of the present invention. In embodiments of the present invention, database migration equipment may include (such as the central processing unit Central of processor 1001 Processing Unit, CPU), communication bus 1002, user interface 1003, network interface 1004, memory 1005.Wherein, Communication bus 1002 is for realizing the connection communication between these components;User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard);Network interface 1004 optionally may include that the wired of standard connects Mouth, wireless interface (such as WI-FI interface);Memory 1005 can be high speed RAM memory, be also possible to stable memory (non-volatile memory), such as magnetic disk storage, memory 1005 optionally can also be independently of aforementioned processor 1001 storage device.It will be understood by those skilled in the art that hardware configuration shown in Fig. 1 is not constituted to limit of the invention It is fixed, it may include perhaps combining certain components or different component layouts than illustrating more or fewer components.
With continued reference to Fig. 1, the memory 1005 in Fig. 1 as a kind of readable storage medium storing program for executing may include operating system, net Network communication module and database migration program.In Fig. 1, network communication module is mainly used for connecting network server, with net Network server carries out data communication;And processor 1001 can call the database migration program stored in memory 1005, and Execute database migration method provided in an embodiment of the present invention.
The embodiment of the invention provides a kind of database migration methods.
It is the flow diagram of database migration method first embodiment of the present invention referring to Fig. 2, Fig. 2.
In the present embodiment, the database migration method is realized that the database migration is set by database migration equipment It is standby to can be the terminal devices such as PC, portable computer, tablet computer, the database migration method the following steps are included:
Step S101 obtains data to be migrated in the first hard disk when the database migration equipment connects the first hard disk The catalogue in library;
Step S102 generates migration script according to the catalogue of the database to be migrated, the migration script is backed up to Default memory space;
Step S103, when the database migration equipment and first hard disk disconnect, and after connecting the second hard disk, The migration script for backing up to default memory space is copied to second hard disk;
Step S104 runs the migration script, by the database migration to be migrated to second hard disk.
Specifically, in the present embodiment, include one or more hard disks in the database migration equipment, work as hard-disk capacity When not enough or wherein one or more hard disk performances reduce, it is possible to cause loss of data or data record incomplete, equipment fortune Rotary speed reduces, and is unable to satisfy routine work demand, needs replacing hard disk, with lifting means performance, improves working efficiency.
And during replacing hard disk, it is often necessary to migrate the database stored in former hard disk.Currently, database is not It is that database migration work is carried out using database connection with the common method migrated between hard disk.And it is connected using database In transition process, need to be manually entered the command statement for executing and migrating in multiple windows, to realize parallel migration.But this side Method error probability is big, be easy to cause missing data or repeats to migrate, and completes length the time required to database migration, transport efficiency It is not high.
In view of the above problem, the present embodiment proposes a kind of database migration method, database migration described in detail below The layout step of method:
Step S101 obtains data to be migrated in the first hard disk when the database migration equipment connects the first hard disk The catalogue in library;
Generally, storage hierarchy can be divided into high-speed buffer, main memory and additional storage three-level in equipment, wherein institute State the speeds match problem that high-speed buffer is used to improve main memory and central processing unit;The main memory is internal layer, Access speed is fast, and internal layer amount of capacity directly affects the equipment speed of service;The additional storage is empty for expanding equipment storage Between, generally hard disk or CD.The present embodiment is related to the additional storage i.e. migration in hard disc data library.
In the present embodiment, first hard disk refers to the hard disk for needing to be replaced in database migration equipment, and described first is hard Disk includes solid state hard disk, mechanical hard disk or hybrid hard disk.When first hard-disk capacity is inadequate or reading rate reduces, shadow When ringing routine work efficiency, it is necessary to replacement in time.
In the present embodiment, the database migration to be migrated is mainly included in the relevant database in Lunix system With or non-relational database, such as PostgreSQL, mongoDB.
In the present embodiment, the data base directory includes list file, data file and server option file etc..
Specifically, when needing to migrate the database in the first hard disk, the database migration equipment determines described wait move The type for moving database further obtains database to be migrated if the database to be migrated is the type of presetting database Directory information select the directory information needed and in actual operation.If the catalogue in first data in hard disk library is not inconsistent It closes and requires, then can create the catalogue of database to be migrated in the first hard disk.
Step S102 generates migration script according to the catalogue of the database to be migrated, the migration script is backed up to Default memory space;
In the present embodiment, the migration script can be write with Bash language.Specifically, it is selected first with script guide Need to edit the database to be migrated of migration script, then selection writes full-text catalog script and selects correlation in script option Attribute writes command statement with Bash language in migration scripting editing frame, finally selects store path, the migration that will be editted Script saves and backs up to default memory space, wherein the default memory space includes one or more in database migration equipment A hard disk for not needing replacement or cloud storage space.
Step S103, when the database migration equipment and first hard disk disconnect, and after connecting the second hard disk, The migration script for backing up to default memory space is copied to second hard disk;
In the present embodiment, relate generally to the first hard disk replacement in database migration equipment be the second hard disk, therefore the After one hard disk disconnects, the second hard disk is connected.Specifically, hard by the user interface connection second of database migration equipment Disk, examines whether second hard disk is compatible with the database migration equipment, generally, if the database migration equipment After connecting the second hard disk, read-write operation can be executed in second hard disk, then illustrate that second hard disk is compatible with the number Default memory space will be backed up to if second hard disk is compatible with the database migration equipment according to library migration equipment Migration script be copied to second hard disk;, whereas if second hard disk is incompatible in the database migration equipment, The second hard disk for being compatible with the database migration equipment is then reselected, or stops the database migration method.Generally Ground, second hard disk can be selected according to the model of the database migration equipment and processing capacity, selection and the data Library migrates corresponding second hard disk of device model, and selects properly to hold according to the maximum capacity of the database migration equipment Second hard disk of amount.
Step S104 runs the migration script, by the database migration to be migrated to second hard disk.
In the present embodiment, the migration script can be explained by interpreter, the database migration equipment is according to explanation results The order for executing database migration, according to the order by the database migration to be migrated to second hard disk.It can also be pre- Executable permission is first set in migration script, and the database migration equipment is after obtaining executable permission, according to migration foot The execution of this definition is sequentially by the database migration to be migrated to second hard disk.
The present embodiment is by obtaining number to be migrated in the first hard disk when the database migration equipment connects the first hard disk According to the catalogue in library;Migration script is generated according to the catalogue of the database to be migrated, the migration script is backed up into default deposit Store up space;When the database migration equipment and first hard disk disconnect, and after connecting the second hard disk, will back up to pre- If the migration script of memory space is copied to second hard disk;The migration script is run, the database to be migrated is moved Move to second hard disk.As a result, by management distributed data base, the catalogue of database to be migrated in the first hard disk is generated Script is migrated, and database migration to be migrated to the second hard disk is improved by the standard of database migration according to the migration script True property and transport efficiency.
Further, referring to Fig. 3, it is based on above-mentioned first embodiment, proposes the second of database migration method of the present invention Embodiment, in the first hard disk of the acquisition the step of catalogue of database to be migrated before further include:
Step S100 checks database to be migrated in first hard disk, disconnects application program to the data to be migrated The access in library.
In the present embodiment, prepares the data in the first hard disk in database to be migrated in advance, treat in migrating data library Data are checked, and unnecessary file is deleted, to save hard drive space.
The data in database that the present embodiment is related to are static datas, are not completely in transition process in database Permission of uniting limitation, is not related to the modification of permission.Therefore it needs to examine before the catalogue of database to be migrated in obtaining the first hard disk Database to be migrated in the first hard disk is looked into, access of the application program to the database to be migrated is disconnected, to guarantee application program It cannot connect to the database to be migrated, prevent database migration imperfect.
It is described to check database to be migrated in first hard disk, disconnect visit of the application program to the database to be migrated After the step of asking further include:
Step S1001 reads the first state information of database to be migrated in first hard disk;
In the present embodiment, the first state information includes data integrity, data structure, log-file information, table sky Between information, data format, data length, interval range, null value, default value etc..
Step S1002 is generated according to the first state information of the database to be migrated and is checked script and save to default Memory space, for checking the migration script whether by the database Successful migration to be migrated;
In the present embodiment, the inspection script can be write with Bash language.Specifically, it is selected first with script guide The database to be migrated of edit check script is needed, then selection writes inspection script and selects related category in script option Property, command statement is write with Bash language in checking scripting editing frame, finally selects store path, the inspection foot that will be editted This preservation simultaneously backs up to default memory space, wherein the default memory space includes one or more in database migration equipment Hard disk or the cloud storage space of replacement are not needed.
In other embodiments, the step S1001 and step S1002 can also after step s 102, step S103 it Preceding completion, details are not described herein.
The present embodiment treat migrating data library generate with the corresponding inspection script of migration script, in case of database migration it Afterwards, database is checked, ensure that the integrality of database migration.And by checking that script examines database It looks into, has saved a large amount of manpowers and time.
Further, referring to Fig. 4, it is based on above-mentioned first and second embodiment, proposes the of database migration method of the present invention Three embodiments, the operation migration script, after the step of the database migration to be migrated to second hard disk Further include:
Step S1041 reads the second status information of database after migrating in second hard disk;
The present embodiment, second status information include data integrity, data structure, log-file information, table space Information, data format, data length, interval range, null value, default value etc..The of database after being migrated in second hard disk First state information of the two-state information corresponding to database to be migrated in the first hard disk.
Step S1042 calls the inspection script that has backed up, will second status information and first state information into Row compares;
In the present embodiment, database migration equipment is called from default memory space after successful operation migrates script The inspection script backed up, by checking script by second status information in the second data in hard disk library and the first data in hard disk The first state information in library is compared.
In the present embodiment, the operation for checking script can be explained that the inspection script, the database are moved by interpreter Moving device executes the order checked database according to explanation results, will be checked database according to the order. Executable permission can be also set in migration script in advance, the database migration equipment after obtaining executable permission, according to The execution sequence for checking that script defines checks the database migrated into the second hard disk.
Step S1043 determines database migration success if comparing successfully;
Step S1044 determines that database migration fails if comparing failure, to migration script and or checks script debugging After re-execute the steps: the migration script is run, by the database migration to be migrated to second hard disk.
In the present embodiment, if second status information is consistent with first state information, as compare successfully, then resulting number It is migrated successfully according to library, the database migration equipment can smoothly read and write the data in the second data in hard disk library.If second shape State information and first state information are inconsistent, then determine that database migration fails, to migration script and or after checking script debugging It re-execute the steps: running the migration script, by the database migration to be migrated to second hard disk.
In other embodiments, special data can also be spot-check, checks the state of one or more special datas Whether information is consistent in the first hard disk and the second hard disk, if the status information accordance of one or more of special datas, Think database migration success, it is anti-regular think database migration fail, to migration script and or check script debugging after again It executes step: running the migration script, then by the database migration to be migrated to second hard disk.
The present embodiment checks the database after migration to by pre-generated inspection script, carries out to database It checks, ensure that the integrality of database migration.And by checking that script checks database, a large amount of manpowers are saved And the time.
Further, referring to Fig. 5, it is based on above-mentioned first, second and third embodiment, proposes database migration method of the present invention Fourth embodiment, it is described according to the catalogue of database to be migrated in the first hard disk generate migration script, by the migration script After the step of preservation to default memory space further include:
Step S1021, by Full Backuping to be migrated in the first hard disk to default memory space.
In the present embodiment, after backup migrates script file, extremely by Full Backuping to be migrated in the first hard disk Default memory space.Wherein, the complete backup refers to the entire database of backup, includes user's table, system table, index, view With all database objects such as storing process.
The included backup tool in backup operation availability data library is completed, and the present embodiment is with PostgreSQL database For DB Backup process is described in detail.PgAdim tool is carried in PostgreSQL database to be specifically invoked at Pg_dump.exe tool under the installation directory of database, in equipment bullet after choosing the pg_dump.exe tool to bring into operation Enter PostgreSQL installation directory bin in dos console out, input executes the finger of backup at the installation directory bin It enables, the instruction for executing backup includes that database to be backed up corresponds to the IP address of equipment, database-name, default memory space Address.In this way, the database can back up to default memory space.
In the present embodiment, database recovery if desired is carried out using the database backed up, then by being invoked at Psql.exe tool under the installation directory of PostgreSQL database, using the psql.exe, input restores Backup Data Instruction, the instruction for restoring Backup Data includes specified recovery address, database-name etc., in this way, described backed up Database can restore according to the instruction for restoring backup database to specified recovery address.
In other embodiments, the step S1021 can also be completed, herein not before step S102 or step S101 It is repeating.
The present embodiment is backed up the database to be migrated in the first hard disk by management distributed data base, for Subsequent carry out data convert, prevents loss of data, and database to be migrated, which is carried out backup, can further ensure data safety.
In addition, the embodiment of the present invention also provides a kind of database migration device.
It is the functional block diagram of database migration device first embodiment of the present invention referring to Fig. 6, Fig. 6.
Database migration device of the present invention is virtual bench, is stored in the memory of database migration equipment shown in FIG. 1 It is functional for realizing the institute of database migration method in 1005, for connecting the first hard disk when the database migration equipment When, obtain the catalogue of database to be migrated in the first hard disk;For generating migration foot according to the catalogue of the database to be migrated This, backs up to default memory space for the migration script;For breaking when the database migration equipment and first hard disk Connection is opened, and after the second hard disk of connection, the migration script for backing up to default memory space is copied to second hard disk;For The migration script is run, by the database migration to be migrated to second hard disk.
Specifically, in the present embodiment, the database migration device includes:
Module 10 is obtained, for obtaining in the first hard disk wait move when the database migration equipment connects the first hard disk Move the catalogue of database;
Generation module 20, for generating migration script according to the catalogue of the database to be migrated, by the migration script Back up to default memory space;
Module 30 is copied, after connecting the second hard disk, the migration script for backing up to default memory space is copied to institute State the second hard disk;
Module 40 is run, for disconnecting when the database migration equipment with first hard disk, and described in operation Script is migrated, by the database migration to be migrated to second hard disk.
Further, the acquisition module is also used to:
It checks database to be migrated in first hard disk, disconnects access of the application program to the database to be migrated.
Further, the operation module is also used to:
Read the first state information of database to be migrated in first hard disk;
It is generated according to the first state information of the database to be migrated and checks script, and saved to default memory space, For checking the migration script whether by the database Successful migration to be migrated.
Further, the operation module is also used to:
Read the second status information of database after migrating in second hard disk;
The inspection script backed up is called, second status information is compared with first state information;
If comparing successfully, database migration success is determined;
If comparing failure, determine that database migration fails, is re-executed to migration script and or after checking script debugging Step: running the migration script, by the database migration to be migrated to second hard disk.
Further, the copy module is also used to:
By Full Backuping to be migrated in the first hard disk to default memory space.
Further, the copy module is also used to:
The second hard disk is connected by the user interface of database migration equipment;
Examine whether second hard disk is compatible with the database migration equipment;
If second hard disk is compatible with the database migration equipment, the migration foot of default memory space will be backed up to Originally it is copied to second hard disk;
If second hard disk is incompatible in the database migration equipment, reselects and be compatible with the database and move Second hard disk of moving device, or stop the database migration method.
Further, the operation module is also used to:
The migration script is explained by interpreter;
It is executed according to explanation results by the database migration to be migrated to the order of second hard disk;Or
Executable permission is set in migration script;
After obtaining executable permission, the execution defined according to migration script is sequentially by the database migration to be migrated to institute State the second hard disk.
Wherein, the function of modules is realized and above-mentioned database migration embodiment of the method in above-mentioned database migration device In each step it is corresponding, function and realization process no longer repeat one by one here.
In addition, the embodiment of the present invention also proposes a kind of computer readable storage medium, the computer readable storage medium On be stored with database migration program, the database migration program realizes that database as described above moves when being run by processor The step of shifting method.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the system that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or system institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or system.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in one as described above In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone, Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above description is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all utilizations Equivalent structure made by description of the invention and accompanying drawing content or process transformation, are applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of database migration method, which is characterized in that the method is applied to database migration equipment, and the database moves Moving device is connect with the first hard disk or the second hard disk, which comprises
When the database migration equipment connects the first hard disk, the catalogue of database to be migrated in the first hard disk is obtained;
Migration script is generated according to the catalogue of the database to be migrated, the migration script is backed up into default memory space;
It is default by backing up to when the database migration equipment and first hard disk disconnect, and after connecting the second hard disk The migration script of memory space is copied to second hard disk;
The migration script is run, by the database migration to be migrated to second hard disk.
2. the method according to claim 1, wherein the catalogue for obtaining database to be migrated in the first hard disk The step of before further include:
It checks database to be migrated in first hard disk, disconnects access of the application program to the database to be migrated.
3. according to the method described in claim 2, it is characterized in that, described check database to be migrated in first hard disk, After the step of disconnecting access of the application program to the database to be migrated further include:
Read the first state information of database to be migrated in first hard disk;
It is generated according to the first state information of the database to be migrated and checks script, and saved to default memory space, for Check the migration script whether by the database Successful migration to be migrated.
4. according to the method described in claim 3, it is characterized in that, described run the migration script, by the number to be migrated After the step of migrating according to library to second hard disk further include:
Read the second status information of database after migrating in second hard disk;
The inspection script backed up is called, second status information is compared with first state information;
If comparing successfully, database migration success is determined;
If comparing failure, determine that database migration fails, re-executes step to migration script and or after checking script debugging It is rapid: the migration script to be run, by the database migration to be migrated to second hard disk.
5. the method according to claim 1, wherein described generate migration foot according to the catalogue of database to be migrated This, after the step of migration script is saved to default memory space further include:
By DB Backup to be migrated in first hard disk to default memory space.
6. method according to any one of claims 1-5, which is characterized in that after the second hard disk of the connection, will back up The step of being copied to second hard disk to the migration script of default memory space include:
The second hard disk is connected by the user interface of database migration equipment;
Examine whether second hard disk is compatible with the database migration equipment;
If second hard disk is compatible with the database migration equipment, the migration script for backing up to default memory space is copied Shellfish is to second hard disk;
If second hard disk is incompatible in the database migration equipment, reselects and be compatible with the database migration and set The second standby hard disk, or stop the database migration method.
7. method according to any one of claims 1-5, which is characterized in that the operation migration script, by institute Stating database migration to be migrated to the step of second hard disk includes:
The migration script is explained by interpreter;
It is executed according to explanation results by the database migration to be migrated to the order of second hard disk;Or
Executable permission is set in migration script;
After obtaining executable permission, the execution sequence that is defined according to migration script is by the database migration to be migrated to described Second hard disk.
8. a kind of database migration device, which is characterized in that the database migration device includes:
Module is obtained, for obtaining data to be migrated in the first hard disk when the database migration equipment connects the first hard disk The catalogue in library;
Generation module backs up to the migration script for generating migration script according to the catalogue of the database to be migrated Default memory space;
Module is copied, for being disconnected when the database migration equipment with first hard disk, and after the second hard disk of connection, The migration script for backing up to default memory space is copied to second hard disk;
Module is run, for running the migration script, by the database migration to be migrated to second hard disk.
9. a kind of database migration equipment, which is characterized in that the database migration equipment includes processor, memory and is deposited The database migration program of storage in the memory when the database migration program is run by the processor, is realized such as The step of database migration method of any of claims 1-7.
10. a kind of computer readable storage medium, which is characterized in that be stored with database on the computer readable storage medium Migrator realizes such as claim 1-7 described in any item databases when the database migration program is run by processor The step of moving method.
CN201811041530.5A 2018-09-07 2018-09-07 Database migration method, device, equipment and storage medium Active CN109684298B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811041530.5A CN109684298B (en) 2018-09-07 2018-09-07 Database migration method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811041530.5A CN109684298B (en) 2018-09-07 2018-09-07 Database migration method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109684298A true CN109684298A (en) 2019-04-26
CN109684298B CN109684298B (en) 2024-02-20

Family

ID=66185683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811041530.5A Active CN109684298B (en) 2018-09-07 2018-09-07 Database migration method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109684298B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110209652A (en) * 2019-05-20 2019-09-06 平安科技(深圳)有限公司 Tables of data moving method, device, computer equipment and storage medium
CN111177113A (en) * 2019-12-06 2020-05-19 中国平安财产保险股份有限公司 Data migration method and device, computer equipment and storage medium
CN111367890A (en) * 2020-03-13 2020-07-03 深圳壹账通智能科技有限公司 Data migration method and device, computer equipment and readable storage medium
CN112148222A (en) * 2020-09-21 2020-12-29 浙江大华技术股份有限公司 Configuration method and device of database hard disk, storage medium and electronic device
CN115543221A (en) * 2022-11-29 2022-12-30 苏州浪潮智能科技有限公司 Data migration method and device for solid state disk, electronic equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840314A (en) * 2010-05-05 2010-09-22 北京星网锐捷网络技术有限公司 Method, device and server for expanding storage space of database
CN104166520A (en) * 2013-05-20 2014-11-26 深圳先进技术研究院 Distributed hard disk system and data migration method thereof
CN104899333A (en) * 2015-06-24 2015-09-09 浪潮(北京)电子信息产业有限公司 Cross-platform migrating method and system for Oracle database
CN105324769A (en) * 2013-07-09 2016-02-10 甲骨文国际公司 Solution to generate a scriptset for an automated database migration
US20160188710A1 (en) * 2014-12-29 2016-06-30 Wipro Limited METHOD AND SYSTEM FOR MIGRATING DATA TO NOT ONLY STRUCTURED QUERY LANGUAGE (NoSOL) DATABASE
US20160203054A1 (en) * 2015-01-12 2016-07-14 Actifio, Inc. Disk group based backup
CN106406754A (en) * 2016-08-31 2017-02-15 北京小米移动软件有限公司 Data migration method and device
CN106776876A (en) * 2016-11-29 2017-05-31 用友网络科技股份有限公司 Data migration method and data mover system
CN107436912A (en) * 2016-05-27 2017-12-05 三星Sds株式会社 Data migration device and its method
CN108153806A (en) * 2016-11-30 2018-06-12 Ncr公司 Data Migration

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840314A (en) * 2010-05-05 2010-09-22 北京星网锐捷网络技术有限公司 Method, device and server for expanding storage space of database
CN104166520A (en) * 2013-05-20 2014-11-26 深圳先进技术研究院 Distributed hard disk system and data migration method thereof
CN105324769A (en) * 2013-07-09 2016-02-10 甲骨文国际公司 Solution to generate a scriptset for an automated database migration
US20160188710A1 (en) * 2014-12-29 2016-06-30 Wipro Limited METHOD AND SYSTEM FOR MIGRATING DATA TO NOT ONLY STRUCTURED QUERY LANGUAGE (NoSOL) DATABASE
US20160203054A1 (en) * 2015-01-12 2016-07-14 Actifio, Inc. Disk group based backup
CN104899333A (en) * 2015-06-24 2015-09-09 浪潮(北京)电子信息产业有限公司 Cross-platform migrating method and system for Oracle database
CN107436912A (en) * 2016-05-27 2017-12-05 三星Sds株式会社 Data migration device and its method
CN106406754A (en) * 2016-08-31 2017-02-15 北京小米移动软件有限公司 Data migration method and device
CN106776876A (en) * 2016-11-29 2017-05-31 用友网络科技股份有限公司 Data migration method and data mover system
CN108153806A (en) * 2016-11-30 2018-06-12 Ncr公司 Data Migration

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CHENX1242: "Linux系统磁盘空间不足Zabbix服务器数据库迁移", pages 1 - 5 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110209652A (en) * 2019-05-20 2019-09-06 平安科技(深圳)有限公司 Tables of data moving method, device, computer equipment and storage medium
CN110209652B (en) * 2019-05-20 2024-02-02 平安科技(深圳)有限公司 Data table migration method, device, computer equipment and storage medium
CN111177113A (en) * 2019-12-06 2020-05-19 中国平安财产保险股份有限公司 Data migration method and device, computer equipment and storage medium
CN111177113B (en) * 2019-12-06 2023-07-25 中国平安财产保险股份有限公司 Data migration method, device, computer equipment and storage medium
CN111367890A (en) * 2020-03-13 2020-07-03 深圳壹账通智能科技有限公司 Data migration method and device, computer equipment and readable storage medium
CN112148222A (en) * 2020-09-21 2020-12-29 浙江大华技术股份有限公司 Configuration method and device of database hard disk, storage medium and electronic device
CN112148222B (en) * 2020-09-21 2023-08-25 浙江大华技术股份有限公司 Configuration method and device of database hard disk, storage medium and electronic device
CN115543221A (en) * 2022-11-29 2022-12-30 苏州浪潮智能科技有限公司 Data migration method and device for solid state disk, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109684298B (en) 2024-02-20

Similar Documents

Publication Publication Date Title
CN109684298A (en) Database migration method, apparatus, equipment and storage medium
US10725692B2 (en) Data storage method and apparatus
US9031910B2 (en) System and method for maintaining a cluster setup
US9158631B1 (en) Systems and methods for providing backup interfaces
CN109325016B (en) Data migration method, device, medium and electronic equipment
US8983899B1 (en) Systems and methods for archiving files in distributed replication environments
JP5186098B2 (en) Method, system, and computer program for backing up data
CN105701190A (en) Data synchronizing method and device
CN108427728A (en) Management method, equipment and the computer-readable medium of metadata
CN114860654A (en) Method and system for dynamically changing Iceberg table Schema based on Flink data stream
CN112256400A (en) Virtual machine snapshot management method and device
CN105938446B (en) The data supported based on RDMA and hardware transactional memory replicate fault-tolerance approach
CN109753381A (en) A kind of continuous data protection method based on object storage
US9020896B1 (en) Systems and methods for simplifying data restoration using resource types
US9696943B2 (en) Accessing stored data
US10761940B2 (en) Method, device and program product for reducing data recovery time of storage system
WO2014187216A1 (en) Method and device for database structure object processing
CN108459925A (en) The restorative procedure of private clound equipment and its database, the device with store function
CN115587141A (en) Database synchronization method and device
US9075635B1 (en) Systems and methods for merging virtual layers
US20180107764A1 (en) Graph comparison for conflict resolution
CN114860378A (en) File system migration method, device, system and medium thereof
CN110704239B (en) Data copying method and device and electronic equipment
CN113886741A (en) Method for typesetting formula and related product
CN110045962A (en) A kind of method and apparatus for supporting multilingual script execution

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
GR01 Patent grant
GR01 Patent grant