Dump file processing method and device, equipment and storage medium
By creating an immutable data table in the database and generating chained digest values, the problems of tampering and loss of dump files are solved, ensuring the integrity and traceability of dump data and improving security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CETC JINCANG (BEIJING) TECH CO LTD
- Filing Date
- 2025-12-23
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional methods cannot effectively identify tampering and loss of dumped files, resulting in gaps in historical audit records and posing a security risk.
By creating an immutable data table that allows insertion operations but prohibits update or deletion operations, a chained digest value is generated. The dump file name and digest value are then inserted into the immutable data table. Combined with hash message authentication codes and asymmetric encryption algorithms, the integrity and traceability of the dump file are ensured.
It effectively ensures the integrity and tamper-proof nature of the database dump data, realizes the traceability of operation history, and improves data auditing and security protection capabilities.
Smart Images

Figure CN121901029A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database management, and in particular to a method, apparatus, device and storage medium for processing dump files. Background Technology
[0002] When database auditing is enabled, audit logs accumulate over time, consuming significant database storage space and potentially impacting database performance. Therefore, it's necessary to periodically transfer audit logs from the database to external storage, and then delete the corresponding original records from the database after the transfer. Multiple transfer operations will generate multiple audit dump files from different time periods. When historical audit information needs to be traced, these dump files must be restored to the database for querying.
[0003] Traditional methods use digest algorithms to process dump files. After the audit record dump is completed, the system calculates a digest for the generated dump file to obtain a unique digest value, and then binds and stores this digest value with the dump file. When the audit record needs to be restored later, the system recalculates the digest value of the file to be restored and compares it with the stored original digest value. If the two match, the file is determined to be untampered; otherwise, the file is determined to be invalid, thus realizing the integrity verification of the dump file.
[0004] However, if an unauthorized user gains modification rights to a dump file, they can tamper with the file content, recalculate and generate a new digest value to replace the original digest value. In this case, the system will determine the file as "legitimate" during the restoration verification and will not be able to identify the tampering behavior. Traditional methods only verify the integrity of a single file and cannot detect the missing parts of a dump file. If an unauthorized user directly deletes part of the dump file, the system cannot detect the file loss through digest comparison, which leads to gaps in historical audit records and results in low security for dump file processing. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for processing dump files, which addresses the technical problem of low security in dump file processing.
[0006] Firstly, this application provides a method for processing dump files, the method comprising:
[0007] In response to a database dump instruction, an immutable data table is created that allows insert operations but prohibits update or delete operations.
[0008] During the nth dump, a chained digest value for the nth dump is generated based on the digest values of the nth dump file and the (n-1)th dump file, where n is an integer greater than 1;
[0009] The filename of the nth dump file and the chained digest value of the nth dump are inserted into the immutable data table.
[0010] In one possible implementation, generating the chained digest value of the nth dump based on the digest values of the nth dump file and the (n-1)th dump file includes:
[0011] The hash message authentication code algorithm is used to process the digest values of the nth dump file and the (n-1)th dump file to generate a chained digest value for the nth dump.
[0012] In one possible implementation, during the nth dump, the following is also included:
[0013] The nth dump file is divided into multiple data blocks;
[0014] Calculate the hash value for each data block and generate a hash tree;
[0015] Insert the root hash value of the hash tree into the immutable data table.
[0016] In one possible implementation, the method further includes:
[0017] A digital signature is generated for the chain digest value of the nth dump using an asymmetric encryption algorithm;
[0018] The digital signature is inserted into the immutable data table.
[0019] In one possible implementation, the method further includes:
[0020] The integrity of the dump files recorded in the immutable data table is periodically verified based on the contents stored in the immutable data table.
[0021] In one possible implementation, verifying the integrity of the dump file recorded in the immutable data table includes:
[0022] Read the chained digest values stored in the immutable data table and verify the continuity of the chained digest values stored in the immutable data table;
[0023] Calculate the chain digest value of the dump file to be verified sequentially, and compare the calculated chain digest value of the dump file to be verified with the chain digest value stored in the immutable data table;
[0024] If the preset conditions are met, it is determined that the dump file to be verified has been tampered with or deleted;
[0025] The preset conditions include one or more of the following:
[0026] The calculated chain digest value of the dump file to be verified does not match the chain digest value stored in the immutable data table; the continuity of the chain digest value stored in the immutable data table is interrupted; the digital signature is invalid; the root hash value of the hash tree changes.
[0027] In one possible implementation, the method further includes:
[0028] During the first dump, an initial digest value is calculated for the first dump file using a hash algorithm;
[0029] The filename of the first dump file and the initial digest value are inserted into the immutable data table.
[0030] Secondly, this application provides a file dumping processing apparatus, comprising:
[0031] The response module is used to create an immutable data table in response to a database dump instruction. The immutable data table allows insertion operations but prohibits update or deletion operations.
[0032] A generation module is used to generate a chained digest value for the nth dump based on the digest values of the nth dump file and the (n-1)th dump file during the nth dump, where n is an integer greater than 1.
[0033] An insertion module is used to insert the filename of the nth dump file and the chained digest value of the nth dump into the immutable data table.
[0034] In one possible implementation, the generation module is further configured to process the digest values of the nth dump file and the (n-1)th dump file using a hash message authentication code algorithm to generate a chained digest value for the nth dump.
[0035] In one possible implementation, the dump file processing device further includes: a partitioning module;
[0036] The partitioning module is used to divide the nth dump file into multiple data blocks;
[0037] The generation module is also used to calculate the hash value for each data block and generate a hash tree;
[0038] The insertion module is also used to insert the root hash value of the hash tree into the immutable data table.
[0039] In one possible implementation, the generation module is further configured to generate a digital signature for the chain digest value of the nth dump using an asymmetric encryption algorithm.
[0040] The insertion module is also used to insert the digital signature into the immutable data table.
[0041] In one possible implementation, the dump file processing device further includes: a verification module;
[0042] The verification module is used to periodically verify the integrity of the dump files recorded in the immutable data table based on the content stored in the immutable data table.
[0043] In one possible implementation, the dump file processing device further includes: a determination module and a calculation module;
[0044] The verification module is also used to read the chain digest values stored in the immutable data table and verify the continuity of the chain digest values stored in the immutable data table.
[0045] The verification module is also used to sequentially calculate the chain digest value of the dump file to be verified, and compare the calculated chain digest value of the dump file to be verified with the chain digest value stored in the immutable data table;
[0046] The determination module is used to determine whether the dump file to be verified has been tampered with or deleted if a preset condition is met.
[0047] The preset conditions include one or more of the following:
[0048] The calculated chain digest value of the dump file to be verified does not match the chain digest value stored in the immutable data table; the continuity of the chain digest value stored in the immutable data table is interrupted; the digital signature is invalid; the root hash value of the hash tree changes.
[0049] In one possible implementation, the computing module is further configured to calculate an initial digest value for the first dump file using a hash algorithm during the first dump.
[0050] The insertion module is also used to insert the filename of the first dump file and the initial digest value into the immutable data table.
[0051] Thirdly, embodiments of this application provide a file dumping processing device, including: a memory and a processor;
[0052] The memory stores computer-executed instructions;
[0053] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0054] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0055] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0056] The dump file processing method provided in this application ensures that all dump records cannot be tampered with or deleted once written by creating an immutable data table that only allows insertion and prohibits updating or deletion. At the same time, a chained digest value is generated using the digest values of the nth and n-1th dump files, and the dump file name and the chained digest value are stored together in the immutable table to form a data chain that is linked and verified layer by layer. This mechanism not only effectively protects the integrity and tamper-proof nature of the database dump data, but also achieves the traceability of operation history and improves data auditing, compliance verification and security protection capabilities. Attached Figure Description
[0057] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0058] Figure 1 Flowchart of the dump file processing method provided in this application Figure 1 ;
[0059] Figure 2 Flowchart of the dump file processing method provided in this application Figure 2 ;
[0060] Figure 3 Flowchart of the dump file processing method provided in this application Figure 3 ;
[0061] Figure 4 A schematic diagram of the structure of the dump file processing device provided in this application;
[0062] Figure 5 A schematic diagram of the dump file processing device provided in this application.
[0063] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0064] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0065] It should be noted that the dump file processing method, apparatus, equipment and storage medium provided in this application can be used in the field of database management, or in any field other than database management. This application does not limit the application field of the dump file processing method, apparatus, equipment and storage medium.
[0066] When database auditing is enabled, the system continuously generates audit logs. These logs accumulate over time, consuming significant database storage resources and potentially slowing down overall database performance. Typically, audit logs need to be exported to external storage media periodically, and the original data deleted from the database after the dump is complete. Repeatedly performing this operation creates a series of time-based audit dump files; when historical operations need to be reviewed, these external files must be re-imported into the database for querying.
[0067] To ensure that the dumped file has not been tampered with, the traditional method uses a digest algorithm for integrity verification: after the file is dumped, the system calculates its digest value and binds it to the file for storage; during subsequent restoration, the digest is calculated again and compared with the original value, and if they match, it is considered valid.
[0068] However, while this method can verify the integrity of a single file to some extent, it has significant security flaws. If an attacker gains modification rights to both the dump file and its corresponding digest value, they can tamper with the content and regenerate a matching digest, causing the system to mistakenly judge the file as legitimate and thus bypassing the integrity check. Furthermore, if an unauthorized user deletes dump files for a specific period, the system, lacking a global view, cannot detect the record gaps, resulting in incomplete historical audit information. This lack of effective protection against file tampering and loss leads to the current low security of audit dump processing.
[0069] To address the aforementioned issues, the dump file processing method provided in this application securely records key metadata for each database dump by constructing an immutable data table that allows only insertion and prohibits update and deletion operations. During the nth (n>1) dump, the system calculates the digest values of the current dump file and its previous dump file, generating a "chain digest value" with a chain dependency relationship. The filename of the current dump and this chain digest value are then inserted into the immutable data table. Since each new digest depends on historical digests, any tampering with past dump files or records will disrupt the chain consistency and can be detected. This mechanism, combined with immutable storage characteristics, ensures the integrity of the dump data, operational traceability, and strong anti-tampering capabilities.
[0070] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0071] Figure 1 Flowchart of the dump file processing method provided in this application Figure 1 In this embodiment, the executing entity is, for example, a file dumping processing system. Figure 1 As shown, the method includes:
[0072] S101: In response to a database dump instruction, create an immutable data table that allows insert operations but prohibits update or delete operations.
[0073] Among them, the database dump instruction refers to the instruction signal triggered by system preset rules, user active operation, or scheduled task, which requires the backup and storage of the current data state of the database.
[0074] An immutable data table is a type of database table with access control and structural constraints. Its core characteristic is that it only opens the data insertion interface and strictly prohibits update (modify existing records) and delete (remove existing records) operations on inserted data.
[0075] Specifically, firstly, the system monitors for database dump indication trigger signals in real time. Upon detection, it immediately initiates the creation process for an immutable data table. During creation, the table's field structure must be defined, including at least basic fields storing dump-related information (such as dump file identifier, summary information, creation time, etc.). Table-level permission constraints and triggers are also configured. At the permission constraint level, all roles' update and delete permissions for the table are revoked, retaining only insert permissions for the designated dump service role and query permissions for read-only roles. At the trigger level, update and delete triggers can be created; when such operations are detected, an exception is triggered directly, and execution is refused. After the data table is created, permission verification and functional testing are performed to ensure that update and delete operations cannot be executed, while insert operations function correctly.
[0076] S102: During the nth dump, generate a chained digest value for the nth dump based on the digest values of the nth dump file and the (n-1)th dump file, where n is an integer greater than 1.
[0077] The nth dump file refers to the backup file containing a specified data range generated after the database performs the nth dump operation (n is an integer greater than 1).
[0078] The (n-1)th dump file refers to the backup file generated by the previous dump operation immediately preceding the nth dump.
[0079] The digest value is a unique string calculated from the file content using an algorithm. Once the file content changes, the digest value will change and can be used to verify file integrity.
[0080] The chained digest value is a new digest value obtained by associating the digest value of the nth dump file with the digest value of the (n-1)th dump file, so that adjacent dump files form a chain association, ensuring the continuity and immutability of the dump file sequence.
[0081] Specifically, after completing the nth database dump and generating the nth dump file, the original digest value of the file is calculated using a preset algorithm. Simultaneously, the original digest value of the (n-1)th dump file is retrieved from a specified storage location. If the chained digest value of the (n-1)th dump already exists, it can be directly obtained as the basis for association. Then, the nth database algorithm value is concatenated with the (n-1)th database algorithm value, and the concatenated string is calculated again using the same algorithm. The result is the chained digest value of the nth dump.
[0082] S103: Insert the filename of the nth dump file and the chained digest value of the nth dump into the immutable data table.
[0083] The filename of the nth dump file is a string used to uniquely identify the nth dump file. It usually contains information such as dump time, dump type, and data range, which facilitates file search and management.
[0084] Specifically, first, organize the data to be inserted, ensuring the filename of the nth dump file is accurate (completely identical to the actual generated dump file name), and the chained digest value of the nth dump is the result calculated above. Then, verify that the role executing the insert operation has the necessary permissions. If permissions are valid, construct an insert statement that conforms to the data table's field structure (field order matches the data table definition, and data types match). After executing the SQL statement, check the database's returned execution result to confirm successful insertion. Then, query the immutable data table to verify the inserted filename and chained digest value are correct, without missing or incorrect values. If insertion fails, investigate permissions, SQL statement format, data types, etc., fix them, and re-execute the insert operation.
[0085] The dump file processing method provided in this embodiment, in response to a database dump instruction, creates an immutable data table. The immutable data table allows insertion operations but prohibits update or deletion operations. During the nth dump, a chained digest value for the nth dump is generated based on the digest values of the nth dump file and the (n-1)th dump file, where n is an integer greater than 1. The filename of the nth dump file and the chained digest value of the nth dump are then inserted into the immutable data table. This method effectively ensures the integrity, traceability, and tamper-proof capability of the database dump data by constructing an immutable data table that only allows insertion and combining it with a chained digest value mechanism.
[0086] Figure 2 Flowchart of the dump file processing method provided in this application Figure 2 ,like Figure 2 As shown, in this embodiment... Figure 1 Based on the examples, the method for processing dump files is described in detail, and the method includes:
[0087] S201: In response to a database dump instruction, create an immutable data table that allows insert operations but prohibits update or delete operations.
[0088] Specifically, firstly, database dump instructions from various trigger sources are acquired in real time. Upon detecting a valid instruction, the immutable data table creation process is automatically initiated: first, the table structure is defined, including basic fields such as dump file identifier, summary information, and creation time; then, table-level permission policies are configured, revoking update and delete permissions for all roles on the table, allocating insert permissions only to the dump service-specific role, and granting query permissions to the audit role; finally, an operation interception trigger is created, which immediately triggers an exception and refuses execution if an update or delete operation is detected. After creation, functional verification is performed by simulating update, delete, and insert operations to ensure that the constraint rules are effective.
[0089] For example, as shown in Table 1, when the system receives a database dump instruction, it immediately creates an immutable data table named aud_dump_file_history (audit dump file history table). This immutable data table contains the core columns aud_dump_file (dump file name) and aud_dump_file_hash (dump file summary value). Through database permission configuration and table-level constraint mechanisms, this table is set to only allow data insertion operations, while prohibiting any update or deletion operations on any data already stored in the table.
[0090] Table 1:
[0091]
[0092] S202: During the nth dump, the digest values of the nth dump file and the (n-1)th dump file are processed using the hash message authentication code algorithm to generate the chained digest value of the nth dump.
[0093] Among them, the hash message authentication code algorithm is an authentication algorithm that combines a key and a hash function, which can simultaneously achieve data integrity verification and identity authentication.
[0094] Specifically, first, the hash message authentication code algorithm and its corresponding key are determined, and the key must be properly stored in the security key management service. After completing the nth database dump, the nth dump file is extracted, and the digest value of the (n-1)th dump file is confirmed to be stored in the immutable data table and read. Then, the digest values of the nth and (n-1)th dump files are concatenated in a fixed order (e.g., n-1 followed by n), using a preset key as the authentication key. The selected hash message authentication code algorithm is used to calculate the concatenated string, and the result is the chain digest value of the nth dump. After calculation, reverse verification is performed to ensure the result is correct; that is, the same key and algorithm are used to recalculate, verifying the consistency of the result.
[0095] For example, when performing the nth full database dump operation, after the dump file is generated, the system will use the SM3 Hash-based Message Authentication Code (SM3HMAC) algorithm to combine the binary data of the generated nth dump file with the chained digest value stored in the aud_dump_file_history table after the previous (n-1) dump. The input is used as a conjoint input for encryption operations. Through this process, a chain digest value specific to the nth dump is finally generated. This process ensures that the digest value of each dump is closely related to the digest value of the previous one, forming an inseparable hash chain. Subsequently, the filename of the nth dump and this newly generated chain digest value are inserted together into the immutable aud_dump_file_history table. This not only ensures the integrity of the dump record, but also effectively prevents any dump file from being tampered with or deleted without being detected through the correlation of the hash chain.
[0096] Optionally, during the nth dump, the following may also be included:
[0097] Divide the nth dump file into multiple data blocks;
[0098] Calculate the hash value for each data block and generate a hash tree;
[0099] Insert the root hash value of the hash tree into an immutable data table.
[0100] Specifically, after the nth dump file is generated, a fixed data block size is first set based on storage efficiency and subsequent verification requirements. The file partitioning program is then started to cut the nth dump file, generating consecutively numbered data blocks and recording the metadata of each data block. Next, a hash algorithm is selected, and the corresponding hash value is calculated by reading the byte stream of each data block one by one. These hash values are used as leaf nodes to build a hash tree (if the number of leaf nodes is odd, the last one is copied and padded with an even number, and the parent node hash value is calculated by concatenating them in pairs, and this process is repeated until a unique top-level root hash value is generated). Finally, the dump sequence number n, dump file name, root hash value and other related information are organized. After verifying the insertion permission of the dedicated dump service role, an SQL insertion statement that conforms to the immutable data table field structure is constructed. After the insertion operation is executed, the root hash value is checked by query to ensure that it is accurately inserted and cannot be tampered with.
[0101] S203: Insert the filename of the nth dump file and the chained digest value of the nth dump into the immutable data table.
[0102] Specifically, first, the data to be inserted is organized, ensuring that the filename of the nth dump file is exactly the same as the actual generated backup file name, the chained digest value is the final result after verification, and auxiliary information such as dump sequence number and insertion time is added to form a complete data entry. Next, it is verified whether the role performing the insertion operation has the configured insertion permissions. If the permissions are valid, an insertion SQL statement conforming to the immutable data table field structure is constructed, ensuring that the field order and data type completely match the table definition. After executing the SQL statement, the execution result returned by the database is checked to confirm successful insertion; then, a query statement is used to query the immutable data table to verify that the inserted filename and chained digest value are accurate and without missing or incorrect values. If the insertion fails, issues such as permissions, SQL syntax, and data types are investigated, fixed, and the operation is re-executed.
[0103] For example, after completing the nth database dump and generating the chain digest value for that dump using the SM3HMAC algorithm, the system immediately performs a data insertion operation: the file name generated in this dump (i.e., the file name of the nth dump file) and the newly generated chain digest value of the nth dump are treated as a complete record and inserted into the pre-created immutable data table `aud_dump_file_history`. This table only allows insertion operations and prohibits update or deletion operations, ensuring the originality of the dump records. Subsequent integrity checks on the audit log dump file will first verify the matching between the file name stored in this data table and the actual dump file, and then verify the hash chain association of the chain digest value. Only if both checks pass is it confirmed that the audit log dump file has not been tampered with. If either check fails, an error is immediately reported indicating that the audit dump file has been tampered with, thus ensuring the security and traceability of the dump file.
[0104] Optionally, a digital signature is generated for the chain digest value of the nth dump using an asymmetric encryption algorithm;
[0105] Insert digital signatures into immutable data tables.
[0106] Specifically, firstly, the chain digest value is encrypted using a preset private key to generate a unique and immutable digital signature. The asymmetric encryption algorithm used can be one that meets cryptographic security standards, and the private key is kept independently by the data manager and is not disclosed to any third party. Subsequently, the generated digital signature is inserted into a designated position in an immutable data table according to a preset data field format. This position corresponds one-to-one with the chain digest value field of the nth dump. The immutable data table uses a storage architecture with tamper-proof characteristics, such as blockchain or write-protected database, to ensure that the inserted digital signature and the chain digest value remain bound together. The digital signature can be verified using the corresponding public key to confirm that the chain digest value of the nth dump has not been illegally tampered with.
[0107] S204: Periodically verify the integrity of dump files recorded in the immutable data table based on the contents stored in the immutable data table.
[0108] Periodicity refers to repeatedly performing an operation at preset time intervals (such as every hour or every day) to ensure continuous monitoring of the dumped data.
[0109] Specifically, first, configure periodic verification tasks, specifying the verification interval, execution triggering method (such as scheduled task scheduling), and verification scope (full dump records or records within a specified time period). During verification, first, read the dump record to be verified from the immutable data table using a query statement, including the filename, corresponding digest value (initial or chained), and dump sequence number. Retrieve the corresponding dump file from the backup storage location based on the filename. For the nth (n>1) dump file, first calculate its own digest value, then combine it with the digest value of the previous dump file, and recalculate the chained digest value using a hash message authentication code algorithm.
[0110] For example, the system will initiate a dump file integrity verification process according to a preset cycle (such as every morning). It will periodically verify the integrity of the dump files recorded in the immutable data table `aud_dump_file_history`. Specifically, the system will extract the filename and chained digest value of the nth dump from the data table in dump order. First, it will locate the corresponding actual dump file using the filename. Then, using the SM3HMAC algorithm, with the digest values of the actual nth dump file and the (n-1)th dump file stored in the data table as input, it will recalculate and generate a new digest value. Then the calculated result The system compares the value with the chained digest value of the nth dump stored in the data table to see if they are equal. The system will perform this verification operation on each dump record in the data table in turn. In this way, the integrity of all dump files recorded in the immutable data table is verified. Once a mismatch is found between the calculated value and the stored value, an abnormal alarm will be triggered immediately.
[0111] S205: During the first dump, calculate the initial digest value of the first dump file using a hash algorithm.
[0112] Specifically, the first database dump operation is performed. After the dump is complete and the first dump file is generated, the entire content of the file is read (ensuring no data loss or corruption during the reading process). The file content is used as input parameters and substituted into the selected hash algorithm for calculation, resulting in a fixed-length string, which is the initial digest value. After the calculation is completed, two repeated calculations are performed for verification. If the two calculation results are consistent, the initial digest value is confirmed to be valid; if they are inconsistent, the file reading problem or the algorithm execution environment problem is investigated, fixed, and the calculation is repeated.
[0113] For example, when performing the first full database dump operation, after the dump process is completed and the corresponding dump file is generated, the system will immediately start the digest calculation process: using the SM3 hash algorithm to perform a hash operation on the complete binary data of the first dump file generated this time, and calculate a unique initial digest value. This initial digest value forms the basis for generating chained digests of all subsequent dump files. The system will then link the filename of this dump with this initial digest value. Together, they are inserted as a single record into the pre-created immutable aud_dump_file_history data table.
[0114] S206: Insert the filename of the first dump file and the initial digest value into the immutable data table.
[0115] Specifically, first, organize the initial dump record data to be inserted, ensuring that the filename of the first dump file is exactly the same as the actual generated backup file name, and that the initial digest value is a valid result that has passed verification. Simultaneously, supplement auxiliary information such as dump sequence number and insertion time to form a complete data entry. Verify that the role performing the insertion operation has the necessary insertion permissions for the immutable data table. If the permissions are valid, construct an insertion SQL statement that conforms to the table structure, explicitly specifying the values for each field to ensure data type matching. After executing the SQL statement, check the execution status returned by the database to confirm successful record insertion. Then, query the record in the immutable data table where dump_id=1 to verify the accuracy of the filename and initial digest value, ensuring no data entry errors.
[0116] For example, after the first database dump operation is completed, the system first calculates the initial digest value of the generated first dump file using the SM3 hash algorithm. Then, the filename of this dump and the corresponding initial digest value are inserted as a complete record into the pre-created immutable data table aud_dump_file_history. This table only supports data insertion operations and prohibits update and deletion operations, ensuring that the core information of the first dump is not tampered with. When verifying the integrity of the first record later, the actual dump file can be located through the filename stored in the table, the digest value is recalculated using the SM3 algorithm, and compared with the initial digest value stored in the table to verify the authenticity of the first dump file.
[0117] The dump file processing method provided in this embodiment, when receiving a database dump instruction, the system creates an immutable data table that only allows insertion, prohibits updates and deletion operations; during the first (1st) dump, a hash algorithm is used to calculate the initial digest value of the dump file, and the file name and the initial digest value are stored together in the immutable data table; starting from the nth (n≥2) dump, the Hash Message Authentication Code (HMAC) algorithm is used to process the digest values of the current dump file and the previous dump file to generate the nth chained digest value with a chain dependency relationship, and the file name of the current dump and the chained digest value are inserted into the immutable data table; the system then periodically verifies the integrity of historical dump files based on the contents recorded in the table; by combining this append-only immutable storage structure with the chained digest mechanism, the integrity, traceability, and anti-tampering capability of the database dump data are effectively ensured.
[0118] Figure 3 Flowchart of the dump file processing method provided in this application Figure 3 ,like Figure 2 As shown, in this embodiment... Figure 2 Based on the examples, a detailed description is provided of the method for verifying the integrity of dump files recorded in the immutable data table, which includes:
[0119] S301: Read the chained digest values stored in the immutable data table and verify the continuity of the chained digest values stored in the immutable data table.
[0120] First, define the verification scope (e.g., dump records within a specified time period or full dump records). Use a query statement to read the corresponding range of dump records from an immutable data table, extracting the dump sequence number (or dump time) and chain digest value, and sorting them in ascending order by dump sequence number. Then, verify continuity based on the chain digest value generation rules: since the chain digest value of the nth (n>1) dump is calculated from the digest values of the nth and (n-1)th dump files, it must be confirmed that each chain digest value can be traced back to a previous dump record; that is, there should be no situation where a record's chain digest value lacks a corresponding preceding association, or where a previous dump record is missing, causing a break in the association. If all chain digest values form a complete association in sequence, the continuity verification passes; if a break in the association exists, it is marked as an anomaly.
[0121] S302: Calculate the chain digest value of the dump file to be verified sequentially, and compare the calculated chain digest value of the dump file to be verified with the chain digest value stored in the immutable data table.
[0122] Specifically, first, all dump files to be verified corresponding to records in the immutable data table are extracted from the backup storage location and sorted by dump number. For the first dump file, the initial digest value is recalculated using the hash algorithm used during the dump. For the nth (n>1) dump file to be verified, its own digest value is first calculated using the same hash algorithm, then the recalculated digest value (initial or chained) of the previous (n-1) dump file is retrieved, and the two digest values are concatenated in the fixed order used during the dump. The chained digest value is then recalculated using the same hash message authentication code algorithm and key. After calculating the digest value for all files to be verified, the recalculated result for each file is compared one by one with the chained digest value of the dump record with the same sequence number in the immutable data table, and the comparison result (match or mismatch) is recorded.
[0123] S303: If the preset conditions are met, it is determined that the dump file to be verified has been tampered with or deleted.
[0124] The preset conditions include one or more of the following:
[0125] The calculated chain digest value of the dump file to be verified does not match the chain digest value stored in the immutable data table; the continuity of the chain digest value stored in the immutable data table is interrupted; the digital signature is invalid; and the root hash value of the hash tree changes.
[0126] First, the continuity verification results and digest value comparison results are summarized, while the digital signature status and hash tree root hash value status of the dump file are checked. Then, each preset condition is checked to ensure it is met: if the digest value comparison is mismatched, continuity verification is interrupted, digital signature verification fails, or the hash tree root hash value is inconsistent with the original value, meeting any one of these conditions indicates that the dump file has been tampered with or deleted. If none of the preset conditions are met, the dump file is determined to be complete and unaltered. After the determination, a verification report is generated, detailing any anomalies (such as the anomaly dump number and the type of preset condition triggered), and the corresponding alarm mechanism is triggered.
[0127] Figure 4 A schematic diagram of the structure of the dump file processing device provided in this application is shown below. Figure 4 As shown, the file dumping processing device 400 provided in this embodiment includes:
[0128] Response module 401 is used to create an immutable data table in response to a database dump instruction. The immutable data table allows insert operations but prohibits update or delete operations.
[0129] The generation module 402 is used to generate a chained digest value for the nth dump based on the digest values of the nth dump file and the (n-1)th dump file during the nth dump. Here, n is an integer greater than 1.
[0130] Insertion module 403 is used to insert the filename of the nth dump file and the chained digest value of the nth dump into the immutable data table.
[0131] In one possible implementation, the generation module 402 is further configured to process the digest values of the nth dump file and the (n-1)th dump file using a hash message authentication code algorithm to generate a chained digest value for the nth dump.
[0132] In one possible implementation, the dump file processing apparatus further includes: a partitioning module 404;
[0133] The partitioning module 404 is used to divide the nth dump file into multiple data blocks;
[0134] The generation module 402 is also used to calculate the hash value for each data block and generate a hash tree;
[0135] Insertion module 403 is also used to insert the root hash value of the hash tree into an immutable data table.
[0136] In one possible implementation, the generation module 402 is also configured to generate a digital signature for the chain digest value of the nth dump using an asymmetric encryption algorithm.
[0137] Insertion module 403 is also used to insert digital signatures into immutable data tables.
[0138] In one possible implementation, the dump file processing apparatus further includes: a verification module 405;
[0139] Verification module 405 is used to periodically verify the integrity of the dump files recorded in the immutable data table based on the contents stored in the immutable data table.
[0140] In one possible implementation, the dump file processing apparatus further includes: a determination module 406 and a calculation module 407;
[0141] The verification module 405 is also used to read the chain digest values stored in the immutable data table and verify the continuity of the chain digest values stored in the immutable data table.
[0142] The verification module 405 is also used to sequentially calculate the chain digest value of the dump file to be verified, and compare the calculated chain digest value of the dump file to be verified with the chain digest value stored in the immutable data table;
[0143] The determination module 406 is used to determine whether the dump file to be verified has been tampered with or deleted if the preset conditions are met.
[0144] The preset conditions include one or more of the following:
[0145] The calculated chain digest value of the dump file to be verified does not match the chain digest value stored in the immutable data table; the continuity of the chain digest value stored in the immutable data table is interrupted; the digital signature is invalid; and the root hash value of the hash tree changes.
[0146] In one possible implementation, the calculation module 407 is further configured to calculate an initial digest value for the first dump file using a hash algorithm during the first dump.
[0147] Insertion module 403 is also used to insert the filename of the first dump file and the initial summary value into the immutable data table.
[0148] The file dumping processing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0149] Figure 5 This is a schematic diagram of the dump file processing device provided in this application. Figure 5As shown, the electronic device of this embodiment may include: at least one processor 501; and a memory 502 communicatively connected to the at least one processor; wherein the memory 502 stores instructions executable by the at least one processor 501, the instructions being executed by the at least one processor 501 to cause the electronic device to perform the method as described in any of the above embodiments.
[0150] Optionally, the memory 502 can be either standalone or integrated with the processor 501. When the memory 502 is set up independently, the device also includes a bus for connecting the memory 502 and the processor 501.
[0151] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the foregoing embodiments, and will not be repeated here.
[0152] This application also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are executed by a processor, the methods provided in any of the foregoing embodiments can be implemented.
[0153] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method provided in any of the foregoing embodiments.
[0154] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0155] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0156] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0157] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0158] Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as resistive random access memory (RRAM), dynamic random access memory (DRAM), static random access memory (SRAM), enhanced dynamic random access memory (EDRAM), high-bandwidth memory (HBM), hybrid memory cube (HMC), etc.
[0159] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0160] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0161] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0162] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for processing dump files, characterized in that, include: In response to a database dump instruction, an immutable data table is created that allows insert operations but prohibits update or delete operations. During the nth dump, a chained digest value for the nth dump is generated based on the digest values of the nth dump file and the (n-1)th dump file, where n is an integer greater than 1; The filename of the nth dump file and the chained digest value of the nth dump are inserted into the immutable data table.
2. The method according to claim 1, characterized in that, The step of generating the chained digest value of the nth dump based on the digest values of the nth dump file and the (n-1)th dump file includes: The hash message authentication code algorithm is used to process the digest values of the nth dump file and the (n-1)th dump file to generate a chained digest value for the nth dump.
3. The method according to claim 2, characterized in that, The nth dump also includes: The nth dump file is divided into multiple data blocks; Calculate the hash value for each data block and generate a hash tree; Insert the root hash value of the hash tree into the immutable data table.
4. The method according to any one of claims 1-3, characterized in that, The method further includes: A digital signature is generated for the chain digest value of the nth dump using an asymmetric encryption algorithm; The digital signature is inserted into the immutable data table.
5. The method according to claim 4, characterized in that, The method further includes: The integrity of the dump files recorded in the immutable data table is periodically verified based on the contents stored in the immutable data table.
6. The method according to claim 5, characterized in that, The verification of the integrity of the dump files recorded in the immutable data table includes: Read the chained digest values stored in the immutable data table and verify the continuity of the chained digest values stored in the immutable data table; Calculate the chain digest value of the dump file to be verified sequentially, and compare the calculated chain digest value of the dump file to be verified with the chain digest value stored in the immutable data table; If the preset conditions are met, it is determined that the dump file to be verified has been tampered with or deleted; The preset conditions include one or more of the following: The calculated chain digest value of the dump file to be verified does not match the chain digest value stored in the immutable data table, the continuity of the chain digest value stored in the immutable data table is interrupted, the digital signature is invalidated, and the root hash value of the hash tree changes.
7. The method according to any one of claims 1-3, characterized in that, The method further includes: During the first dump, an initial digest value is calculated for the first dump file using a hash algorithm; The filename of the first dump file and the initial digest value are inserted into the immutable data table.
8. A file dumping processing device, characterized in that, include: The response module is used to create an immutable data table in response to a database dump instruction. The immutable data table allows insertion operations but prohibits update or deletion operations. A generation module is used to generate a chained digest value for the nth dump based on the digest values of the nth dump file and the (n-1)th dump file during the nth dump, where n is an integer greater than 1. An insertion module is used to insert the filename of the nth dump file and the chained digest value of the nth dump into the immutable data table.
9. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.