Movatterモバイル変換


[0]ホーム

URL:


CN105446828A - Database backup and recovery method, apparatus and system - Google Patents

Database backup and recovery method, apparatus and system
Download PDF

Info

Publication number
CN105446828A
CN105446828ACN201410523108.9ACN201410523108ACN105446828ACN 105446828 ACN105446828 ACN 105446828ACN 201410523108 ACN201410523108 ACN 201410523108ACN 105446828 ACN105446828 ACN 105446828A
Authority
CN
China
Prior art keywords
database
backup
full backup
data
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201410523108.9A
Other languages
Chinese (zh)
Other versions
CN105446828B (en
Inventor
符玲亭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology 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 Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co LtdfiledCriticalBeijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201410523108.9ApriorityCriticalpatent/CN105446828B/en
Publication of CN105446828ApublicationCriticalpatent/CN105446828A/en
Application grantedgrantedCritical
Publication of CN105446828BpublicationCriticalpatent/CN105446828B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

Translated fromChinese

本发明实施例公开了一种数据库备份、恢复方法、装置及系统,在对待恢复数据库进行恢复时,使用待恢复数据库最近一次全量备份时间的全量备份数据以及待恢复数据库最近一次全量备份时间至恢复目标时间点之间的记录数据,对待恢复数据库进行数据恢复。应用本发明实施例,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。

The embodiment of the present invention discloses a database backup and recovery method, device and system. When restoring the database to be restored, the full backup data of the latest full backup time of the database to be restored and the latest full backup time of the database to be restored are used to restore the database. Record data between the target time points, and perform data recovery on the database to be recovered. By applying the embodiments of the present invention, it is avoided that only the latest full database backup data before the database restoration target time point is used to restore the database when the database is restored. Loss of data between backup time points.

Description

Translated fromChinese
一种数据库备份、恢复方法、装置及系统A database backup and recovery method, device and system

技术领域technical field

本发明涉及计算机信息安全技术领域,特别涉及一种数据库备份、恢复方法、装置及系统。The invention relates to the technical field of computer information security, in particular to a database backup and recovery method, device and system.

背景技术Background technique

随着计算机技术和互联网技术的发展,信息安全的重要性日趋明显。数据库作为信息安全的一个重要内容也被越来越重视。数据库是指长期存储在计算机内有组织、可共享的数据集合。如果没有对数据库进行备份,那么在数据库发生错误时,就不能对数据库进行恢复,从而导致数据库数据的丢失,此时造成的损失是无法弥补的。With the development of computer technology and Internet technology, the importance of information security is becoming more and more obvious. As an important content of information security, database is also paid more and more attention. A database is an organized and shareable collection of data stored in a computer for a long time. If the database is not backed up, then when an error occurs in the database, the database cannot be restored, resulting in the loss of database data, and the loss caused at this time is irreparable.

现有技术中常用的一种数据库备份及恢复方法,是预先设置数据库全量备份时间点,当时间到达预先设置的数据库全量备份时间点时,对数据库进行全量备份,生成数据库全量备份数据,所谓的全量备份是指对整个数据库进行完全的备份。当数据库出现问题时,使用数据库恢复目标时间点之前的最近一次数据库全量备份数据,对数据库进行恢复。A database backup and recovery method commonly used in the prior art is to pre-set the time point of full database backup. Full backup refers to a complete backup of the entire database. When there is a problem with the database, use the latest full database backup data before the database recovery target time point to restore the database.

但是,在数据库出现问题需要对数据库进行恢复时,应用上述的数据库备份及恢复方法,只能将数据库的状态恢复到数据库恢复目标时间点之前的最近一次数据库全量备份时间点的状态,全量备份所花时间较长,资源消耗较大,因此相邻两次全量备份的时间间隔比较长,而且全量备份期间出现数据库恢复需求时,能够获得的最近一次完整的数据库全量备份数据已经时隔很久,往往导致数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点的大量数据无法恢复,因此全量备份的方式有较多缺陷和不安全的因素存在。However, when there is a problem with the database and the database needs to be restored, the above-mentioned database backup and restoration method can only restore the state of the database to the state of the latest full database backup time point before the target time point of database restoration. It takes a long time and consumes a lot of resources, so the time interval between two adjacent full backups is relatively long, and when a database recovery requirement occurs during the full backup, the latest complete database full backup data that can be obtained has been a long time ago, often As a result, a large amount of data from the database recovery target time point to the last database full backup time point before the database recovery target time point cannot be recovered, so the full backup method has many defects and unsafe factors.

发明内容Contents of the invention

本发明实施例的目的在于提供一种数据库备份、恢复方法、装置及系统,以防止在数据库进行恢复时,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。The purpose of the embodiments of the present invention is to provide a method, device and system for database backup and recovery, so as to prevent the database recovery target time point from the latest full database backup time point before the database recovery target time point when the database is restored. loss of data.

为达到上述目的,本发明实施例公开了一种数据库备份方法,包括:In order to achieve the above object, the embodiment of the present invention discloses a database backup method, comprising:

根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;According to the full backup time point of each database in the database group, perform a full backup of each database at its full backup time point;

在对任一数据库相邻两次全量备份时间之间,记录对该数据库的修改,生成记录数据。Between the time of two adjacent full backups of any database, the modification of the database is recorded to generate record data.

较佳的,所述数据库组,包括:Preferably, the database set includes:

在多租户环境下,分别为每位租户配置的一个独立于其他租户存在的数据库的集合。In a multi-tenant environment, each tenant is configured with a collection of databases independent of other tenants.

较佳的,所述数据库组中的各个数据库的全量备份时间点是预先设置的;Preferably, the full backup time point of each database in the database group is preset;

或所述全量备份时间点,是由策略管理单元确定的。Or the full backup time point is determined by the policy management unit.

较佳的,所述策略管理单元确定所述全量备份时间点,包括:Preferably, the policy management unit determines the full backup time point, including:

所述策略管理单元根据预设的数据库组中的各个数据库的全量备份时间间隔,或根据数据库组中的数据库个数,或者每个数据库的存储空间大小,或者数据库的修改频率,确定数据库组中的各个数据库的全量备份时间点。According to the preset full backup time interval of each database in the database group, or according to the number of databases in the database group, or the storage space size of each database, or the modification frequency of the database, the policy management unit determines the The full backup time point of each database.

较佳的,所述策略管理单元确定所述全量备份时间点,包括:Preferably, the policy management unit determines the full backup time point, including:

所述策略管理单元根据所述数据库组中的数据库的备份时间间隔,计算各个备份时间点拟启动全量备份的数据库的个数,如果数据库个数大于预设的阈值,则将数据库存储空间最大的数据库的全量备份时间点开始时间向前或向后移动到第二时间起点。The policy management unit calculates the number of databases to be fully backed up at each backup time point according to the backup time interval of the databases in the database group, and if the number of databases is greater than a preset threshold, the database with the largest storage space The starting time of the full backup time point of the database is moved forward or backward to the second time starting point.

较佳的,所述方法还包括:Preferably, the method also includes:

对所述记录数据进行增量备份。Incremental backup is performed on the recorded data.

较佳的,所述对所述记录数据进行增量备份,包括:Preferably, the incremental backup of the recorded data includes:

对所述记录数据实时进行增量备份;Incremental backup of the recorded data in real time;

or

在预先设置的增量备份时间点,对所述记录数据进行增量备份。Incremental backup is performed on the recorded data at a preset incremental backup time point.

较佳的,所述方法还包括:Preferably, the method also includes:

将当前最后一次全量备份之前的增量备份数据删除。Delete the incremental backup data before the last full backup.

较佳的,所述将当前最后一次全量备份之前的增量备份数据删除,包括:Preferably, the deletion of the incremental backup data before the current last full backup includes:

完成第n次全量备份后,将第n次全量备份与第n-1次全量备份之间的增量备份数据删除,其中,n=2、3、4……。After the n-th full backup is completed, the incremental backup data between the n-th full backup and the n-1 full backup is deleted, where n=2, 3, 4 . . . .

为达到上述目的,本发明实施例公开了一种数据库恢复方法,包括:In order to achieve the above object, the embodiment of the present invention discloses a database recovery method, including:

接收数据库恢复指令,确定待恢复数据库的恢复目标时间点T0,所述数据库恢复指令中包括待恢复数据库的标识;Receiving a database restoration instruction, determining a restoration target time point T0 of the database to be restored, wherein the database restoration instruction includes an identifier of the database to be restored;

获取所述恢复目标时间点T0之前的、待恢复数据库最近一次全量备份时间T1的全量备份数据;Obtain the full backup data of the latest full backup time T1 of the database to be restored before the recovery target time point T0;

根据所述全量备份数据以及T0至T1之间的记录数据,对待恢复数据库进行数据恢复。According to the full backup data and the recorded data between T0 and T1, perform data recovery on the database to be restored.

较佳的,所述根据所述全量备份数据以及T0至T1之间的记录数据,对待恢复数据库进行数据恢复,包括:Preferably, the data restoration of the database to be restored is performed according to the full backup data and the recorded data between T0 and T1, including:

利用待恢复数据库最近一次全量备份时间T1的全量备份数据,将待恢复数据库恢复到T1时刻状态;Use the full backup data of the latest full backup time T1 of the database to be restored to restore the database to be restored to the state at time T1;

利用T0至T1之间的记录数据,将待恢复数据库恢复到T0时刻状态。Use the recorded data between T0 and T1 to restore the database to be restored to the state at T0.

为达到上述目的,本发明实施例公开了一种数据库备份装置,包括:全量备份模块、记录数据生成模块,其中,In order to achieve the above purpose, the embodiment of the present invention discloses a database backup device, including: a full backup module and a record data generation module, wherein,

所述全量备份模块,用于根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;The full backup module is used to perform a full backup of each database at its full backup time point according to the full backup time point of each database in the database group;

所述记录数据生成模块,在对任一数据库相邻两次全量备份时间之间,记录对该数据库的修改,生成记录数据。The record data generation module records the modification of any database between two adjacent full backup times to generate record data.

较佳的,所述数据库组,包括:Preferably, the database set includes:

在多租户环境下,分别为每位租户配置的一个独立于其他租户存在的数据库的集合。In a multi-tenant environment, each tenant is configured with a collection of databases independent of other tenants.

较佳的,所述数据库组中的各个数据库的全量备份时间点是预先设置的;Preferably, the full backup time point of each database in the database group is preset;

或所述全量备份时间点,是由策略管理单元确定的。Or the full backup time point is determined by the policy management unit.

较佳的,所述策略管理单元确定所述全量备份时间点,包括:Preferably, the policy management unit determines the full backup time point, including:

所述策略管理单元根据预设的数据库组中的各个数据库的全量备份时间间隔,或根据数据库组中的数据库个数,或者每个数据库的存储空间大小,或者数据库的修改频率,确定数据库组中的各个数据库的全量备份时间点。According to the preset full backup time interval of each database in the database group, or according to the number of databases in the database group, or the storage space size of each database, or the modification frequency of the database, the policy management unit determines the The full backup time point of each database.

较佳的,所述策略管理单元,确定所述全量备份时间点,包括:Preferably, the policy management unit determines the full backup time point, including:

所述策略管理单元根据所述数据库组中的数据库的备份时间间隔,计算各个备份时间点拟启动全量备份的数据库的个数,如果数据库个数大于预设的阈值,则将数据库存储空间最大的数据库的全量备份时间点开始时间向前或向后移动到第二时间起点。The policy management unit calculates the number of databases to be fully backed up at each backup time point according to the backup time interval of the databases in the database group, and if the number of databases is greater than a preset threshold, the database with the largest storage space The starting time of the full backup time point of the database is moved forward or backward to the second time starting point.

较佳的,所述装置还包括:增量备份模块,其中,Preferably, the device further includes: an incremental backup module, wherein,

所述增量备份模块,用于对所述记录数据进行增量备份。The incremental backup module is used for incrementally backing up the record data.

较佳的,所述增量备份模块,具体用于:Preferably, the incremental backup module is specifically used for:

对所述记录数据实时进行增量备份;Incremental backup of the recorded data in real time;

or

在预先设置的增量备份时间点,对所述记录数据进行增量备份。Incremental backup is performed on the recorded data at a preset incremental backup time point.

较佳的,所述装置还包括:删除模块,其中,Preferably, the device further includes: a deletion module, wherein,

所述删除模块,用于将当前最后一次全量备份之前的增量备份数据删除。The deletion module is used to delete the incremental backup data before the current last full backup.

较佳的,所述删除模块,具体用于:Preferably, the deletion module is specifically used for:

完成第n次全量备份后,将第n次全量备份与第n-1次全量备份之间的增量备份数据删除,其中,n=2、3、4……。After the n-th full backup is completed, the incremental backup data between the n-th full backup and the n-1 full backup is deleted, where n=2, 3, 4 . . . .

为达到上述目的,本发明实施例公开了一种数据库恢复装置,包括:确定模块、全量备份获取模块和恢复模块,其中,In order to achieve the above purpose, the embodiment of the present invention discloses a database recovery device, including: a determination module, a full backup acquisition module and a recovery module, wherein,

所述确定模块,用于接收数据库恢复指令,确定待恢复数据库的恢复目标时间点T0,所述数据库恢复指令中包括待恢复数据库的标识;The determining module is configured to receive a database restoration instruction, and determine a restoration target time point T0 of the database to be restored, where the database restoration instruction includes an identifier of the database to be restored;

所述全量备份获取模块,用于获取所述恢复目标时间点T0之前的、待恢复数据库最近一次全量备份时间T1的全量备份数据;The full backup obtaining module is used to obtain the full backup data of the latest full backup time T1 of the database to be restored before the recovery target time point T0;

所述恢复模块,用于根据所述全量备份数据以及T0至T1之间的记录数据,对待恢复数据库进行数据恢复。The restoration module is configured to restore the data of the database to be restored according to the full backup data and the recorded data between T0 and T1.

较佳的,所述恢复模块,具体用于:Preferably, the recovery module is specifically used for:

利用待恢复数据库最近一次全量备份时间T1的全量备份数据,将待恢复数据库恢复到T1时刻状态;Use the full backup data of the latest full backup time T1 of the database to be restored to restore the database to be restored to the state at time T1;

利用T0至T1之间的记录数据,将待恢复数据库恢复到T0时刻状态。Use the recorded data between T0 and T1 to restore the database to be restored to the state at T0.

为达到上述目的,本发明实施例公开了一种数据库备份恢复系统,包括:上述数据库备份装置的任意一种以及上述数据库恢复装置的任意一种。To achieve the above purpose, the embodiment of the present invention discloses a database backup and recovery system, including: any one of the above-mentioned database backup devices and any one of the above-mentioned database recovery devices.

为达到上述目的,本发明实施例公开了一种数据库备份恢复系统,包括:全量备份模块、记录数据生成模块、确定模块、全量备份获取模块和恢复模块,In order to achieve the above purpose, the embodiment of the present invention discloses a database backup and recovery system, including: a full backup module, a record data generation module, a determination module, a full backup acquisition module and a recovery module,

所述全量备份模块,用于根据数据库的全量备份时间点,对数据库在其每个全量备份时间点进行全量备份;The full backup module is used to perform a full backup of the database at each full backup time point according to the full backup time point of the database;

所述记录数据生成模块,用于在对数据库相邻两次全量备份的时间之间,或者全程记录对该数据库的修改,生成记录数据;The record data generation module is used to generate record data between the time of two adjacent full backups of the database, or record the modification of the database throughout the process;

所述确定模块,用于接收数据库恢复指令,确定待恢复数据库的恢复目标时间点;The determining module is configured to receive a database recovery instruction and determine a recovery target time point of the database to be recovered;

所述全量备份获取模块,用于获取所述恢复目标时间点之前的、待恢复数据库最近一次全量备份时间的全量备份数据;The full backup obtaining module is used to obtain the full backup data of the latest full backup time of the database to be restored before the restoration target time point;

所述恢复模块,用于获取所述全量备份数据以及恢复目标时间点至所述恢复目标时间点之前的、待恢复数据库最近一次全量备份的时间之间的记录数据,根据该记录数据对待恢复数据库进行数据恢复。The recovery module is configured to acquire the full backup data and record data between the recovery target time point and the last full backup time of the database to be recovered before the recovery target time point, and the database to be recovered is based on the record data Perform data recovery.

为达到上述目的,本发明实施例公开了一种数据库备份恢复系统,包括:全量备份模块、记录数据生成模块、确定模块、全量备份获取模块和恢复模块,In order to achieve the above purpose, the embodiment of the present invention discloses a database backup and recovery system, including: a full backup module, a record data generation module, a determination module, a full backup acquisition module and a recovery module,

所述全量备份模块,用于根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;The full backup module is used to perform a full backup of each database at its full backup time point according to the full backup time point of each database in the database group;

所述记录数据生成模块,用于在对任一数据库相邻两次全量备份的时间之间,记录对该数据库的修改,生成记录数据;The record data generation module is used to record the modification of the database between the time of two adjacent full backups of any database, and generate record data;

所述确定模块,用于接收数据库恢复指令,确定待恢复数据库的恢复目标时间点T0,所述数据库恢复指令中包括待恢复数据库的标识;The determining module is configured to receive a database restoration instruction, and determine a restoration target time point T0 of the database to be restored, where the database restoration instruction includes an identifier of the database to be restored;

所述全量备份获取模块,用于获取所述恢复目标时间点T0之前的、待恢复数据库最近一次全量备份时间T1的全量备份数据;The full backup obtaining module is used to obtain the full backup data of the latest full backup time T1 of the database to be restored before the recovery target time point T0;

所述恢复模块,用于根据所述全量备份数据以及T0至T1之间的记录数据,对待恢复数据库进行数据恢复。The restoration module is configured to restore the data of the database to be restored according to the full backup data and the recorded data between T0 and T1.

由上述的技术方案可见,本发明实施例提供了一种数据库备份、恢复方法、装置及系统,根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;在对任一数据库相邻两次全量备份时间之间,记录对该数据库的修改,生成记录数据。在数据库出现问题时,对数据库使用数据库恢复目标时间点之前的最近一次数据库全量备份数据和该次数据库全量备份至数据库恢复目标时间点的记录数据对数据库进行恢复,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。It can be seen from the above technical solution that the embodiment of the present invention provides a method, device and system for database backup and recovery. According to the full backup time point of each database in the database group, each database is respectively backed up at its full backup time point. Full backup; between two adjacent full backups of any database, record the modification of the database and generate record data. When there is a problem with the database, the database is restored using the latest full database backup data before the database recovery target time point and the record data from the database full backup to the database recovery target time point to restore the database, avoiding the need to restore the database when restoring the database. The database is restored using the latest full database backup data before the database recovery target time point, and the data is lost between the database recovery target time point and the latest database full backup time point before the database recovery target time point.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1为本发明实施例提供的一种数据库备份方法的流程示意图;Fig. 1 is a schematic flow chart of a database backup method provided by an embodiment of the present invention;

图2为本发明实施例提供的另一种数据库备份方法的流程示意图;FIG. 2 is a schematic flow diagram of another database backup method provided by an embodiment of the present invention;

图3为本发明实施例提供的再一种数据库备份方法的流程示意图;FIG. 3 is a schematic flow diagram of another database backup method provided by an embodiment of the present invention;

图4为本发明实施例提供的一种数据库恢复方法的流程示意图;FIG. 4 is a schematic flowchart of a method for restoring a database provided by an embodiment of the present invention;

图5为本发明实施例提供的一种数据库备份装置的结构示意图;FIG. 5 is a schematic structural diagram of a database backup device provided by an embodiment of the present invention;

图6为本发明实施例提供的另一种数据库备份装置的结构示意图;FIG. 6 is a schematic structural diagram of another database backup device provided by an embodiment of the present invention;

图7为本发明实施例提供的再一种数据库备份装置的结构示意图;FIG. 7 is a schematic structural diagram of another database backup device provided by an embodiment of the present invention;

图8为本发明实施例提供的一种数据库恢复装置的结构示意图。FIG. 8 is a schematic structural diagram of a database restoration device provided by an embodiment of the present invention.

具体实施方式detailed description

本发明实施例提供了一种数据库备份恢复系统,该系统包括:全量备份模块、记录数据生成模块、确定模块、全量备份获取模块和恢复模块,其中,An embodiment of the present invention provides a database backup and recovery system, the system includes: a full backup module, a record data generation module, a determination module, a full backup acquisition module and a recovery module, wherein,

全量备份模块,用于根据数据库的全量备份时间点,对数据库在其每个全量备份时间点进行全量备份;The full backup module is used to perform a full backup of the database at each full backup time point according to the full backup time point of the database;

记录数据生成模块,用于在对数据库相邻两次全量备份的时间点之间,或者全程记录对该数据库的修改,生成记录数据;The record data generation module is used to generate record data between the time points of two adjacent full backups of the database, or to record the modification of the database throughout the process;

确定模块,用于接收数据库恢复指令,确定待恢复数据库的恢复目标时间点;A determination module, configured to receive a database recovery instruction, and determine a recovery target time point of the database to be recovered;

全量备份获取模块,用于获取所述恢复目标时间点之前的、待恢复数据库最近一次全量备份时间的全量备份数据;A full backup acquisition module, configured to acquire full backup data at the latest full backup time of the database to be restored before the recovery target time point;

恢复模块,用于获取所述全量备份数据以及恢复目标时间点至所述恢复目标时间点之前的、待恢复数据库最近一次全量备份的时间之间的记录数据,根据该记录数据对待恢复数据库进行数据恢复。A recovery module, configured to acquire the full backup data and record data between the recovery target time point and the time of the last full backup of the database to be recovered before the recovery target time point, and perform data processing on the database to be recovered according to the record data recover.

本发明实施例提供了一种数据库备份恢复系统,该系统包括:全量备份模块、记录数据生成模块、确定模块、全量备份获取模块和恢复模块,其中,An embodiment of the present invention provides a database backup and recovery system, the system includes: a full backup module, a record data generation module, a determination module, a full backup acquisition module and a recovery module, wherein,

全量备份模块,用于根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;The full backup module is used to perform a full backup of each database at its full backup time point according to the full backup time point of each database in the database group;

记录数据生成模块,用于在对任一数据库相邻两次全量备份的时间之间,记录对该数据库的修改,生成记录数据;The record data generation module is used to record the modification of the database between the time of two adjacent full backups of any database, and generate record data;

确定模块,用于接收数据库恢复指令,确定待恢复数据库的恢复目标时间点T0,所述数据库恢复指令中包括待恢复数据库的标识;A determining module, configured to receive a database restoration instruction, and determine a restoration target time point T0 of the database to be restored, wherein the database restoration instruction includes an identifier of the database to be restored;

全量备份获取模块,用于获取所述恢复目标时间点T0之前的、待恢复数据库最近一次全量备份时间T1的全量备份数据;A full backup acquisition module, configured to acquire the full backup data of the latest full backup time T1 of the database to be restored before the recovery target time point T0;

恢复模块,用于根据所述全量备份数据以及T0至T1之间的记录数据,对待恢复数据库进行数据恢复。The restoration module is configured to restore the data of the database to be restored according to the full backup data and the recorded data between T0 and T1.

本发明实施例提供了一种数据库备份、恢复方法、装置及系统,其中,The embodiment of the present invention provides a database backup and recovery method, device and system, wherein,

数据库备份方法包括:根据数据库的全量备份时间点,对数据库在其每个全量备份时间点进行全量备份;在对数据库相邻两次全量备份的时间点之间,或者全程记录对该数据库的修改,生成记录数据。The database backup method includes: according to the full backup time point of the database, perform a full backup of the database at each full backup time point; between two adjacent full backup time points of the database, or record the modification of the database throughout the process , generating record data.

数据库恢复方法包括:接收数据库恢复指令,确定待恢复数据库的恢复目标时间点;获取所述恢复目标时间点之前的、待恢复数据库最近一次全量备份时间的全量备份数据;获取所述全量备份数据以及恢复目标时间点至所述恢复目标时间点之前的、待恢复数据库最近一次全量备份的时间之间的记录数据,根据该记录数据对待恢复数据库进行数据恢复。The database recovery method includes: receiving a database recovery instruction, determining a recovery target time point of the database to be recovered; obtaining full backup data of the latest full backup time of the database to be recovered before the recovery target time point; acquiring the full backup data and From the recovery target time point to the time of the last full backup of the database to be recovered before the recovery target time point, data recovery is performed on the database to be recovered according to the recorded data.

本发明实施例提供了一种数据库备份、恢复方法、装置及系统,其中,The embodiment of the present invention provides a database backup and recovery method, device and system, wherein,

数据库备份方法包括:根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;在对任一数据库相邻两次全量备份的时间之间,记录对该数据库的修改,生成记录数据。The database backup method includes: according to the full backup time points of each database in the database group, perform a full backup of each database at its full backup time point; between the time of two adjacent full backups of any database, record Modifications to the database generate record data.

数据库恢复方法包括:接收数据库恢复指令,确定待恢复数据库的恢复目标时间点T0,所述数据库恢复指令中包括待恢复数据库的标识;获取所述恢复目标时间点T0之前的、待恢复数据库最近一次全量备份时间T1的全量备份数据;根据所述全量备份数据以及T0至T1之间的记录数据,对待恢复数据库进行数据恢复。The database recovery method includes: receiving a database recovery instruction, determining a recovery target time point T0 of the database to be recovered, wherein the database recovery command includes an identifier of the database to be recovered; obtaining the latest time point of the recovery database before the recovery target time point T0 The full backup data of the full backup time T1; according to the full backup data and the recorded data between T0 and T1, perform data recovery on the database to be restored.

其中,全量备份是指在对数据库组中的某个数据库进行完全的备份。记录数据可以是事务日志。在实际应用中,对数据库的修改,进行记录可以采用数据库的事务日志,所谓的事务日志是一个与数据库文件分开的文件,它是用来记录数据库的更新情况的文件,它可以记录针对数据库的任何操作,并将记录的结果保存到独立的文件中。Wherein, the full backup refers to a complete backup of a certain database in the database group. The recorded data may be a transaction log. In practical applications, the transaction log of the database can be used to record the modification of the database. The so-called transaction log is a file separate from the database file. It is a file used to record the update of the database. Any operation, and save the recorded results to a separate file.

在数据库出现问题时,对数据库使用数据库恢复目标时间点之前的最近一次数据库全量备份数据和该次数据库全量备份至数据库恢复目标时间点的记录数据对数据库进行恢复,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。When there is a problem with the database, the database is restored using the latest full database backup data before the database recovery target time point and the record data from the database full backup to the database recovery target time point to restore the database, avoiding the need to restore the database when restoring the database. The database is restored using the latest full database backup data before the database recovery target time point, and the data is lost between the database recovery target time point and the latest database full backup time point before the database recovery target time point.

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some of the embodiments of the present invention, not all of them. 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.

下面通过具体实施例,对本发明进行详细说明。The present invention will be described in detail below through specific examples.

图1为本发明实施例提供的一种数据库备份方法的流程示意图,可以包括:Fig. 1 is a schematic flow chart of a database backup method provided by an embodiment of the present invention, which may include:

S101:根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;S101: Perform a full backup of each database at its full backup time point according to the full backup time point of each database in the database group;

其中,数据库组中的各个数据库的全量备份时间点可以为预先设置的。Wherein, the full backup time point of each database in the database group may be preset.

具体地,数据库组为在多租户的环境下,分别为每位租户配置的一个独立于其他租户存在的数据库的集合;Specifically, the database group is a collection of databases configured for each tenant independently of other tenants in a multi-tenant environment;

示例性的,在本发明实施例中,假设数据库组包括:名称为小区物业管理系统的数据库、名称为X超市商品的数据库和名称为Y公司的人力资源管理数据库。Exemplarily, in the embodiment of the present invention, it is assumed that the database group includes: a database named Community Property Management System, a database named X Supermarket Merchandise, and a human resource management database named Y Company.

下面以数据库的名称为小区物业管理系统为例进行说明,In the following, the name of the database is Community Property Management System as an example for illustration.

假设对小区物业管理系统数据库预先设置的全量备份时间点为:每天的0:00、6:00、12:00和18:00,即每天4次全量备份数据库小区物业管理系统,每次全量备份间隔6小时。Assume that the pre-set full backup time points for the community property management system database are: 0:00, 6:00, 12:00 and 18:00 every day, that is, the community property management system is fully backed up 4 times a day, and each full backup 6 hours apart.

该小区物业管理系统数据库中存在7个表,分别为:表1A、表1B、表1C、表1D、表1E、表1F和表1G。There are 7 tables in the property management system database of the community, namely: Table 1A, Table 1B, Table 1C, Table 1D, Table 1E, Table 1F and Table 1G.

其中,表1A中记录物业公司ID号、名称、地址、联系电话和成立时间;Among them, the property company ID number, name, address, contact number and establishment time are recorded in Table 1A;

表1B中记录业主ID号、姓名、入住时间、房间号、楼号和小区ID号;Table 1B records the ID number, name, check-in time, room number, building number and community ID number of the owner;

表1C中记录物业公司员工ID号、姓名、负责的项目、负责小区ID号、家庭住址和联系电话;In Table 1C, record the employee ID number, name, responsible project, responsible community ID number, home address and contact number of the property company employee;

表1D中记录小区ID号、小区名、负责人、建成日期和小区位置;Table 1D records the ID number of the community, the name of the community, the person in charge, the date of completion and the location of the community;

表1E中记录用户ID号、姓名、密码、用户名和权限;Record user ID number, name, password, username and authority in Table 1E;

表1F中记录楼号、小区ID号、层数和建成时间;Table 1F records the building number, community ID number, number of floors and completion time;

表1G中记录房间号、楼号、小区ID号、是否入住和用户ID。Table 1G records the room number, building number, cell ID number, check-in and user ID.

假设某天6:00该小区物业管理系统数据库的状态如下:Assume that the status of the community property management system database at 6:00 on a certain day is as follows:

表1ATable 1A

CidCidCnameCnameCadsCadsCnumCnumCtimeCtime11平安物业Ping An Property北京朝阳Beijing Chaoyang85510000855100002003-10-32003-10-322为您物业for your property北京海淀Beijing Haidian88520101885201012005-12-52005-12-5

表1BTable 1B

YidYidYnameYnameYtimeYtimeRoomRoomLouyuLouyuXidXid11张三Zhang San2006-10-32006-10-3101101111122李四Li Si2006-5-62006-5-62012012222

表1CTable 1C

WidwidWnameWnameXiangmuXiangmuXidXidWadsWadsWnumWnum11王五Wang Wu维修repair11河北邯郸Handan, Hebei159101012231591010122322赵六Zhao Liu安保security22山东淄博Zibo, Shandong1365236598613652365986

表1DTable 1D

XidXidXnameXnameWnameWnameXdateXdateWeizhiWei Zhi11明光小区Mingguang District钱大big money2003-8-82003-8-8北京朝阳Beijing Chaoyang22建设小区Building a community孙大Sun Da2004-5-72004-5-7北京海淀Beijing Haidian

表1ETable 1E

TidTidTnameTnameTpasTpasTnumTnumQuanxianQuanxian11AdminAdminAdminAdminAdminAdminAdminAdmin22UserUserUserUserUserUserGuestguest

表1FTable 1F

LouyuLouyuXidXidLnumLnumDatedate1111332005-5-42005-5-42211332005-5-62005-5-61122332004-6-52004-6-52222332005-8-42005-8-4

表1GTable 1G

RoomRoomLouyuLouyuXidXidYNYNTidTid1011011111YY112012011111NN

3013011111NN1011012211NN2012012211NN3013012211NN1011011122NN2012011122NN3013011122NN1011012222NN2012012222YY223013012222NN

将该状态下的小区物业管理系统数据库进行一次全量备份,生成6:00该小区物业管理系统数据库的全量备份数据。Perform a full backup of the community property management system database in this state to generate the full backup data of the community property management system database at 6:00.

数据库组中的各个数据库的全量备份时间点也可以是:由预先设置一个策略管理单元确定的。The full backup time point of each database in the database group may also be determined by setting a policy management unit in advance.

具体的,预先设置一个策略管理单元,策略管理单元根据预设的数据库组中的各个数据库的全量备份时间间隔,或根据数据库组中的数据库个数,或者每个数据库的存储空间大小,或者数据库的修改频率,确定数据库组中的各个数据库的全量备份时间点。策略管理单元还可以根据所述数据库组中的数据库的备份时间间隔,计算各个备份时间点拟启动全量备份的数据库的个数,如果数据库个数大于预设的阈值,则将数据库存储空间最大的数据库的全量备份时间点开始时间向前或向后移动到第二时间起点。Specifically, a policy management unit is preset, and the policy management unit is based on the full backup time interval of each database in the preset database group, or according to the number of databases in the database group, or the storage space size of each database, or the database Modification frequency, determine the full backup time point of each database in the database group. The policy management unit can also calculate the number of databases to start full backup at each backup time point according to the backup time interval of the databases in the database group, if the number of databases is greater than the preset threshold, the database with the largest storage space The starting time of the full backup time point of the database is moved forward or backward to the second time starting point.

具体的,在多租户环境下,为每位租户配置的一个独立于其他租户存在的数据库。对于至少一个或者多个数据库进行备份时,尽量将不同的数据库的全量备份时间间隔开来,而不是在同一个时间同时进行备份。Specifically, in a multi-tenant environment, each tenant is configured with a database independent of other tenants. When backing up at least one or more databases, try to space out the full backup time of different databases, rather than backing up at the same time at the same time.

具体地,我们可以从创建数据库的时间起,设置为每隔固定的一个时间段对该数据库进行全量备份。由于多租户环境下,为每个租户创建数据库的时间是不固定的,因此各个数据库的全量备份时间点,通常是间隔开的。但是也会出现,某个时间点全量备份的数据库过多给备份服务器带来压力的情况出现,因此设置一个策略管理单元,为整个备份服务器的数据库群的全量备份时间点进行管理,使得每个租户的备份时间点不同,全量备份的时间点得以均衡分配。Specifically, we can set the database to be fully backed up at regular intervals from the time the database is created. Since the time to create a database for each tenant is not fixed in a multi-tenant environment, the full backup time points of each database are usually spaced apart. But it will also happen that too many databases backed up at a certain point in time will bring pressure to the backup server. Therefore, a policy management unit is set up to manage the full backup time point of the database group of the entire backup server, so that each Tenants have different backup time points, and the full backup time points can be evenly distributed.

具体地,策略管理单元确定每个数据库的全量备份时间点为:根据预设的各个数据库的全量备份时间间隔,根据数据库的个数,数据库的修改频率,数据库存储空间的大小等因素确定。Specifically, the policy management unit determines the full backup time point of each database as: according to the preset full backup time interval of each database, according to the number of databases, the modification frequency of the database, the size of the database storage space and other factors.

具体地,各个数据库的全量备份时间间隔,是可以有用户或者本系统进行人工或自动计算设置的。Specifically, the full backup time interval of each database can be manually or automatically calculated and set by the user or the system.

具体地,策略管理单元根据所有的数据库的备份时间间隔计算各个备份时间点有多少个数据库将要启动全量备份,如果数据库个数大于预设的阈值,则将数据库存储空间最大的数据库的全量备份时间点开始时间向前或向后移动到第二时间起点。例如,多租户环境下,一共创建有3个数据库,数据库1的全量备份时间间隔是3小时,存储空间是5G;数据库2的全量备份时间间隔是2小时,存储空间是6G;数据库3的全量备份时间间隔是1小时,存储空间是7G。假设3个数据库的第一时间起点拟分别设置在1点、2点、3点钟的时候进行全量备份,策略管理单元计算得到,在4点钟的时候将要有3个数据库同时开始全量备份,如果预设的阈值是2,3大于预设的阈值2,于是策略管理单元将存储空间为7G的最大数据库3的第一时间起点向后延迟半小时。Specifically, the policy management unit calculates how many databases will start full backup at each backup time point according to the backup time intervals of all databases. If the number of databases is greater than the preset threshold, the full backup time of the database with the largest database storage space The point start time moves forward or backward to the second time start. For example, in a multi-tenant environment, a total of 3 databases are created. The full backup interval of database 1 is 3 hours, and the storage space is 5G; the full backup interval of database 2 is 2 hours, and the storage space is 6G; the full backup of database 3 The backup time interval is 1 hour, and the storage space is 7G. Assuming that the first starting point of the three databases is to be set at 1 o'clock, 2 o'clock, and 3 o'clock for full backup respectively, the policy management unit calculates that at 4 o'clock, three databases will start full backup at the same time. If the preset threshold is 2, and 3 is greater than the preset threshold 2, then the policy management unit delays the first time starting point of the largest database 3 with a storage space of 7G for half an hour.

S102:在对任一数据库相邻两次全量备份时间之间,记录对该数据库的修改,生成记录数据。S102: Between two adjacent full backup times of any database, record modifications to the database, and generate record data.

示例性的,对上述小区物业管理系统数据库进行的修改,可以采用基于数据前后变化的方式进行记录,如表2所示:Exemplarily, the modification to the database of the residential property management system above can be recorded in a manner based on changes in data, as shown in Table 2:

表2Table 2

时间time表名Table Name列名column name行号line number变化前before change变化后after change8:108:10表1BTable 1BRoomRoom111011013013018:108:10表1GTable 1GYNYN11YYNN

8:108:10表1GTable 1GTidTid11118:108:10表1GTable 1GYNYN33NNYY8:108:10表1GTable 1GTidTid33119:209:20表1ATable 1ACidCid33339:209:20表1ATable 1ACnameCname33恒诚物业Hengcheng Property9:209:20表1ATable 1ACadsCads33北京朝阳Beijing Chaoyang9:209:20表1ATable 1ACnumCnum3385514520855145209:209:20表1ATable 1ACtimeCtime332004-5-62004-5-612:2512:25表1CTable 1CWidwid111112:2512:25表1CTable 1CWnameWname11王五Wang Wu12:2512:25表1CTable 1CXiangmuXiangmu11维修repair12:2512:25表1CTable 1CXidXid111112:2512:25表1CTable 1CWadsWads11河北邯郸Handan, Hebei12:2512:25表1CTable 1CWnumWnum111591010122315910101223

对小区物业管理系统数据库进行的修改,还可以采用基于语句的方式进行记录,Modifications to the community property management system database can also be recorded in a statement-based manner,

8:10,update’表1B’setRoom=’301’whereYname=’张三’;8:10, update'table 1B'setRoom='301'whereYname='Zhang San';

update’表1G’setYN=’N’andTid=”whereRoom=’101’ANDLouyu=’1’;update'table 1G'setYN='N'andTid="whereRoom='101'ANDLouyu='1';

update’表1G’setYN=’Y’andTid=’1’whereRoom=’301’ANDLouyu=’1’;update'Table 1G'setYN='Y'andTid='1'whereRoom='301'ANDLouyu='1';

9:20,insertinto’表1A’values(’3’,’恒诚物业’,’北京朝阳’,’85514520’,’2004-5-6’);9:20, insertinto'Table 1A'values('3','Hengcheng Property','Beijing Chaoyang','85514520','2004-5-6');

12:25,deletefrom’表1C’whereWname=’王五’;12:25, deletefrom'Table 1C'whereWname='Wang Wu';

在实际应用中,对数据库的修改,进行记录可以采用数据库的事务日志,所谓的事务日志是一个与数据库文件分开的文件,它是用来记录数据库的更新情况的文件,它可以记录针对数据库的任何操作,并将记录的结果保存到独立的文件中。In practical applications, the transaction log of the database can be used to record the modification of the database. The so-called transaction log is a file separate from the database file. It is a file used to record the update of the database. Any operation, and save the recorded results to a separate file.

需要说明的是,本申请中并不对数据库的修改,进行记录的方式做限定,任何可能的实现方式都可以应用于本申请中。It should be noted that this application does not limit the modification and recording methods of the database, and any possible implementation methods can be applied to this application.

需要说明的是,上述以数据库的名称为小区物业管理系统为例进行说明,仅为一具体实例,并不够成对本申请的限定。It should be noted that the above description using the name of the database as the community property management system as an example is only a specific example and is not enough to limit the application.

应用本发明图1所示实施例,根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;在对任一数据库相邻两次全量备份时间之间,记录对该数据库的修改,生成记录数据。在数据库出现问题时,对数据库使用数据库恢复目标时间点之前的最近一次数据库全量备份数据和该次数据库全量备份至数据库恢复目标时间点的记录数据对数据库进行恢复,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。Apply the embodiment shown in Fig. 1 of the present invention, according to the full amount backup time point of each database in the database group, carry out full amount backup to each database at its full amount backup time point respectively; Between, record the modification of this database, generate record data. When there is a problem with the database, the database is restored using the latest full database backup data before the database recovery target time point and the record data from the database full backup to the database recovery target time point to restore the database, avoiding the need to restore the database when restoring the database. The database is restored using the latest full database backup data before the database recovery target time point, and the data is lost between the database recovery target time point and the latest database full backup time point before the database recovery target time point.

图2为本发明实施例提供的另一种数据库备份方法的流程示意图,本发明图2所示实施例在图1所示实施例的基础上,增加S103:对所述记录数据进行增量备份。Fig. 2 is a schematic flowchart of another database backup method provided by the embodiment of the present invention. The embodiment shown in Fig. 2 of the present invention is based on the embodiment shown in Fig. 1, adding S103: performing incremental backup on the recorded data .

其中,增量备份是指每次只备份上一次备份后修改过的数据,可以对所述记录数据实时进行增量备份。Wherein, the incremental backup means that only the modified data after the last backup is backed up each time, and the recorded data can be incrementally backed up in real time.

考虑到在实际应用中,对记录数据实时进行增量备份,占用系统资源,为了节省系统资源的占用,可以预先设置增量备份时间点,对记录数据在预先设置的增量备份时间点进行增量备份。Considering that in practical applications, incremental backup of recorded data in real time takes up system resources. In order to save system resources, the time point of incremental backup can be set in advance, and the recorded data can be incrementally backed up at the pre-set incremental backup time point. volume backup.

假设预先设置的增量备份时间点为:每天的2:00、4:00、8:00、9:00、10:00、14:00、16:00、20:00和22:00,Assume that the preset incremental backup time points are: 2:00, 4:00, 8:00, 9:00, 10:00, 14:00, 16:00, 20:00 and 22:00 every day,

则对上述小区物业管理系统数据库进行的修改,记录数据进行的增量备份分别为:The modification to the database of the residential property management system above, and the incremental backup of the recorded data are as follows:

在8:00进行第一次增量备份,对小区物业管理系统数据库6:00-8:00的修改,生成的记录数据进行增量备份,Carry out the first incremental backup at 8:00, modify the residential property management system database from 6:00-8:00, and perform incremental backup of the generated record data,

在9:00进行第二次增量备份,对小区物业管理系统数据库8:00-9:00的修改,生成的记录数据进行增量备份,Carry out the second incremental backup at 9:00, modify the residential property management system database from 8:00-9:00, and perform incremental backup of the generated record data,

在10:00进行第三次增量备份,对小区物业管理系统数据库9:00-10:00的修改,生成的记录数据进行增量备份,Carry out the third incremental backup at 10:00, modify the residential property management system database at 9:00-10:00, and perform incremental backup of the generated record data,

在14:00进行第四次增量备份,对小区物业管理系统数据库12:00-14:00的修改,生成的记录数据进行增量备份。Carry out the fourth incremental backup at 14:00, modify the database of the property management system of the community at 12:00-14:00, and perform incremental backup on the generated record data.

需要说明的是,上述以数据库的名称为小区物业管理系统为例进行说明,仅为一具体实例,并不够成对本申请的限定。It should be noted that the above description using the name of the database as the community property management system as an example is only a specific example and is not enough to limit the application.

应用本发明图2所示实施例,在数据库出现问题时,对数据库使用数据库恢复目标时间点之前的最近一次数据库全量备份数据和该次数据库全量备份至数据库恢复目标时间点的记录数据对数据库进行恢复,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。并且对生成的记录数据进行备份,防止了由于记录数据的丢失,造成数据库不能修复的情况的发生。Applying the embodiment shown in Fig. 2 of the present invention, when a problem occurs in the database, the latest full backup data of the database before the database recovery target time point and the record data of the database full backup to the database recovery target time point are used for the database. Restoration avoids restoring the database by only using the latest full database backup data before the database recovery target time point when restoring the database. data loss. In addition, the generated record data is backed up to prevent the occurrence of the situation that the database cannot be repaired due to the loss of the record data.

考虑到在实际应用中,进行增量备份的次数越多,生成的增量备份数据越占用磁盘空间,为了减少磁盘空间的占用,本发明实施例还提供再一种数据库备份方法,参见图3所示,本发明图3所示实施例在图2所示实施例基础上,增加S104:将当前最后一次全量备份之前的增量备份数据删除。Considering that in practical applications, the more incremental backups are performed, the more disk space the generated incremental backup data takes up. In order to reduce the disk space occupation, the embodiment of the present invention also provides another database backup method, as shown in FIG. 3 As shown, the embodiment shown in FIG. 3 of the present invention is based on the embodiment shown in FIG. 2 , adding S104: deleting the incremental backup data before the current last full backup.

具体的,当完成一次全量备份后,在数据库管理员确认该次全量备份成功且该次全量备份时间点的数据库无误的情况下,该次全量备份时间点之前的增量备份数据可以被删除。在实际应用中,可以在完成第n次全量备份后,将第n次全量备份与第n-1次全量备份之间的增量备份数据和/或差量备份数据删除,其中,n=2、3、4……。Specifically, after a full backup is completed, if the database administrator confirms that the full backup is successful and the database at the time point of the full backup is correct, the incremental backup data before the time point of the full backup can be deleted. In practical applications, after the nth full backup is completed, the incremental backup data and/or differential backup data between the nth full backup and the n-1th full backup can be deleted, where n=2 , 3, 4....

应用本发明图3所示实施例,减少了由于多次增量备份,使得生成的增量备份数据对磁盘空间的占用。By applying the embodiment shown in FIG. 3 of the present invention, the disk space occupied by the generated incremental backup data due to multiple incremental backups is reduced.

图4为本发明实施例提供的一种数据库恢复方法的流程示意图,可以包括:Fig. 4 is a schematic flow chart of a database recovery method provided by an embodiment of the present invention, which may include:

S201:接收数据库恢复指令,确定待恢复数据库的恢复目标时间点T0;S201: Receive a database recovery instruction, and determine a recovery target time point T0 of the database to be recovered;

其中,数据库恢复指令中包括待恢复数据库的标识,在实际应用中该标识可为数据库的名称。Wherein, the database restoration instruction includes an identifier of the database to be restored, which may be the name of the database in practical applications.

示例性的,下面以数据库的名称为小区物业管理系统为例进行说明。Exemplarily, the description below takes the name of the database as community property management system as an example.

在本发明实施例中,通常情况下,会将数据库恢复到当前时间,即恢复目标时间点T0指当前时间,例如遇到停电、计算机down机等情况时,需要恢复到当前时间的数据库。In the embodiment of the present invention, under normal circumstances, the database will be restored to the current time, that is, the restoration target time point T0 refers to the current time. For example, in the event of a power outage, computer down, etc., the database at the current time needs to be restored.

在某些情况下,也需要将数据库恢复到当前时间之前的某一时间,本申请也适用于,指定恢复目标时间点T0的情况。例如:当前时间为13:00,数据库管理员对小区物业管理系统进行数据检查发现其数据发生错误,经过分析发现,从10:20分该数据库的数据发生错误,因此需要将该数据库的数据恢复到10:20。In some cases, it is also necessary to restore the database to a certain time before the current time, and this application is also applicable to the situation where the restoration target time point T0 is specified. For example: the current time is 13:00, the database administrator checks the data of the property management system of the community and finds that the data is wrong. After analysis, it is found that the data of the database is wrong from 10:20, so the data of the database needs to be restored By 10:20.

还例如,数据库系统在进行自检时发现某个全量备份数据出现数据错误,那么数据库恢复系统准备修复这一错误时,将根据待恢复数据库的备份时间来确定恢复目标时间点T0。For another example, if the database system finds a data error in a certain full backup data during self-check, then the database recovery system will determine the recovery target time point T0 according to the backup time of the database to be recovered when the database recovery system is preparing to repair the error.

还例如,用户自己对数据库读写操作后反悔,希望将数据库恢复到自己希望的过去某个时间点的状态时,数据库恢复系统获取一个用户告知的待恢复数据库的恢复目标时间点T0。For another example, when the user regrets the read and write operations on the database and wishes to restore the database to the desired state at a certain point in the past, the database restoration system obtains a restoration target time point T0 of the database to be restored notified by the user.

S202:获取所述恢复目标时间点T0之前的、待恢复数据库最近一次全量备份时间T1的全量备份数据;S202: Obtain the full backup data of the latest full backup time T1 of the database to be restored before the recovery target time point T0;

根据S201确定的数据库恢复时间点10:20,首先查找到10:20之前的最近一次数据库全量备份为6:00进行的全量备份。According to the database recovery time point determined in S201 at 10:20, first find that the latest full database backup before 10:20 is the full backup performed at 6:00.

S203:根据所述全量备份数据以及T0至T1之间的记录数据,对待恢复数据库进行数据恢复。S203: Perform data restoration on the database to be restored according to the full backup data and the recorded data between T0 and T1.

其中,记录数据中所记载的信息,是最近一次时间的全量备份数据库完成时间T1,至接收到数据恢复指令时间之间的对数据库进行修改的数据。Wherein, the information recorded in the record data is the data of modifying the database between the latest full backup database completion time T1 and the time when the data recovery instruction is received.

具体的,利用待恢复数据库最近一次全量备份时间T1的全量备份数据,将待恢复数据库恢复到T1时刻状态;Specifically, use the full backup data of the latest full backup time T1 of the database to be restored to restore the database to be restored to the state at time T1;

利用T0至T1之间的记录数据,将待恢复数据库恢复到T0时刻状态。Use the recorded data between T0 and T1 to restore the database to be restored to the state at T0.

首先,利用6:00的全量备份数据将小区物业管理系统数据库恢复到6:00的状态如下:First, use the full backup data at 6:00 to restore the community property management system database to the state at 6:00 as follows:

表1ATable 1A

CidCidCnameCnameCadsCadsCnumCnumCtimeCtime11平安物业Ping An Property北京朝阳Beijing Chaoyang85510000855100002003-10-32003-10-322为您物业for your property北京海淀Beijing Haidian88520101885201012005-12-52005-12-5

表1BTable 1B

YidYidYnameYnameYtimeYtimeRoomRoomLouyuLouyuXidXid11张三Zhang San2006-10-32006-10-3101101111122李四Li Si2006-5-62006-5-62012012222

表1CTable 1C

WidwidWnameWnameXiangmuXiangmuXidXidWadsWadsWnumWnum11王五Wang Wu维修repair11河北邯郸Handan, Hebei159101012231591010122322赵六Zhao Liu安保security22山东淄博Zibo, Shandong1365236598613652365986

表1DTable 1D

XidXidXnameXnameWnameWnameXdateXdateWeizhiWei Zhi11明光小区Mingguang District钱大big money2003-8-82003-8-8北京朝阳Beijing Chaoyang

22建设小区Building a community孙大Sun Da2004-5-72004-5-7北京海淀Beijing Haidian

表1ETable 1E

TidTidTnameTnameTpasTpasTnumTnumQuanxianQuanxian11AdminAdminAdminAdminAdminAdminAdminAdmin22UserUserUserUserUserUserGuestguest

表1FTable 1F

LouyuLouyuXidXidLnumLnumDatedate1111332005-5-42005-5-42211332005-5-62005-5-61122332004-6-52004-6-52222332005-8-42005-8-4

表1GTable 1G

RoomRoomLouyuLouyuXidXidYNYNTidTid1011011111YY112012011111NN3013011111NN1011012211NN2012012211NN3013012211NN

1011011122NN2012011122NN3013011122NN1011012222NN2012012222YY223013012222NN

再利用6:00至10:20之间的记录数据,即:8:10记录的对小区物业管理系统数据库修改的数据、9:20记录的对小区物业管理系统数据库修改的数据。Reuse the recorded data between 6:00 and 10:20, namely: the data modified on the community property management system database recorded at 8:10, and the data modified on the community property management system database recorded at 9:20.

对小区物业管理系统数据库进行数据恢复。Perform data recovery on the community property management system database.

将小区物业管理系统数据库恢复到9:20的状态如下:Restore the community property management system database to the state at 9:20 as follows:

表1ATable 1A

CidCidCnameCnameCadsCadsCnumCnumCtimeCtime11平安物业Ping An Property北京朝阳Beijing Chaoyang85510000855100002003-10-32003-10-322为您物业for your property北京海淀Beijing Haidian88520101885201012005-12-52005-12-533恒诚物业Hengcheng Property北京朝阳Beijing Chaoyang85514520855145202004-5-62004-5-6

表1BTable 1B

YidYidYnameYnameYtimeYtimeRoomRoomLouyuLouyuXidXid11张三Zhang San2006-10-32006-10-3301301111122李四Li Si2006-5-62006-5-62012012222

表1CTable 1C

WidwidWnameWnameXiangmuXiangmuXidXidWadsWadsWnumWnum11王五Wang Wu维修repair11河北邯郸Handan, Hebei159101012231591010122322赵六Zhao Liu安保security22山东淄博Zibo, Shandong1365236598613652365986

表1DTable 1D

XidXidXnameXnameWnameWnameXdateXdateWeizhiWei Zhi11明光小区Mingguang District钱大big money2003-8-82003-8-8北京朝阳Beijing Chaoyang22建设小区Building a community孙大Sun Da2004-5-72004-5-7北京海淀Beijing Haidian

表1ETable 1E

TidTidTnameTnameTpasTpasTnumTnumQuanxianQuanxian11AdminAdminAdminAdminAdminAdminAdminAdmin22UserUserUserUserUserUserGuestguest

表1FTable 1F

LouyuLouyuXidXidLnumLnumDatedate1111332005-5-42005-5-42211332005-5-62005-5-61122332004-6-52004-6-52222332005-8-42005-8-4

表1GTable 1G

RoomRoomLouyuLouyuXidXidYNYNTidTid1011011111NN2012011111NN3013011111YY111011012211NN2012012211NN

3013012211NN1011011122NN2012011122NN3013011122NN1011012222NN2012012222YY223013012222NN

由于在9:20至10:20,没有对小区物业管理系统数据库进行修改,因此10:20小区物业管理系统数据库的状态和9:20小区物业管理系统数据库的状态相同。至此,小区物业管理系统数据库的数据恢复完成。Since there is no modification to the community property management system database from 9:20 to 10:20, the state of the community property management system database at 10:20 is the same as the state of the community property management system database at 9:20. So far, the data recovery of the residential property management system database is completed.

在将数据库恢复到当前时间的情况下,理想状态下,与当前时间T2最接近的T3时间的数据库数据可以与当前时间T2的数据库数据相同,但有可能事务日志备份不及时,导致最终恢复到T3时间的数据库,早于T2时间的数据库数据,与T2时间的数据库有差异。In the case of restoring the database to the current time, ideally, the database data at the T3 time closest to the current time T2 can be the same as the database data at the current time T2, but it is possible that the transaction log backup is not timely, resulting in the final recovery to The database at T3 time, the database data earlier than T2 time, is different from the database at T2 time.

举例1:Example 1:

假设有第一个全量备份完成于T0时间,第二个全量备份时间开始于T1时间,将于T4时间结束,在第二个全量备份数据库尚未备份完成之时,用户在T2时间要求将数据库恢复到T2时间,然而T2时间的事务日志有一条尚未记录进去,为满足用户的需求,本发明的技术方案可以实现恢复到早于T2时间的T3时间的数据库给用户。T2时间收到用户的数据库恢复请求后,查找最近一次时间的全量备份数据库,即T0时间的数据库,查找最近一次记录的事务日志,发现没有T2时间的事务日志,最近一次的是T3时间点的事务日志。根据T0时间到T3时间的事务日志所记载的数据库的数据操作信息,将T0时间的数据库逐步恢复到T3时间点的数据库,即还原获得与T2时间最接近的T3时间数据库。举例1中,时间T0<T1<T3<T2<T4。Assume that the first full backup is completed at time T0, and the second full backup starts at time T1 and will end at time T4. Before the second full backup database is backed up, the user requests to restore the database at time T2 At T2 time, however, one of the transaction logs at T2 time has not been recorded. In order to meet the needs of users, the technical solution of the present invention can restore the database to the user at T3 time earlier than T2 time. After receiving the user's database recovery request at T2, search for the latest full backup database, that is, the database at T0, and search for the last recorded transaction log. It is found that there is no transaction log at T2, and the latest one is at T3. transaction log. According to the data operation information of the database recorded in the transaction log from time T0 to time T3, the database at time T0 is gradually restored to the database at time T3, that is, the database at time T3 closest to time T2 is restored. In Example 1, time T0<T1<T3<T2<T4.

举例2:Example 2:

假设有第一个全量备份完成于T0时间,第二个全量备份时间开始于T1时间,并于T4时间结束,T4时间之后的T2时间时尚未开始第三次全量备份,用户在T2时间要求将数据库恢复到T2时间,然而T2时间的事务日志有一条尚未记录进去,最近一次的事务日志是T3时间的事务日志,为满足用户的需求,本发明的技术方案可以实现恢复到早于T2时间的T3时间的数据库给用户。T2时间收到用户的数据库恢复请求后,查找最近一次时间的全量备份数据库,即T4时间的数据库,查找最近一次记录的事务日志,发现没有T2时间的事务日志,最近一次的是T3时间点的事务日志。根据T4时间到T3时间的事务日志所记载的数据库的数据操作信息,将T4时间的数据库逐步恢复到T3时间点的数据库,即还原获得与T2时间最接近的T3时间数据库。举例2中,时间T0<T1<T4<T3<T2。Assume that the first full backup is completed at time T0, the second full backup starts at time T1 and ends at time T4, and the third full backup has not yet started at time T2 after time T4, the user requests at time T2 to The database is restored to the T2 time, but there is an entry in the transaction log of the T2 time that has not been recorded yet. The latest transaction log is the transaction log of the T3 time. The database of T3 time is given to the user. After receiving the user's database recovery request at T2, search for the latest full backup database, that is, the database at T4, and search for the last recorded transaction log. It is found that there is no transaction log at T2, and the latest one is at T3. transaction log. According to the data operation information of the database recorded in the transaction log from time T4 to time T3, the database at time T4 is gradually restored to the database at time T3, that is, the database at time T3 closest to time T2 is restored. In example 2, time T0<T1<T4<T3<T2.

需要说明的是,上述以数据库的名称为小区物业管理系统为例进行说明,仅为一具体实例,并不够成对本申请的限定。It should be noted that the above description using the name of the database as the community property management system as an example is only a specific example and is not enough to limit the application.

应用本发明图4所示实施例,在数据库出现问题时,对数据库使用数据库恢复目标时间点之前的最近一次数据库全量备份数据和该次数据库全量备份至数据库恢复目标时间点的记录数据对数据库进行恢复,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。Applying the embodiment shown in Fig. 4 of the present invention, when a problem occurs in the database, the latest database full backup data before the database recovery target time point and the record data from the database full backup to the database recovery target time point are used for the database. Restoration avoids restoring the database by only using the latest full database backup data before the database recovery target time point when restoring the database. data loss.

与上述的方法实施例相对应,本发明实施例还提供数据备份装置以及数据恢复装置。Corresponding to the above method embodiments, the embodiments of the present invention further provide a data backup device and a data recovery device.

图5为本发明实施例提供的一种数据库备份装置的结构示意图,可以包括:全量备份模块301和记录数据生成模块302,FIG. 5 is a schematic structural diagram of a database backup device provided by an embodiment of the present invention, which may include: a full backup module 301 and a record data generation module 302,

其中,全量备份模块301,用于根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;其中,Wherein, the full backup module 301 is configured to perform a full backup of each database at its full backup time point according to the full backup time point of each database in the database group; wherein,

数据库组为:在多租户环境下,分别为每位租户配置的一个独立于其他租户存在的数据库的集合。A database group is: in a multi-tenant environment, a collection of databases configured for each tenant that exists independently of other tenants.

数据库组中的各个数据库的全量备份时间点,可以是预先设置的,也可以是通过预先设置的一个策略管理单元确定的,策略管理单元可以根据预设的数据库组中的各个数据库的全量备份时间间隔,或根据数据库组中的数据库个数以及每个数据库的存储空间大小确定的。The full backup time point of each database in the database group can be preset or determined by a preset policy management unit, and the policy management unit can be based on the preset full backup time of each database in the database group interval, or determined according to the number of databases in the database group and the storage space of each database.

具体地,策略管理单元,可以根据预设的数据库组中的各个数据库的全量备份时间间隔,或根据数据库组中的数据库个数,或者每个数据库的存储空间大小,或者数据库的修改频率,确定数据库组中的各个数据库的全量备份时间点。Specifically, the policy management unit may determine according to the preset full backup time interval of each database in the database group, or according to the number of databases in the database group, or the storage space of each database, or the modification frequency of the database. The full backup time point of each database in the database group.

具体地,策略管理单元,还可以根据所述数据库组中的数据库的备份时间间隔,计算各个备份时间点拟启动全量备份的数据库的个数,如果数据库个数大于预设的阈值,则将数据库存储空间最大的数据库的全量备份时间点开始时间向前或向后移动到第二时间起点。Specifically, the policy management unit can also calculate the number of databases to start full backup at each backup time point according to the backup time interval of the databases in the database group, and if the number of databases is greater than the preset threshold, the database The start time of the full backup time point of the database with the largest storage space is moved forward or backward to the second time start point.

记录数据生成模块302,用于在对任一数据库相邻两次全量备份时间之间,记录对该数据库的修改,生成记录数据。The record data generating module 302 is configured to record the modification of any database between two adjacent full backup times to generate record data.

应用本发明图5所示实施例,在根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;在对任一数据库相邻两次全量备份之间,记录对该数据库的修改,生成记录数据。在数据库出现问题时,对数据库使用数据库恢复目标时间点之前的最近一次数据库全量备份数据和该次数据库全量备份至数据库恢复目标时间点的记录数据对数据库进行恢复,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。Apply the embodiment shown in Fig. 5 of the present invention, according to the full amount backup time point of each database in the database group, carry out full amount backup to each database at its full amount backup time point respectively; Between, record the modification of this database, generate record data. When there is a problem with the database, the database is restored using the latest full database backup data before the database recovery target time point and the record data from the database full backup to the database recovery target time point to restore the database, avoiding the need to restore the database when restoring the database. The database is restored using the latest full database backup data before the database recovery target time point, and the data is lost between the database recovery target time point and the latest database full backup time point before the database recovery target time point.

图6为本发明实施例提供的另一种数据库备份装置的结构示意图,本发明图6所示实施例在图5所示实施例的基础上,增加增量备份模块303,其中,FIG. 6 is a schematic structural diagram of another database backup device provided by an embodiment of the present invention. The embodiment shown in FIG. 6 of the present invention adds an incremental backup module 303 on the basis of the embodiment shown in FIG. 5 , wherein,

增量备份模块303,用于对所述记录数据进行增量备份。The incremental backup module 303 is configured to perform incremental backup on the recorded data.

本发明实施例的增量备份模块303,具体可以用于:The incremental backup module 303 of the embodiment of the present invention can specifically be used for:

对所述记录数据实时进行增量备份;Incremental backup of the recorded data in real time;

or

在预先设置的增量备份时间点,对所述记录数据进行增量备份。Incremental backup is performed on the recorded data at a preset incremental backup time point.

应用本发明图6所示实施例,在数据库出现问题时,对数据库使用数据库恢复目标时间点之前的最近一次数据库全量备份数据和该次数据库全量备份至数据库恢复目标时间点的记录数据对数据库进行恢复,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。并且对生成的记录数据进行备份,防止了由于记录数据的丢失,造成数据库不能修复的情况的发生。Applying the embodiment shown in Fig. 6 of the present invention, when a problem occurs in the database, the latest database full backup data before the database recovery target time point and the record data from the database full backup to the database recovery target time point are used for the database. Restoration avoids restoring the database by only using the latest full database backup data before the database recovery target time point when restoring the database. data loss. In addition, the generated record data is backed up to prevent the occurrence of the situation that the database cannot be repaired due to the loss of the record data.

图7为本发明实施例提供的再一种数据库备份装置的结构示意图,本发明图7所示实施例在图6所示实施例的基础上,增加删除模块304,其中,Fig. 7 is a schematic structural diagram of another database backup device provided by an embodiment of the present invention. The embodiment shown in Fig. 7 of the present invention is based on the embodiment shown in Fig. 6, and a deletion module 304 is added, wherein,

删除模块304,用于将当前最后一次全量备份之前的增量备份数据删除。The deletion module 304 is configured to delete the incremental backup data before the current last full backup.

本发明实施例的删除模块304,具体可以用于:The deletion module 304 of the embodiment of the present invention can specifically be used for:

完成第n次全量备份后,将第n次全量备份与第n-1次全量备份之间的增量备份数据删除,其中,n=2、3、4……。After the n-th full backup is completed, the incremental backup data between the n-th full backup and the n-1 full backup is deleted, where n=2, 3, 4 . . . .

应用本发明图7所示实施例,减少了由于多次增量备份,使得生成的增量备份数据对磁盘空间的占用。By applying the embodiment shown in FIG. 7 of the present invention, the disk space occupied by the generated incremental backup data due to multiple incremental backups is reduced.

图8为本发明实施例提供的一种数据库恢复装置的结构示意图,可以包括:确定模块401、全量备份获取模块402和恢复模块403,其中,Fig. 8 is a schematic structural diagram of a database recovery device provided by an embodiment of the present invention, which may include: a determination module 401, a full backup acquisition module 402, and a recovery module 403, wherein,

确定模块401,用于接收数据库恢复指令,确定待恢复数据库的恢复目标时间点T0,所述数据库恢复指令中包括待恢复数据库的标识;The determining module 401 is configured to receive a database restoration instruction, and determine a restoration target time point T0 of the database to be restored, wherein the database restoration instruction includes an identifier of the database to be restored;

全量备份获取模块402,用于获取所述恢复目标时间点T0之前的、待恢复数据库最近一次全量备份时间T1的全量备份数据;A full backup acquisition module 402, configured to acquire the full backup data of the latest full backup time T1 of the database to be restored before the recovery target time point T0;

恢复模块403,用于根据所述全量备份数据以及T0至T1之间的记录数据,对待恢复数据库进行数据恢复。The restoration module 403 is configured to restore the data of the database to be restored according to the full backup data and the recorded data between T0 and T1.

本发明实施例的恢复模块403,具体可以用于:The recovery module 403 of the embodiment of the present invention can specifically be used for:

利用待恢复数据库最近一次全量备份时间T1的全量备份数据,将待恢复数据库恢复到T1时刻状态;Use the full backup data of the latest full backup time T1 of the database to be restored to restore the database to be restored to the state at time T1;

利用T0至T1之间的记录数据,将待恢复数据库恢复到T0时刻状态。Use the recorded data between T0 and T1 to restore the database to be restored to the state at T0.

应用本发明图8所示实施例,在数据库出现问题时,对数据库使用数据库恢复目标时间点之前的最近一次数据库全量备份数据和该次数据库全量备份至数据库恢复目标时间点的记录数据对数据库进行恢复,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。Applying the embodiment shown in Fig. 8 of the present invention, when a problem occurs in the database, the latest database full backup data before the database recovery target time point and the record data of the database full backup to the database recovery target time point are used for the database. Restoration avoids restoring the database by only using the latest full database backup data before the database recovery target time point when restoring the database. data loss.

本发明实施例还提供一种数据库备份恢复系统,包括上述数据库备份装置的任意一种以及上述数据库恢复装置的任意一种。An embodiment of the present invention also provides a database backup and recovery system, including any one of the above-mentioned database backup devices and any one of the above-mentioned database recovery devices.

本发明实施例还提供一种数据库备份恢复系统,包括:全量备份模块、记录数据生成模块、确定模块、全量备份获取模块和恢复模块,其中,The embodiment of the present invention also provides a database backup and recovery system, including: a full backup module, a record data generation module, a determination module, a full backup acquisition module, and a recovery module, wherein,

所述全量备份模块,用于根据数据库的全量备份时间点,对数据库在其每个全量备份时间点进行全量备份;The full backup module is used to perform a full backup of the database at each full backup time point according to the full backup time point of the database;

所述记录数据生成模块,用于在对数据库相邻两次全量备份的时间之间,或者全程记录对该数据库的修改,生成记录数据;The record data generation module is used to generate record data between the time of two adjacent full backups of the database, or record the modification of the database throughout the process;

所述确定模块,用于接收数据库恢复指令,确定待恢复数据库的恢复目标时间点;The determining module is configured to receive a database recovery instruction and determine a recovery target time point of the database to be recovered;

所述全量备份获取模块,用于获取所述恢复目标时间点之前的、待恢复数据库最近一次全量备份时间的全量备份数据;The full backup obtaining module is used to obtain the full backup data of the latest full backup time of the database to be restored before the restoration target time point;

所述恢复模块,用于获取所述全量备份数据以及恢复目标时间点至所述恢复目标时间点之前的、待恢复数据库最近一次全量备份的时间之间的记录数据,根据该记录数据对待恢复数据库进行数据恢复。The recovery module is configured to acquire the full backup data and record data between the recovery target time point and the last full backup time of the database to be recovered before the recovery target time point, and the database to be recovered is based on the record data Perform data recovery.

本发明实施例还提供一种数据库备份恢复系统,包括:全量备份模块、记录数据生成模块、确定模块、全量备份获取模块和恢复模块,其中,The embodiment of the present invention also provides a database backup and recovery system, including: a full backup module, a record data generation module, a determination module, a full backup acquisition module, and a recovery module, wherein,

所述全量备份模块,用于根据数据库组中的各个数据库的全量备份时间点,分别对每个数据库在其全量备份时间点进行全量备份;The full backup module is used to perform a full backup of each database at its full backup time point according to the full backup time point of each database in the database group;

所述记录数据生成模块,用于在对任一数据库相邻两次全量备份的时间之间,记录对该数据库的修改,生成记录数据;The record data generation module is used to record the modification of the database between the time of two adjacent full backups of any database, and generate record data;

所述确定模块,用于接收数据库恢复指令,确定待恢复数据库的恢复目标时间点T0,所述数据库恢复指令中包括待恢复数据库的标识;The determining module is configured to receive a database restoration instruction, and determine a restoration target time point T0 of the database to be restored, where the database restoration instruction includes an identifier of the database to be restored;

所述全量备份获取模块,用于获取所述恢复目标时间点T0之前的、待恢复数据库最近一次全量备份时间T1的全量备份数据;The full backup obtaining module is used to obtain the full backup data of the latest full backup time T1 of the database to be restored before the recovery target time point T0;

所述恢复模块,用于根据所述全量备份数据以及T0至T1之间的记录数据,对待恢复数据库进行数据恢复。The restoration module is configured to restore the data of the database to be restored according to the full backup data and the recorded data between T0 and T1.

应用本发明实施例提供的数据库备份恢复系统,避免了在数据库恢复时,只使用数据库恢复目标时间点之前的最近一次数据库全量备份数据对数据库进行恢复,数据库恢复目标时间点至数据库恢复目标时间点之前的最近一次数据库全量备份时间点之间数据的丢失。Applying the database backup recovery system provided by the embodiment of the present invention avoids restoring the database by using only the latest full database backup data before the database recovery target time point when the database is restored, from the database recovery target time point to the database recovery target time point Data loss between the time point of the most recent full database backup.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or order between them. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, as for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for relevant parts, please refer to part of the description of the method embodiment.

本领域普通技术人员可以理解实现上述方法实施方式中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于计算机可读取存储介质中,这里所称得的存储介质,如:ROM/RAM、磁碟、光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the implementation of the above method can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, referred to herein as Storage media, such as: ROM/RAM, disk, CD, etc.

以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present invention are included in the protection scope of the present invention.

Claims (25)

CN201410523108.9A2014-09-302014-09-30A kind of DB Backup, restoration methods, apparatus and systemActiveCN105446828B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201410523108.9ACN105446828B (en)2014-09-302014-09-30A kind of DB Backup, restoration methods, apparatus and system

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201410523108.9ACN105446828B (en)2014-09-302014-09-30A kind of DB Backup, restoration methods, apparatus and system

Publications (2)

Publication NumberPublication Date
CN105446828Atrue CN105446828A (en)2016-03-30
CN105446828B CN105446828B (en)2019-05-31

Family

ID=55557061

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201410523108.9AActiveCN105446828B (en)2014-09-302014-09-30A kind of DB Backup, restoration methods, apparatus and system

Country Status (1)

CountryLink
CN (1)CN105446828B (en)

Cited By (37)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN105955845A (en)*2016-04-262016-09-21浪潮电子信息产业股份有限公司Data recovery method and device
CN106201780A (en)*2016-07-082016-12-07浪潮通用软件有限公司Historical data reduction method
CN106648980A (en)*2016-12-122017-05-10北京雷石天地电子技术有限公司Backup and recovery method and backup and recovery device for high-availability server databases in offline places
CN106776120A (en)*2016-11-242017-05-31珠海市魅族科技有限公司The method and device of data recovery
CN107229540A (en)*2017-06-062017-10-03贵州易鲸捷信息技术有限公司A kind of database restoring method and system based on time point
WO2017215432A1 (en)*2016-06-152017-12-21腾讯科技(深圳)有限公司Data retracement method, device and system
CN107515801A (en)*2017-09-132017-12-26绿金在线电子商务有限公司A kind of data self-repairing method based on relevant database
CN108156264A (en)*2018-03-062018-06-12爱普(福建)科技有限公司A kind of method of data synchronization towards dual-computer redundancy
CN108241555A (en)*2016-12-262018-07-03阿里巴巴集团控股有限公司A kind of backup of distributed data base, restoration methods, device and server
CN108511035A (en)*2017-02-232018-09-07仁智(苏州)医学研究有限公司A kind of data managing method and device of hospital information system
CN109101369A (en)*2018-08-212018-12-28郑州云海信息技术有限公司A kind of sustainable protection method, system and device of business host data
CN109408283A (en)*2018-09-042019-03-01深圳市宝德计算机系统有限公司A kind of method of server data protection, equipment and storage medium
CN110263095A (en)*2019-05-312019-09-20众安在线财产保险股份有限公司Backup and recovery method, apparatus, computer equipment and storage medium
CN110673985A (en)*2019-09-202020-01-10深圳创维-Rgb电子有限公司Method for automatically backing up version library, storage medium and server
CN110784499A (en)*2018-07-302020-02-11华为技术有限公司 Method and terminal device for backing up data
CN110941509A (en)*2019-11-082020-03-31北京浪潮数据技术有限公司Database backup method, device, equipment and storage medium of cloud platform
CN111176889A (en)*2019-12-112020-05-19天翼电子商务有限公司 Automatic backup and recovery device and method
CN111209267A (en)*2019-12-232020-05-29中国建设银行股份有限公司Information providing method, system, device and storage medium
CN111611108A (en)*2020-05-212020-09-01云和恩墨(北京)信息技术有限公司Method and device for restoring virtual database
US11320978B2 (en)2018-12-202022-05-03Nutanix, Inc.User interface for database management services
USD956776S1 (en)2018-12-142022-07-05Nutanix, Inc.Display screen or portion thereof with a user interface for a database time-machine
CN115048336A (en)*2021-03-082022-09-13北京金山云网络技术有限公司Disaster recovery method and device for table data, storage server and storage medium
CN115480958A (en)*2022-10-132022-12-16上海英方软件股份有限公司Automatic adaptive archiving method and system in recovery after regular file backup to tape
US11604762B2 (en)2018-12-272023-03-14Nutanix, Inc.System and method for provisioning databases in a hyperconverged infrastructure system
US11604705B2 (en)2020-08-142023-03-14Nutanix, Inc.System and method for cloning as SQL server AG databases in a hyperconverged system
US11604806B2 (en)2020-12-282023-03-14Nutanix, Inc.System and method for highly available database service
US11640340B2 (en)2020-10-202023-05-02Nutanix, Inc.System and method for backing up highly available source databases in a hyperconverged system
US11803368B2 (en)2021-10-012023-10-31Nutanix, Inc.Network learning to control delivery of updates
US11816066B2 (en)2018-12-272023-11-14Nutanix, Inc.System and method for protecting databases in a hyperconverged infrastructure system
US11892918B2 (en)2021-03-222024-02-06Nutanix, Inc.System and method for availability group database patching
WO2024027314A1 (en)*2022-07-302024-02-08超聚变数字技术有限公司Backup data recovery method and computing device
US11907167B2 (en)2020-08-282024-02-20Nutanix, Inc.Multi-cluster database management services
US12105683B2 (en)2021-10-212024-10-01Nutanix, Inc.System and method for creating template for database services
US12164541B2 (en)2020-08-282024-12-10Nutanix, Inc.Multi-cluster database management system
US12174856B2 (en)2021-10-252024-12-24Nutanix, Inc.Database group management
CN119847822A (en)*2024-12-312025-04-18北京深盾科技股份有限公司Method for recovering file, method for backing up file, storage device, processing device and storage medium
US12306819B2 (en)2022-06-222025-05-20Nutanix, Inc.Database as a service on cloud

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1659522A (en)*2002-04-192005-08-24电脑联合想象公司 Disaster recovery method and system
CN101067818A (en)*2007-06-062007-11-07中国工商银行股份有限公司Data incremental backup and recovery method applied to data bank
US8260750B1 (en)*2009-03-162012-09-04Quest Software, Inc.Intelligent backup escalation system
CN103118011A (en)*2013-01-122013-05-22合肥华云通信技术有限公司Method for protecting customer data in multi-tenant environment
CN103885855A (en)*2012-12-202014-06-25航天信息股份有限公司Data backup and recovery method and data backup and recovery device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN1659522A (en)*2002-04-192005-08-24电脑联合想象公司 Disaster recovery method and system
CN101067818A (en)*2007-06-062007-11-07中国工商银行股份有限公司Data incremental backup and recovery method applied to data bank
US8260750B1 (en)*2009-03-162012-09-04Quest Software, Inc.Intelligent backup escalation system
CN103885855A (en)*2012-12-202014-06-25航天信息股份有限公司Data backup and recovery method and data backup and recovery device
CN103118011A (en)*2013-01-122013-05-22合肥华云通信技术有限公司Method for protecting customer data in multi-tenant environment

Cited By (50)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN105955845A (en)*2016-04-262016-09-21浪潮电子信息产业股份有限公司Data recovery method and device
WO2017215432A1 (en)*2016-06-152017-12-21腾讯科技(深圳)有限公司Data retracement method, device and system
US10956374B2 (en)2016-06-152021-03-23Tencent Technology (Shenzhen) Company LimitedData recovery method, apparatus, and system
CN106201780A (en)*2016-07-082016-12-07浪潮通用软件有限公司Historical data reduction method
CN106776120A (en)*2016-11-242017-05-31珠海市魅族科技有限公司The method and device of data recovery
CN106648980A (en)*2016-12-122017-05-10北京雷石天地电子技术有限公司Backup and recovery method and backup and recovery device for high-availability server databases in offline places
CN108241555B (en)*2016-12-262022-03-01阿里巴巴集团控股有限公司Backup and recovery method and device of distributed database and server
CN108241555A (en)*2016-12-262018-07-03阿里巴巴集团控股有限公司A kind of backup of distributed data base, restoration methods, device and server
CN108511035A (en)*2017-02-232018-09-07仁智(苏州)医学研究有限公司A kind of data managing method and device of hospital information system
CN107229540A (en)*2017-06-062017-10-03贵州易鲸捷信息技术有限公司A kind of database restoring method and system based on time point
CN107515801A (en)*2017-09-132017-12-26绿金在线电子商务有限公司A kind of data self-repairing method based on relevant database
CN108156264B (en)*2018-03-062021-01-26爱普(福建)科技有限公司Data synchronization method oriented to dual-computer redundancy
CN108156264A (en)*2018-03-062018-06-12爱普(福建)科技有限公司A kind of method of data synchronization towards dual-computer redundancy
CN110784499A (en)*2018-07-302020-02-11华为技术有限公司 Method and terminal device for backing up data
CN110784499B (en)*2018-07-302021-08-20华为技术有限公司 Method and terminal device for backing up data
CN109101369A (en)*2018-08-212018-12-28郑州云海信息技术有限公司A kind of sustainable protection method, system and device of business host data
CN109408283A (en)*2018-09-042019-03-01深圳市宝德计算机系统有限公司A kind of method of server data protection, equipment and storage medium
USD956776S1 (en)2018-12-142022-07-05Nutanix, Inc.Display screen or portion thereof with a user interface for a database time-machine
US11907517B2 (en)2018-12-202024-02-20Nutanix, Inc.User interface for database management services
US11320978B2 (en)2018-12-202022-05-03Nutanix, Inc.User interface for database management services
US11860818B2 (en)2018-12-272024-01-02Nutanix, Inc.System and method for provisioning databases in a hyperconverged infrastructure system
US11816066B2 (en)2018-12-272023-11-14Nutanix, Inc.System and method for protecting databases in a hyperconverged infrastructure system
US11604762B2 (en)2018-12-272023-03-14Nutanix, Inc.System and method for provisioning databases in a hyperconverged infrastructure system
US12026124B2 (en)2018-12-272024-07-02Nutanix, Inc.System and method for provisioning databases in a hyperconverged infrastructure system
CN110263095A (en)*2019-05-312019-09-20众安在线财产保险股份有限公司Backup and recovery method, apparatus, computer equipment and storage medium
CN110263095B (en)*2019-05-312021-10-01众安在线财产保险股份有限公司Data backup and recovery method and device, computer equipment and storage medium
CN110673985A (en)*2019-09-202020-01-10深圳创维-Rgb电子有限公司Method for automatically backing up version library, storage medium and server
CN110673985B (en)*2019-09-202023-12-26深圳创维-Rgb电子有限公司Method for automatically backing up version library, storage medium and server
CN110941509A (en)*2019-11-082020-03-31北京浪潮数据技术有限公司Database backup method, device, equipment and storage medium of cloud platform
CN111176889A (en)*2019-12-112020-05-19天翼电子商务有限公司 Automatic backup and recovery device and method
CN111209267A (en)*2019-12-232020-05-29中国建设银行股份有限公司Information providing method, system, device and storage medium
CN111209267B (en)*2019-12-232024-01-30中国建设银行股份有限公司Information providing method, system, device and storage medium
CN111611108A (en)*2020-05-212020-09-01云和恩墨(北京)信息技术有限公司Method and device for restoring virtual database
US11604705B2 (en)2020-08-142023-03-14Nutanix, Inc.System and method for cloning as SQL server AG databases in a hyperconverged system
US12019523B2 (en)2020-08-142024-06-25Nutanix, Inc.System and method for cloning as SQL server AG databases in a hyperconverged system
US12164541B2 (en)2020-08-282024-12-10Nutanix, Inc.Multi-cluster database management system
US11907167B2 (en)2020-08-282024-02-20Nutanix, Inc.Multi-cluster database management services
US11640340B2 (en)2020-10-202023-05-02Nutanix, Inc.System and method for backing up highly available source databases in a hyperconverged system
US12153499B2 (en)2020-10-202024-11-26Nutanix, Inc.System and method for backing up highly available source databases in a hyperconverged system
US11995100B2 (en)2020-12-282024-05-28Nutanix, Inc.System and method for highly available database service
US11604806B2 (en)2020-12-282023-03-14Nutanix, Inc.System and method for highly available database service
CN115048336A (en)*2021-03-082022-09-13北京金山云网络技术有限公司Disaster recovery method and device for table data, storage server and storage medium
US11892918B2 (en)2021-03-222024-02-06Nutanix, Inc.System and method for availability group database patching
US11803368B2 (en)2021-10-012023-10-31Nutanix, Inc.Network learning to control delivery of updates
US12105683B2 (en)2021-10-212024-10-01Nutanix, Inc.System and method for creating template for database services
US12174856B2 (en)2021-10-252024-12-24Nutanix, Inc.Database group management
US12306819B2 (en)2022-06-222025-05-20Nutanix, Inc.Database as a service on cloud
WO2024027314A1 (en)*2022-07-302024-02-08超聚变数字技术有限公司Backup data recovery method and computing device
CN115480958A (en)*2022-10-132022-12-16上海英方软件股份有限公司Automatic adaptive archiving method and system in recovery after regular file backup to tape
CN119847822A (en)*2024-12-312025-04-18北京深盾科技股份有限公司Method for recovering file, method for backing up file, storage device, processing device and storage medium

Also Published As

Publication numberPublication date
CN105446828B (en)2019-05-31

Similar Documents

PublicationPublication DateTitle
CN105446828B (en)A kind of DB Backup, restoration methods, apparatus and system
CN106407356B (en)Data backup method and device
JP5646639B2 (en) Backup using metadata virtual hard drive and differential virtual hard drive
JP6219305B2 (en) System and method for restoring application data
US8260747B2 (en)System, method, and computer program product for allowing access to backup data
CN105989059B (en)Data record checking method and device
US20170060699A1 (en)Methods and systems for restoring data containers in a storage system
US10146633B2 (en)Data recovery from multiple data backup technologies
CN105550062B (en)The data reflow method restored based on continuous data protection and time point browsing
CN112286728A (en)Data backup method, device, equipment and computer storage medium
CN106537353B (en) A data replication method, device and system
TW201640346A (en)Data backup method and apparatus
CN105468475A (en)Backup method and backup device of database
CN103970834A (en)Recovery method for incremental data synchronization fault in isomerous database synchronizing system
CN110673978A (en) A data recovery method and related device after a power failure of a dual-control cluster
US10409691B1 (en)Linking backup files based on data partitions
CN105593829A (en)Excluding file system objects from raw image backups
CN102799503B (en)Recover method applied to large quantity of small files
US20130262393A1 (en)Database backup without particularly specifying server
CN107729541A (en)A kind of data processing method, device and computer-readable recording medium
CN106155838A (en)A kind of database back-up data restoration methods and device
US20160026536A1 (en)Recovery path selection during database restore
US9557932B1 (en)Method and system for discovering snapshot information based on storage arrays
CN104391760A (en)Data backup method, server and system
CN117909020A (en) Backup and recovery method of business cluster instance and related equipment

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp