Database operation and maintenance method, device and equipment and storage medium

By classifying and storing database execution statements, identifying and processing target statements and style statements, the problem of databases being unable to be classified and marked is solved, improving operational efficiency and reducing manual intervention.

CN116126835BActive Publication Date: 2026-06-16PINGAN YIQIANBAO E COMMERCE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PINGAN YIQIANBAO E COMMERCE CO LTD
Filing Date
2023-03-07
Publication Date
2026-06-16

Smart Images

  • Figure CN116126835B_ABST
    Figure CN116126835B_ABST
Patent Text Reader

Abstract

The application relates to financial technology, and provides a database operation and maintenance method, device, equipment and storage medium. The method collects running statements of a service database in real time, classifies the running statements, obtains category statements and category information, stores the category statements and the category information into a tool database, in response to a database operation and maintenance request, identifies target statements and style statements from the tool database based on the category information and a request time, processes the target statements and the style statements according to the statement type of the target statements, until the service database is released from an exception, and the database operation and maintenance efficiency is improved. In addition, the application also relates to blockchain technology, and the category information can be stored in a blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of operation and maintenance technology, and in particular to a database operation and maintenance method, apparatus, equipment and storage medium. Background Technology

[0002] With the massive increase in data volume in the fintech sector, databases have become a fundamental underlying component of application systems. However, poor Structured Query Language (SQL) requests can instantly crash database services. Therefore, database maintenance is essential.

[0003] Currently, when maintaining a database, only real-time SQL requests can be viewed at the database level, making it impossible to use historical SQL requests for database maintenance. In addition, the inability of the database to categorize and label SQL requests increases the difficulty of SQL request analysis, thereby increasing the workload and complexity for maintenance personnel. Summary of the Invention

[0004] In view of the above, it is necessary to provide a database operation and maintenance method, device, equipment and storage medium that can solve the technical problem of how to improve the operation and maintenance efficiency of database services while freeing up operation and maintenance manpower.

[0005] On one hand, this invention proposes a database operation and maintenance method, which includes:

[0006] Real-time acquisition of the execution statements of the service database;

[0007] The multiple execution statements are categorized to obtain at least one category statement and category information for each category statement;

[0008] Store the at least one category statement and the category information in the tool database;

[0009] In response to a database maintenance request, based on the request time of the database maintenance request, the target statement of the service database is identified from the tool database;

[0010] Based on the category information and the request time, the style statement of the service database is identified from the tool database;

[0011] Based on the statement type of the target statement, the target statement and the style statement are processed until the service database resolves the anomaly.

[0012] According to a preferred embodiment of the present invention, classifying the plurality of execution statements to obtain at least one category statement and category information for each category statement includes:

[0013] Identify the statement format of each executed statement;

[0014] Merge the statements with the same statement format to obtain at least one category statement;

[0015] Generate a category identification code for each category of statement based on the stated statement format;

[0016] Count the number of statements executed for each category of statements;

[0017] The execution timestamp of each running statement is obtained from the service database, and the execution timestamp of each category of statement is generated based on the execution timestamp;

[0018] The category information is generated based on the category identification code, the number of statements, the execution timestamp, the library identifier of the service database, and the user identifier of the user who executed the statement.

[0019] According to a preferred embodiment of the present invention, the step of identifying the target statement of the service database from the tool database based on the request time of the database operation and maintenance request includes:

[0020] Generate a target time period based on the requested time and the preset time period;

[0021] Read the category statements whose execution timestamps fall within the target time period from the tool database as historical statements;

[0022] The total number of runs for each historical statement during the target time period is calculated based on the number of statements.

[0023] Based on the total number of runs, the target statement is selected from a plurality of historical statements.

[0024] According to a preferred embodiment of the present invention, the category information includes the execution timestamp and the number of statements, and the step of identifying the style statements of the service database from the tool database based on the category information and the request time includes:

[0025] The category statements whose execution timestamp is greater than or equal to the request time are identified as initial screening statements;

