Specified library table backup and recovery method and device, computer equipment and storage medium

By determining the specified library table in a distributed database, recording and playing back transaction statements, the problem of inefficient backup and recovery in the existing technology is solved, and fast and efficient backup and recovery of specified library tables is achieved.

CN119902930APending Publication Date: 2025-04-29JINZHUAN INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411987156.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

The prior art takes a long time and is inefficient when backing up and restoring in distributed databases. Especially when the data volume is huge, it is difficult to achieve rapid recovery, affecting business continuity and bringing data risks.

Method used

By determining the specified library tables that need to be backed up in a distributed database, recording their data files and transaction statements, generating backup files, and playing back transaction statements based on the backup file to restore the specified library table.

Benefits of technology

It effectively improves the backup and recovery efficiency of designated library tables in distributed databases, reduces the amount and time of data processing during backup and recovery, optimizes resource usage, and meets the needs of rapid data recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119902930A_ABST
    Figure CN119902930A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and discloses a specified library table backup and recovery method and device, computer equipment and a storage medium, which are applied to a distributed database, and the method comprises the following steps: determining a specified library table needing to be backed up in the distributed database; recording a data file of the specified library table and a transaction statement executed on the specified library table in a backup period to obtain a backup file of the specified library table; based on the backup file, sequentially replaying the transaction statements on the data file so as to restore the specified library table to a target position; therefore, the backup and recovery efficiency of the specified database table in the distributed database can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method, device, computer equipment and computer-readable storage medium for backing up and restoring a designated library table. Background Art

[0002] At present, databases, as a core component of modern information technology infrastructure, play a vital role in enterprise data management and business operations. In order to ensure data security and business continuity, database backup and recovery technology has emerged. Database backup refers to creating a copy of the database to deal with unavailable status caused by data loss or damage. Database recovery is to restore the database to its previous normal state based on the previous backup copy.

[0003] Currently, in existing technologies, the backup methods supported by distributed databases usually require backing up the entire database instance. This means that during the backup process, the system will scan the information of all database tables and save the corresponding data files to the specified path. However, backing up the entire database instance and restoring it with the backup is time-consuming and inefficient, especially when the amount of data is huge. In a production environment, a distributed database may cause serious data loss due to misoperation, such as deleting a database or table. The existing backup and recovery mode is difficult to achieve rapid recovery in this case, which not only affects business continuity, but also brings huge data risks to the enterprise.

[0004] In summary, how to provide a specified library table backup and recovery method, device, computer equipment and computer-readable storage medium to effectively improve the backup and recovery efficiency of specified library tables in distributed databases is a problem that needs to be urgently solved by technical personnel in this field. Summary of the invention

[0005] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a method, device, computer equipment and computer-readable storage medium for backing up and restoring specified library tables, aiming to solve the problem of how to effectively improve the backup and recovery efficiency of specified library tables in a distributed database.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a method for backing up and restoring a specified database table, which is applied to a distributed database, wherein the method comprises:

[0008] Determine the designated library table that needs to be backed up in the distributed database;

[0009] Recording the data file of the designated library table and the transaction statements executed on the designated library table during the backup period, and obtaining the backup file of the designated library table;

[0010] Based on the backup file, the transaction statements are played back to the data file in sequence to restore the designated library table to the target location.

[0011] In a second aspect, the present invention provides a designated library table backup and recovery device, which is applied to a distributed database, wherein the device comprises:

[0012] A determination module, used to determine the designated library table that needs to be backed up in the distributed database;

[0013] A backup module, used to record the data file of the specified library table and the transaction statements executed on the specified library table during the backup period, and obtain the backup file of the specified library table;

[0014] A recovery module is used to play back the transaction statements to the data file in sequence based on the backup file to restore the designated library table to a target location.

[0015] In a third aspect, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-described method for backing up and restoring a designated library table when executing the computer program.

[0016] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the designated library table backup and recovery method as described above.

[0017] Compared with the prior art, the present invention provides a method, apparatus, computer device and computer-readable storage medium for backing up and restoring a designated library table, which are applied to a distributed database, wherein the designated library table that needs to be backed up in the distributed database is determined; a data file of the designated library table and a transaction statement executed on the designated library table during the backup are recorded to obtain a backup file of the designated library table; based on the backup file, the transaction statements are played back to the data file in sequence to restore the designated library table to a target location; thus, the present invention can effectively improve the backup and recovery efficiency of the designated library table in the distributed database. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A schematic diagram of an application environment of a method for backing up and restoring a designated library table provided in one embodiment of the present invention.

[0020] Figure 2 A flowchart of a method for backing up and restoring a specified library table provided in one embodiment of the present invention.

[0021] Figure 3 A schematic diagram of a program module of a designated library table backup and recovery device provided by an embodiment of the present invention.

[0022] Figure 4 A schematic diagram of the structure of a computer device provided by an embodiment of the present invention.

[0023] Figure 5 Another structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0026] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0027] As used in the present specification and the appended claims, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0028] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0029] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0030] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0031] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.

[0032] A method for backing up and restoring a specified database table provided by an embodiment of the present invention can be applied in the following situations: Figure 1In the application environment shown, the client and the server communicate through the network. The client includes but is not limited to PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud computing devices, personal digital assistants (PDAs) and other computer devices. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0033] See also Figure 2 An embodiment of the present invention provides a method for backing up and restoring a specified database table, which is applied to a distributed database, wherein the method comprises the following steps:

[0034] S100, determining a designated library table that needs to be backed up in the distributed database;

[0035] S200, recording the data file of the designated library table and the transaction statements executed on the designated library table during the backup period, and obtaining a backup file of the designated library table;

[0036] S300. Based on the backup file, play back the transaction statements in sequence to the data file to restore the designated library table to a target location.

[0037] In specific implementation, this embodiment effectively reduces the amount of data required to be processed during the backup and recovery process by specifically backing up and restoring only the key designated library tables in the distributed database, rather than the entire database instance. In step S100, by accurately selecting the designated library tables that need to be backed up, a comprehensive scan of the entire database is avoided, thereby saving backup time and storage space. In step S200, only the data files and related transaction statements of the designated library tables are recorded, further reducing the complexity and time consumption of the backup operation. Finally, in step S300, by replaying the transaction statements on the data files in sequence, a rapid recovery of the designated library tables is achieved instead of restoring the entire database instance. This method of the present embodiment not only improves the efficiency of backup and recovery, reduces the long-term business interruption caused by full instance backup and recovery, but also optimizes resource usage, making backup and recovery operations more flexible and economical, and meeting the demand for rapid data recovery in modern distributed database environments.

[0038] Furthermore, in one embodiment, the method for backing up and restoring a designated library table, wherein the step S100 of determining the designated library table in the distributed database that needs to be backed up, specifically comprises the steps of:

[0039] Obtain parameter information of each library table in the distributed database;

[0040] The designated library table that needs to be backed up in the distributed database is screened out according to the parameter information.

[0041] In specific implementation, in this embodiment, in the backup of the specified library table, firstly, the corresponding parameter information needs to be input, including: 1) backing up the specified library, or backing up the specified table; 2) excluding the specified library, or excluding the specified table; this embodiment obtains the parameter information of each library table in the distributed database, and screens out the specified library table that needs to be backed up according to these parameter information (such as the size of the library table, access frequency, data change rate, business importance, etc.), thereby realizing more refined backup management. Such technical effects enable the backup operation to focus more on data that is critical to the business, optimize resource allocation, reduce unnecessary data backup, thereby improving backup efficiency, reducing storage costs, and ensuring the security and availability of key data, while providing a guarantee for rapid recovery, and enhancing the pertinence and flexibility of database backup and recovery operations.

[0042] Furthermore, in one embodiment, the method for backing up and restoring a designated library table, wherein the step S200, recording the data file of the designated library table and the transaction statements executed on the designated library table during the backup, to obtain the backup file of the designated library table, specifically comprises the steps of:

[0043] Recording the data file of the designated library table and the transaction statements executed on the designated library table during backup;

[0044] Integrate the data file with the transaction statement to obtain the backup file of the specified library table;

[0045] The file content of the backup file is verified, and when the backup file passes the verification, identification information is added to the backup file.

[0046] In specific implementation, this embodiment achieves the integrity and consistency of data backup by recording in detail the data files of the specified library table and the transaction statements executed during the backup, and integrating this information to form a complete backup file. By verifying the file content of the backup file and adding identification information after the verification, the reliability and validity of the backup data are further ensured. Such technical effects improve the availability of backup files, reduce the risk of recovery failure caused by backup data errors or damage, enhance the success rate of data recovery, and facilitate the management and tracking of backup files, thereby improving the efficiency and security of the entire backup and recovery process.

[0047] Furthermore, in one embodiment, the method for backing up and restoring a designated library table, wherein the step S300, based on the backup file, plays back the transaction statements in sequence to the data file to restore the designated library table to the target location, specifically comprises the steps of:

[0048] According to the user instruction, determining the target location of the designated library table to be restored;

[0049] Locking the designated library table in the backup file, and playing back the transaction statements in sequence on the data file at the target location to restore the designated library table to the target location;

[0050] When the designated library table is restored, an unlocking operation is performed on the designated library table restored in the target location.

[0051] In specific implementation, this embodiment achieves the technical effect of accurately controlling the data recovery process by determining the target location of the specified library table to be restored according to the user's instructions, locking the specified library table in the backup file, and playing back the transaction statements in sequence to the data file. This method of this embodiment ensures the consistency and integrity of the data during the recovery process and avoids the impact of concurrent operations on the restored data. After the recovery is completed, the specified library table restored in the target location is unlocked, which ensures the atomicity of the recovery process and the availability of the restored data, while improving the recovery efficiency and flexibility, allowing users to flexibly select the recovery location according to actual business needs, and optimizing the disaster recovery capability and business continuity of the database.

[0052] Furthermore, in one embodiment, in the designated library table backup and recovery method, the target location is a database in the distributed database.

[0053] In specific implementation, this embodiment specifies the target location as a database in a distributed database, and the technical effect is to ensure that the backup and recovery operations directly act on a specific database instance, thereby improving the pertinence and efficiency of data management. This method of this embodiment allows accurate data backup and recovery of a single or specific database instance in a distributed database environment without involving the entire database cluster, which can reduce the occupation of system resources by backup and recovery operations, reduce the impact on business operations, and speed up recovery. In particular, when a single database instance needs to be quickly restored to deal with a specific failure or data loss event, this targeted operation provides faster recovery time and higher flexibility.

[0054] Furthermore, in one embodiment, the method for backing up and restoring the designated library table, wherein the locking operation is performed on the designated library table in the backup file, and the transaction statements are sequentially played back on the data file at the target location to restore the designated library table to the target location, specifically includes:

[0055] Performing a locking operation on the designated library table in the backup file at the computing node level of the distributed database, and detecting whether a corresponding designated library table exists in the target location;

[0056] If the corresponding designated library table exists in the target location, after deleting the corresponding designated library table in the target location, the transaction statements are played back to the data file in sequence at the target location to restore the designated library table in the backup file to the target location;

[0057] If the corresponding designated library table does not exist in the target location, the computing node is instructed to lock the table name of the designated library table in the target location, and then the transaction statements are played back to the data file in sequence at the target location to restore the designated library table in the backup file to the target location.

[0058] In specific implementation, this embodiment locks the specified library table in the backup file at the computing node level of the distributed database, and decides whether to delete the existing library table first or directly lock the table name (in order to prohibit the concurrent creation of the same-name table in the target location) according to whether the corresponding library table exists in the target location, and then replays the transaction statements to the data file in sequence, thereby realizing a precisely controlled recovery process. This technical effect ensures the consistency and integrity of the data during the recovery process, avoids data conflicts and inconsistencies, and improves the flexibility and security of the recovery operation, allowing the specified library table in the backup file to be effectively restored to the target location in different scenarios (whether the specified library table exists or not in the target location), meeting the needs of rapid recovery and optimizing the disaster recovery capability and business continuity of the database.

[0059] Of course, in this embodiment, if the target library table to be restored in the specified library table is selected for restoration, the library table name of the target library table to be restored needs to be additionally input during the recovery phase; the input library table name will then be verified to see whether the target library table exists in the backup file; after the verification is passed, the above-mentioned "specified library table backup" recovery process is executed to restore the target library table in the target location.

[0060] Furthermore, in one embodiment, the method for backing up and restoring the designated library table, wherein after the designated library table is restored, unlocking the designated library table restored in the target location, specifically includes:

[0061] After the designated library table is restored, content verification is performed on the designated library table restored in the target location. After the verification is passed, the computing node is instructed to unlock the designated library table restored in the target location.

[0062] In specific implementation, this embodiment achieves the technical effect of enhanced data recovery accuracy and security by performing content verification after the specified library table is restored, and performing the unlocking operation only after the verification is passed. This process of this embodiment ensures that only after the data is correctly restored, the specified library table that was previously locked to protect the recovery process will be unlocked, thereby ensuring the integrity and consistency of the data and preventing data problems that may be caused by recovery errors from affecting the normal operation of the database. In addition, this verification and unlocking mechanism also improves the reliability of database operations and ensures the atomicity of the recovery operation, that is, the recovery operation is either completely successful or appropriate error handling is performed when the verification fails, thereby maintaining the stability of the database and the continuity of business.

[0063] It can be seen from the above method embodiments that the designated library table backup and recovery method provided by the present invention is applied to a distributed database, wherein the method comprises: determining the designated library table that needs to be backed up in the distributed database; recording the data file of the designated library table and the transaction statements executed on the designated library table during the backup to obtain the backup file of the designated library table; based on the backup file, playing back the transaction statements in sequence on the data file to restore the designated library table to the target location. In this way, the backup and recovery efficiency of the designated library table in the distributed database can be effectively improved by the method of the present invention.

[0064] It should be understood that, although the present application provides method operation steps as described in the embodiments or flowcharts, more or less operation steps may be included based on conventional or non-creative labor, and these operation steps are not necessarily performed in sequence according to the embodiment or flowchart. The order of steps listed in the embodiment or flowchart is only one way of executing the order of many steps, and does not represent the only execution order. It should be noted that there is not necessarily a certain order between the above steps. A person of ordinary skill in the art can understand from the description of the embodiment of the present invention that in different embodiments, the above steps may have different execution orders, that is, they may be executed in parallel, or they may be executed in exchange, etc. Moreover, at least a part of the steps in the embodiment or flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but may be executed in turn, alternately or synchronously with other steps or at least a part of the sub-steps or stages of other steps.

[0065] Based on the above method embodiment, please refer to Figure 3 Another embodiment of the present invention further provides a designated library table backup and recovery device, which is applied to a distributed database, wherein the device comprises:

[0066] A determination module 11 is used to determine a designated library table that needs to be backed up in the distributed database;

[0067] A backup module 12 is used to record the data file of the specified library table and the transaction statements executed on the specified library table during the backup period, and obtain a backup file of the specified library table;

[0068] The recovery module 13 is used to play back the transaction statements to the data files in sequence based on the backup file to restore the designated library table to the target location.

[0069] Furthermore, in one embodiment, the designated library table backup and recovery device, wherein the determination module 11 is specifically used for:

[0070] Obtain parameter information of each library table in the distributed database;

[0071] The designated library table that needs to be backed up in the distributed database is screened out according to the parameter information.

[0072] Furthermore, in one embodiment, the designated library table backup and recovery device, wherein the backup module 12 is specifically used for:

[0073] Recording the data file of the designated library table and the transaction statements executed on the designated library table during backup;

[0074] Integrate the data file with the transaction statement to obtain the backup file of the specified library table;

[0075] The file content of the backup file is verified, and when the backup file passes the verification, identification information is added to the backup file.

[0076] Furthermore, in one embodiment, the designated library table backup and recovery device, wherein the recovery module 13 is specifically used for:

[0077] According to the user instruction, determining the target location of the designated library table to be restored;

[0078] Locking the designated library table in the backup file, and playing back the transaction statements in sequence on the data file at the target location to restore the designated library table to the target location;

[0079] When the designated library table is restored, an unlocking operation is performed on the designated library table restored in the target location.

[0080] Furthermore, in one embodiment, the designated library table backup and recovery device, wherein the target location is a database in the distributed database.

[0081] Furthermore, in one embodiment, the designated library table backup and recovery device, wherein the locking operation is performed on the designated library table in the backup file, and the transaction statements are sequentially played back on the data file at the target location to restore the designated library table to the target location, specifically includes:

[0082] Performing a locking operation on the designated library table in the backup file at the computing node level of the distributed database, and detecting whether a corresponding designated library table exists in the target location;

[0083] If the corresponding designated library table exists in the target location, after deleting the corresponding designated library table in the target location, the transaction statements are played back to the data file in sequence at the target location to restore the designated library table in the backup file to the target location;

[0084] If the corresponding designated library table does not exist in the target location, the computing node is instructed to lock the table name of the designated library table in the target location, and then the transaction statements are played back to the data file in sequence at the target location to restore the designated library table in the backup file to the target location.

[0085] Furthermore, in one embodiment, the designated library table backup and recovery device, wherein after the designated library table is recovered, unlocking the designated library table recovered in the target location specifically includes:

[0086] After the designated library table is restored, content verification is performed on the designated library table restored in the target location. After the verification is passed, the computing node is instructed to unlock the designated library table restored in the target location.

[0087] It should be noted that in the embodiment of the device of the present invention, the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the aforementioned method embodiment part and will not be repeated here.

[0088] Based on the above method embodiment, another embodiment of the present invention further provides a computer device, which may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the functions or steps on the server side of the specified library table backup and recovery method in any of the above method embodiments are implemented.

[0089] Based on the above method embodiment, another embodiment of the present invention further provides a computer device, which may be a client, and its internal structure diagram may be as follows: Figure 5As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the functions or steps of the client side of the specified library table backup and recovery method in any of the above method embodiments are implemented.

[0090] Those skilled in the art will understand that Figure 4 and Figure 5 The structural schematic diagram shown in the figure is only a schematic diagram of a partial structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0091] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc.

[0092] Among them, the memory includes a readable storage medium, an internal memory, etc., wherein the internal memory can be the memory of a computer device, and the internal memory provides an environment for the operation of an operating system and computer-readable instructions in the readable storage medium. The readable storage medium can be a hard disk of a computer device, and in other embodiments, it can also be an external storage device of a computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on a computer device. Further, the memory can also include both an internal storage unit of a computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of a computer program, etc. The memory can also be used to temporarily store data that has been output or is to be output.

[0093] Based on the above method embodiments, another embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the designated library table backup and recovery method in any of the above method embodiments is implemented. The computer-readable storage medium may be non-volatile or volatile.

[0094] It should be noted that the above-mentioned functions or steps that can be implemented by the computer-readable storage medium or computer device, and the technical effects brought about by the functions / steps, can be found in the relevant descriptions in the aforementioned method embodiments. To avoid repetition, they will not be described one by one here.

