A database restoration method, system, device and medium
By separating the table object structure definition and data content changes records in the database log, and using cache to manage table object meta information, the calculation burden caused by data redundant records is solved, and the cost of database maintenance and recovery is reduced.
Patent Information
- Application Number
- CN202411231909.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-09-04
AI Technical Summary
There are redundant data records in the existing database logs during data restoration, resulting in an increase in the system's parsing and computing burden, thereby increasing the cost of database maintenance and recovery.
Two types of logs are adopted (the first log records the table object structure definition, and the second log records the data content changes) and the table object meta information in the first log is managed by cache to reduce the redundant parsing calculation of the processor.
It reduces the system's analytical and computing burden during data restoration, and reduces the cost of database maintenance and recovery.
Smart Images

Figure CN118733350B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of databases, and in particular to a database restoration method, system, device and medium. Background Art
[0002] Database logs are a type of logical logs, commonly used in database business scenarios such as master-slave replication and data recovery. In most cases, database logs are organized in binary data structures, and the corresponding parsing program needs to consume and parse the log content to obtain SQL statements that the database can recognize, and then replay the SQL statements to execute the change operations recorded in the database log.
[0003] In the related art, the data organization form in which the table object meta-information is defined first and the changed data content is followed is used as the change record unit, and then the change record unit is written into the database log. Although this method can synchronize the table object meta-information with the change record, it will cause redundant data records, increase the system's analytical calculation burden during the data restoration process, and thus increase the cost of database maintenance and recovery. Summary of the invention
[0004] In order to reduce the cost of database maintenance and recovery, the present application provides a database restoration method, system, device and medium.
[0005] In a first aspect, the present application provides a database restoration method, which adopts the following technical solution:
[0006] A database restoration method, comprising:
[0007] Obtain a log consumption request, and obtain corresponding log consumption data from a database log according to the log consumption request; the database log includes a first log and a second log; the first log is a log that only records the definition and modification of a table object structure; the second log is a log that records changes in data content;
[0008] Acquire a corresponding data identifier according to the log consumption data, and determine whether the table object meta information corresponding to the log consumption data is in the cache according to the data identifier;
[0009] If not, obtaining the table object meta information corresponding to the log consumption data from the first log, and caching the table object meta information corresponding to the log consumption data;
[0010] The target database is restored by SQL according to the log consumption data and the table object meta information corresponding to the log consumption data.
[0011] By adopting the above technical solution, a log consumption request is first obtained, and corresponding log consumption data is obtained from a database log according to the log consumption request, wherein the database log includes a first log and a second log; the first log is a log that only records the definition and modification of a table object structure, and the second log is a log that records the change of data content, and then the corresponding data identifier is obtained according to the log consumption data, and it is determined according to the data identifier whether the table object meta information corresponding to the log consumption data is in the cache; if the table object meta information corresponding to the log consumption data is in the cache, the table object meta information corresponding to the log consumption data is obtained from the first log, and the table object meta information corresponding to the log consumption data is cached, and then SQL restore is performed on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data; in the above method, the object meta information and the change data record are abandoned as the change record unit, the database log is designed as the first log and the second log, and the cache is used to manage and maintain the table object meta information in the first log, thereby reducing the redundant analysis and calculation of the table object meta information by the processor, reducing the analysis and calculation burden of the system during the data restoration process, and thus reducing the cost of database maintenance and recovery.
[0012] Optionally, before the step of obtaining the log consumption request and obtaining corresponding log consumption data from the database log according to the log consumption request, the method further includes:
[0013] Obtaining a SQL request from a user, and determining whether the SQL request is a DDL request or a DML request according to the SQL request;
[0014] If the SQL request is a DDL request, the DDL operation corresponding to the SQL request is written into the first log and the second log respectively, and table object meta information corresponding to the DDL operation is generated according to the SQL request, and the table object meta information corresponding to the DDL operation is cached;
[0015] If the SQL request is a DML request, the DML operation corresponding to the SQL request is written into the second log.
[0016] By adopting the above technical solution, in order to generate or update the first log and the second log, the user's SQL request is obtained, and it is determined whether the SQL request is a DDL request or a DML request according to the SQL request. If the SQL request is a DDL request, the DDL operation corresponding to the SQL request is written into the first log and the second log respectively, and the table object meta information corresponding to the DDL operation is generated according to the SQL request, and the table object meta information corresponding to the DDL operation is cached. If the SQL request is a DML request, the DML operation corresponding to the SQL request is written into the second log.
[0017] Optionally, the step of obtaining a log consumption request and obtaining corresponding log consumption data from a database log according to the log consumption request includes:
[0018] Obtaining a log consumption request, and determining a starting consumption position and a data consumption length for the database log according to the log consumption request;
[0019] The corresponding log consumption data is obtained from the second log according to the starting consumption position and the data consumption length.
[0020] By adopting the above technical solution, in order to obtain log consumption data, a log consumption request is first obtained, and the starting consumption position and data consumption length of the database log are determined according to the log consumption request, and then the corresponding log consumption data is obtained from the second log according to the starting consumption position and the data consumption length.
[0021] Optionally, the step of obtaining a corresponding data identifier according to the log consumption data includes:
[0022] Create a log consumption object according to the log consumption data;
[0023] The corresponding data identifier is obtained according to the built-in method of the log consumption object.
[0024] By adopting the above technical solution, in order to obtain the data identifier, a log consumption object is first created according to the log consumption data, and then the corresponding data identifier is obtained according to the built-in method of the log consumption object.
[0025] Optionally, after the step of performing SQL restoration on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data, the step further includes:
[0026] If so, the table object meta information corresponding to the log consumption data is obtained from the cache, and SQL restoration is performed on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data.
[0027] By adopting the above technical solution, when it is determined according to the data identifier that the table object meta-information corresponding to the log consumption data is in the cache, the table object meta-information corresponding to the log consumption data is obtained from the cache, and then the target database is SQL restored according to the log consumption data and the table object meta-information corresponding to the log consumption data.
[0028] Optionally, the step of performing SQL restoration on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data includes:
[0029] generating a corresponding SQL statement according to the log consumption data and the table object meta information corresponding to the log consumption data;
[0030] Execute the SQL statement in the target database.
[0031] By adopting the above technical solution, in order to perform SQL restoration on the target database, firstly, a corresponding SQL statement is generated according to the log consumption data and the table object meta information corresponding to the log consumption data, and then the SQL statement is executed in the target database.
[0032] Optionally, the method further includes:
[0033] Determine whether the amount of table object meta information in the cache is greater than a preset value, and if so, obtain the usage frequency of each table object meta information, and use the table object meta information with the smallest usage frequency as the target table object meta information;
[0034] The target table object meta information is removed from the cache.
[0035] By adopting the above technical solution, in order to alleviate the pressure of database services on memory resources, it is determined whether the amount of table object meta-information in the cache is greater than a preset value. If so, the usage frequency of each table object meta-information is obtained, and the table object meta-information with the least usage frequency is used as the target table object meta-information, and then the target table object meta-information is moved out of the cache.
[0036] In a second aspect, the present application also provides a database restoration system, which adopts the following technical solution:
[0037] A database restoration system, comprising:
[0038] A data acquisition module, used to acquire a log consumption request, and acquire corresponding log consumption data from a database log according to the log consumption request; the database log includes a first log and a second log; the first log is a log that only records the definition and modification of the table object structure; the second log is a log that records the change of data content;
[0039] A cache judgment module, used for obtaining a corresponding data identifier according to the log consumption data, and determining whether the table object meta information corresponding to the log consumption data is in the cache according to the data identifier;
[0040] A data cache module, configured to obtain the table object meta-information corresponding to the log consumption data from the first log when the table object meta-information corresponding to the log consumption data is not in the cache, and cache the table object meta-information corresponding to the log consumption data;
[0041] The data restoration module is used to perform SQL restoration on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data.
[0042] In a third aspect, the present application also provides a computer device, which adopts the following technical solution:
[0043] A computer device comprises a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the method described in the first aspect when executing the computer program.
[0044] In a fourth aspect, the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0045] A computer-readable storage medium stores a computer program that can be loaded by a processor and execute the method described in the first aspect.
[0046] In summary, the present application includes at least the following beneficial technical effects: first, a log consumption request is obtained, and corresponding log consumption data is obtained from a database log according to the log consumption request, wherein the database log includes a first log and a second log; the first log is a log that only records the definition and modification of a table object structure, and the second log is a log that records the change in data content; then, a corresponding data identifier is obtained according to the log consumption data, and it is determined according to the data identifier whether the table object meta information corresponding to the log consumption data is in the cache; if the table object meta information corresponding to the log consumption data is in the cache, the table object meta information corresponding to the log consumption data is obtained from the first log, and the table object meta information corresponding to the log consumption data is cached, and then SQL restore is performed on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data; in the above method, the method of using object meta information and change data records as change record units is abandoned, the database log is designed as a first log and a second log, and the cache is used to manage and maintain the table object meta information in the first log, thereby reducing the redundant analysis and calculation of the table object meta information by the processor, reducing the analysis and calculation burden of the system during the data restoration process, and thus reducing the cost of database maintenance and recovery. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the specific implementation of the present application or the technical solution in the prior art, the following is a brief introduction to the drawings required for the specific implementation or the prior art description. In all drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, each element or part is not necessarily drawn according to the actual scale.
[0048] Figure 1 It is a schematic diagram of the overall process of an embodiment of the present application.
[0049] Figure 2 It is a schematic diagram of the structure of the system of this application.
[0050] Figure 3 It is a structural block diagram of the computer device of the present application.
[0051] The functional features and advantages of the present application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of this application more clear, the following Figure 1-3 It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0053] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0054] The embodiment of the present application discloses a database restoration method.
[0055] Reference Figure 1 , a database restoration method, comprising:
[0056] Step S11, obtaining a log consumption request, and obtaining corresponding log consumption data from a database log according to the log consumption request.
[0057] The database log includes a first log and a second log; the first log is a log that only records the definition and modification of the table object structure; the second log is a log that records the change of data content.
[0058] It should be noted that the second log can also record data related to the definition and modification of the table object structure, that is, the second log can also record the data recorded in the first log; during the use of the database, data related to the definition and modification of the table object structure (that is, DDL operation data) will be written to the first log and the second log synchronously, while data related to data content changes (DML operation data) will only be written to the second log.
[0059] It can be understood that DDL operations are operations for defining and managing a database, such as creating, modifying, and deleting tables, and DML operations are operations for processing data content, such as adding, deleting, modifying, and querying data.
[0060] Step S12: acquiring a corresponding data identifier according to the log consumption data, and determining whether the table object meta information corresponding to the log consumption data is in the cache according to the data identifier.
[0061] It should be noted that the data structure of the log consumption data consists of a data header and a data body. In this embodiment, the length and format of the data header are usually fixed. The data header includes the transaction number, change action, partition number, change source node number, library ID, message delivery time, transaction submission time, file number, header offset of the log consumption data in the log, object ID, number of large objects, change data length, etc. The data body includes SQL information, operation data, etc.
[0062] It should be further explained that the table object meta-information is the information that describes the structure of the table object, that is, the table object meta-information records the information for defining and modifying the structure of the table object. The table object meta-information is constructed from the data in the first log. This construction action usually occurs during the log consumption process, that is, when the meta-information cache table in the cache lacks the table object meta-information required by the log consumption data, the system reads the latest DDL operation data of the table object in the first log, constructs it, and then writes it into the meta-information cache table for direct access next time.
[0063] Step S13: if not, obtaining the table object meta information corresponding to the log consumption data from the first log, and caching the table object meta information corresponding to the log consumption data.
[0064] Specifically, if the table object meta information corresponding to the log consumption data is in the cache, the table object meta information corresponding to the log consumption data is obtained from the first log, and the table object meta information corresponding to the log consumption data is cached.
[0065] Step S14: Perform SQL restoration on the target database according to the log consumption data and the table object meta-information corresponding to the log consumption data.
[0066] In the above implementation, a log consumption request is first obtained, and corresponding log consumption data is obtained from a database log according to the log consumption request, wherein the database log includes a first log and a second log; the first log is a log that only records the definition and modification of a table object structure, and the second log is a log that records the change of data content, and then a corresponding data identifier is obtained according to the log consumption data, and it is determined whether the table object meta information corresponding to the log consumption data is in the cache according to the data identifier; if the table object meta information corresponding to the log consumption data is in the cache, the table object meta information corresponding to the log consumption data is obtained from the first log, and the table object meta information corresponding to the log consumption data is cached, and then SQL restore is performed on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data; in the above method, the object meta information and the change data record are abandoned as the change record unit, the database log is designed as a first log and a second log, and the cache is used to manage and maintain the table object meta information in the first log, thereby reducing the redundant analysis and calculation of the table object meta information by the processor, reducing the analysis and calculation burden of the system during the data restoration process, and thus reducing the cost of database maintenance and recovery.
[0067] As a further implementation of the database restoration method, before the step of obtaining a log consumption request and obtaining corresponding log consumption data from a database log according to the log consumption request, the method further includes:
[0068] Obtain the user's SQL request and determine whether the SQL request is a DDL request or a DML request based on the SQL request;
[0069] If the SQL request is a DDL request, the DDL operation corresponding to the SQL request is written into the first log and the second log respectively, and table object meta information corresponding to the DDL operation is generated according to the SQL request, and the table object meta information corresponding to the DDL operation is cached;
[0070] If the SQL request is a DML request, the DML operation corresponding to the SQL request is written into the second log.
[0071] In the above implementation, in order to generate or update the first log and the second log, the user's SQL request is obtained, and it is determined whether the SQL request is a DDL request or a DML request according to the SQL request. If the SQL request is a DDL request, the DDL operation corresponding to the SQL request is written into the first log and the second log respectively, and the table object meta information corresponding to the DDL operation is generated according to the SQL request, and the table object meta information corresponding to the DDL operation is cached. If the SQL request is a DML request, the DML operation corresponding to the SQL request is written into the second log.
[0072] As a further implementation method of the database restoration method, the steps of obtaining a log consumption request and obtaining corresponding log consumption data from a database log according to the log consumption request include:
[0073] Step S31, obtaining a log consumption request, and determining the starting consumption position and data consumption length of the database log according to the log consumption request.
[0074] It should be noted that after receiving the log consumption request, the database server will call the POLL_MODIFY_DATA method according to the log consumption request, and use the partition number, file number and file offset header position as the actual parameters of the POLL_MODIFY_DATA method to determine the starting consumption position of the database log; then read the data header of the log consumption data into the memory, and determine the data consumption length by accessing the parameters of the data header.
[0075] Step S32: Obtain corresponding log consumption data from the second log according to the starting consumption position and the data consumption length.
[0076] In the above implementation, in order to obtain log consumption data, a log consumption request is first obtained, and the starting consumption position and data consumption length of the database log are determined according to the log consumption request, and then the corresponding log consumption data is obtained from the second log according to the starting consumption position and data consumption length.
[0077] As a further implementation of the database restoration method, the step of obtaining the corresponding data identifier according to the log consumption data includes:
[0078] Step S41, creating a log consumption object according to the log consumption data.
[0079] Step S42, obtaining the corresponding data identifier according to the built-in method of the log consumption object.
[0080] In the above implementation, in order to obtain the data identifier, a log consumption object is first created according to the log consumption data, and then the corresponding data identifier is obtained according to the built-in method of the log consumption object.
[0081] As a further implementation of the database restoration method, after the step of performing SQL restoration on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data, the method further includes:
[0082] If so, the table object meta information corresponding to the log consumption data is obtained from the cache, and SQL restoration is performed on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data.
[0083] Specifically, when it is determined according to the data identifier that the table object meta information corresponding to the log consumption data is in the cache, the table object meta information corresponding to the log consumption data is obtained from the cache, and SQL restoration is performed on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data.
[0084] In the above implementation, when it is determined according to the data identifier that the table object meta-information corresponding to the log consumption data is in the cache, the table object meta-information corresponding to the log consumption data is obtained from the cache, and then the target database is SQL restored according to the log consumption data and the table object meta-information corresponding to the log consumption data.
[0085] As a further implementation of the database restoration method, the step of performing SQL restoration on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data includes:
[0086] Step S61: Generate a corresponding SQL statement according to the log consumption data and the table object meta-information corresponding to the log consumption data.
[0087] Step S62: execute the SQL statement in the target database.
[0088] In the above implementation, in order to perform SQL restoration on the target database, a corresponding SQL statement is first generated according to the log consumption data and the table object meta information corresponding to the log consumption data, and then the SQL statement is executed in the target database.
[0089] As a further implementation of the database restoration method, the database restoration method further includes:
[0090] Step S71, determining whether the amount of table object meta information in the cache is greater than a preset value, if so, obtaining the usage frequency of each table object meta information, and taking the table object meta information with the least usage frequency as the target table object meta information.
[0091] Specifically, determine whether the amount of table object meta-information in the cache is greater than a preset value. If the amount of table object meta-information in the cache is greater than the preset value, obtain the usage frequency of each table object meta-information, and use the table object meta-information with the least usage frequency as the target table object meta-information; if the amount of table object meta-information in the cache is not greater than the preset value, continue to determine after a preset time period.
[0092] Step S72, moving the target table object meta information out of the cache.
[0093] It should be noted that the size of the first log will grow synchronously with the frequency of use of the database service, so the first log is not suitable for full loading into the system memory. In this embodiment, the table object meta information used is loaded in an on-demand loading manner, and the table object meta information is cached. The number of cached table object meta information is set with an upper limit (i.e., a preset value). When the number of cached table object meta information exceeds the preset value, the table object meta information with the least frequency of use will be eliminated from the memory slot, and then new table object meta information can be placed in the memory slot, thereby alleviating the pressure of the database service on memory resources while ensuring the performance of the data service.
[0094] In the above implementation, in order to alleviate the pressure of database services on memory resources, it is determined whether the amount of table object meta-information in the cache is greater than a preset value. If so, the usage frequency of each table object meta-information is obtained, and the table object meta-information with the least usage frequency is used as the target table object meta-information, and then the target table object meta-information is moved out of the cache.
[0095] The embodiment of the present application also discloses a database restoration system.
[0096] refer to Figure 2 , a database restoration system, comprising:
[0097] The data acquisition module is used to obtain a log consumption request and obtain corresponding log consumption data from the database log according to the log consumption request; the database log includes a first log and a second log; the first log is a log that only records the definition and modification of the table object structure; the second log is a log that records the change of data content;
[0098] A cache judgment module is used to obtain a corresponding data identifier according to the log consumption data, and determine whether the table object meta information corresponding to the log consumption data is in the cache according to the data identifier;
[0099] A data cache module, used for obtaining the table object meta information corresponding to the log consumption data from the first log when the table object meta information corresponding to the log consumption data is not in the cache, and caching the table object meta information corresponding to the log consumption data;
[0100] The data restoration module is used to perform SQL restoration on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data.
[0101] The database restoration system of the present invention can implement any one of the database restoration methods, and the specific working process of the database restoration system of the present invention can refer to the corresponding process in the above-mentioned database restoration method.
[0102] The embodiment of the present application also discloses a computer device.
[0103] refer to Figure 3 A computer device includes a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, any one of the above-mentioned database restoration methods is implemented.
[0104] The embodiment of the present application also discloses a computer-readable storage medium.
[0105] A computer-readable storage medium stores a computer program that can be loaded by a processor and execute any one of the above database restoration methods.
[0106] Among them, computer-readable storage media can be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus or device; the program code contained on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0107] In some embodiments, the computer readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories. The computer may be various computing devices including intelligent terminals and servers.
[0108] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, 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 units or modules, which can be electrical or other forms.
[0109] The above are all preferred embodiments of the present application, and are not intended to limit the protection scope of the present application. Any feature disclosed in this specification (including the abstract and drawings), unless otherwise stated, can be replaced by other equivalent or alternative features with similar purposes. That is, unless otherwise stated, each feature is only an example of a series of equivalent or similar features.
Claims
1. A database restoration method, characterized in that: include: Obtain a log consumption request, and obtain corresponding log consumption data from a database log according to the log consumption request; the database log includes a first log and a second log; the first log only records table object structure definition data and table object structure modification data; the second log records data on data content changes; Acquire a corresponding data identifier according to the log consumption data, and determine whether the table object meta information corresponding to the log consumption data is in the cache according to the data identifier; If not, obtaining the table object meta information corresponding to the log consumption data from the first log, and caching the table object meta information corresponding to the log consumption data; The target database is restored by SQL according to the log consumption data and the table object meta information corresponding to the log consumption data.
2. A database restoration method according to claim 1, characterized in that: Before the step of obtaining the log consumption request and obtaining corresponding log consumption data from the database log according to the log consumption request, the method further includes: Obtaining a SQL request from a user, and determining whether the SQL request is a DDL request or a DML request according to the SQL request; If the SQL request is a DDL request, the DDL operation corresponding to the SQL request is written into the first log and the second log respectively, and table object meta information corresponding to the DDL operation is generated according to the SQL request, and the table object meta information corresponding to the DDL operation is cached; If the SQL request is a DML request, the DML operation corresponding to the SQL request is written into the second log.
3. A database restoration method according to claim 1, characterized in that: The step of obtaining a log consumption request and obtaining corresponding log consumption data from a database log according to the log consumption request includes: Obtaining a log consumption request, and determining a starting consumption position and a data consumption length for the database log according to the log consumption request; The corresponding log consumption data is obtained from the second log according to the starting consumption position and the data consumption length.
4. A database restoration method according to claim 1, characterized in that: The step of obtaining the corresponding data identifier according to the log consumption data includes: Create a log consumption object according to the log consumption data; The corresponding data identifier is obtained according to the built-in method of the log consumption object.
5. A database restoration method according to claim 1, characterized in that: After the step of performing SQL restoration on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data, the method further includes: If so, the table object meta information corresponding to the log consumption data is obtained from the cache, and SQL restoration is performed on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data.
6. A database restoration method according to claim 1, characterized in that: The step of performing SQL restoration on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data includes: generating a corresponding SQL statement according to the log consumption data and the table object meta information corresponding to the log consumption data; Execute the SQL statement in the target database.
7. A database restoration method according to claim 1, characterized in that: The method further comprises: Determine whether the amount of table object meta information in the cache is greater than a preset value, and if so, obtain the usage frequency of each table object meta information, and use the table object meta information with the smallest usage frequency as the target table object meta information; The target table object meta information is removed from the cache.
8. A database restoration system, characterized in that: include: The data acquisition module is used to obtain a log consumption request, and obtain corresponding log consumption data from a database log according to the log consumption request; the database log includes a first log and a second log; the first log only records table object structure definition data and table object structure modification data; the second log records data on data content changes; A cache judgment module, used for obtaining a corresponding data identifier according to the log consumption data, and determining whether the table object meta information corresponding to the log consumption data is in the cache according to the data identifier; A data cache module, configured to obtain the table object meta-information corresponding to the log consumption data from the first log when the table object meta-information corresponding to the log consumption data is not in the cache, and cache the table object meta-information corresponding to the log consumption data; The data restoration module is used to perform SQL restoration on the target database according to the log consumption data and the table object meta information corresponding to the log consumption data.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: A computer program is stored which can be loaded by a processor and execute the method according to any one of claims 1 to 7.
