CN115794491A - Database file backup method, device, equipment and storage medium - Google Patents

Database file backup method, device, equipment and storage medium Download PDF

Info

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
Application number
CN202211527352.3A
Other languages
Chinese (zh)
Inventor
覃时森
余吉昌
明德
张常华
朱正辉
赵定金
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Baolun Electronics Co Ltd
Original Assignee
Guangzhou Baolun Electronics 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 Guangzhou Baolun Electronics Co Ltd filed Critical Guangzhou Baolun Electronics Co Ltd
Priority to CN202211527352.3A priority Critical patent/CN115794491A/en
Publication of CN115794491A publication Critical patent/CN115794491A/en
Pending legal-status Critical Current

Links

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

数据库文件备份方法、装置、设备及存储介质Database file backup method, device, equipment and storage medium

技术领域technical field

本发明涉及数据备份技术领域,尤其是涉及一种数据库文件备份方法、装置、设备及存储介质。The invention relates to the technical field of data backup, in particular to a database file backup method, device, equipment and storage medium.

背景技术Background technique

现有的数据库文件备份恢复的方案,通常需要获取的当前数据库文件与映像副本文件对比得到增量数量,然后再对增量数据进行备份输出文件,然后再对备份输出文件与原有映像副本文件进行对比,再将备份输出文件合并到映像副本中,后续再将映像副本更新到数据库。上述现有的方案中,数据库文件内容变化对比和存储方式较为复杂,效率不高。The existing database file backup and recovery scheme usually needs to compare the obtained current database file with the image copy file to obtain the incremental number, then back up the incremental data and output the file, and then compare the backup output file with the original image copy file For comparison, the backup output files are merged into the image copy, and the image copy is subsequently updated to the database. In the above-mentioned existing solution, the content change comparison and storage method of the database file are relatively complicated, and the efficiency is not high.

发明内容Contents of the invention

本发明旨在提供一种数据库文件备份方法、装置、设备及存储介质,以解决上述技术问题,从而能够简化文件对比和文件备份过程,从而提高数据库文件备份效率。The present invention aims to provide a database file backup method, device, equipment and storage medium to solve the above technical problems, thereby simplifying file comparison and file backup processes, thereby improving database file backup efficiency.

为了解决上述技术问题,本发明提供了一种数据库文件备份方法,包括:In order to solve the above technical problems, the invention provides a database file backup method, comprising:

响应于定时备份任务指令,遍历查询目标数据库中的所有文件;In response to the scheduled backup task instruction, traverse all files in the query target database;

将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件;其中,所述目标备份文件夹为备份库中最新的备份文件夹;Each table data file in the target database is correspondingly compared with the table data files in the target backup folder one by one, and the table data files with inconsistent comparison results in the target database are marked as files to be backed up; wherein , the target backup folder is the latest backup folder in the backup repository;

对所述目标备份文件夹进行复制得到当前备份文件夹,基于当前系统时间对所述当前备份文件夹进行命名,将标记为待备份文件的所有表数据文件进行复制并对所述当前备份文件夹中对应的表数据文件进行替换,并将所述当前备份文件夹添加至所述备份库中。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 and copying the current backup folder Replace the corresponding table data file in , and add the current backup folder to the backup library.

进一步地,所述遍历查询目标数据库中的所有文件,包括:Further, the traversal query of all files in the target database includes:

当查询到所述目标数据库的表结构文件时,若判断所述表结构文件发生损坏,则对所述目标备份文件夹中的备份表结构文件进行复制,并对所述目标数据库中的表结构文件进行替换。When the table structure file of the target database is inquired, if it is judged that the table structure file is damaged, the backup table structure file in the target backup folder is copied, and the table structure in the target database is copied. file to replace.

进一步地,所述遍历查询目标数据库中的所有文件,包括:Further, the traversal query of all files in the target database includes:

当查询并判断所述目标数据库中的表数据文件发生损坏时,结束当前备份任务,并启动文件恢复程序。When it is queried and judged that the table data file in the target database is damaged, the current backup task is ended and the file recovery program is started.

进一步地,在响应于定时备份任务指令,遍历查询目标数据库中的所有文件之前,还包括:Further, before traversing and querying all files in the target database in response to the scheduled backup task instruction, the method further includes:

当判断所述备份库中不存在备份文件夹时,对所述目标数据库进行全量备份得到第一备份文件夹,并将所述第一备份文件夹添加至所述备份库中。When it is judged that there is no backup folder in the backup repository, a full backup is performed on the target database to obtain a first backup folder, and the first backup folder is added to the backup repository.

进一步地,还包括:Further, it also includes:

当判断所述备份库中备份文件夹的数量大于预设的阈值时,将所述备份库中最旧的备份文件夹进行删除。When it is judged that the number of backup folders in the backup library is greater than a preset threshold, the oldest backup folder in the backup library is deleted.

进一步地,所述判断所述表结构文件发生损坏的方式包括:Further, the manner of judging that the table structure file is damaged includes:

当判断所述表结构文件的文件大小是否为零时,则确定所述表结构文件发生损坏。When judging whether the file size of the table structure file is zero, it is determined that the table structure file is damaged.

进一步地,所述将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件,具体包括:Further, the one-to-one consistency comparison is performed between each table data file in the target database and the table data file in the target backup folder, and the table data files in the target database with inconsistent comparison results are marked as Files to be backed up, including:

分别计算所述目标数据库中的各个表数据文件以及所述目标备份文件夹中的表数据文件的MD5值;Calculate respectively the MD5 value of each table data file in the target database and the table data file in the target backup folder;