[0095] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM). The disclosed memory components or memories of the operating environments described herein are intended to comprise one or more of these and / or any other suitable types of memory.

[0096] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, in the embodiment of the device of the present invention, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.

[0097] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0098] In the embodiments provided by the present invention, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0099] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0100] It should be noted that if software tools or components other than those of the Company appear in the embodiments of the present application, they are only used for illustration and do not represent actual use. The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the above embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features thereof can be replaced by equivalents; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.

Claims

1. A method for backing up and restoring a specified database table, applied to a distributed database, characterized in that: The method comprises: Determine the designated library table that needs to be backed up in the distributed database; Recording the data file of the designated library table and the transaction statements executed on the designated library table during the backup period, and obtaining the backup file of the designated library table; Based on the backup file, the transaction statements are played back to the data file in sequence to restore the designated library table to the target location.

2. The method for backing up and restoring a designated library table according to claim 1, characterized in that: The determining of the designated library table that needs to be backed up in the distributed database includes: Obtain parameter information of each library table in the distributed database; The designated library table that needs to be backed up in the distributed database is screened out according to the parameter information.

3. The method for backing up and restoring a designated library table according to claim 1, characterized in that: The data file recording the designated library table and the transaction statements executed on the designated library table during the backup period, to obtain the backup file of the designated library table, includes: Recording the data file of the designated library table and the transaction statements executed on the designated library table during backup; Integrate the data file with the transaction statement to obtain the backup file of the specified library table; The file content of the backup file is verified, and when the backup file passes the verification, identification information is added to the backup file.

4. The method for backing up and restoring a designated library table according to claim 1, 2 or 3, characterized in that: The step of replaying the transaction statements to the data files in sequence based on the backup file to restore the designated library table to a target location includes: According to the user instruction, determining the target location of the designated library table to be restored; Locking the designated library table in the backup file, and playing back the transaction statements in sequence on the data file at the target location to restore the designated library table to the target location; When the designated library table is restored, an unlocking operation is performed on the designated library table restored in the target location.

5. The method for backing up and restoring a designated library table according to claim 4, characterized in that: The target location is a database in the distributed database.

6. The method for backing up and restoring a designated library table according to claim 5, characterized in that: The locking operation is performed on the designated library table in the backup file, and the transaction statements are played back to the data file in sequence at the target location to restore the designated library table to the target location, including: Performing a locking operation on the designated library table in the backup file at the computing node level of the distributed database, and detecting whether a corresponding designated library table exists in the target location; If the corresponding designated library table exists in the target location, after deleting the corresponding designated library table in the target location, the transaction statements are played back to the data file in sequence at the target location to restore the designated library table in the backup file to the target location; If the corresponding designated library table does not exist in the target location, the computing node is instructed to lock the table name of the designated library table in the target location, and then the transaction statements are played back to the data file in sequence at the target location to restore the designated library table in the backup file to the target location.

7. The method for backing up and restoring a designated library table according to claim 6, characterized in that: When the designated library table is restored, unlocking the designated library table restored in the target location includes: After the designated library table is restored, content verification is performed on the designated library table restored in the target location. After the verification is passed, the computing node is instructed to unlock the designated library table restored in the target location.

8. A designated database table backup and recovery device, applied to a distributed database, characterized in that: The device comprises: A determination module, used to determine the designated library table that needs to be backed up in the distributed database; A backup module, used to record the data file of the specified library table and the transaction statements executed on the specified library table during the backup period, and obtain the backup file of the specified library table; A recovery module is used to play back the transaction statements to the data file in sequence based on the backup file to restore the designated library table to a target location.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the designated library table backup and recovery method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the designated library table backup and recovery method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Database online backup recovery fault tolerance method and device

    CN121560648A

  • A method and apparatus for online backup and recovery of databases with fault tolerance

    CN121560648B