[0026] Statements whose number exceeds a preset number are identified as the style statements.

[0027] According to a preferred embodiment of the present invention, the step of processing the target statement and the style statement according to the statement type of the target statement until the service database resolves the anomaly includes:

[0028] If the statement type is not a preset type, then the style statement will be detected and eliminated; or

[0029] If the statement type is the preset type, then the target statement is detected and eliminated, and the service database is checked to see if the anomaly has been resolved.

[0030] If the service database is not resolved, then the style statement will be checked and eliminated.

[0031] According to a preferred embodiment of the present invention, detecting whether the service database has resolved the anomaly includes:

[0032] Obtain the running load and running identifier of the service database;

[0033] Compare the running load with the configured load;

[0034] If the operating load is less than the configured load, and the operating identifier is a preset identifier, then the service database is determined to be free of anomalies.

[0035] According to a preferred embodiment of the present invention, storing the at least one category statement and the category information in the tool database includes:

[0036] The category information is formatted to obtain standardized information;

[0037] Generate an execution file based on the at least one category statement and the standardized information;

[0038] Invoke the execution thread that matches the tool database and write the runtime file into the tool database.

[0039] On the other hand, the present invention also proposes a database operation and maintenance device, the database operation and maintenance device comprising:

[0040] The acquisition unit is used to collect the running statements of the service database in real time;

[0041] A classification unit is used to classify multiple execution statements to obtain at least one category statement and category information for each category statement;

[0042] Storage unit, used to store the at least one category statement and the category information into the tool database;

[0043] The identification unit is used to identify the target statement of the service database from the tool database in response to a database operation and maintenance request, based on the request time of the database operation and maintenance request;

[0044] The identification unit is further configured to identify the style statement of the service database from the tool database based on the category information and the request time;

[0045] The processing unit is used to process the target statement and the style statement according to the statement type of the target statement until the service database is cleared of the anomaly.

[0046] On the other hand, the present invention also proposes an electronic device, the electronic device comprising:

[0047] Memory, which stores computer-readable instructions; and

[0048] The processor executes computer-readable instructions stored in the memory to implement the database operation and maintenance method.

[0049] On the other hand, the present invention also proposes a computer-readable storage medium storing computer-readable instructions, which are executed by a processor in an electronic device to implement the database operation and maintenance method.

[0050] As can be seen from the above technical solutions, this application can classify multiple running statements to obtain at least one category statement, thus solving the analysis difficulty caused by the inability of the service database to perform classification and marking. Furthermore, the style statement can be quickly identified through the category information, and the target statement can be identified from the tool database at the request time. It is evident that calling the tool database can solve the problem that the service database cannot analyze and obtain the target statement. Moreover, the target statement and the style statement can be processed by combining the statement type of the target statement. Since there is no need for operation and maintenance personnel to perform statement analysis and statement removal, it can improve operation and maintenance efficiency while freeing up operation and maintenance manpower. Attached Figure Description

[0051] Figure 1 This is a flowchart of a preferred embodiment of the database operation and maintenance method of the present invention.

[0052] Figure 2 This is a schematic diagram of the tool database in the database operation and maintenance method of this invention.

[0053] Figure 3 This is a functional block diagram of a preferred embodiment of the database operation and maintenance device of the present invention.

[0054] Figure 4 This is a schematic diagram of the structure of an electronic device that implements a preferred embodiment of the database operation and maintenance method of the present invention. Detailed Implementation

[0055] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0056] like Figure 1 The diagram shown is a flowchart of a preferred embodiment of the database operation and maintenance method of the present invention. Depending on different requirements, the order of the steps in this flowchart can be changed, and some steps can be omitted.

[0057] The database operation and maintenance method is applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored computer-readable instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0058] The electronic device can be any electronic product that can interact with the user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), game console, interactive network television (IPTV), smart wearable device, etc.

[0059] The electronic devices may include network devices and / or user devices. The network devices include, but are not limited to, single network electronic devices, groups of multiple network electronic devices, or cloud computing-based systems consisting of a large number of hosts or network electronic devices.

[0060] The network in which the electronic device is located includes, but is not limited to: the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.

[0061] 101, the execution statement for the real-time data acquisition service database.

[0062] In at least one embodiment of the present invention, the service database may be a DB (database). The service database typically cannot access historical SQL (Structured Query Language) requests, and therefore cannot categorize or label SQL requests.

[0063] In at least one embodiment of the present invention, the execution statement is an SQL request collected by the electronic device from the service database in real time.

[0064] The service database allows direct access to running SQL requests. By analyzing these statements, the service database can be automated for maintenance, thus freeing up maintenance manpower.

[0065] 102. Classify the multiple execution statements to obtain at least one category statement and category information for each category statement.

[0066] In at least one embodiment of the present invention, the at least one category statement refers to a statement obtained by merging the running statements corresponding to the same statement format.

[0067] The category information includes, but is not limited to: the category identification code corresponding to each category statement, the number of statements in the running statements corresponding to each category statement, the execution timestamp of each category statement in the service database, the database identifier of the service database collected by each category statement, and the user identifier of the user executing the running statements corresponding to each category statement, etc.

[0068] Wherein, the category identification code is used to uniquely identify the category statement, the statement quantity refers to the total amount of data in the service database corresponding to the category statement, the execution timestamp refers to the specific time when the category statement runs in the service database, the library identifier refers to the identifier corresponding to the service database that collected the category statement, and the user identifier refers to the identifier corresponding to the specific user who triggered the execution of the category statement.

[0069] In at least one embodiment of the present invention, the electronic device categorizes the plurality of execution statements to obtain at least one category statement and category information for each category statement, including:

[0070] Identify the statement format of each executed statement;

[0071] Merge the statements with the same statement format to obtain at least one category statement;

[0072] Generate a category identification code for each category of statement based on the stated statement format;

[0073] Count the number of statements executed for each category of statements;

[0074] The execution timestamp of each running statement is obtained from the service database, and the execution timestamp of each category of statement is generated based on the execution timestamp;

[0075] The category information is generated based on the category identification code, the number of statements, the execution timestamp, the library identifier of the service database, and the user identifier of the user who executed the statement.

[0076] The statement format refers to the statement obtained after removing the independent variables from the executed statement. For example, if the executed statement is: select id from tab where id='a', then the statement format can be select idfrom tab where id.

[0077] The at least one category statement refers to the statement obtained by merging running statements with the same statement format. For example, running statement 1 is: select id from tab where id = 'a', and running statement 2 is: select id from tab where id = 'b'. It can be seen that running statement 1 and running statement 2 have the same statement format. Therefore, merging running statement 1 and running statement 2 results in the category statement: select id from tab where id = ''.

[0078] The runtime timestamp refers to the specific time when the runtime statement is executed in the service database, and the execution timestamp refers to the specific time when the category statement is executed in the service database.

[0079] By recognizing the statement format, the execution statements can be accurately merged, thereby improving the generation accuracy of at least one category statement. Furthermore, the category information can be directly generated from the relevant information of the execution statement, which is beneficial for subsequent analysis of the category statement.

[0080] In other embodiments, the electronic device may also invoke the PT (Percona Toolkit) tool to categorize the plurality of execution statements.

[0081] 103. Store the at least one category statement and the category information in the tool database.

[0082] It should be emphasized that, to further ensure the privacy and security of the above-mentioned information, it can also be stored in a node of a blockchain.

[0083] In at least one embodiment of the present invention, the tool database refers to a database that supports continuous writing of the at least one category statement and the category information.

[0084] In at least one embodiment of the present invention, the electronic device stores the at least one category statement and the category information in the tool database, including:

[0085] The category information is formatted to obtain standardized information;

[0086] Generate an execution file based on the at least one category statement and the standardized information;

[0087] Invoke the execution thread that matches the tool database and write the runtime file into the tool database.

[0088] The execution thread refers to a thread specifically used to write information to the tool's database.

[0089] By formatting the category information, the uniformity of the standardized information can be improved. At the same time, the execution thread can improve the writing efficiency of the running file.

[0090] like Figure 2 The diagram shown is a schematic representation of the tool database in the database operation and maintenance method of this invention. Figure 2 In the tool database, there are running file 1, running file 2, running file 3 and running file 4. The timestamp corresponding to running file 1 is execution timestamp A, the timestamp corresponding to running file 2 is execution timestamp B, the timestamp corresponding to running file 3 is execution timestamp C, and the timestamp corresponding to running file 4 is execution timestamp D.

[0091] 104. In response to a database maintenance request, based on the request time of the database maintenance request, identify the target statement of the service database from the tool database.

[0092] In at least one embodiment of the present invention, the database maintenance request may be a request triggered when the service database experiences a service anomaly or a load anomaly.

[0093] The request time refers to the point in time when the service database generates the database operation and maintenance request.

[0094] The target statements refer to n historical statements whose total execution volume exceeds a preset total volume. These historical statements are those whose execution timestamps fall within the target time period. n can be arbitrarily set, and this application will not elaborate further. The target time period is determined based on the request time of the database maintenance request and the preset time period.

[0095] In at least one embodiment of the present invention, the electronic device identifies the target statement of the service database from the tool database based on the request time of the database maintenance request, including:

[0096] Generate a target time period based on the requested time and the preset time period;

[0097] Read the category statements whose execution timestamps fall within the target time period from the tool database as historical statements;

[0098] The total number of runs for each historical statement during the target time period is calculated based on the number of statements.

[0099] Based on the total number of runs, the target statement is selected from a plurality of historical statements.

[0100] The preset time period can be set according to actual needs. For example, if the preset time period is 1 hour and the requested time is 8:00, then the target time period can be 7:00-8:00.

[0101] By combining the request time and the preset time period, the target time period can be reasonably generated, and the historical statements can be quickly read from the tool database. Then, by counting the total number of runs of the historical statements in the target time period, the target statements can be accurately filtered out.

[0102] Specifically, the electronic device selects the target statement from a plurality of historical statements based on the total number of operations, including:

[0103] The historical statements whose total execution volume is greater than the preset total volume are identified as initial statements;

[0104] Based on the total number of operations, the initial statements are sorted in descending order to obtain a statement queue;

[0105] The first n initial statements are extracted from the statement queue and used as the target statements.

[0106] By using the preset total amount, initial statements that have a significant impact on the service database can be selected. Then, by using the total amount of execution, multiple initial statements can be sorted in descending order, thereby improving the extraction efficiency of the target statement from the statement queue.

[0107] 105. Based on the category information and the request time, identify the style statement of the service database from the tool database.

[0108] In at least one embodiment of the present invention, the style statement refers to a category statement in which the execution timestamp is greater than or equal to the request time and the number of statements is greater than a preset number.

[0109] In at least one embodiment of the present invention, the category information includes the execution timestamp and the number of statements. Based on the category information and the request time, the electronic device identifies the style statements of the service database from the tool database, including:

[0110] The category statements whose execution timestamp is greater than or equal to the request time are identified as initial screening statements;

[0111] Statements whose number exceeds a preset number are identified as the style statements.

[0112] The preset quantity can be set according to actual needs.

[0113] By combining the category information and the request time, the style statements can be reasonably filtered out.

[0114] 106. Process the target statement and the style statement according to the statement type of the target statement until the service database is cleared of the anomaly.

[0115] In at least one embodiment of the present invention, the statement type may include, but is not limited to, query type, etc.

[0116] The fact that the service database has been cleared of anomalies indicates that the service database can operate normally.

[0117] In at least one embodiment of the present invention, the electronic device processes the target statement and the style statement according to the statement type of the target statement, including:

[0118] If the statement type is not a preset type, then the style statement will be detected and eliminated; or

[0119] If the statement type is the preset type, then the target statement is detected and eliminated, and the service database is checked to see if the anomaly has been resolved.

[0120] If the service database is not resolved, then the style statement will be checked and eliminated.

[0121] The preset type can be set to the query type.

[0122] By comparing the statement type with the preset type, the target statement can be directly eliminated when the statement type is detected to be the preset type. This can resolve the anomaly of the service database without affecting its operation. Furthermore, if the anomaly of the service database is not resolved, the style statement can be eliminated, thereby reducing the operating load of the service database.

[0123] In other embodiments, after detecting and eliminating the style statements, the method further includes:

[0124] The electronic device detects whether the service database has resolved the anomaly.

[0125] If the service database is not resolved, an alarm message will be generated.

[0126] In this embodiment, after the target statement and the style statement are detected and removed, the abnormal situation of the service database is further detected. If the abnormality of the service database is still not resolved, the alarm information is generated to promptly remind the operation and maintenance user.

[0127] Specifically, the electronic device detects whether the service database has resolved the anomaly by including:

[0128] Obtain the running load and running identifier of the service database;

[0129] Compare the running load with the configured load;

[0130] If the operating load is less than the configured load, and the operating identifier is a preset identifier, then the service database is determined to be free of anomalies.

[0131] The configured load refers to the maximum load that the service database can withstand, and the configured load can be set according to the operating performance of the service data.

[0132] The preset identifier is usually set as an identifier code that indicates that the service database is operating normally.

[0133] Through the above implementation method, the service database can be detected for anomalies by combining the operating load and the operating identifier, thereby improving the detection accuracy.

[0134] In other embodiments, if the operating load is greater than or equal to the configured load, or if the operating identifier is not the preset identifier, the electronic device determines that the service database has not been cleared of the anomaly.

[0135] As can be seen from the above technical solutions, this application can classify multiple running statements to obtain at least one category statement, thus solving the analysis difficulty caused by the inability of the service database to perform classification and marking. Furthermore, the style statement can be quickly identified through the category information, and the target statement can be identified from the tool database at the request time. It is evident that calling the tool database can solve the problem that the service database cannot analyze and obtain the target statement. Moreover, the target statement and the style statement can be processed by combining the statement type of the target statement. Since there is no need for operation and maintenance personnel to perform statement analysis and statement removal, it can improve operation and maintenance efficiency while freeing up operation and maintenance manpower.

[0136] like Figure 3 The diagram shown is a functional block diagram of a preferred embodiment of the database operation and maintenance device of the present invention. The database operation and maintenance device 11 includes a collection unit 110, a classification unit 111, a storage unit 112, an identification unit 113, a processing unit 114, a detection unit 115, a generation unit 116, and a determination unit 117. The module / unit referred to in this invention refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and perform a fixed function, and are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0137] The acquisition unit 110 is used to acquire the running statements of the service database in real time;

[0138] The classification unit 111 is used to classify the multiple running statements to obtain at least one category statement and category information for each category statement;

[0139] Storage unit 112 is used to store the at least one category statement and the category information into the tool database;

[0140] The identification unit 113 is used to identify the target statement of the service database from the tool database in response to a database operation and maintenance request, based on the request time of the database operation and maintenance request;

[0141] The identification unit 113 is further configured to identify the style statement of the service database from the tool database based on the category information and the request time;

[0142] The processing unit 114 is used to process the target statement and the style statement according to the statement type of the target statement until the service database is cleared of the anomaly.

[0143] In at least one embodiment of the present invention, the classification unit 111 is further configured to identify the statement format of each running statement;

[0144] Merge the statements with the same statement format to obtain at least one category statement;

[0145] Generate a category identification code for each category of statement based on the stated statement format;

[0146] Count the number of statements executed for each category of statements;

[0147] The execution timestamp of each running statement is obtained from the service database, and the execution timestamp of each category of statement is generated based on the execution timestamp;

[0148] The category information is generated based on the category identification code, the number of statements, the execution timestamp, the library identifier of the service database, and the user identifier of the user who executed the statement.

[0149] By recognizing the statement format, the execution statements can be accurately merged, thereby improving the generation accuracy of at least one category statement. Furthermore, the category information can be directly generated from the relevant information of the execution statement, which is beneficial for subsequent analysis of the category statement.

[0150] In at least one embodiment of the present invention, the identification unit is further configured to 113 generate a target time period based on the requested time and the preset time period;

[0151] Read the category statements whose execution timestamps fall within the target time period from the tool database as historical statements;

[0152] The total number of runs for each historical statement during the target time period is calculated based on the number of statements.

[0153] Based on the total number of runs, the target statement is selected from a plurality of historical statements.

[0154] By combining the request time and the preset time period, the target time period can be reasonably generated, and the historical statements can be quickly read from the tool database. Then, by counting the total number of runs of the historical statements in the target time period, the target statements can be accurately filtered out.

[0155] Specifically, the identification unit is further configured to 113 identify historical statements whose total number of runs is greater than the preset total number as initial statements;

[0156] Based on the total number of operations, the initial statements are sorted in descending order to obtain a statement queue;

[0157] The first n initial statements are extracted from the statement queue and used as the target statements.

[0158] By using the preset total amount, initial statements that have a significant impact on the service database can be selected. Then, by using the total amount of execution, multiple initial statements can be sorted in descending order, thereby improving the extraction efficiency of the target statement from the statement queue.

[0159] In at least one embodiment of the present invention, the category information includes the execution timestamp and the number of statements, and the identification unit is further configured to 113 determine the category statements whose execution timestamp is greater than or equal to the request time as preliminary screening statements;

[0160] Statements whose number exceeds a preset number are identified as the style statements.

[0161] By combining the category information and the request time, the style statements can be reasonably filtered out.

[0162] In at least one embodiment of the present invention, the processing unit 114 is further configured to detect and eliminate the style statement if the statement type is not a preset type; or

[0163] If the statement type is the preset type, then the target statement is detected and eliminated, and the service database is checked to see if the anomaly has been resolved.

[0164] If the service database is not resolved, then the style statement will be checked and eliminated.

[0165] By comparing the statement type with the preset type, the target statement can be directly eliminated when the statement type is detected to be the preset type. This can resolve the anomaly of the service database without affecting its operation. Furthermore, if the anomaly of the service database is not resolved, the style statement can be eliminated, thereby reducing the operating load of the service database.

[0166] In other embodiments, after the style statement is detected and removed, the detection unit 115 is used to detect whether the service database has been cleared of the anomaly.

[0167] The generation unit 116 is used to generate alarm information if the service database has not resolved the anomaly.

[0168] In this embodiment, after the target statement and the style statement are detected and removed, the abnormal situation of the service database is further detected. If the abnormality of the service database is still not resolved, the alarm information is generated to promptly remind the operation and maintenance user.

[0169] In at least one embodiment of the present invention, the processing unit 114 is further configured to obtain the running load and running identifier of the service database;

[0170] Compare the running load with the configured load;

[0171] If the operating load is less than the configured load, and the operating identifier is a preset identifier, then the service database is determined to be free of anomalies.

[0172] Through the above implementation method, the service database can be detected for anomalies by combining the operating load and the operating identifier, thereby improving the detection accuracy.

[0173] In other embodiments, the determining unit 117 is configured to determine that the service database has not been cleared of anomalies if the running load is greater than or equal to the configured load, or if the running identifier is not the preset identifier.

[0174] In at least one embodiment of the present invention, the storage unit 112 is further configured to format the category information to obtain standardized information;

[0175] Generate an execution file based on the at least one category statement and the standardized information;

[0176] Invoke the execution thread that matches the tool database and write the runtime file into the tool database.

[0177] By formatting the category information, the uniformity of the standardized information can be improved. At the same time, the execution thread can improve the writing efficiency of the running file.

[0178] As can be seen from the above technical solutions, this application can classify multiple running statements to obtain at least one category statement, thus solving the analysis difficulty caused by the inability of the service database to perform classification and marking. Furthermore, the style statement can be quickly identified through the category information, and the target statement can be identified from the tool database at the request time. It is evident that calling the tool database can solve the problem that the service database cannot analyze and obtain the target statement. Moreover, the target statement and the style statement can be processed by combining the statement type of the target statement. Since there is no need for operation and maintenance personnel to perform statement analysis and statement removal, it can improve operation and maintenance efficiency while freeing up operation and maintenance manpower.

[0179] like Figure 4The diagram shown is a schematic representation of the structure of an electronic device that implements the database operation and maintenance method of the present invention.

[0180] In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer-readable instructions, such as a database maintenance program, stored in the memory 12 and executable on the processor 13.

[0181] Those skilled in the art will understand that the schematic diagram is merely an example of electronic device 1 and does not constitute a limitation on electronic device 1. It may include more or fewer components than shown in the diagram, or combine certain components, or different components. For example, electronic device 1 may also include input / output devices, network access devices, buses, etc.

[0182] The processor 13 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 13 is the computing core and control center of the electronic device 1, connecting various parts of the electronic device 1 through various interfaces and lines, and executing the operating system of the electronic device 1, as well as various installed application programs and program code.

[0183] For example, the computer-readable instructions can be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units can be a series of computer-readable instruction segments capable of performing a specific function, which describe the execution process of the computer-readable instructions in the electronic device 1. For example, the computer-readable instructions can be divided into a collection unit 110, a classification unit 111, a storage unit 112, an identification unit 113, a processing unit 114, a detection unit 115, a generation unit 116, and a determination unit 117.

[0184] The memory 12 can be used to store the computer-readable instructions and / or modules. The processor 13 implements various functions of the electronic device 1 by running or executing the computer-readable instructions and / or modules stored in the memory 12 and calling the data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. The memory 12 may include non-volatile and volatile memory, such as: hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other storage devices.

[0185] The memory 12 can be the external memory and / or internal memory of the electronic device 1. Furthermore, the memory 12 can be a physical memory, such as a memory module, a TF card (Trans-flash Card), etc.

[0186] If the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by instructing related hardware through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium, and when executed by a processor, the computer-readable instructions can implement the steps of the various method embodiments described above.

[0187] The computer-readable instructions include computer-readable instruction code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), and random access memory (RAM).

[0188] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed database operation and maintenance, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0189] Combination Figure 1 The memory 12 in the electronic device 1 stores computer-readable instructions to implement a database operation and maintenance method, and the processor 13 can execute the computer-readable instructions to achieve the following:

[0190] Real-time acquisition of the execution statements of the service database;

[0191] The multiple execution statements are categorized to obtain at least one category statement and category information for each category statement;

[0192] Store the at least one category statement and the category information in the tool database;

[0193] In response to a database maintenance request, based on the request time of the database maintenance request, the target statement of the service database is identified from the tool database;

[0194] Based on the category information and the request time, the style statement of the service database is identified from the tool database;

[0195] Based on the statement type of the target statement, the target statement and the style statement are processed until the service database resolves the anomaly.

[0196] Specifically, the specific implementation method of the processor 13 for the above-mentioned computer-readable instructions can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.

[0197] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.

[0198] The computer-readable storage medium stores computer-readable instructions, which, when executed by the processor 13, are used to perform the following steps:

[0199] Real-time acquisition of the execution statements of the service database;

[0200] The multiple execution statements are categorized to obtain at least one category statement and category information for each category statement;

[0201] Store the at least one category statement and the category information in the tool database;

[0202] In response to a database maintenance request, based on the request time of the database maintenance request, the target statement of the service database is identified from the tool database;

[0203] Based on the category information and the request time, the style statement of the service database is identified from the tool database;

[0204] Based on the statement type of the target statement, the target statement and the style statement are processed until the service database resolves the anomaly.

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

[0206] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.

[0207] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.

[0208] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices described may also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.

[0209] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A database operation and maintenance method, characterized in that, The database operation and maintenance method includes: Real-time acquisition of the execution statements of the service database; The process of categorizing multiple execution statements to obtain at least one category statement and category information for each category statement includes: identifying the statement format of each execution statement; merging execution statements with the same statement format to obtain the at least one category statement; generating a category identification code for each category statement based on the statement format; counting the number of execution statements corresponding to each category statement; obtaining the execution timestamp of each execution statement from the service database and generating an execution timestamp for each category statement based on the execution timestamp; and generating the category information based on the category identification code, the number of statements, the execution timestamp, the database identifier of the service database, and the user identifier of the user executing the execution statement. Store the at least one category statement and the category information in the tool database; In response to a database maintenance request, based on the request time of the database maintenance request, the target statement of the service database is identified from the tool database; Based on the category information and the request time, the style statement of the service database is identified from the tool database; Based on the statement type of the target statement, the target statement and the style statement are processed until the service database resolves the anomaly.

2. The database operation and maintenance method as described in claim 1, characterized in that, The target statement for identifying the service database from the tool database based on the request time of the database operation and maintenance request includes: Generate a target time period based on the requested time and the preset time period; Read the category statements whose execution timestamps fall within the target time period from the tool database as historical statements; The total number of runs for each historical statement during the target time period is calculated based on the number of statements. Based on the total number of runs, the target statement is selected from a plurality of historical statements.

3. The database operation and maintenance method as described in claim 1, characterized in that, The category information includes the execution timestamp and the number of statements. The step of identifying the style statements of the service database from the tool database based on the category information and the request time includes: The category statements whose execution timestamp is greater than or equal to the request time are identified as initial screening statements; Statements whose number exceeds a preset number are identified as the style statements.

4. The database operation and maintenance method as described in claim 1, characterized in that, The step of processing the target statement and the style statement according to the statement type of the target statement includes: If the statement type is not a preset type, then the style statement will be detected and eliminated; or If the statement type is the preset type, then the target statement is detected and eliminated, and the service database is checked to see if the anomaly has been resolved. If the service database is not resolved, then the style statement will be checked and eliminated.

5. The database operation and maintenance method as described in claim 4, characterized in that, The step of detecting whether the service database has resolved the anomaly includes: Obtain the running load and running identifier of the service database; Compare the running load with the configured load; If the operating load is less than the configured load, and the operating identifier is a preset identifier, then the service database is determined to be free of anomalies.

6. The database operation and maintenance method as described in claim 1, characterized in that, The step of storing the at least one category statement and the category information into the tool database includes: The category information is formatted to obtain standardized information; Generate an execution file based on the at least one category statement and the standardized information; Invoke the execution thread that matches the tool database and write the runtime file into the tool database.

7. A database operation and maintenance device, characterized in that, The database operation and maintenance device includes: The acquisition unit is used to collect the running statements of the service database in real time; A classification unit is used to classify multiple execution statements to obtain at least one category statement and category information for each category statement, including: identifying the statement format of each execution statement; merging execution statements with the same statement format to obtain the at least one category statement; generating a category identification code for each category statement based on the statement format; counting the number of execution statements corresponding to each category statement; obtaining the execution timestamp of each execution statement from the service database and generating an execution timestamp for each category statement based on the execution timestamp; generating the category information based on the category identification code, the number of statements, the execution timestamp, the database identifier of the service database, and the user identifier of the user executing the execution statement. Storage unit, used to store the at least one category statement and the category information into the tool database; The identification unit is used to identify the target statement of the service database from the tool database in response to a database operation and maintenance request, based on the request time of the database operation and maintenance request; The identification unit is further configured to identify the style statement of the service database from the tool database based on the category information and the request time; The processing unit is used to process the target statement and the style statement according to the statement type of the target statement until the service database is cleared of the anomaly.

8. An electronic device, characterized in that, The electronic device includes: Memory, which stores computer-readable instructions; and The processor executes computer-readable instructions stored in the memory to implement the database operation and maintenance method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which are executed by a processor in an electronic device to implement the database operation and maintenance method as described in any one of claims 1 to 6.