基于各个文件的MD5值,将所述目标数据库中的各个表数据文件与所述目标备份文件夹中的表数据文件一一对应进行一致性对比;Based on the MD5 value of each file, each table data file in the target database is compared with the table data file in the target backup folder in one-to-one correspondence;

当判断所述目标数据库中的目标表数据文件的MD5值与目标备份文件夹中对应的表数据文件的MD5值不一致时,将所述目标表数据文件标记为待备份文件。When judging that the MD5 value of the target table data file in the target database is inconsistent with the MD5 value of the corresponding table data file in the target backup folder, mark the target table data file as a file to be backed up.

本发明还提供一种数据库文件备份装置,包括:The present invention also provides a database file backup device, comprising:

任务响应模块,用于响应于定时备份任务指令,遍历查询目标数据库中的所有文件;A task response module, configured to traverse all files in the query target database in response to a scheduled backup task instruction;

文件对比模块,用于将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件;其中,所述目标备份文件夹为备份库中最新的备份文件夹;A file comparison module, configured to perform a one-to-one consistency comparison between each table data file in the target database and the table data file in the target backup folder, and mark the table data files with inconsistent comparison results in the target database is the file to be backed up; wherein, the target backup folder is the latest backup folder in the backup library;

文件备份模块,用于对所述目标备份文件夹进行复制得到当前备份文件夹,基于当前系统时间对所述当前备份文件夹进行命名,将标记为待备份文件的所有表数据文件进行复制并对所述当前备份文件夹中对应的表数据文件进行替换,并将所述当前备份文件夹添加至所述备份库中。A file backup module, configured to copy the target backup folder to obtain a current backup folder, name the current backup folder based on the current system time, copy all table data files marked as files to be backed up and The corresponding table data file in the current backup folder is replaced, and the current backup folder is added to the backup repository.

本发明还提供一种终端设备,包括处理器和存储有计算机程序的存储器,所述处理器执行所述计算机程序时实现任一项所述的数据库文件备份方法。The present invention also provides a terminal device, including a processor and a memory storing a computer program. When the processor executes the computer program, the database file backup method described in any one is implemented.

本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现任一项所述的数据库文件备份方法。The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the database file backup method described in any one is realized.

与现有技术相比,本发明具有如下有益效果:Compared with the prior art, the present invention has the following beneficial effects:

本发明提供了一种数据库文件备份方法、装置、设备及存储介质,所述方法包括:响应于定时备份任务指令,遍历查询目标数据库中的所有文件;将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件;其中,所述目标备份文件夹为备份库中最新的备份文件夹;对所述目标备份文件夹进行复制得到当前备份文件夹,基于当前系统时间对所述当前备份文件夹进行命名,将标记为待备份文件的所有表数据文件进行复制并对所述当前备份文件夹中对应的表数据文件进行替换,并将所述当前备份文件夹添加至所述备份库中。本发明简化文件对比和文件备份过程,从而提高了数据库文件备份的效率。The present invention provides a database file backup method, device, equipment and storage medium. The method includes: responding to the timing backup task instruction, traversing and querying all files in the target database; storing each table data file in the target database Carry out a one-to-one consistency comparison with the table data files in the target backup folder, and mark the inconsistent table data files in the target database as files to be backed up; wherein, the target backup folder is in the backup library The latest backup folder; the target backup folder is copied to obtain the current backup folder, the current backup folder is named based on the current system time, and all table data files marked as files to be backed up are copied and copied The corresponding table data file in the current backup folder is replaced, and the current backup folder is added to the backup repository. The invention simplifies the process of file comparison and file backup, thereby improving the efficiency of database file backup.

附图说明Description of drawings

图1是本发明提供的数据库文件备份方法的流程示意图之一;Fig. 1 is one of schematic flow charts of the database file backup method provided by the present invention;

图2是本发明提供的数据库文件备份方法的流程示意图之二;Fig. 2 is the second schematic flow chart of the database file backup method provided by the present invention;

图3是本发明提供的数据库文件备份方法的文件恢复流程示意图;Fig. 3 is a schematic diagram of the file restoration process of the database file backup method provided by the present invention;

图4是本发明提供的数据库文件备份装置的结构示意图。Fig. 4 is a schematic structural diagram of the database file backup device provided by the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整的描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

请参见图1,本发明实施例提供了一种数据库文件备份方法,可以包括步骤:Referring to Fig. 1, the embodiment of the present invention provides a kind of database file backup method, may comprise steps:

S1、响应于定时备份任务指令,遍历查询目标数据库中的所有文件;S1. In response to the scheduled backup task instruction, traverse and query all files in the target database;

S2、将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件;其中,所述目标备份文件夹为备份库中最新的备份文件夹;S2. Perform a one-to-one consistency comparison between each table data file in the target database and the table data file in the target backup folder, and mark the table data files with inconsistent comparison results in the target database as files to be backed up ; Wherein, the target backup folder is the latest backup folder in the backup library;

S3、对所述目标备份文件夹进行复制得到当前备份文件夹,基于当前系统时间对所述当前备份文件夹进行命名,将标记为待备份文件的所有表数据文件进行复制并对所述当前备份文件夹中对应的表数据文件进行替换,并将所述当前备份文件夹添加至所述备份库中。S3. Copy the target backup folder to obtain the current backup folder, name the current backup folder based on the current system time, copy all table data files marked as files to be backed up, and copy the current backup folder The corresponding table data files in the folder are replaced, and the current backup folder is added to the backup library.

