CN115794491A - Database file backup method, device, equipment and storage medium - Google Patents
Database file backup method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN115794491A CN115794491A CN202211527352.3A CN202211527352A CN115794491A CN 115794491 A CN115794491 A CN 115794491A CN 202211527352 A CN202211527352 A CN 202211527352A CN 115794491 A CN115794491 A CN 115794491A
- Authority
- CN
- China
- Prior art keywords
- backup
- file
- target
- database
- folder
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 56
- 238000004590 computer program Methods 0.000 claims description 15
- 230000004044 response Effects 0.000 claims description 8
- 230000008569 process Effects 0.000 abstract description 14
- 238000011084 recovery Methods 0.000 description 9
- 230000008859 change Effects 0.000 description 5
- 230000008439 repair process Effects 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 3
- 230000001960 triggered effect Effects 0.000 description 3
- 238000012795 verification Methods 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a database file backup method, a device, equipment and a storage medium, wherein the method comprises the following steps: responding to the timed backup task instruction, and traversing and querying all files in the target database; carrying out consistency comparison on each table data file in the target database and the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up; the target backup folder is the latest backup folder in the backup library; the method comprises the steps of copying a target backup folder to obtain a current backup folder, naming the current backup folder based on current system time, copying all table data files marked as files to be backed up, replacing corresponding table data files in the current backup folder, and adding the current backup folder into a backup library. The invention simplifies the file comparison and file backup process, thereby improving the efficiency of database file backup.
Description
Technical Field
The present invention relates to the field of data backup technologies, and in particular, to a database file backup method, apparatus, device, and storage medium.
Background
In the existing database file backup and recovery scheme, usually, a current database file needs to be acquired and compared with an image copy file to obtain an incremental quantity, then, an incremental data is backed up to output a file, then, the backed up output file is compared with an original image copy file, then, the backed up output file is merged into an image copy, and then, the image copy is updated to a database. In the existing scheme, the content change comparison and storage mode of the database file is complex, and the efficiency is not high.
Disclosure of Invention
The invention aims to provide a database file backup method, a device, equipment and a storage medium, which aim to solve the technical problems, so that the file comparison and file backup processes can be simplified, and the database file backup efficiency is improved.
In order to solve the technical problem, the invention provides a database file backup method, which comprises the following steps:
responding to the timed backup task instruction, and traversing and querying all files in the target database;
carrying out consistency comparison on each table data file in the target database and the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up; the target backup folder is the latest backup folder in the backup library;
copying the target backup folder to obtain a current backup folder, naming the current backup folder based on the current system time, copying all table data files marked as files to be backed up, replacing corresponding table data files in the current backup folder, and adding the current backup folder into the backup library.
Further, the traversing queries all files in the target database, including:
when the table structure file of the target database is inquired, if the table structure file is judged to be damaged, copying the backup table structure file in the target backup folder, and replacing the table structure file in the target database.
Further, the traversing queries all files in the target database, including:
and when the table data file in the target database is inquired and judged to be damaged, ending the current backup task and starting a file recovery program.
Further, before traversing all files in the query target database in response to the timed backup task instruction, the method further comprises:
and when judging that the backup folder does not exist in the backup library, carrying out full backup on the target database to obtain a first backup folder, and adding the first backup folder into the backup library.
Further, still include:
and when the number of the backup folders in the backup library is judged to be larger than a preset threshold value, deleting the oldest backup folder in the backup library.
Further, the manner for determining that the table structure file is damaged includes:
and when judging whether the file size of the table structure file is zero, determining that the table structure file is damaged.
Further, the consistency comparison of the table data files in the target database with the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up specifically include:
respectively calculating the MD5 values of all table data files in the target database and the table data files in the target backup folder;
on the basis of the MD5 value of each file, carrying out consistency comparison on each table data file in the target database and the table data file in the target backup folder in a one-to-one correspondence manner;
and when the MD5 value of the target table data file in the target database is judged to be inconsistent with the MD5 value of the corresponding table data file in the target backup folder, marking the target table data file as a file to be backed up.
The present invention also provides a database file backup device, including:
the task response module is used for responding to the timed backup task instruction and traversing and inquiring all files in the target database;
the file comparison module is used for carrying out consistency comparison on each table data file in the target database and the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up; the target backup folder is the latest backup folder in the backup library;
and the file backup module is used for copying the target backup folder to obtain a current backup folder, naming the current backup folder based on the current system time, copying all table data files marked as files to be backed up, replacing the corresponding table data files in the current backup folder, and adding the current backup folder into the backup library.
The invention also provides terminal equipment which comprises a processor and a memory stored with a computer program, wherein the processor realizes any database file backup method when executing the computer program.
The present invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements any of the database file backup methods described herein.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides a database file backup method, a device, equipment and a storage medium, wherein the method comprises the following steps: responding to a timed backup task instruction, and traversing and inquiring all files in a target database; carrying out consistency comparison on each table data file in the target database and the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up; the target backup folder is the latest backup folder in the backup library; the target backup folder is copied to obtain a current backup folder, the current backup folder is named based on current system time, all table data files marked as files to be backed up are copied, corresponding table data files in the current backup folder are replaced, and the current backup folder is added into the backup library. The invention simplifies the file comparison and file backup process, thereby improving the efficiency of database file backup.
Drawings
FIG. 1 is a schematic flowchart of a database file backup method provided by the present invention;
FIG. 2 is a second schematic flowchart of a database file backup method according to the present invention;
FIG. 3 is a schematic diagram illustrating a file recovery flow of the database file backup method according to the present invention;
fig. 4 is a schematic structural diagram of a database file backup device provided in the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, an embodiment of the present invention provides a database file backup method, which includes the steps of:
s1, responding to a timing backup task instruction, and traversing and querying all files in a target database;
s2, carrying out consistency comparison on each table data file in the target database and the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up; the target backup folder is the latest backup folder in the backup library;
and S3, copying the target backup folder to obtain a current backup folder, naming the current backup folder based on the current system time, copying all table data files marked as files to be backed up, replacing corresponding table data files in the current backup folder, and adding the current backup folder into the backup library.
In the embodiment of the invention, a timing backup task can be set, and the file backup program is executed once every preset period. Before adding the backup files, comparing each file in the database with the corresponding file in the latest backup folder one by one, wherein the files with consistent comparison do not need to be backed up, and the files with inconsistent comparison are marked as files to be backed up. When all files in the target database are subjected to traversal query and at least one file to be backed up is determined, a current backup folder (the latest backup folder in a copy backup library) is created, the folder is named at the current time, the list data file marked as the file to be backed up is copied and the corresponding file in the current backup folder is replaced, and the current backup folder is added into the backup library after the backup file is replaced, so that backup is completed.
According to the database file backup method provided by the embodiment of the invention, incremental judgment and backup of the whole backup folder are not needed, and each table data file is respectively judged and finely backed up, so that the file content change comparison process is simplified, and the file backup efficiency is effectively improved.
In this embodiment of the present invention, further, the traversing queries all files in the target database, including:
when the table structure file of the target database is inquired, if the table structure file is judged to be damaged, copying the backup table structure file in the target backup folder, and replacing the table structure file in the target database.
It should be noted that, for the searched table structure file, when it is determined that the table structure file is damaged, the corresponding backup table structure file needs to be obtained according to the latest backup folder to perform copy replacement so as to repair the table structure file of the database.
In this embodiment of the present invention, further, the traversing queries all files in the target database, including:
and when the table data file in the target database is queried and judged to be damaged, ending the current backup task and starting a file recovery program.
It should be noted that, when it is determined that a table data file of the database is damaged in the backup process, the current backup task is ended, and the file recovery program is started. It should be noted that starting the file recovery program may trigger a file damage prompt for the user, instead of directly and automatically executing file recovery, and further determine whether recovery is needed through human intervention, thereby effectively preventing the problem of user data loss caused by system misjudgment, and improving reliability and stability of system backup recovery.
In this embodiment of the present invention, further, before traversing all files in the query target database in response to the timed backup task instruction, the method further includes:
and when judging that the backup folder does not exist in the backup library, carrying out full backup on the target database to obtain a first backup folder, and adding the first backup folder into the backup library.
It should be noted that before determining the need for table data file backup of a data file, it is also necessary to determine whether a backup folder exists in the backup library, and if not, a new backup folder is needed, and the data file of the database is backed up in full.
In the embodiment of the present invention, further, the method further includes:
and when the number of the backup folders in the backup library is judged to be larger than a preset threshold value, deleting the oldest backup folder in the backup library.
It should be noted that, because the backup that is too long has no practical use, a certain automatic deletion strategy can be set to delete the backup file of the old version in time, thereby saving storage resources such as computer disk space.
In this embodiment of the present invention, further, the determining that the table structure file is damaged includes:
and when judging whether the file size of the table structure file is zero, determining that the table structure file is damaged.
It should be noted that, whether the table structure file is damaged or not may be determined by determining whether the file size of the table structure file is zero or not.
In this embodiment of the present invention, further, the performing consistency comparison on the table data files in the target database and the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up specifically includes:
respectively calculating the MD5 values of all the table data files in the target database and the table data files in the target backup folder;
on the basis of the MD5 value of each file, carrying out consistency comparison on each table data file in the target database and the table data file in the target backup folder in a one-to-one correspondence manner;
and when the MD5 value of the target table data file in the target database is judged to be inconsistent with the MD5 value of the corresponding table data file in the target backup folder, marking the target table data file as a file to be backed up.
It should be noted that, in the embodiment of the present invention, the consistency determination of the table data file may be performed in an MD5 verification manner, which is logically simple, accurate, and efficient, so that the efficiency and the accuracy of the file consistency determination are improved.
Based on the above solution, in order to better understand the database file backup method provided in the embodiment of the present invention, the following detailed description is made:
it should be noted that the method of the embodiment of the present invention may ensure that the system is operated safely for 7 × 24 hours without interruption, and mainly ensure that data is not lost and the system is stably operated when the database system is in operation failure by using the database backup recovery technology.
The document MD5 is a document signature, and if the document content has not changed, the calculated document MD5 is consistent, so that it can be determined whether the data document has changed by means of MD5 verification.
In the embodiment of the invention, whether the files need to be backed up is judged mainly by judging whether the MD5 values of the database structure files and the data files in the MySQL/data directory are consistent with the MD5 values of the database structure files and the data files in the backup folder or not through MD5 of the files, and the backup is performed by physical copy and cp command.
The embodiment of the invention judges whether the file needs to be backed up or not by a mode different from the traditional backup technology. Through the file MD5, the file content change comparison process is simplified, compared with the file increment acquisition or the timing full backup, the memory resource, the disk space and the CPU overhead of a computer are saved, and the invalid files of the system are reduced.
Meanwhile, in the process of timing task backup, the system can judge whether the database structure file is damaged or not according to whether the database structure file under the MySQL/data directory is 0kb or not, if the database structure file is damaged, the corresponding file under the previous backup folder is copied to replace the damaged file, the problem caused by damage of the database table structure file is repaired, and the operation stability and the robustness of the system are improved.
It should be noted that, in the embodiment of the present invention, the table structure file stores the structure of the table with the suffix of frm; storing the data relation by the table data file with ibd suffix; for example, in excel, the header of the first row has name, ID card and age, the contents in the second row are all contents, the table structure file is equivalent to the header of excel, and the table data file is equivalent to the contents in the second row of excel.
If the data file under the MySQL/data directory corresponding to the database is judged to be damaged, a file recovery program is triggered to remind a user whether the file recovery is needed, and the user can log in the operation and maintenance platform system and repair the data file through one-key repair.
For the storage of the backup folder, the total backup folder can be set to store 7 copies at most (which can be unrelated to the time span), the backup which is too long is not practical, and the disk space of the computer can be saved by deleting the old backup files.
Referring to fig. 2, the embodiment of the present invention can be implemented by the following steps:
1. starting up to run a backup program, firstly judging whether a backup folder storage path (backup library) has a backup folder, if not, firstly fully backing up one copy (stored to mysql/data) for subsequent timing tasks and performing MD5 judgment on files under the mysql/data directory;
2. executing a timed backup task (or executing the backup task according to a preset trigger condition) according to a period, so as to backup the newly modified file;
3. traversing and inquiring files in a MySQL/data directory (target database), comparing the files with the MD5 value of the corresponding file in the latest backup folder, and judging whether the files in the database are modified;
4. when the table structure file is inquired (frm is at the end), judging whether the table structure file is damaged (for example, the file size is 0kb, and the file is determined to be damaged), and if the table structure file is damaged, restoring the table structure file through the latest backup file;
5. whether each table data file in the target database is damaged or not is judged, for example, whether the table data file is damaged or not can be determined by querying a piece of data through MySQL (select x from < table name > where 1limit 1) and judging whether the table data file is normal or not. If the table data file is damaged, the backup program is ended, a recovery task prompt is triggered, and a user is waited to log in the system and select whether to restore by one key or not (see fig. 3).
6. After traversing the MySQL/data directory files and determining which data files with the changed MD5, if at least one table data file needing to be backed up exists, copying the latest backup folder, naming the latest backup folder by the current time (20220907121212), replacing the data file with the changed MD5 value, and storing the data file in a backup library to complete backup.
7. And when the number of the backup folders is judged to be more than 7, deleting the oldest backup, and waiting for the next timing task to be executed after the execution is finished.
Referring to fig. 3, the file recovery process can be implemented by the following steps:
1. through the file damage prompt triggered by the process, a user finds that the database table data file is damaged, and logs in an operation and maintenance platform;
2. viewing a database backup folder list;
3. selecting backup folder versions needing to be restored;
4. the system replaces the damaged table data file in the database with the table data file in the backup folder;
5. and after the replacement is finished, starting the backup program and finishing the repair.
It can be understood that the embodiment of the present invention gives the user the right to recover the initiative, so as to prevent the system from misjudging, which results in the loss of user data.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
1. the invention develops a new method, and judges whether the content of the file is modified or not by comparing the file MD5 value of the file under MySQL/data with the file corresponding to the backup folder, thereby optimizing the change comparison process of the content of the file. Compared with the method for obtaining file increment or timing full backup, the method saves computer memory resources, disk space and CPU (central processing unit) overhead and reduces invalid files of the system.
2. Meanwhile, in the timed task backup process, the system also determines whether the table structure file is damaged by judging whether the database structure file under the MySQL/data directory is 0kb, and the damaged file is copied by the corresponding file under the backup folder before, so that the damaged file is replaced, the problem caused by the damage of the database table structure file is repaired, and the operation stability and the robustness of the system are improved.
It should be noted that the embodiment of the present invention is characterized in that:
1. whether the file needs to be backed up or not is judged in a mode different from the prior art. By adopting the mode of file MD5 verification, the file content change comparison process is simplified, and compared with the mode of acquiring file increment or timing full backup, the method saves the memory resources of a computer, the disk space and the CPU overhead and reduces invalid files of the system.
2. Meanwhile, in the timed task backup process, the system automatically judges whether the database table structure file under the MySQL/data directory is damaged or not and repairs the damaged or not, so that the stability and the robustness of the system are improved, and the after-sale labor expense of the system is reduced.
It should be noted that, for simplicity of description, the above method or flow embodiment is described as a series of acts, but those skilled in the art should understand that the embodiment of the present invention is not limited by the described acts, as some steps can be performed in other orders or simultaneously according to the embodiment of the present invention. Further, those of skill in the art will appreciate that the embodiments described in the specification are exemplary embodiments and that no acts are necessarily required of the embodiments of the invention.
Referring to fig. 4, an embodiment of the present invention further provides a database file backup apparatus, including:
the task response module 1 is used for responding to the timing backup task instruction and traversing and inquiring all files in the target database;
the file comparison module 2 is used for carrying out consistency comparison on each table data file in the target database and the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up; the target backup folder is the latest backup folder in the backup library;
the file backup module 3 is configured to copy the target backup folder to obtain a current backup folder, name the current backup folder based on current system time, copy all table data files marked as files to be backed up, replace corresponding table data files in the current backup folder, and add the current backup folder to the backup library.
Further, the task response module 1 is specifically configured to:
when the table structure file of the target database is inquired, if the table structure file is judged to be damaged, the backup table structure file in the target backup folder is copied, and the table structure file in the target database is replaced.
Further, the task response module 1 is specifically configured to:
and when the table data file in the target database is queried and judged to be damaged, ending the current backup task and starting a file recovery program.
Further, the database file backup apparatus further includes a folder creation module configured to:
and when judging that the backup folder does not exist in the backup library, carrying out full backup on the target database to obtain a first backup folder, and adding the first backup folder into the backup library.
Further, the database file backup apparatus further includes a file deletion module configured to:
and when the number of the backup folders in the backup library is judged to be larger than a preset threshold value, deleting the oldest backup folder in the backup library.
Further, the manner for determining that the table structure file is damaged includes:
and when judging whether the file size of the table structure file is zero, determining that the table structure file is damaged.
Further, the file comparison module 2 is specifically configured to:
respectively calculating the MD5 values of all table data files in the target database and the table data files in the target backup folder;
on the basis of the MD5 value of each file, carrying out consistency comparison on each table data file in the target database and the table data file in the target backup folder in a one-to-one correspondence manner;
and when the MD5 value of the target table data file in the target database is judged to be inconsistent with the MD5 value of the corresponding table data file in the target backup folder, marking the target table data file as a file to be backed up.
It can be understood that the foregoing device item embodiment corresponds to the method item embodiment of the present invention, and the database file backup device provided in the embodiment of the present invention can implement the database file backup method provided in any method item embodiment of the present invention.
The present invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements any of the database file backup methods described herein.
It should be noted that the above-described device embodiments are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
It can be clearly understood by those skilled in the art that, for convenience and brevity, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
The terminal device may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor, a memory.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like, said processor being the control center of said terminal device, and various interfaces and lines are used to connect the various parts of the whole terminal device.
The memory may be used to store the computer program, and the processor may implement various functions of the terminal device by running or executing the computer program stored in the memory and calling data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the mobile phone, and the like. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The storage medium is a computer-readable storage medium, in which the computer program is stored, which computer program, when being executed by a processor, is adapted to carry out the steps of the above-mentioned respective method embodiments. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer-readable medium may contain suitable additions or subtractions depending on the requirements of legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer-readable media may not include electrical carrier signals or telecommunication signals in accordance with legislation and patent practice.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.
Claims (10)
1. A database file backup method is characterized by comprising the following steps:
responding to the timed backup task instruction, and traversing and querying all files in the target database;
carrying out consistency comparison on each table data file in the target database and the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up; the target backup folder is the latest backup folder in the backup library;
the target backup folder is copied to obtain a current backup folder, the current backup folder is named based on current system time, all table data files marked as files to be backed up are copied, corresponding table data files in the current backup folder are replaced, and the current backup folder is added into the backup library.
2. The database file backup method of claim 1, wherein the traversing queries all files in the target database, comprising:
when the table structure file of the target database is inquired, if the table structure file is judged to be damaged, the backup table structure file in the target backup folder is copied, and the table structure file in the target database is replaced.
3. The database file backup method of claim 1, wherein the traversing queries all files in the target database, comprising:
and when the table data file in the target database is queried and judged to be damaged, ending the current backup task and starting a file recovery program.
4. The database file backup method according to claim 1, before traversing all files in the query target database in response to the timed backup task instruction, further comprising:
and when judging that the backup folder does not exist in the backup library, carrying out full backup on the target database to obtain a first backup folder, and adding the first backup folder into the backup library.
5. The database file backup method according to claim 1, further comprising:
and when the number of the backup folders in the backup library is judged to be larger than a preset threshold value, deleting the oldest backup folder in the backup library.
6. The database file backup method according to claim 2, wherein said determining the damage of the table structure file comprises:
and when judging whether the file size of the table structure file is zero, determining that the table structure file is damaged.
7. The database file backup method according to any one of claims 1 to 6, wherein the consistency comparison is performed on each table data file in the target database in one-to-one correspondence with the table data files in the target backup folder, and the table data files with inconsistent comparison results in the target database are marked as files to be backed up, specifically comprising:
respectively calculating the MD5 values of all the table data files in the target database and the table data files in the target backup folder;
on the basis of the MD5 value of each file, carrying out consistency comparison on each table data file in the target database and the table data file in the target backup folder in a one-to-one correspondence manner;
and when the MD5 value of the target table data file in the target database is judged to be inconsistent with the MD5 value of the corresponding table data file in the target backup folder, marking the target table data file as a file to be backed up.
8. A database file backup apparatus, comprising:
the task response module is used for responding to the timing backup task instruction and traversing and inquiring all files in the target database;
the file comparison module is used for carrying out consistency comparison on each table data file in the target database and the table data files in the target backup folder in a one-to-one correspondence manner, and marking the table data files with inconsistent comparison results in the target database as files to be backed up; the target backup folder is the latest backup folder in the backup library;
and the file backup module is used for copying the target backup folder to obtain a current backup folder, naming the current backup folder based on the current system time, copying all table data files marked as files to be backed up, replacing the corresponding table data files in the current backup folder, and adding the current backup folder into the backup library.
9. A terminal device comprising a processor and a memory storing a computer program, wherein the processor implements the database file backup method according to any one of claims 1 to 7 when executing the computer program.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the database file backup method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211527352.3A CN115794491A (en) | 2022-11-30 | 2022-11-30 | Database file backup method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211527352.3A CN115794491A (en) | 2022-11-30 | 2022-11-30 | Database file backup method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115794491A true CN115794491A (en) | 2023-03-14 |
Family
ID=85444338
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211527352.3A Pending CN115794491A (en) | 2022-11-30 | 2022-11-30 | Database file backup method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115794491A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070106713A1 (en) * | 2005-11-08 | 2007-05-10 | Network Blackbox, Inc. | Hazard protected file backup system |
US7797279B1 (en) * | 2007-12-31 | 2010-09-14 | Emc Corporation | Merging of incremental data streams with prior backed-up data |
US10146631B1 (en) * | 2015-09-30 | 2018-12-04 | EMC IP Holding Company LLC | Incremental forever backups for exchange |
CN109815058A (en) * | 2019-01-28 | 2019-05-28 | 网宿科技股份有限公司 | The method and device of file backup under a kind of Linux server |
CN111880967A (en) * | 2020-07-28 | 2020-11-03 | 平安科技(深圳)有限公司 | File backup method, device, medium and electronic equipment in cloud scene |
CN113722155A (en) * | 2021-11-01 | 2021-11-30 | 苏州浪潮智能科技有限公司 | Data backup and repair method in distributed file system and related components |
CN114296827A (en) * | 2021-12-30 | 2022-04-08 | 河南紫联物联网技术有限公司 | Data file processing method, device, equipment and storage medium |
-
2022
- 2022-11-30 CN CN202211527352.3A patent/CN115794491A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070106713A1 (en) * | 2005-11-08 | 2007-05-10 | Network Blackbox, Inc. | Hazard protected file backup system |
US7797279B1 (en) * | 2007-12-31 | 2010-09-14 | Emc Corporation | Merging of incremental data streams with prior backed-up data |
US10146631B1 (en) * | 2015-09-30 | 2018-12-04 | EMC IP Holding Company LLC | Incremental forever backups for exchange |
CN109815058A (en) * | 2019-01-28 | 2019-05-28 | 网宿科技股份有限公司 | The method and device of file backup under a kind of Linux server |
CN111880967A (en) * | 2020-07-28 | 2020-11-03 | 平安科技(深圳)有限公司 | File backup method, device, medium and electronic equipment in cloud scene |
CN113722155A (en) * | 2021-11-01 | 2021-11-30 | 苏州浪潮智能科技有限公司 | Data backup and repair method in distributed file system and related components |
CN114296827A (en) * | 2021-12-30 | 2022-04-08 | 河南紫联物联网技术有限公司 | Data file processing method, device, equipment and storage medium |
Non-Patent Citations (3)
Title |
---|
冯春培等: "《Oracle数据库DBA专题技术精粹》", 冶金工业出版社, pages: 170 - 173 * |
李光辉: "SQL SERVER数据库自动备份与还原方法", 电子技术与软件工程, no. 06 * |
柏建明等: "一种中小企业数据自动备份方法实现", 现代计算机(专业版), no. 34 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110096476B (en) | Data backup method, device and computer readable storage medium | |
CN109284073B (en) | Data storage method, device, system, server, control node and medium | |
RU2565109C2 (en) | Method and apparatus for recovering backup database | |
US20110218967A1 (en) | Partial Block Based Backups | |
CN110543386B (en) | Data storage method, device, equipment and storage medium | |
KR100515890B1 (en) | Method of efficiently recovering database | |
CN110602165B (en) | Government affair data synchronization method, device, system, computer equipment and storage medium | |
CN113420081A (en) | Data verification method and device, electronic equipment and computer storage medium | |
CN108121774B (en) | Data table backup method and terminal equipment | |
CN114416665B (en) | Method, device and medium for detecting and repairing data consistency | |
CN108664255B (en) | Software upgrading method and device | |
CN118069745A (en) | SQL SERVER increment acquisition method, storage medium and equipment based on transaction log | |
CN112596959A (en) | Distributed storage cluster data backup method and device | |
CN109324931B (en) | Method for realizing vmware mount recovery in data de-duplication system | |
CN115794491A (en) | Database file backup method, device, equipment and storage medium | |
CN111625397B (en) | Service log backup method, cluster, device, electronic equipment and storage medium | |
CN116089394A (en) | Data rollback method, storage medium and device of database | |
CN111338842A (en) | File backup method and device | |
CN112711627B (en) | Data importing method, device and equipment of Greemplum database | |
US11645333B1 (en) | Garbage collection integrated with physical file verification | |
CN114385657A (en) | Data storage method, device and storage medium | |
CN112631741A (en) | Transaction processing method, device and storage medium | |
CN113468190B (en) | Configuration updating method and device for MongoDB database instance | |
CN112612648B (en) | SQL Server database recovery method, terminal equipment and storage medium | |
CN118035207A (en) | Small file merging method and device based on HDFS (Hadoop distributed File System) framework and related medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |