Data deletion monitoring and backup method and device, equipment and medium
By using SQL plug-in to intercept and parse delete statements in the database, combined with whitelist and data row count judgment, efficient monitoring and backup of database data deletion operations is achieved, solving the problem of inefficiency of traditional methods and improving data security and system performance.
Patent Information
- Application Number
- CN202411752364.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-21
AI Technical Summary
Traditional database data monitoring methods are inefficient and have low accuracy, and cannot accurately and efficiently identify and intercept database data deletion operations. Traditional backup methods are inefficient and have high resource occupancy.
By using pre-set SQL plug-in to intercept the database data deletion statement, parse the deletion statement to obtain the target data table, determine whether the whitelist table contains the target data table, and determine whether data backup or alarm information is generated based on the number of deleted data rows.
Real-time monitoring and efficient backup of database deletion operations are realized, which improves data security and integrity, reduces the workload of the database, and improves system performance.
Smart Images

Figure CN119668989A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of data monitoring technology and financial technology, and in particular to a data deletion monitoring and backup method, device, equipment and medium. Background Art
[0002] With the advent of the digital age, data has become one of the most valuable assets of an enterprise. As a core tool for storing and managing data, the security and stability of databases are crucial to ensuring the operation of an enterprise. However, databases are also facing more and more challenges, including risks such as data loss, damage or hacker attacks, which may lead to huge economic losses or reputation crises. In order to avoid data being accidentally deleted by the system and unable to be retrieved, it is necessary to back up the data when it is deleted, restore the data in an emergency, and monitor the deleted data. Therefore, the research on data backup and monitoring technology has become particularly urgent, especially in the financial industry. For example, the user data and business data in the database of a financial enterprise are important assets of the financial enterprise and the key to the survival and development of the enterprise. Therefore, financial enterprises attach great importance to the security of the database.
[0003] However, traditional database data monitoring methods are inefficient and inaccurate, and are unable to accurately and efficiently identify and intercept database data deletion operations. Traditional database backup methods are also inefficient and have high resource usage. Therefore, it is necessary to develop a method that can realize real-time monitoring of database deletion instructions and real-time backup of deleted data as required. Summary of the invention
[0004] The present invention provides a data deletion monitoring and backup method, device, equipment and medium, the main purpose of which is to solve the problems of low efficiency and low accuracy of the existing data deletion monitoring and backup methods.
[0005] In a first aspect, a data deletion monitoring and backup method is provided, comprising:
[0006] Using a preset plug-in to intercept data deletion statements in the database, obtain deletion statements, and perform data analysis on the deletion statements to obtain a target data table;
[0007] Determine whether the pre-acquired whitelist table contains the target data table;
[0008] If the pre-obtained whitelist table contains the target data table, executing the delete statement;
[0009] If the whitelist table does not include the target data table, converting the delete statement into a query quantity statement, obtaining the number of deleted data rows according to the query quantity statement, and determining whether the number of deleted data rows is greater than a preset quantity threshold;
[0010] If the number of deleted data rows is less than or equal to a preset number threshold, converting the delete statement into a query detail data statement, acquiring query data according to the query detail data statement, backing up the query data, and executing the delete statement after the data backup is completed;
[0011] If the number of deleted data rows is greater than the predetermined number threshold, an alarm message is generated and sent to the operation and maintenance terminal, and after obtaining the confirmation message from the operation and maintenance terminal, the step of converting the deletion statement into a query detail data statement and obtaining the query data according to the query detail data statement is returned to execute. In a second aspect, a data deletion monitoring and backup device is provided, comprising:
[0012] The data interception module is used to intercept the data deletion statement of the database by using the preset plug-in, obtain the deletion statement, and perform data analysis on the deletion statement to obtain the target data table;
[0013] A whitelist judgment module, used to judge whether the pre-acquired whitelist table includes the target data table, and if the pre-acquired whitelist table includes the target data table, execute the delete statement, or if the whitelist table does not include the target data table, convert the delete statement into a query quantity statement, and obtain the number of deleted data rows according to the query quantity statement;
[0014] A row number judgment module is used to judge whether the number of deleted data rows is greater than a preset number threshold, and if the number of deleted data rows is less than or equal to the preset number threshold, convert the delete statement into a query detail data statement, and obtain query data according to the query detail data statement; or, if the number of deleted data rows is greater than the preset number threshold, generate an alarm message and send it to the operation and maintenance terminal, and after obtaining confirmation information from the operation and maintenance terminal, re-execute the step of converting the delete statement into a query detail data statement, and obtaining query data according to the query detail data statement;
[0015] The data backup module is used to back up the query data and execute the deletion statement after the data backup is completed.
[0016] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned data deletion monitoring and backup method when executing the computer program.
[0017] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned data deletion monitoring and backup method are implemented.
[0018] In the scheme implemented by the above-mentioned data deletion monitoring and backup method, device, computer equipment and storage medium, the client can use a pre-set plug-in to intercept data deletion statements in the database, obtain deletion statements, and perform data parsing on the deletion statements to obtain a target data table, and determine whether the pre-acquired whitelist table contains the target data table. If the pre-acquired whitelist table contains the target data table, the deletion statement is executed, or if the whitelist table does not contain the target data table, the deletion statement is converted into a query quantity statement, and the number of deleted data rows is obtained according to the query quantity statement, and the determination is made. Whether the number of deleted data rows is greater than a preset number threshold, if the number of deleted data rows is less than or equal to the preset number threshold, the delete statement is converted into a query detail data statement, and query data is obtained according to the query detail data statement, or, if the number of deleted data rows is greater than the preset number threshold, an alarm message is generated and sent to the operation and maintenance terminal, and after obtaining the confirmation information of the operation and maintenance terminal, the step of converting the delete statement into a query detail data statement and obtaining query data according to the query detail data statement is re-executed, the query data is backed up, and the delete statement is executed after the data backup is completed. In the present invention, an innovative method is adopted to enhance the monitoring and management of database deletion operations. The core of this method is to intercept the delete statement by using SQL plug-in technology. Through this configuration, we can realize real-time monitoring of deleted data at the database operation level, thereby effectively managing and protecting key data. Specifically, the present invention can capture relevant delete statements before the database executes the delete operation through a carefully designed SQL plug-in. Such an interception mechanism allows us to review and record data before it is actually deleted to ensure the security and integrity of the data. At the same time, by establishing configurations for different data tables in a targeted manner, we can optimize the monitoring process to make it more efficient and accurate. At the same time, due to the non-invasive design of the SQL plug-in, we have reduced the need to modify existing code scripts, which not only simplifies the development process, but also reduces the risk of introducing new errors. More importantly, the present invention reduces the extra workload of the database. By reducing unnecessary data processing and query operations, we reduce the pressure on the database server, thereby improving the overall system performance. This optimization not only improves the response speed of the database, but also facilitates the long-term maintenance and upgrade of the database. In summary, the present invention greatly improves the backup and monitoring efficiency of deleted data in the database by configuring the SQL plug-in to intercept the delete statement. This method not only ensures the security and integrity of the data, but also improves the efficiency of database maintenance, and provides an efficient, safe and economical solution for database management. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0020] Figure 1 Schematic diagram of an application environment of a data deletion monitoring and backup method in one embodiment of the present invention;
[0021] Figure 2 It is a flow chart of a data deletion monitoring and backup method in one embodiment of the present invention;
[0022] Figure 3 It is a structural diagram of a data deletion monitoring and backup device in one embodiment of the present invention;
[0023] Figure 4 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0024] Figure 5 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] The data deletion monitoring and backup method provided by the embodiment of the present invention can be applied in the following aspects: Figure 1In an application environment, the client intercepts a data deletion statement of the database by using a preset plug-in to obtain a deletion statement, performs data analysis on the deletion statement, obtains a target data table, and executes the deletion statement if the pre-acquired whitelist table contains the target data table, and the business process ends. If the whitelist table does not contain the target data table, the deletion statement is converted into a query quantity statement, and the number of deleted data rows is obtained according to the query quantity statement. If the number of deleted data rows is less than or equal to a preset quantity threshold, the deletion statement is converted into a query detail data statement, and query data is obtained according to the query detail data statement. If the number of deleted data rows is greater than the preset quantity threshold, an alarm message is generated and sent to the operation and maintenance terminal. After obtaining the confirmation information of the operation and maintenance terminal, the step of converting the deletion statement into a query detail data statement and obtaining query data according to the query detail data statement is re-executed. After backing up the query data, the deletion statement is executed to confirm the end of the business process. The efficiency of backing up and monitoring deleted data in the database can be effectively improved. The client can be, but not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server side can be implemented by an independent server or a server cluster composed of multiple servers. The present invention is described in detail below through specific embodiments.
[0027] See also Figure 2 As shown, Figure 2 A flowchart of a data deletion monitoring and backup method provided by an embodiment of the present invention includes the following steps:
[0028] S1. Using a preset plug-in to intercept data deletion statements in the database, obtain deletion statements, and perform data analysis on the deletion statements to obtain a target data table.
[0029] In the embodiment of the present invention, the use of a pre-set plug-in to intercept data deletion statements in the database to obtain a deletion statement is to intercept the deletion statement through a SQL (Structured Query Language) plug-in, which is intended to prevent the deletion statement from executing the data deletion operation on the database. As an extension tool, this plug-in can intervene and monitor database operations, especially those SQL commands that attempt to remove data from the database. Through this mechanism, the plug-in can detect and intervene before the deletion statement is executed, thereby ensuring the integrity and security of the data.
[0030] In detail, the SQL is a programming language specifically used to communicate with a database. It is widely used to manage and operate relational database management systems (RDBMS). SQL allows users to perform various operations, including data query, data update, data reporting and data maintenance.
[0031] In the embodiment of the present invention, the interception of delete statements is implemented through the SQ plug-in, which is based on the plug-in extension capability of mybatis to intercept delete statements. The mybatis is a semi-automatic object-relational mapping framework, which avoids the performance overhead that may be brought by the fully automatic object-relational mapping framework, and at the same time provides sufficient flexibility to write complex SQL statements. It has powerful plug-in extension capabilities and can intercept delete statements by introducing configuration into mybatis.
[0032] In the embodiment of the present invention, the method of intercepting a data deletion statement on a database by using a preset plug-in to obtain a deletion statement includes:
[0033] Obtain all operation statements for operating the database and obtain an operation statement set;
[0034] Performing deletion statement keyword recognition on the operation statement set to obtain a recognition result;
[0035] A deletion statement in the operation statement set is obtained according to the recognition result.
[0036] In detail, the acquiring of all operation statements for operating the database to obtain an operation statement set refers to identifying all SQL scripts to be executed on the database.
[0037] In detail, the identifying the delete statement keyword for the operation statement set refers to identifying whether the statements in the operation statement set contain "delete".
[0038] In the embodiment of the present invention, by using a pre-set plug-in to intercept the data deletion statement of the database, the deletion statement is obtained, which improves the subsequent analysis and acquisition of the target data table.
[0039] In the embodiment of the present invention, performing data parsing on the delete statement to obtain the target data table refers to performing SQL parsing on the delete statement to extract the data table involved in the delete statement.
[0040] In detail, the data parsing of the delete statements involves in-depth SQL syntax analysis of a group of delete statements. Specifically, this process includes detailed SQL parsing of the delete statements in order to accurately extract the data table information they operate on from these statements. Through this parsing, the specific data table targeted by each delete statement can be identified and determined, so that these data tables can be further processed or monitored.
[0041] In the embodiment of the present invention, the target data table refers to the table name of the data table.
[0042] In the embodiment of the present invention, the data parsing of the delete statement to obtain the target data table includes:
[0043] Performing field parsing on the delete statement to obtain a parsing result;
[0044] Identify the target table name in the delete statement according to the parsing result;
[0045] Determine whether the data table corresponding to the target table name is empty;
[0046] If the data table corresponding to the target table name is empty, the process ends;
[0047] If the data table corresponding to the target table name is not empty, then the data table corresponding to the target table name is confirmed to be the target data table.
[0048] In detail, to determine whether the data table corresponding to the target table name is empty, the COUNT function can be used to query the number of rows in the data table corresponding to the target table name. After executing the COUNT function query, a numerical result can be obtained, which represents the number of rows in the target data table. If this numerical result is 0, it means that there are no records in the target data table, indicating that the data table is empty. In this case, we can clearly determine that the target data table is empty. Relatively speaking, if the query result shows that the number of rows is greater than 0, that is, there is at least one record, then we can determine that the target data table is not empty. In this way, we can use a simple and efficient method to determine whether the data table in the database is empty, which has important practical significance for database management, maintenance, data backup and recovery and other operations. This method can not only reduce the workload of manual inspection, but also improve the degree of automation and accuracy of data processing.
[0049] In the embodiment of the present invention, the target data table is obtained by performing data parsing on the delete statement, thereby improving the efficiency of subsequent determination of whether the pre-acquired whitelist includes the target data table.
[0050] S2. Determine whether the pre-acquired whitelist table includes the target data table.
[0051] If the pre-acquired whitelist table contains the target data table, then S3 is executed, the delete statement is executed, or,
[0052] If the whitelist table does not include the target data table, S4 is executed to convert the delete statement into a query quantity statement, and the number of deleted data rows is obtained according to the query quantity statement.
[0053] In the embodiment of the present invention, the pre-acquired whitelist table is a table containing table names of multiple data tables. The data tables in the whitelist are regarded as unimportant data tables, so there is no need to perform data deletion interception or backup on the data tables in the whitelist.
[0054] In detail, the data tables included in the whitelist are considered by the system as non-important data tables. Such classification allows the system to be more efficient and targeted when processing data deletion requests. For those non-important data tables in the whitelist, the system will not perform data deletion interception operations. This means that when a user or application attempts to delete data in these non-important data tables, the system will not perform additional checks or blocks because the data in these data tables is not considered critical or sensitive. Similarly, for the data tables in the whitelist, the system will not perform data backup operations. In this way, the present invention can effectively reduce unnecessary processing of non-critical data, thereby optimizing system performance and ensuring that important data is properly protected and managed.
[0055] In the embodiment of the present invention, after intercepting the data deletion statement of the database by using the preset plug-in to obtain the deletion statement, and performing data parsing on the deletion statement to obtain the target data table, the method further includes:
[0056] Obtain the table names of all data tables in the whitelist table to obtain a table name set;
[0057] Determine whether the table name set contains a table name that is identical to the target data table;
[0058] If there is a table name identical to the target data table, determining that the pre-acquired whitelist table includes the target data table;
[0059] If there is no table name identical to the target data table, it is determined that the whitelist table does not include the target data table.
[0060] In the embodiment of the present invention, by judging whether the pre-acquired whitelist table includes the target data table, the efficiency of executing different operations according to the judgment result is improved. In the embodiment of the present invention, when the whitelist table includes the target data table, it means that the data included in the target data table is not important data, so there is no need to perform deletion interception or backup, and the deletion statement can be executed normally to achieve data deletion.
[0061] In the embodiment of the present invention, the conversion of the delete statement into a query quantity statement is performed by replacing a delete keyword in the delete statement with a query quantity keyword.
[0062] In the embodiment of the present invention, converting the delete statement into a query quantity statement, and obtaining the number of deleted data rows according to the query quantity statement includes:
[0063] Performing key field identification on the delete statement to obtain a key field identification result;
[0064] Identify the deletion keyword of the deletion statement according to the key field identification result to obtain a deletion keyword identification result;
[0065] According to the deletion keyword recognition result, the deletion keyword of the deletion statement is replaced with the query quantity keyword to obtain a query quantity statement;
[0066] Execute the query quantity statement to obtain the number of deleted data rows.
[0067] In detail, replacing the delete keyword of the delete statement with the query quantity keyword according to the delete keyword identification result to obtain the query quantity statement means replacing "delete" in the delete statement with "select count(*)cnt". For example, a delete statement is "delete from B where pid=1", which can be converted into "selectcount(*)cnt from B where pid=1".
[0068] In the embodiment of the present invention, the number of deleted data rows refers to the number of rows of data to be deleted by the delete statement.
[0069] In an embodiment of the present invention, when the whitelist table does not include the target data table, the deletion statement is converted into a query quantity statement, and the number of deleted data rows is obtained according to the query quantity statement, thereby improving the efficiency of subsequent judgment of whether the number of deleted data rows is greater than a preset quantity threshold.
[0070] S5. Determine whether the number of deleted data rows is greater than a preset number threshold.
[0071] In the embodiment of the present invention, the preset quantity threshold is a value set according to actual business needs.
[0072] In the embodiment of the present invention, by judging whether the number of deleted data rows is greater than a preset number threshold, the efficiency of executing different operations according to the judgment result is improved.
[0073] If the number of deleted data rows is less than or equal to a preset number threshold, execute S6, convert the delete statement into a query detail data statement, obtain query data according to the query detail data statement, back up the query data, and execute the delete statement after the data backup is completed.
[0074] In the embodiment of the present invention, converting the delete statement into a query detail data statement refers to replacing the delete keyword in the delete statement with a query detail keyword.
[0075] In the embodiment of the present invention, converting the delete statement into a query detail data statement, and acquiring query data according to the query detail data statement includes:
[0076] Identify the deletion keyword of each deletion statement in the deletion statement set to obtain a deletion keyword identification result;
[0077] According to the deletion keyword recognition result, the deletion keyword of each deletion statement is replaced with the query detail keyword to obtain the query detail statement;
[0078] Execute the query detail statement to obtain query data.
[0079] In detail, replacing the delete keyword of each delete statement with a query detail keyword according to the delete keyword identification result means replacing "delete" in the delete statement with "select*". For example, a delete statement "delete from B where pid=1" can be converted into "select*from B where pid=1".
[0080] In the embodiment of the present invention, the query data is backed up to facilitate subsequent data tracing and restoration.
[0081] In the embodiment of the present invention, the step of backing up the query data includes:
[0082] Generate a backup file according to the query data;
[0083] Performing a data recovery test on the backup file, and determining whether the backup file passes the data recovery test;
[0084] If the data recovery test fails, re-execute the step of generating a backup file according to the query data;
[0085] If the data recovery test is passed, it is confirmed that the query data is backed up successfully.
[0086] In detail, the data recovery test of the backup file refers to verifying the integrity and availability of the backup data. The core purpose of data recovery testing of backup data is to ensure that the integrity and availability of the backup data are verified. This testing process is crucial because it is directly related to the effectiveness of data backup and the ability to recover in the event of actual data loss. Specifically, data recovery testing involves extracting data from a backup file and attempting to restore it to its original state or a new environment. In this process, it is necessary to check whether all data in the backup file can be successfully restored, including files, database records, system settings, etc. Integrity verification ensures that the data in the backup is not damaged or lost during storage or transmission, while availability verification ensures that the restored data can be accessed and used normally. In order to perform this test, a series of checks and operations may need to be performed, including but not limited to comparing the consistency of the original data and the restored data, checking whether the function is normal after the data is restored, and verifying whether the access rights and integrity of the data are retained. These tests can help identify possible problems in the backup process, such as damage to the backup file, data loss, or errors in the recovery process.
[0087] In the embodiment of the present invention, by backing up the query data and executing the deletion statement after the data backup is completed, the efficiency of backing up and monitoring the deleted data is improved.
[0088] In an embodiment of the present invention, when the number of deleted data rows is less than or equal to a preset threshold value, the efficiency of obtaining query data is improved by converting the deletion statement into a query detail data statement, and the query data is obtained by executing the query detail data statement, thereby improving the efficiency of subsequent backup of the query data.
[0089] If the number of deleted data rows is greater than the preset threshold, execute S7, generate an alarm message and send it to the operation and maintenance terminal, obtain the confirmation information from the operation and maintenance terminal, and then return to S6, convert the deletion statement into a query detail data statement, and obtain the query data according to the query detail data statement.
[0090] In the embodiment of the present invention, when the number of deleted data rows is greater than the predetermined number threshold, it indicates that the deletion operation at this time is risky, and therefore an alarm message needs to be generated to prompt relevant operation and maintenance personnel.
[0091] In the embodiment of the present invention, the generating of alarm information and sending it to the operation and maintenance terminal may be sending an alarm email to the operation and maintenance terminal.
[0092] In detail, the obtaining of confirmation information from the operation and maintenance terminal refers to obtaining confirmation information from the operation and maintenance personnel of the operation and maintenance terminal on the alarm information.
[0093] In the embodiment of the present invention, when the number of deleted data rows is greater than a predetermined number threshold, an alarm message is generated and sent to the operation and maintenance terminal, and confirmation information of the operation and maintenance terminal is obtained, thereby improving data security.
[0094] It can be seen that in the embodiment of the present invention, an innovative method is adopted to enhance the monitoring and management of database deletion operations. The core of this method is to intercept the deletion statement by using SQL plug-in technology. Through this configuration, we can realize real-time monitoring of deleted data at the database operation level, so as to effectively manage and protect key data. Specifically, the present invention can capture the relevant deletion statement before the database executes the deletion operation through a carefully designed SQL plug-in. Such an interception mechanism allows us to review and record the data before it is actually deleted, ensuring the security and integrity of the data. At the same time, by establishing configurations for different data tables in a targeted manner, we can optimize the monitoring process to make it more efficient and accurate. At the same time, due to the non-invasive design of the SQL plug-in, we reduce the need to modify the existing code scripts, which not only simplifies the development process, but also reduces the risk of introducing new errors. More importantly, the present invention reduces the additional workload of the database. By reducing unnecessary data processing and query operations, we reduce the pressure on the database server, thereby improving the overall system performance. This optimization not only improves the response speed of the database, but also facilitates the long-term maintenance and upgrade of the database. In summary, the present invention greatly improves the backup and monitoring efficiency of deleted data in the database by configuring the SQL plug-in to intercept the deletion statement. This method not only ensures the security and integrity of data, but also improves the efficiency of database maintenance, providing an efficient, secure and economical solution for database management.
[0095] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0096] In one embodiment, a data deletion monitoring and backup device is provided, and the data deletion monitoring and backup device corresponds one-to-one with the data deletion monitoring and backup method in the above embodiment. Figure 3As shown, the data deletion monitoring and backup device includes a data interception module 101, a whitelist determination module 102, a row number determination module 103 and a data backup module 104. The functional modules are described in detail as follows:
[0097] The data interception module 101 is used to intercept the data deletion statement of the database by using a preset plug-in, obtain the deletion statement, and perform data analysis on the deletion statement to obtain the target data table;
[0098] The whitelist determination module 102 is used to determine whether the pre-acquired whitelist table includes the target data table, and if the pre-acquired whitelist table includes the target data table, execute the deletion statement.
[0099] Alternatively, if the whitelist table does not include the target data table, the delete statement is converted into a query quantity statement, and the number of deleted data rows is obtained according to the query quantity statement;
[0100] The row number judgment module 103 is used to judge whether the number of deleted data rows is greater than a preset number threshold. If the number of deleted data rows is less than or equal to the preset number threshold, the delete statement is converted into a query detail data statement, and query data is obtained according to the query detail data statement; or, if the number of deleted data rows is greater than the preset number threshold, an alarm message is generated and sent to the operation and maintenance terminal. After obtaining confirmation information from the operation and maintenance terminal, the step of converting the delete statement into a query detail data statement and obtaining query data according to the query detail data statement is re-executed;
[0101] The data backup module 104 is used to back up the query data and execute the deletion statement after the data backup is completed.
[0102] In one embodiment, the data interception module 101, when executing the data deletion statement interception on the database using the preset plug-in and obtaining the deletion statement, is used to:
[0103] Obtain all operation statements for operating the database and obtain an operation statement set;
[0104] Performing deletion statement keyword recognition on the operation statement set to obtain a recognition result;
[0105] A deletion statement in the operation statement set is obtained according to the recognition result.
[0106] In one embodiment, the data interception module 101, when performing data parsing on the delete statement to obtain the target data table, is used to:
[0107] Performing field parsing on the delete statement to obtain a parsing result;
[0108] Identify the target table name in the delete statement according to the parsing result;
[0109] Determine whether the data table corresponding to the target table name is empty;
[0110] If the data table corresponding to the target table name is empty, the process ends;
[0111] If the data table corresponding to the target table name is not empty, then the data table corresponding to the target table name is confirmed to be the target data table.
[0112] In one embodiment, the whitelist determination module 102, after executing the predetermined plug-in to intercept the data deletion statement of the database, obtain the deletion statement, and perform data analysis on the deletion statement to obtain the target data table, is further used to:
[0113] Obtain the table names of all data tables in the whitelist table to obtain a table name set;
[0114] Determine whether the table name set contains a table name that is identical to the target data table;
[0115] If there is a table name identical to the target data table, determining that the pre-acquired whitelist table includes the target data table;
[0116] If there is no table name identical to the target data table, it is determined that the whitelist table does not include the target data table.
[0117] In one embodiment, the whitelist determination module 102, when converting the delete statement into a query quantity statement and obtaining the number of deleted data rows according to the query quantity statement, is used to:
[0118] Performing key field identification on the delete statement to obtain a key field identification result;
[0119] Identify the deletion keyword of the deletion statement according to the key field identification result to obtain a deletion keyword identification result;
[0120] According to the deletion keyword recognition result, the deletion keyword of the deletion statement is replaced with the query quantity keyword to obtain a query quantity statement;
[0121] Execute the query quantity statement to obtain the number of deleted data rows.
[0122] In one embodiment, the row number determination module 103, when converting the delete statement into a query detail data statement and acquiring query data according to the query detail data statement, is used to:
[0123] Identify the deletion keyword of each deletion statement in the deletion statement set to obtain a deletion keyword identification result;
[0124] According to the deletion keyword recognition result, the deletion keyword of each deletion statement is replaced with the query detail keyword to obtain the query detail statement;
[0125] Execute the query detail statement to obtain query data.
[0126] In one embodiment, when performing data backup on the query data, the data backup module 104 is used to:
[0127] Generate a backup file according to the query data;
[0128] Performing a data recovery test on the backup file, and determining whether the backup file passes the data recovery test;
[0129] If the data recovery test fails, re-execute the step of generating a backup file according to the query data;
[0130] If the data recovery test is passed, it is confirmed that the query data is backed up successfully.
[0131] The present invention provides a data deletion monitoring and backup device, which enhances the monitoring and management of database deletion operations by adopting an innovative method. The core of this method is to intercept deletion statements using SQL plug-in technology. Through this configuration, we can achieve real-time monitoring of deleted data at the database operation level, thereby effectively managing and protecting key data. Specifically, the present invention can capture relevant deletion statements before the database executes the deletion operation through a carefully designed SQL plug-in. Such an interception mechanism allows us to review and record data before it is actually deleted, ensuring the security and integrity of the data. At the same time, by establishing configurations for different data tables in a targeted manner, we can optimize the monitoring process to make it more efficient and accurate. At the same time, due to the non-invasive design of the SQL plug-in, we reduce the need to modify existing code scripts, which not only simplifies the development process, but also reduces the risk of introducing new errors. More importantly, the present invention reduces the additional workload of the database. By reducing unnecessary data processing and query operations, we reduce the pressure on the database server, thereby improving the overall system performance. This optimization not only improves the response speed of the database, but also facilitates the long-term maintenance and upgrade of the database. In summary, the present invention greatly improves the backup and monitoring efficiency of deleted data in the database by configuring the SQL plug-in to intercept the deletion statement. This method not only ensures the security and integrity of the data, but also improves the efficiency of database maintenance, providing an efficient, secure and economical solution for database management. For the specific definition of the data deletion monitoring and backup device, please refer to the definition of the intelligent question and answer method above, which will not be repeated here. Each module in the above-mentioned data deletion monitoring and backup device can be implemented in whole or in part through software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0132] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client via a network connection. When the computer program is executed by the processor, it realizes the functions or steps of a data deletion monitoring and backup method server side.
[0133] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it realizes the functions or steps of the client side of a data deletion monitoring and backup method
[0134] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0135] Using a preset plug-in to intercept data deletion statements in the database, obtain deletion statements, and perform data analysis on the deletion statements to obtain a target data table;
[0136] Determine whether the pre-acquired whitelist table contains the target data table;
[0137] If the pre-obtained whitelist table contains the target data table, executing the delete statement;
[0138] If the whitelist table does not include the target data table, converting the delete statement into a query quantity statement, obtaining the number of deleted data rows according to the query quantity statement, and determining whether the number of deleted data rows is greater than a preset quantity threshold;
[0139] If the number of deleted data rows is less than or equal to a preset number threshold, converting the delete statement into a query detail data statement, acquiring query data according to the query detail data statement, backing up the query data, and executing the delete statement after the data backup is completed;
[0140] If the number of deleted data rows is greater than the predetermined number threshold, an alarm message is generated and sent to the operation and maintenance terminal, and after obtaining the confirmation message from the operation and maintenance terminal, the process returns to the step of converting the delete statement into a query detail data statement and obtaining query data according to the query detail data statement. In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0141] Using a preset plug-in to intercept data deletion statements in the database, obtain deletion statements, and perform data analysis on the deletion statements to obtain a target data table;
[0142] Determine whether the pre-acquired whitelist table contains the target data table;
[0143] If the pre-obtained whitelist table contains the target data table, executing the delete statement;
[0144] If the whitelist table does not include the target data table, converting the delete statement into a query quantity statement, obtaining the number of deleted data rows according to the query quantity statement, and determining whether the number of deleted data rows is greater than a preset quantity threshold;
[0145] If the number of deleted data rows is less than or equal to a preset number threshold, converting the delete statement into a query detail data statement, acquiring query data according to the query detail data statement, backing up the query data, and executing the delete statement after the data backup is completed;
[0146] If the number of deleted data rows is greater than the pre-set threshold, an alarm message is generated and sent to the operation and maintenance terminal, and after obtaining the confirmation message from the operation and maintenance terminal, the process returns to the step of converting the deletion statement into a query detail data statement and obtaining the query data according to the query detail data statement. It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device mentioned above can be referred to in the relevant descriptions of the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0147] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0148] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0149] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0150] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0151] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0152] Finally, it should be noted that if software tools or components other than those of the company appear in the application embodiments, they are only used for illustration and do not represent actual use. The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the above embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.
Claims
1. A data deletion monitoring and backup method, characterized in that: include: Using a preset plug-in to intercept data deletion statements in the database, obtain deletion statements, and perform data analysis on the deletion statements to obtain a target data table; Determine whether the pre-acquired whitelist table contains the target data table; If the pre-obtained whitelist table contains the target data table, executing the delete statement; If the whitelist table does not include the target data table, converting the delete statement into a query quantity statement, obtaining the number of deleted data rows according to the query quantity statement, and determining whether the number of deleted data rows is greater than a preset quantity threshold; If the number of deleted data rows is less than or equal to a preset number threshold, converting the delete statement into a query detail data statement, acquiring query data according to the query detail data statement, backing up the query data, and executing the delete statement after the data backup is completed; If the number of deleted data rows is greater than the preset threshold value, an alarm message is generated and sent to the operation and maintenance terminal. After obtaining the confirmation information from the operation and maintenance terminal, the process returns to the step of converting the deletion statement into a query detail data statement and obtaining query data according to the query detail data statement.
2. The data deletion monitoring and backup method according to claim 1, characterized in that: The method of using a preset plug-in to intercept a data deletion statement in the database to obtain a deletion statement includes: Obtain all operation statements for operating the database and obtain an operation statement set; Performing deletion statement keyword recognition on the operation statement set to obtain a recognition result; A deletion statement in the operation statement set is obtained according to the recognition result.
3. The data deletion monitoring and backup method according to claim 1, characterized in that: The data parsing of the delete statement to obtain a target data table includes: Performing field parsing on the delete statement to obtain a parsing result; Identify the target table name in the delete statement according to the parsing result; Determine whether the data table corresponding to the target table name is empty; If the data table corresponding to the target table name is empty, the process ends; If the data table corresponding to the target table name is not empty, then the data table corresponding to the target table name is confirmed to be the target data table.
4. The data deletion monitoring and backup method according to claim 1, characterized in that: After intercepting the data deletion statement of the database by using the preset plug-in to obtain the deletion statement, and performing data parsing on the deletion statement to obtain the target data table, the method further includes: Obtain the table names of all data tables in the whitelist table to obtain a table name set; Determine whether the table name set contains a table name that is identical to the target data table; If there is a table name identical to the target data table, determining that the pre-acquired whitelist table includes the target data table; If there is no table name identical to the target data table, it is determined that the whitelist table does not include the target data table.
5. The data deletion monitoring and backup method according to claim 1, characterized in that: The step of converting the delete statement into a query quantity statement and obtaining the number of deleted data rows according to the query quantity statement includes: Performing key field identification on the delete statement to obtain a key field identification result; Identify the deletion keyword of the deletion statement according to the key field identification result to obtain a deletion keyword identification result; According to the deletion keyword recognition result, the deletion keyword of the deletion statement is replaced with the query quantity keyword to obtain a query quantity statement; Execute the query quantity statement to obtain the number of deleted data rows.
6. The data deletion monitoring and backup method according to claim 1, characterized in that: The step of converting the delete statement into a detailed data query statement and acquiring query data according to the detailed data query statement includes: Identify the deletion keyword of each deletion statement in the deletion statement set to obtain a deletion keyword identification result; According to the deletion keyword recognition result, the deletion keyword of each deletion statement is replaced with the query detail keyword to obtain the query detail statement; Execute the query detail statement to obtain query data.
7. The data deletion monitoring and backup method according to claim 1, characterized in that: The step of backing up the query data includes: Generate a backup file according to the query data; Performing a data recovery test on the backup file, and determining whether the backup file passes the data recovery test; If the data recovery test fails, re-execute the step of generating a backup file according to the query data; If the data recovery test is passed, it is confirmed that the query data is backed up successfully.
8. A data deletion monitoring and backup device, characterized in that: include: The data interception module is used to intercept the data deletion statement of the database by using a preset plug-in, obtain the deletion statement, and perform data analysis on the deletion statement to obtain the target data table; A whitelist judgment module, used to judge whether the pre-acquired whitelist table includes the target data table, and if the pre-acquired whitelist table includes the target data table, execute the delete statement, or if the whitelist table does not include the target data table, convert the delete statement into a query quantity statement, and obtain the number of deleted data rows according to the query quantity statement; A row number judgment module is used to judge whether the number of deleted data rows is greater than a preset number threshold, and if the number of deleted data rows is less than or equal to the preset number threshold, convert the delete statement into a query detail data statement, and obtain query data according to the query detail data statement; or, if the number of deleted data rows is greater than the preset number threshold, generate an alarm message and send it to the operation and maintenance terminal, and after obtaining confirmation information from the operation and maintenance terminal, re-execute the step of converting the delete statement into a query detail data statement, and obtaining query data according to the query detail data statement; The data backup module is used to back up the query data and execute the deletion statement after the data backup is completed.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the data deletion monitoring and backup method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the data deletion monitoring and backup method as described in any one of claims 1 to 7 are implemented.