在本发明实施例中,可以设定定时备份任务,每隔预设的周期执行一次文件备份程序。在添加备份文件之前,先将数据库中各个文件与最新的备份文件夹中对应的文件进行一一对比,对比一致的文件则不需要备份,对比不一致的文件标记为待备份文件。对目标数据库中的所有文件进行遍历查询并确定了至少一个待备份文件时,创建当前备份文件夹(复制备份库中最新的备份文件夹),以当前时间对文件夹进行命名,将标记为待备份文件的表数据文件复制出来并对当前备份文件夹中相应的文件进行替换,替换备份文件后将该当前备份文件夹添加到备份库中,完成备份。In the embodiment of the present invention, a scheduled backup task can be set, and the file backup program is executed every preset period. Before adding the backup file, compare each file in the database with the corresponding file in the latest backup folder one by one. The files that are consistent do not need to be backed up, and the files that are inconsistent are marked as files to be backed up. When traversing all files in the target database and determining at least one file to be backed up, create the current backup folder (copy the latest backup folder in the backup library), name the folder with the current time, and mark it as the file to be backed up Copy the table data file of the backup file and replace the corresponding file in the current backup folder. After replacing the backup file, add the current backup folder to the backup library to complete the backup.

本发明实施例提供的数据库文件备份方法,无需对整个备份文件夹进行增量判断和备份,改为对各个表数据文件进行分别判断并精细化备份,简化了文件内容变化对比过程,有效提高了文件备份的效率。The database file backup method provided by the embodiment of the present invention does not need to perform incremental judgment and backup on the entire backup folder, but instead judges each table data file separately and refines the backup, which simplifies the process of comparing changes in file content and effectively improves the database file backup method. Efficiency of file backup.

在本发明实施例中,进一步地,所述遍历查询目标数据库中的所有文件,包括:In the embodiment of the present invention, further, the traversal of all files in the query target database includes:

当查询到所述目标数据库的表结构文件时,若判断所述表结构文件发生损坏,则对所述目标备份文件夹中的备份表结构文件进行复制,并对所述目标数据库中的表结构文件进行替换。When the table structure file of the target database is inquired, if it is judged that the table structure file is damaged, the backup table structure file in the target backup folder is copied, and the table structure in the target database is copied. file to replace.

需要说明的是,对于查询到的表结构文件,当判断该表结构文件发生损坏时,则需要根据最新的备份文件夹获取相应的备份表结构文件进行复制替换以对数据库的表结构文件进行修复。It should be noted that for the queried table structure file, when it is judged that the table structure file is damaged, it is necessary to obtain the corresponding backup table structure file according to the latest backup folder to copy and replace the table structure file of the database. .

在本发明实施例中,进一步地,所述遍历查询目标数据库中的所有文件,包括:In the embodiment of the present invention, further, the traversal of all files in the query target database includes:

当查询并判断所述目标数据库中的表数据文件发生损坏时,结束当前备份任务,并启动文件恢复程序。When it is queried and judged that the table data file in the target database is damaged, the current backup task is ended and the file recovery program is started.

需要说明的是,当在备份过程中判断数据库的表数据文件发生损坏时,则结束当前的备份任务,启动文件恢复程序。需要说明的是,启动文件恢复程序可以是触发对用户的文件损坏提示,而并不直接自动执行文件恢复,通过人为介入进一步判断是否需要进行恢复,有效防止了由于系统误判导致的用户数据丢失问题,提高了系统备份恢复的可靠性和稳定性。It should be noted that, when it is judged that the table data file of the database is damaged during the backup process, the current backup task is terminated and the file recovery program is started. It should be noted that starting the file recovery program can trigger a file damage prompt to the user, but not directly and automatically perform file recovery, and further judge whether recovery is necessary through human intervention, effectively preventing the loss of user data due to system misjudgment problem, improving the reliability and stability of system backup and recovery.

在本发明实施例中,进一步地,在响应于定时备份任务指令,遍历查询目标数据库中的所有文件之前,还包括:In the embodiment of the present invention, further, before traversing all the files in the query target database in response to the scheduled backup task instruction, it also includes:

当判断所述备份库中不存在备份文件夹时,对所述目标数据库进行全量备份得到第一备份文件夹,并将所述第一备份文件夹添加至所述备份库中。When it is judged that there is no backup folder in the backup repository, a full backup is performed on the target database to obtain a first backup folder, and the first backup folder is added to the backup repository.

需要说明的是,在对数据文进行表数据文件备份需求判断之前,还需要判断备份库中是否存在备份文件夹,如果没有则需要新建一个,并且对数据库的数据文件进行全量备份。It should be noted that before judging the table data file backup requirements for the data file, it is also necessary to judge whether there is a backup folder in the backup database. If not, it is necessary to create a new one and perform a full backup of the data files of the database.

在本发明实施例中,进一步地,还包括:In the embodiment of the present invention, it further includes:

当判断所述备份库中备份文件夹的数量大于预设的阈值时,将所述备份库中最旧的备份文件夹进行删除。When it is judged that the number of backup folders in the backup library is greater than a preset threshold, the oldest backup folder in the backup library is deleted.

需要说明的是,由于太久远的备份没实际用处,可以设定一定的自动删除策略及时对旧版本的备份文件进行删除,从而节省计算机磁盘空间等存储资源。It should be noted that since backups that are too old are of no practical use, a certain automatic deletion strategy can be set to delete the backup files of the old version in time, thereby saving storage resources such as computer disk space.

在本发明实施例中,进一步地,所述判断所述表结构文件发生损坏的方式包括:In the embodiment of the present invention, further, the manner of judging that the table structure file is damaged includes:

当判断所述表结构文件的文件大小是否为零时,则确定所述表结构文件发生损坏。When judging whether the file size of the table structure file is zero, it is determined that the table structure file is damaged.

需要说明的是,可以通过判断表结构文件的文件大小是否为零来确定该表结构文件是否损坏。It should be noted that whether the table structure file is damaged can be determined by judging whether the file size of the table structure file is zero.

在本发明实施例中,进一步地,所述将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件,具体包括:In the embodiment of the present invention, further, the one-to-one correspondence between each table data file in the target database and the table data file in the target backup folder is compared, and the comparison result in the target database Inconsistent table data files are marked as files to be backed up, including:

分别计算所述目标数据库中的各个表数据文件以及所述目标备份文件夹中的表数据文件的MD5值;Calculate respectively the MD5 value of each table data file in the target database and the table data file in the target backup folder;

基于各个文件的MD5值,将所述目标数据库中的各个表数据文件与所述目标备份文件夹中的表数据文件一一对应进行一致性对比;Based on the MD5 value of each file, each table data file in the target database is compared with the table data file in the target backup folder in one-to-one correspondence;

当判断所述目标数据库中的目标表数据文件的MD5值与目标备份文件夹中对应的表数据文件的MD5值不一致时,将所述目标表数据文件标记为待备份文件。When judging that the MD5 value of the target table data file in the target database is inconsistent with the MD5 value of the corresponding table data file in the target backup folder, mark the target table data file as a file to be backed up.

需要说明的是,在本发明实施例中,表数据文件的一致性判断可以采用MD5验证的方式进行,该方式逻辑简单且准确高效,从而提高了文件一致性判断的效率和准确性。It should be noted that, in the embodiment of the present invention, the consistency judgment of the table data file can be performed by means of MD5 verification, which is logically simple, accurate and efficient, thereby improving the efficiency and accuracy of the file consistency judgment.

基于上述方案,为便于更好的理解本发明实施例提供的数据库文件备份方法,以下进行详细说明:Based on the above solution, in order to better understand the database file backup method provided by the embodiment of the present invention, the following detailed description:

需要说明的是,本发明实施例的方法可以保证系统7×24小时不间断地安全生产运行,主要通过数据库备份恢复技术来确保在数据库系统运行发生故障的情况下不丢失数据和稳定运行。It should be noted that the method of the embodiment of the present invention can ensure the safe production and operation of the system 7×24 hours, mainly through the database backup and recovery technology to ensure no data loss and stable operation in the event of a failure in the operation of the database system.

文件MD5是一种文件签名,如果文件内容没有发生变化,计算出来的文件MD5是一致的,因此可以通过MD5验证的方式来确定数据文件是否有变化。File MD5 is a file signature. If the file content has not changed, the calculated file MD5 is consistent. Therefore, it can be determined whether the data file has changed through MD5 verification.

在本发明实施例中,主要是通过文件的md5,判断MySQL/data目录下数据库结构文件和数据文件是否与备份文件夹中的数据库结构文件和数据文件的MD5值是否是否一致来判断该文件是否需要备份,备份是以物理拷贝,cp命令进行备份。In the embodiment of the present invention, mainly by the md5 of the file, judge whether the database structure file and the data file in the MySQL/data directory are consistent with the MD5 value of the database structure file and the data file in the backup folder to judge whether the file is Backup is required, the backup is a physical copy, and the cp command is used for backup.

本发明实施例通过与传统备份技术不同的方式,来判断文件是否需要备份。通过文件MD5,简化了文件内容变化对比过程,相比于获取文件增量或者定时全量备份,节约了计算机内存资源、磁盘空间和CPU开销,减少系统无效文件。The embodiment of the present invention judges whether a file needs to be backed up in a way different from the traditional backup technology. Through file MD5, the process of comparing file content changes is simplified. Compared with obtaining file increments or regular full backups, it saves computer memory resources, disk space, and CPU overhead, and reduces system invalid files.

同时,系统在定时任务备份过程中,也会根据MySQL/data目录下数据库结构文件是否为0kb,来判断其是否损坏,若损坏则通过之前备份文件夹下对应的文件进行拷贝,替换损坏的文件,修复数据库表结构文件损坏导致的问题,提高系统的运行稳定性和健壮性。At the same time, during the scheduled task backup process, the system will also judge whether it is damaged according to whether the database structure file in the MySQL/data directory is 0kb. If it is damaged, it will copy the corresponding file in the previous backup folder to replace the damaged file. , repair the problems caused by the damage of the database table structure file, and improve the stability and robustness of the system.

需要说明的是,本发明实施例中,表结构文件以.frm后缀,存放表的结构;表数据文件以.ibd后缀,存储数据关系;例如excel,第一行表头有姓名、身份证、年龄,第二行往后的都是内容,而表结构文件相当于excel的表头,表数据文件相当于excel第二行往后的内容。It should be noted that, in the embodiment of the present invention, the table structure file has a suffix of .frm to store the structure of the table; the table data file has a suffix of .ibd to store data relationships; Age, the content after the second line is the content, while the table structure file is equivalent to the header of excel, and the table data file is equivalent to the content after the second line of excel.

若判断数据库对应的MySQL/data目录下数据文件损坏,则触发文件恢复程序,以提醒用户是否需要进行文件恢复,用户可以登录运维平台系统,通过一键修复,进行数据文件修复。If it is judged that the data file in the MySQL/data directory corresponding to the database is damaged, the file recovery program will be triggered to remind the user whether file recovery is required. The user can log in to the operation and maintenance platform system and perform data file recovery through one-click repair.

对于备份文件夹的存储,可以设定总备份文件夹最多保存7份(可以与时间跨度无关),太久远的备份没实际用处,删除这些旧的备份文件可以节约计算机磁盘空间。For the storage of the backup folder, you can set the total backup folder to save up to 7 copies (it can be irrelevant to the time span). Backups that are too old are of no practical use. Deleting these old backup files can save computer disk space.

请参见图2,本发明实施例可以通过以下步骤实现:Referring to Fig. 2, the embodiment of the present invention can be realized through the following steps:

1、开机运行备份程序,首先判断备份文件夹保存路径(备份库)是否存在备份文件夹,若不存在,则需要先全量备份一份(存储至mysql/data),用于后续定时任务与mysql/data目录下文件进行文件MD5判断;1. Start up and run the backup program, first determine whether there is a backup folder in the backup folder storage path (backup library), if not, you need to back up a full copy (stored to mysql/data) for subsequent scheduled tasks and mysql Files in the /data directory are judged by file MD5;

2、按周期执行定时备份任务(或根据预设的触发条件来执行备份任务),用以备份最新修改的文件;2. Perform scheduled backup tasks periodically (or perform backup tasks according to preset trigger conditions) to back up the latest modified files;

3、遍历查询MySQL/data目录(目标数据库)下的文件,与最新的备份文件夹中对应的文件进行文件MD5值对比,判断数据库中的文件是否有修改;3. Traverse and query the files under the MySQL/data directory (target database), compare the MD5 value of the files with the corresponding files in the latest backup folder, and determine whether the files in the database have been modified;

4、当查询到表结构文件(.frm结尾),则判断该表结构文件是否损坏(例如文件大小为0kb确定为损坏),如果损坏,通过最新的备份文件恢复表结构文件;4. When the table structure file (end of .frm) is found in the query, it is judged whether the table structure file is damaged (for example, the file size is determined to be damaged if it is 0kb), and if it is damaged, restore the table structure file through the latest backup file;

5、判断目标数据库中的各个表数据文件是否损坏,例如可以通过MySQL(select*from<表名>where 1limit 1)查询出一条数据并判断是否正常的方式来确定该表数据文件是否损坏。如果表数据文件损坏,结束备份程序,触发恢复任务提示,等待用户登录系统,选择是否一键还原(参见图3)。5. Determine whether each table data file in the target database is damaged. For example, you can query a piece of data through MySQL (select*from<table name>where 1limit 1) and determine whether the table data file is damaged. If the table data file is damaged, end the backup program, trigger the recovery task prompt, wait for the user to log in to the system, and choose whether to restore with one key (see Figure 3).

6、遍历MySQL/data目录文件并确定哪些是MD5有变化的数据文件之后,若存在至少一个需要备份的表数据文件,则复制最新的备份文件夹,以当前时间命名(20220907121212),替换掉文件MD5值有变化的数据文件,并存储至备份库,完成备份。6. After traversing the MySQL/data directory files and determining which data files have changed in MD5, if there is at least one table data file that needs to be backed up, copy the latest backup folder, name it with the current time (20220907121212), and replace the file The data files with changed MD5 values are stored in the backup library to complete the backup.

7、当判断备份文件夹的数量大于7份,则删除最旧的备份,执行完毕,等待下一次定时任务执行。7. When it is judged that the number of backup folders is greater than 7, delete the oldest backup, and wait for the next scheduled task to be executed after the execution is completed.

请参见图3,文件恢复的过程可以通过以下步骤实现:Please refer to Figure 3, the process of file recovery can be realized through the following steps:

1、通过上述流程触发的文件损坏提示,用户发现数据库表数据文件损坏,登录运维平台;1. Through the file damage prompt triggered by the above process, the user finds that the data file of the database table is damaged and logs in to the operation and maintenance platform;

2、查看数据库备份文件夹列表;2. View the list of database backup folders;

3、选择需要恢复的备份文件夹版本;3. Select the backup folder version to be restored;

4、系统用备份文件夹中的表数据文件替换数据库中损坏的表数据文件;4. The system replaces the damaged table data files in the database with the table data files in the backup folder;

5、替换完成,启动备份程序,修复完成。5. After the replacement is completed, start the backup program, and the repair is completed.

可以理解的是,本发明实施例之所以让恢复主动权交给用户,是防止系统误判,导致用户数据丢失。It can be understood that the reason why the embodiment of the present invention gives the recovery initiative to the user is to prevent the system from misjudging and causing loss of user data.

与现有技术相比,本发明实施例具有如下有益效果:Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

1、本发明另辟蹊径,通过MySQL/data下的文件与备份文件夹下对应的文件的文件MD5值对比,判断文件内容是否有修改,优化了文件内容变化对比过程。相比于获取文件增量或者定时全量备份,节约了计算机内存资源、磁盘空间和CPU开销,减少系统无效文件。1. The present invention finds another way to compare the MD5 values of the files under MySQL/data with the corresponding files under the backup folder to judge whether the file content has been modified, and optimize the file content change comparison process. Compared with obtaining file increments or regular full backups, it saves computer memory resources, disk space, and CPU overhead, and reduces system invalid files.

2、同时,系统在定时任务备份过程中,也会通过判断MySQL/data目录下数据库结构文件是否为0kb来确定表结构文件是否损坏,损坏就通过之前备份文件夹下对应的文件进行拷贝,替换损坏的文件,修复由于数据库表结构文件损坏导致的问题,提高系统的运行稳定性和健壮性。2. At the same time, during the scheduled task backup process, the system will also determine whether the table structure file is damaged by judging whether the database structure file in the MySQL/data directory is 0kb. If it is damaged, copy and replace it with the corresponding file in the previous backup folder Damaged files, repair problems caused by corrupted database table structure files, and improve system stability and robustness.

需要说明的是,本发明实施例的特点在于:It should be noted that the embodiments of the present invention are characterized in that:

1、通过与现有技术不同的方式,判断文件是否需要备份。采用文件MD5验证的方式,简化了文件内容变化对比过程,相比于获取文件增量或者定时全量备份,节约了计算机内存资源、磁盘空间和CPU开销,减少系统无效文件。1. Judging whether a file needs to be backed up in a manner different from that of the prior art. The method of file MD5 verification simplifies the process of comparing file content changes. Compared with obtaining file increments or regular full backups, it saves computer memory resources, disk space, and CPU overhead, and reduces system invalid files.

2、同时,系统在定时任务备份过程中,自动化判断MySQL/data目录下数据库表结构文件是否损坏、修复,提高了系统的稳定性和健壮性,减少了系统售后人力开销。2. At the same time, during the backup process of scheduled tasks, the system automatically judges whether the database table structure files under the MySQL/data directory are damaged and repairs them, which improves the stability and robustness of the system and reduces the after-sales labor costs of the system.

需要说明的是,对于以上方法或流程实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明实施例并不受所描述的动作顺序的限制,因为依据本发明实施例,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作并不一定是本发明实施例所必须的。It should be noted that, for the above method or process embodiment, for the sake of simple description, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiment of the present invention is not limited by the described action sequence. Because according to the embodiment of the present invention, some steps may be performed in other order or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

请参见图4,本发明实施例还提供一种数据库文件备份装置,包括:Referring to Fig. 4, the embodiment of the present invention also provides a database file backup device, including:

任务响应模块1,用于响应于定时备份任务指令,遍历查询目标数据库中的所有文件;The task response module 1 is used to traverse all files in the query target database in response to the scheduled backup task instruction;

文件对比模块2,用于将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件;其中,所述目标备份文件夹为备份库中最新的备份文件夹;The file comparison module 2 is used to compare the consistency of each table data file in the target database with the table data files in the target backup folder one by one, and compare the table data files with inconsistent results in the target database. Mark as a file to be backed up; wherein, the target backup folder is the latest backup folder in the backup library;

文件备份模块3,用于对所述目标备份文件夹进行复制得到当前备份文件夹,基于当前系统时间对所述当前备份文件夹进行命名,将标记为待备份文件的所有表数据文件进行复制并对所述当前备份文件夹中对应的表数据文件进行替换,并将所述当前备份文件夹添加至所述备份库中。The file backup module 3 is used to copy the target backup folder to obtain the current backup folder, name the current backup folder based on the current system time, copy all table data files marked as files to be backed up and Replace the corresponding table data file in the current backup folder, and add the current backup folder to the backup library.

进一步地,所述任务响应模块1具体用于:Further, the task response module 1 is specifically used for:

当查询到所述目标数据库的表结构文件时,若判断所述表结构文件发生损坏,则对所述目标备份文件夹中的备份表结构文件进行复制,并对所述目标数据库中的表结构文件进行替换。When the table structure file of the target database is inquired, if it is judged that the table structure file is damaged, the backup table structure file in the target backup folder is copied, and the table structure in the target database is copied. file to replace.

进一步地,所述任务响应模块1具体用于:Further, the task response module 1 is specifically used for:

当查询并判断所述目标数据库中的表数据文件发生损坏时,结束当前备份任务,并启动文件恢复程序。When it is queried and judged that the table data file in the target database is damaged, the current backup task is ended and the file recovery program is started.

进一步地,所述数据库文件备份装置还包括文件夹创建模块,其用于:Further, the database file backup device also includes a folder creation module, which is used for:

当判断所述备份库中不存在备份文件夹时,对所述目标数据库进行全量备份得到第一备份文件夹,并将所述第一备份文件夹添加至所述备份库中。When it is judged that there is no backup folder in the backup repository, a full backup is performed on the target database to obtain a first backup folder, and the first backup folder is added to the backup repository.

进一步地,所述数据库文件备份装置还包括文件删除模块,其用于:Further, the database file backup device also includes a file deletion module, which is used for:

当判断所述备份库中备份文件夹的数量大于预设的阈值时,将所述备份库中最旧的备份文件夹进行删除。When it is judged that the number of backup folders in the backup library is greater than a preset threshold, the oldest backup folder in the backup library is deleted.

进一步地,所述判断所述表结构文件发生损坏的方式包括:Further, the manner of judging that the table structure file is damaged includes:

当判断所述表结构文件的文件大小是否为零时,则确定所述表结构文件发生损坏。When judging whether the file size of the table structure file is zero, it is determined that the table structure file is damaged.

进一步地,所述文件对比模块2具体用于:Further, the file comparison module 2 is specifically used for:

分别计算所述目标数据库中的各个表数据文件以及所述目标备份文件夹中的表数据文件的MD5值;Calculate respectively the MD5 value of each table data file in the target database and the table data file in the target backup folder;

基于各个文件的MD5值,将所述目标数据库中的各个表数据文件与所述目标备份文件夹中的表数据文件一一对应进行一致性对比;Based on the MD5 value of each file, each table data file in the target database is compared with the table data file in the target backup folder in one-to-one correspondence;

当判断所述目标数据库中的目标表数据文件的MD5值与目标备份文件夹中对应的表数据文件的MD5值不一致时,将所述目标表数据文件标记为待备份文件。When judging that the MD5 value of the target table data file in the target database is inconsistent with the MD5 value of the corresponding table data file in the target backup folder, mark the target table data file as a file to be backed up.

可以理解的是上述装置项实施例,是与本发明方法项实施例相对应的,本发明实施例提供的一种数据库文件备份装置,可以实现本发明任意一项方法项实施例提供的数据库文件备份方法。It can be understood that the above device embodiment corresponds to the method embodiment of the present invention, and a database file backup device provided by the embodiment of the present invention can realize the database file provided by any method embodiment of the present invention. backup method.

本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现任一项所述的数据库文件备份方法。The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the database file backup method described in any one is implemented.

需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本发明提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。It should be noted that the device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physically separated. A unit can be located in one place, or it can be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that they have a communication connection, which can be specifically implemented as one or more communication buses or signal lines. It can be understood and implemented by those skilled in the art without creative effort.

所述领域的技术人员可以清楚地了解到,为了方便和简洁,上述描述的装置的具体工作过程,可参考前述方法实施例中对应的过程,在此不再赘述。Those skilled in the art can clearly understand that, for the sake of convenience and brevity, for the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which will not be repeated here.

终端设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器、存储器。The terminal device may be a computing device such as a desktop computer, a notebook, a handheld computer, or a cloud server. The terminal device may include, but not limited to, a processor and a memory.

所称处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器是所述终端设备的控制中心,利用各种接口和线路连接整个终端设备的各个部分。The so-called processor can be a central processing unit (Central Processing Unit, CPU), and can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf Programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and connects various parts of the entire terminal device with various interfaces and lines.

所述存储器可用于存储所述计算机程序,所述处理器通过运行或执行存储在所述存储器内的计算机程序,以及调用存储在存储器内的数据,实现所述终端设备的各种功能。所述存储器可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据手机的使用所创建的数据等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory can be used to store the computer program, and the processor implements 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 program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function, etc.; the data storage area may store data created according to the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, internal memory, plug-in hard disk, smart memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card , a flash memory card (Flash Card), at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices.

所述存储介质为计算机可读存储介质,所述计算机程序存储在所述计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。The storage medium is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be realized. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM, Read-Only Memory) , Random Access Memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, computer-readable media Excludes electrical carrier signals and telecommunication signals.

以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。The above description is a preferred embodiment of the present invention, and it should be pointed out that for those skilled in the art, without departing from the principle of the present invention, some improvements and modifications can also be made, and these improvements and modifications are also considered Be the protection scope of the present invention.

Claims (10)

1.一种数据库文件备份方法,其特征在于,包括:1. A database file backup method, characterized in that, comprising: 响应于定时备份任务指令,遍历查询目标数据库中的所有文件;In response to the scheduled backup task instruction, traverse all files in the query target database; 将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件;其中,所述目标备份文件夹为备份库中最新的备份文件夹;Each table data file in the target database is correspondingly compared with the table data files in the target backup folder one by one, and the table data files with inconsistent comparison results in the target database are marked as files to be backed up; wherein , the target backup folder is the latest backup folder in the backup repository; 对所述目标备份文件夹进行复制得到当前备份文件夹,基于当前系统时间对所述当前备份文件夹进行命名,将标记为待备份文件的所有表数据文件进行复制并对所述当前备份文件夹中对应的表数据文件进行替换,并将所述当前备份文件夹添加至所述备份库中。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 and copying the current backup folder Replace the corresponding table data file in , and add the current backup folder to the backup library. 2.根据权利要求1所述的数据库文件备份方法,其特征在于,所述遍历查询目标数据库中的所有文件,包括:2. The database file backup method according to claim 1, wherein the traversal of all files in the query target database includes: 当查询到所述目标数据库的表结构文件时,若判断所述表结构文件发生损坏,则对所述目标备份文件夹中的备份表结构文件进行复制,并对所述目标数据库中的表结构文件进行替换。When the table structure file of the target database is inquired, if it is judged that the table structure file is damaged, the backup table structure file in the target backup folder is copied, and the table structure in the target database is copied. file to replace. 3.根据权利要求1所述的数据库文件备份方法,其特征在于,所述遍历查询目标数据库中的所有文件,包括:3. The database file backup method according to claim 1, wherein the traversal of all files in the query target database includes: 当查询并判断所述目标数据库中的表数据文件发生损坏时,结束当前备份任务,并启动文件恢复程序。When it is queried and judged that the table data file in the target database is damaged, the current backup task is ended and the file recovery program is started. 4.根据权利要求1所述的数据库文件备份方法,其特征在于,在响应于定时备份任务指令,遍历查询目标数据库中的所有文件之前,还包括:4. The database file backup method according to claim 1, wherein, before responding to the timing backup task instruction, before traversing all files in the query target database, it also includes: 当判断所述备份库中不存在备份文件夹时,对所述目标数据库进行全量备份得到第一备份文件夹,并将所述第一备份文件夹添加至所述备份库中。When it is judged that there is no backup folder in the backup repository, a full backup is performed on the target database to obtain a first backup folder, and the first backup folder is added to the backup repository. 5.根据权利要求1所述的数据库文件备份方法,其特征在于,还包括:5. The database file backup method according to claim 1, further comprising: 当判断所述备份库中备份文件夹的数量大于预设的阈值时,将所述备份库中最旧的备份文件夹进行删除。When it is judged that the number of backup folders in the backup library is greater than a preset threshold, the oldest backup folder in the backup library is deleted. 6.根据权利要求2所述的数据库文件备份方法,其特征在于,所述判断所述表结构文件发生损坏的方式包括:6. The method for backing up database files according to claim 2, wherein the method for judging that the table structure file is damaged comprises: 当判断所述表结构文件的文件大小是否为零时,则确定所述表结构文件发生损坏。When judging whether the file size of the table structure file is zero, it is determined that the table structure file is damaged. 7.根据权利要求1-6任一项所述的数据库文件备份方法,其特征在于,所述将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件,具体包括:7. The database file backup method according to any one of claims 1-6, characterized in that, performing one-to-one correspondence between each table data file in the target database and the table data file in the target backup folder Consistency comparison, and the table data files with inconsistent comparison results in the target database are marked as files to be backed up, specifically including: 分别计算所述目标数据库中的各个表数据文件以及所述目标备份文件夹中的表数据文件的MD5值;Calculate respectively the MD5 value of each table data file in the target database and the table data file in the target backup folder; 基于各个文件的MD5值,将所述目标数据库中的各个表数据文件与所述目标备份文件夹中的表数据文件一一对应进行一致性对比;Based on the MD5 value of each file, each table data file in the target database is compared with the table data file in the target backup folder in one-to-one correspondence; 当判断所述目标数据库中的目标表数据文件的MD5值与目标备份文件夹中对应的表数据文件的MD5值不一致时,将所述目标表数据文件标记为待备份文件。When judging that the MD5 value of the target table data file in the target database is inconsistent with the MD5 value of the corresponding table data file in the target backup folder, mark the target table data file as a file to be backed up. 8.一种数据库文件备份装置,其特征在于,包括:8. A database file backup device, characterized in that, comprising: 任务响应模块,用于响应于定时备份任务指令,遍历查询目标数据库中的所有文件;A task response module, configured to traverse all files in the query target database in response to a scheduled backup task instruction; 文件对比模块,用于将所述目标数据库中的各个表数据文件与目标备份文件夹中的表数据文件一一对应进行一致性对比,并将所述目标数据库中对比结果不一致的表数据文件标记为待备份文件;其中,所述目标备份文件夹为备份库中最新的备份文件夹;A file comparison module, configured to perform a one-to-one consistency comparison between each table data file in the target database and the table data file in the target backup folder, and mark the table data files with inconsistent comparison results in the target database is the file to be backed up; wherein, the target backup folder is the latest backup folder in the backup library; 文件备份模块,用于对所述目标备份文件夹进行复制得到当前备份文件夹,基于当前系统时间对所述当前备份文件夹进行命名,将标记为待备份文件的所有表数据文件进行复制并对所述当前备份文件夹中对应的表数据文件进行替换,并将所述当前备份文件夹添加至所述备份库中。A file backup module, configured to copy the target backup folder to obtain a current backup folder, name the current backup folder based on the current system time, copy all table data files marked as files to be backed up and The corresponding table data file in the current backup folder is replaced, and the current backup folder is added to the backup library. 9.一种终端设备,包括处理器和存储有计算机程序的存储器,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7任一项所述的数据库文件备份方法。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.一种非暂态计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时实现如权利要求1至7任一项所述的数据库文件备份方法。10. A non-transitory computer-readable storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the database file backup method according to any one of claims 1 to 7 is realized.
CN202211527352.3A 2022-11-30 2022-11-30 Database file backup method, device, equipment and storage medium Pending CN115794491A (en)

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)

* Cited by examiner, † Cited by third party
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 网宿科技股份有限公司 A method and device for file backup under a 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, device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
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 网宿科技股份有限公司 A method and device for file backup under a 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, device and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
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
CN109542682B (en) Data backup method, device, equipment and storage medium
US20110218967A1 (en) Partial Block Based Backups
CN114356651A (en) System and method for automated cloud-based full data backup and recovery on mobile devices
US11256434B2 (en) Data de-duplication
CN114528127A (en) Data processing method and device, storage medium and electronic equipment
CN107479881B (en) Synchronization method, storage medium, electronic device and system for difference code
CN109753381B (en) Continuous data protection method based on object storage
CN113672436B (en) Disaster recovery backup method, device, equipment and storage medium
CN101751478A (en) File backup method and system
CN110019063B (en) Method for computing node data disaster recovery playback, terminal device and storage medium
US11593304B2 (en) Browsability of backup files using data storage partitioning
EP4579475A1 (en) Data processing method and apparatus
CN112965939A (en) File merging method, device and equipment
CN109324931B (en) Method for realizing vmware mount recovery in data de-duplication system
CN115729749A (en) Data backup method and system
CN114416665A (en) A method, device and medium for data consistency detection and repair
CN115794491A (en) Database file backup method, device, equipment and storage medium
WO2024255440A1 (en) Virtual machine backup method, computing device and computer storage medium
US11645333B1 (en) Garbage collection integrated with physical file verification
CN117971390A (en) Virtual machine recovery method and server
WO2024113543A1 (en) Data processing method, system, and apparatus, non-volatile readable storage medium, and electronic device
CN118069745A (en) SQL SERVER increment acquisition method, storage medium and equipment based on transaction log
CN114138182B (en) Cross-storage online cloning method, system and device for distributed cloud hard disk
CN113987089A (en) System cascading method, data processing method and device

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