Database exception handling methods, devices, electronic equipment and storage media
By dividing database performance metrics into multiple metric groups and performing anomaly detection, and combining this with an anomaly scenario database to match and handle contingency plans, the problems of false positives and false negatives in database anomaly detection have been solved, achieving automation of anomaly handling and the accumulation of experience.
Patent Information
- Application Number
- CN202611259315.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-17
AI Technical Summary
Existing database anomaly detection relies on fixed thresholds, leading to frequent false alarms or missed alarms. Furthermore, anomaly handling solutions depend on human experience, resulting in low processing efficiency and difficulty in accumulating and reusing experience.
The database operation metrics data are divided into multiple metric groups, and anomaly detection is performed on each group. Anomaly events are generated, and the anomaly events are matched with a preset anomaly scenario library to determine the handling plan. Feedback information is then used to update the anomaly scenario library.
It covers anomaly detection across different operational dimensions of the database, reducing false alarms or missed alarms, decreasing reliance on human experience, and enabling the accumulation and reuse of anomaly handling experience.
Smart Images

Figure CN123114909A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing, and in particular to a database anomaly handling method, apparatus, electronic device, and storage medium. Background Technology
[0002] Database systems are widely used in various business scenarios such as finance, e-commerce, and government affairs, and are a critical infrastructure supporting the continuous operation of businesses. As business scale continues to expand and data volume continues to grow, the complexity of database system operation and maintenance also increases.
[0003] Currently, database anomaly detection primarily relies on monitoring systems to collect operational metrics data and set fixed thresholds for alerts. Upon receiving an alert, operations and maintenance personnel determine the anomaly type and select appropriate handling methods based on their personal experience. However, due to the significant periodic variations in database workload, fixed thresholds struggle to adapt to changing patterns across different time periods, leading to frequent false alarms or missed alarms. Furthermore, different anomaly symptoms may correspond to different root causes, and the selection of anomaly handling solutions depends on manual experience, resulting in low efficiency and making it difficult to accumulate and reuse experience gained during anomaly handling. Summary of the Invention
[0004] This disclosure provides a database exception handling method, apparatus, electronic device, and storage medium. Its main objective is to solve at least one of the above-mentioned technical problems.
[0005] According to a first aspect of this disclosure, a database exception handling method is provided, comprising: Collect operational metrics data from the database; The operational metric data is divided into multiple metric groups, and anomaly detection is performed on each metric group. When an anomaly is detected in any metric group, an anomaly event is generated. The multiple metric groups include at least two of the following: overall performance metric group, resource usage metric group, single SQL performance metric group, and process status metric group. Based on the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library, the target abnormal scenario and the corresponding handling plan are determined. Obtain feedback information on handling the abnormal event according to the processing plan, and update the abnormal scenario database based on the feedback information.
[0006] In some embodiments, the anomaly detection for each indicator group includes: Anomaly detection is performed on the overall performance index group based on a pre-trained unsupervised or semi-supervised anomaly detection model. Anomaly detection is performed on the resource usage indicator group based on preset upper and lower thresholds of resource utilization rate and the rate of change per unit time. Anomaly detection is performed on the single SQL performance indicator group based on the high percentile threshold determined from historical data of the same period. Based on the preset normal operating range and / or alarm information, anomaly detection is performed on the process status indicator group.
[0007] In some embodiments, before the pre-trained unsupervised or semi-supervised anomaly detection model performs anomaly detection on the overall performance metric group, the method further includes: Historical normal sample data of the database is obtained at preset time intervals; wherein, the historical normal sample data is the operation indicator data of historical periods with the same business cycle characteristics as the current time. The unsupervised or semi-supervised anomaly detection model is trained based on the historical normal sample data to obtain the pre-trained unsupervised or semi-supervised anomaly detection model.
[0008] In some embodiments, the anomaly detection model based on pre-trained unsupervised or semi-supervised training performs anomaly detection on the overall performance metric group, including: Input the current feature vector of the overall performance index group into the pre-trained unsupervised or semi-supervised anomaly detection model, calculate the average path length and map it to the anomaly score; When the abnormal score exceeds a threshold determined based on historical normal samples, the overall performance index group is determined to be abnormal.
[0009] In some embodiments, before determining the target abnormal scenario and its corresponding handling plan based on the matching degree between the abnormal event and each abnormal scenario in a preset abnormal scenario library, the method further includes: Construct the preset abnormal scenario library; the abnormal scenario library contains multiple abnormal scenarios; each abnormal scenario is configured with scenario feature tags, associated historical case sets, key indicators and non-key indicators, weight coefficients corresponding to each indicator, and processing plans; In the same abnormal scenario, the weight coefficient of the key indicator is greater than that of the non-key indicator, and the average weight coefficient of all indicators is 1.
[0010] In some embodiments, determining the target abnormal scenario and its corresponding handling plan based on the matching degree between the abnormal event and each abnormal scenario in a preset abnormal scenario library includes: Extract the abnormal feature vector corresponding to the abnormal event; Based on the weight coefficients corresponding to each indicator in each abnormal scenario, the average weighted distance and minimum weighted distance between the abnormal feature vector and the feature vectors of all historical cases in each abnormal scenario are determined respectively. Based on the average of the average weighted distance and the minimum weighted distance corresponding to each of the abnormal scenarios, the comprehensive distance between the abnormal event and each of the abnormal scenarios is determined. Based on the order of comprehensive distance from smallest to largest, a preset number of abnormal scenarios are determined as the target abnormal scenarios. The corresponding handling plan for the target abnormal scenarios and the analysis report corresponding to the historical case with the smallest weighted distance in the target abnormal scenarios are obtained and output.
[0011] In some embodiments, obtaining feedback information on handling the abnormal event according to the processing plan, and updating the abnormal scenario database based on the feedback information, includes: If the feedback information indicates that the target abnormal scenario is correctly matched, then the abnormal event and the abnormal feature vector are added as new historical cases to the historical case set corresponding to the target abnormal scenario. If the feedback information indicates that the target abnormal scenario is mismatched, then the division of the key indicators and non-key indicators of the target abnormal scenario and / or the weight coefficients corresponding to each indicator are adjusted. If the feedback information indicates that the abnormal event does not belong to any existing abnormal scenario in the abnormal scenario library, then a new abnormal scenario is created based on the abnormal event and added to the abnormal scenario library.
[0012] According to a second aspect of this disclosure, a database exception handling apparatus is provided, comprising: The data acquisition unit is used to collect operational indicator data from the database. The detection unit is used to divide the operational indicator data into multiple indicator groups, perform anomaly detection on each indicator group, and generate an anomaly event when an anomaly is detected in any indicator group; wherein, the multiple indicator groups include at least two of the following: overall performance indicator group, resource usage indicator group, single SQL performance indicator group, and process status indicator group. The matching unit is used to determine the target abnormal scenario and the corresponding handling plan based on the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library. The update unit is used to obtain feedback information on the handling of the abnormal event according to the processing plan, and update the abnormal scenario library based on the feedback information.
[0013] In some embodiments, the detection unit includes: The first detection module is used to perform anomaly detection on the overall performance index group based on a pre-trained unsupervised or semi-supervised anomaly detection model. The second detection module is used to detect anomalies in the resource usage index group based on preset upper and lower thresholds of resource utilization and the rate of change per unit time. The third detection module is used to perform anomaly detection on the single SQL performance index group based on the high percentile threshold determined by historical data from the same period. The fourth detection module is used to perform anomaly detection on the process status indicator group based on the preset normal operating range and / or alarm information.
[0014] In some embodiments, the apparatus further includes: The acquisition module is used to acquire historical normal sample data of the database at preset time intervals before the first detection module performs anomaly detection on the overall performance index group based on a pre-trained unsupervised or semi-supervised anomaly detection model; wherein, the historical normal sample data is the operation index data of historical time periods with the same business cycle characteristics as the current time. The training module is used to train the unsupervised or semi-supervised anomaly detection model based on the historical normal sample data, so as to obtain the pre-trained unsupervised or semi-supervised anomaly detection model.
[0015] In some embodiments, the first detection module is further configured to: Input the current feature vector of the overall performance index group into the pre-trained unsupervised or semi-supervised anomaly detection model, calculate the average path length and map it to the anomaly score; When the abnormal score exceeds a threshold determined based on historical normal samples, the overall performance index group is determined to be abnormal.
[0016] In some embodiments, the apparatus further includes: A construction unit is used to construct the preset abnormal scenario library before the matching unit determines the target abnormal scenario and corresponding handling plan based on the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library. The abnormal scenario library contains multiple abnormal scenarios. Each abnormal scenario is configured with scenario feature tags, associated historical case sets, key indicators and non-key indicators, weight coefficients corresponding to each indicator, and handling plans. In the same abnormal scenario, the weight coefficient of the key indicator is greater than that of the non-key indicator, and the average weight coefficient of all indicators is 1.
[0017] In some embodiments, the matching unit includes: The extraction module is used to extract the abnormal feature vector corresponding to the abnormal event; The first determining module is used to determine the average weighted distance and the minimum weighted distance between the abnormal feature vector and the feature vectors of all historical cases under each abnormal scenario, based on the weight coefficients corresponding to each indicator of each abnormal scenario. The second determining module is used to determine the comprehensive distance between the abnormal event and each abnormal scenario based on the average of the average weighted distance and the minimum weighted distance corresponding to each abnormal scenario. The output module is used to determine a preset number of abnormal scenarios as the target abnormal scenarios in order of increasing comprehensive distance, obtain and output the corresponding processing plan for the target abnormal scenarios and the analysis report corresponding to the historical case with the smallest weighted distance in the target abnormal scenarios.
[0018] In some embodiments, the updating unit is further configured to: If the feedback information indicates that the target abnormal scenario is correctly matched, then the abnormal event and the abnormal feature vector are added as new historical cases to the historical case set corresponding to the target abnormal scenario. If the feedback information indicates that the target abnormal scenario is mismatched, then the division of the key indicators and non-key indicators of the target abnormal scenario and / or the weight coefficients corresponding to each indicator are adjusted. If the feedback information indicates that the abnormal event does not belong to any existing abnormal scenario in the abnormal scenario library, then a new abnormal scenario is created based on the abnormal event and added to the abnormal scenario library.
[0019] According to a third aspect of this disclosure, an electronic device is provided, comprising: At least one processor; and a memory communicatively connected to said at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect above.
[0020] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method described in the first aspect above.
[0021] According to a fifth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described in the first aspect above.
[0022] In summary, the database anomaly handling method, apparatus, electronic device, and storage medium provided in this disclosure include: collecting database operation indicator data; dividing the operation indicator data into multiple indicator groups, performing anomaly detection on each indicator group, and generating an anomaly event when any indicator group detects an anomaly; wherein the multiple indicator groups include at least two of an overall performance indicator group, a resource usage indicator group, a single SQL performance indicator group, and a process status indicator group; determining a matching target anomaly scenario and a corresponding handling plan based on the matching degree between the anomaly event and each anomaly scenario in a preset anomaly scenario library; obtaining feedback information on handling the anomaly event according to the handling plan, and updating the anomaly scenario library based on the feedback information. Compared with related technologies, the solution disclosed in this paper can divide the operational indicator data of the database into multiple indicator groups and perform anomaly detection on each group. When an anomaly is detected in any indicator group, an anomaly event is generated. Then, the target anomaly scenario and its corresponding handling plan are determined by the matching degree between the anomaly event and each anomaly scenario in the preset anomaly scenario library. The anomaly scenario library is updated based on the feedback information after the handling plan is executed. This covers anomaly detection in different operational dimensions of the database, reduces false alarms or false negatives caused by fixed thresholds, and provides corresponding handling plans for anomaly events through a scenario matching mechanism, reducing the reliance on human experience. At the same time, the anomaly scenario library is continuously updated through feedback information, so that anomaly handling experience can be accumulated and reused.
[0023] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0024] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein: Figure 1 This is a flowchart illustrating a database exception handling method provided in an embodiment of the present disclosure. Figure 2 This is a flowchart illustrating an unsupervised or semi-supervised anomaly detection model training method provided in an embodiment of this disclosure. Figure 3 This is a flowchart illustrating an anomaly detection method for an overall performance index group provided in an embodiment of this disclosure. Figure 4 A flowchart illustrating an abnormal scenario matching and contingency plan recommendation method provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram of the structure of a database exception handling device provided in an embodiment of the present disclosure; Figure 6 This is a schematic diagram of another database exception handling device provided in an embodiment of the present disclosure; Figure 7 This is a schematic block diagram of an example electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0025] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0026] The database anomaly handling method, apparatus, electronic device, and storage medium of this disclosure are described below with reference to the accompanying drawings.
[0027] Figure 1 This is a flowchart illustrating a database exception handling method provided in an embodiment of the present disclosure.
[0028] like Figure 1 As shown, the method includes the following steps: Step 101: Collect operational metrics data from the database.
[0029] In some embodiments, operational indicator data refers to various quantitative indicators that reflect the operational status of the database. Operational indicator data can be obtained through the performance monitoring interface provided by the database itself, through an agent program deployed on the database server, or through statistical views built into the database management system. The methods for collecting operational indicator data include, but are not limited to, the methods described above. The collection period for operational indicator data can be configured according to actual needs; for example, it can be set to collect data once per second or once every five seconds. The collected operational indicator data can be stored in a time-series database, a relational database, or a memory cache; this disclosure does not limit the storage location.
[0030] By using the above methods, we can obtain various quantitative indicators that reflect the current operating status of the database, providing a data foundation for subsequent anomaly detection.
[0031] Step 102: Divide the operational indicator data into multiple indicator groups, and perform anomaly detection on each indicator group. When an anomaly is detected in any indicator group, an anomaly event is generated. The multiple indicator groups include at least two of the following: overall performance indicator group, resource usage indicator group, single SQL performance indicator group, and process status indicator group.
[0032] In some embodiments, the overall performance indicator group refers to a set of indicators reflecting the overall operational status of the database; the resource usage indicator group refers to a set of indicators reflecting the hardware resource consumption of the database server; the single SQL performance indicator group refers to a set of indicators reflecting the execution status of a single SQL statement in the database; and the process status indicator group refers to a set of indicators reflecting the operational status of database-related processes and connection links. After dividing the operational indicator data into multiple indicator groups, anomaly detection is performed independently on each indicator group. The anomaly detection of each indicator group is independent of each other. When any indicator group detects an anomaly, an anomaly event is generated. An anomaly event refers to an event that deviates from the normal state during database operation, and each anomaly event corresponds to the indicator group that triggered the anomaly.
[0033] The above method enables anomaly detection in the database from multiple dimensions. When an anomaly occurs in any dimension, an anomaly event can be generated, avoiding the problem of anomaly omission caused by relying on only a single dimension or comprehensive score for judgment.
[0034] Step 103: Based on the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library, determine the target abnormal scenario and the corresponding handling plan.
[0035] In some embodiments, the abnormal scenario library is pre-built, containing multiple abnormal scenarios. Each abnormal scenario corresponds to a known database anomaly type, and each abnormal scenario is associated with a corresponding handling plan. The handling plan refers to a pre-defined disposal scheme for a specific abnormal scenario. The abnormal scenario library can be constructed manually based on historical operation and maintenance experience, or automatically generated based on statistical analysis of historical abnormal events. This disclosure does not limit the construction method of the abnormal scenario library. The matching degree is used to characterize the similarity between an abnormal event and a certain abnormal scenario in the abnormal scenario library. The matching degree can be calculated based on the distance between feature vectors, based on rule matching, or based on prediction using a machine learning model. This disclosure does not limit the specific calculation method of the matching degree. After determining the target abnormal scenario, the corresponding handling plan is obtained and output for operation and maintenance personnel to refer to and execute.
[0036] By using the above methods, abnormal events can be matched with known abnormal scenarios, the abnormal type can be automatically determined, and corresponding handling plans can be output, reducing the reliance on the personal experience of operation and maintenance personnel.
[0037] Step 104: Obtain feedback information on handling the abnormal event according to the processing plan, and update the abnormal scenario database based on the feedback information.
[0038] In some embodiments, feedback information refers to the information recorded by operation and maintenance personnel after handling abnormal events according to the handling plan. Feedback information can be obtained through the human-computer interaction interface of the operation and maintenance management platform, or it can be automatically generated by an automated script after executing the handling plan. This disclosure does not limit the method of obtaining feedback information. Updating the abnormal scenario library based on feedback information refers to modifying or expanding the content in the abnormal scenario library according to the handling results recorded in the feedback information. The updated content may include, but is not limited to, adding abnormal scenarios, adjusting the configuration information of existing abnormal scenarios, and supplementing existing abnormal scenarios with new cases. This disclosure does not limit the specific content of the update.
[0039] In this way, the experience gained from each exception handling can be fed back into the exception scenario library, which will be continuously enriched and improved with use, thus achieving the continuous accumulation of exception handling experience.
[0040] In summary, the database anomaly handling method provided by the embodiments of this disclosure can divide the database's operational indicator data into multiple indicator groups and perform anomaly detection on each group. When an anomaly is detected in any indicator group, an anomaly event is generated. Then, the target anomaly scene and its corresponding handling plan are determined by the matching degree between the anomaly event and each anomaly scene in the preset anomaly scene library. The anomaly scene library is updated based on the feedback information after the handling plan is executed, thereby covering anomaly detection in different operational dimensions of the database, reducing false alarms or missed alarms caused by fixed thresholds, and providing corresponding handling plans for anomaly events through a scene matching mechanism, reducing reliance on human experience. At the same time, the anomaly scene library is continuously updated through feedback information, allowing anomaly handling experience to be accumulated and reused.
[0041] Optionally, based on any of the above embodiments or optional methods, the step of performing anomaly detection on each indicator group includes: Anomaly detection is performed on the overall performance index group based on a pre-trained unsupervised or semi-supervised anomaly detection model. Anomaly detection is performed on the resource usage indicator group based on preset upper and lower thresholds of resource utilization rate and the rate of change per unit time. Anomaly detection is performed on the single SQL performance indicator group based on the high percentile threshold determined from historical data of the same period. Based on the preset normal operating range and / or alarm information, anomaly detection is performed on the process status indicator group.
[0042] In some embodiments, after dividing the operational metric data into multiple metric groups, anomaly detection is performed on each metric group, with each metric group employing an anomaly detection method corresponding to its characteristics. The overall performance metric group reflects the overall operational efficiency of the database. Features in the overall performance metric group may include, but are not limited to, original metrics such as CPU utilization, memory utilization, average number of active sessions, and average response time of Structured Query Language, as well as their derived features. Derived features may include 1-minute average, 5-minute average, 1-minute change, 5-minute change, and the ratio of average number of active sessions to CPU cores, etc., which describe the trend and relative level of the metrics over a short period. The overall performance metric group corresponds to a pre-trained unsupervised or semi-supervised anomaly detection model. This unsupervised or semi-supervised anomaly detection model is pre-trained based on historical operational metric data of the database under normal conditions, and is used to learn the feature distribution of the database under normal conditions. The unsupervised or semi-supervised anomaly detection model may employ, but is not limited to, the Isolation Forest model, the Single-Class Support Vector Machine model, and the Autoencoder model. When performing anomaly detection on the overall performance index group, the current feature vector of the overall performance index group is input into the unsupervised or semi-supervised anomaly detection model to obtain anomaly degree information. When the anomaly degree information meets the preset anomaly conditions, the overall performance index group is determined to be abnormal.
[0043] Resource usage metrics are used to reflect the consumption of database resources. Features in these metrics may include connection utilization and data space utilization, as well as derived features constructed from them. For example, derived features may include the positive portion of the difference between connection utilization and 90%, the positive portion of the difference between 5% and connection utilization, the positive portion of the difference between data space utilization and 90%, the positive portion of the difference between 5% and data space utilization, and the changes in connection utilization and data space utilization over 5 minutes. When detecting anomalies in resource usage metrics, judgments are made based on preset upper and lower thresholds for resource utilization and the rate of change per unit time. When resource utilization exceeds the upper threshold or falls below the lower threshold, the resource usage metrics are deemed abnormal. Similarly, when the rate of change of resource utilization exceeds a preset range, such as connection utilization rising from 50% to 95% within 5 minutes, the resource usage metrics are also deemed abnormal.
[0044] The Single SQL Performance Metrics (STM) group reflects the execution performance of a single Structured Query Language (SCL) query. Features within the STM group can include the average and maximum response times over a 10-minute period for each parameterized SCL query. Anomaly detection for the STM group is performed based on a high-quantile threshold determined from historical data. Historical data refers to the response times of single SCL queries within the same business timeframe as the current time. The high-quantile threshold is a threshold calculated from historical data that is higher than most normal response times; for example, the 95th percentile of response times in historical data might be used. When the response time of a single SCL query exceeds this high-quantile threshold, the STM group is considered abnormal.
[0045] Process status indicator groups are used to reflect the running status of critical database processes. Features within these groups can include whether the critical process status is normal, and whether there are alarms or abnormal results from emergency inspections. Critical processes can include database instance processes, proxy processes, etc. When detecting anomalies in process status indicator groups, judgments are made based on the preset normal operating range and / or alarm information. If the critical process status is outside the preset normal operating range, the process status indicator group is considered abnormal; and / or, if there are alarms or abnormal results from emergency inspections for critical processes, the process status indicator group is also considered abnormal. When any indicator group detects an anomaly, an anomaly event is generated. This event is an information record describing the current abnormal state of the database.
[0046] By using the above method, an abnormal event is generated when any indicator group is abnormal, thus avoiding missed detections caused by focusing only on a single indicator or a uniform model.
[0047] Figure 2 The flowchart of an unsupervised or semi-supervised anomaly detection model training method provided in this disclosure embodiment is further illustrated, such as... Figure 2 As shown, the method includes the following steps: Step 201: Obtain historical normal sample data from the database at preset time intervals; wherein, the historical normal sample data is the operational indicator data of historical periods that have the same business cycle characteristics as the current time.
[0048] In some embodiments, historical normal sample data refers to operational indicator data collected when the database is in a normal state. The preset time interval is a pre-defined model training trigger cycle, which can be set to hourly, daily, or weekly, depending on the actual scenario. Same business cycle characteristics refer to the periodic variation pattern of the database's business load; for example, the business load is similar in the same hour every day, similar in the same day every week, and different in the business load on weekdays and holidays. Selecting operational indicator data from historical periods with the same business cycle characteristics as the current time ensures that the business characteristics of the training samples are close to those of the current period. For example, if the current time is 3 PM on Wednesday, operational indicator data from within 10 minutes before and after 3 PM on Wednesdays 1 day ago, 3 days ago, and 7 days ago, when the database was in a normal state, can be selected as historical normal sample data. For weekends and holidays, data from historical periods that are also weekends or holidays can be selected as training data. By obtaining historical normal sample data with the same business cycle characteristics as the current time at preset time intervals, consistency between the training data and the business load characteristics of the current period can be guaranteed.
[0049] Step 202: Train the unsupervised or semi-supervised anomaly detection model based on the historical normal sample data to obtain the pre-trained unsupervised or semi-supervised anomaly detection model.
[0050] In some embodiments, unsupervised or semi-supervised anomaly detection models can employ, but are not limited to, isolated forest models, single-class support vector machine models, and autoencoder models. Taking the isolated forest model as an example, the training process includes: randomly selecting features from historical normal sample data to construct isolated trees; during the construction of each isolated tree, randomly selecting features and split values, and recursively splitting the samples until each sample is segmented into a separate space; since the feature values of normal samples are similar, multiple splits are required to separate different normal samples, while abnormal samples are outside the normal samples and can be isolated with fewer splits. Repeating the above construction process creates multiple isolated trees, forming the isolated forest model. During training, only historical sample data under normal conditions is used, without labeling abnormal samples, which conforms to the characteristics of unsupervised or semi-supervised methods. After training, a pre-trained unsupervised or semi-supervised anomaly detection model is obtained. This model is used to detect anomalies in the overall performance index group, determining whether the features of the current overall performance index group deviate from the feature distribution of the normal state. It should be noted that the pre-trained unsupervised or semi-supervised anomaly detection model can be retrained at preset time intervals to ensure that the model can adapt to changes in the database's operating state.
[0051] Using the above method, a pre-trained unsupervised or semi-supervised anomaly detection model is trained based on historical normal sample data with the same business cycle characteristics as the current time. This enables the model to learn the normal state characteristics of the database under the corresponding business period, providing a basis for the judgment of anomaly detection of the overall performance index group.
[0052] Figure 3 A flowchart illustrating an anomaly detection method for an overall performance index group provided in this disclosure is further illustrated, as shown in the embodiment. Figure 3 As shown, the method includes the following steps: Step 301: Input the current feature vector of the overall performance index group into the pre-trained unsupervised or semi-supervised anomaly detection model, calculate the average path length and map it to the anomaly score.
[0053] In some embodiments, the pre-trained unsupervised or semi-supervised anomaly detection model is a detection model based on randomly segmented path lengths, such as the Isolation Forest model. The Isolation Forest model consists of multiple isolated trees, each trained on historical normal sample data. When performing anomaly detection on the overall performance metric group, the current feature vector of the overall performance metric group is input into the Isolation Forest model. The current feature vector contains the values of each feature in the overall performance metric group at the current time, such as CPU utilization, memory utilization, average number of active sessions, average response time of Structured Query Language, and their derived features. Each isolated tree in the Isolation Forest model recursively segments the current feature vector, recording the path length traversed by the current feature vector from the root node to its segmentation into a separate space within each isolated tree. Because the feature values of normal samples are similar, normal samples usually require more segmentations to be separated, resulting in longer path lengths; anomaly samples are outside the distribution of normal samples and can be isolated with fewer segmentations, resulting in shorter path lengths. The average path length of the current feature vector across the multiple isolated trees is calculated, and the average path length is mapped to anomaly scores based on a preset normalization function. Anomaly scores characterize the degree to which the database's operating state deviates from its normal state; a higher anomaly score indicates a greater degree of deviation. For example, anomaly scores calculated from historical normal samples are typically low, such as 0.05; for slight deviations, the anomaly score is, for example, 0.15; and for significant anomalies, the anomaly score is, for example, 0.35. A preset normalization function, constructed based on the statistical properties of the average path length of isolated trees, is used to convert path lengths into a uniform anomaly score scale.
[0054] Step 302: When the abnormal score exceeds the threshold determined based on historical normal samples, the overall performance index group is determined to be abnormal.
[0055] In some embodiments, the threshold determined based on historical normal samples is obtained as follows: historical normal sample data is input into a pre-trained unsupervised or semi-supervised anomaly detection model, anomaly score for each historical normal sample is calculated, the distribution of historical normal sample anomaly scores is statistically analyzed, and the 95th percentile of the historical normal sample anomaly scores is taken as the threshold, meaning that 95% of the historical normal samples have anomaly scores not exceeding this threshold. When performing anomaly detection on the overall performance index group, if the anomaly score calculated from the current feature vector exceeds this threshold, it indicates that the current overall performance index group has deviated from the normal state, and the overall performance index group is determined to be abnormal. To further improve the robustness of the detection results, a continuous sliding time window can be used for judgment. Within the continuous sliding time window, sampling is performed at 1-minute intervals to obtain the overall performance index group feature vectors at multiple sampling times. The anomaly score at each sampling time is calculated. If the anomaly scores at most sampling times within the window exceed the threshold determined based on historical normal samples, the overall performance index group is finally determined to be abnormal. For example, a 10-minute continuous sliding time window is used, containing 10 sampling times. If more than 5 sampling times are judged as abnormal, the overall performance index group within this time window is determined to be abnormal.
[0056] The above method utilizes a pre-trained unsupervised or semi-supervised anomaly detection model to detect anomalies in the overall performance index group. By mapping the average path length to anomaly scores and comparing them with thresholds determined based on historical normal samples, anomalies can be identified when the features of the overall performance index group deviate from the normal distribution. The sliding window majority decision method can reduce misjudgments caused by instantaneous fluctuations and improve the accuracy of anomaly detection in the overall performance index group.
[0057] Optionally, based on any of the above embodiments or optional methods, before determining the matching target abnormal scenario and corresponding handling plan according to the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library, the method further includes: Construct the preset abnormal scenario library; the abnormal scenario library contains multiple abnormal scenarios; each abnormal scenario is configured with scenario feature tags, associated historical case sets, key indicators and non-key indicators, weight coefficients corresponding to each indicator, and processing plans; In the same abnormal scenario, the weight coefficient of the key indicator is greater than that of the non-key indicator, and the average weight coefficient of all indicators is 1.
[0058] In some embodiments, the process of constructing a pre-defined abnormal scenario library is as follows: The abnormal scenario library contains multiple abnormal scenarios, each corresponding to a database anomaly type. Each abnormal scenario is configured with scenario feature tags, an associated set of historical cases, a division between key and non-key indicators, weight coefficients for each indicator, and a handling plan. Scenario feature tags are used to describe the typical characteristics of the corresponding abnormal scenario from a feature perspective, such as scenario name and typical behavior. The associated set of historical cases is a collection of historical abnormal cases associated with this abnormal scenario. Historical cases are manually tagged and associated with abnormal scenarios; one historical case can be associated with one abnormal scenario, and multiple abnormal scenarios can be associated in complex scenarios. The division between key and non-key indicators is obtained through expert analysis of historical cases in this scenario. Indicators that differ significantly from other scenarios are defined as key indicators in this scenario, and the remaining indicators are non-key indicators. For example, in scenarios with excessively high CPU utilization, key metrics include CPU utilization, average number of active sessions, and overall structured query language performance; in scenarios with lock wait anomalies, key metrics include queues, average number of active sessions, and locks; in scenarios with hardware failure anomalies, key metrics include key process states, process state changes, and data space utilization; and in scenarios with full connection availability, key metrics include connection utilization, CPU utilization, and log keywords. The weight coefficients corresponding to each metric represent the importance of that metric in scenario matching. Key metrics have a weight coefficient greater than 1, while non-key metrics have a weight coefficient less than 1. The average of all weight coefficients is 1, meaning the sum of all weight coefficients equals the total number of metrics. This weight coefficient setting ensures that the overall distance scale after weighted calculation does not systematically amplify or shrink, but only redistributes importance among the dimensions. The contingency plan is a pre-defined processing flow and / or processing steps for the corresponding anomaly scenario. Developing contingency plans includes establishing standard inspection and handling procedures to form an emergency response plan; writing simulation scripts to simulate the abnormal scenario to verify the effectiveness of the plan and tools; and regularly organizing database administrators to conduct simulation drills for handling abnormal events based on the simulation scripts. By building an abnormal scenario library containing the above configurations, a foundation is provided for subsequent abnormal event matching.
[0059] The above methods can be used to pre-establish a structured abnormal scenario library. By using scenario feature tags, historical case sets, the division of key and non-key indicators, weight coefficients, and handling plans, the distinguishing features between different abnormal scenarios can be strengthened, providing support for the subsequent calculation of the matching degree between abnormal events and abnormal scenarios, improving the matching distinguishing ability and the pertinence of the handling plan.
[0060] Figure 4 A flowchart illustrating an abnormal scenario matching and contingency plan recommendation method provided in this disclosure embodiment is further shown, such as... Figure 4 As shown, the method may include the following steps: Step 401: Extract the abnormal feature vector corresponding to the abnormal event.
[0061] In some embodiments, an abnormal event is an event generated when any indicator group detects an anomaly. The anomaly feature vector is composed of the feature values of each indicator involved in the abnormal event. When constructing the anomaly feature vector, the indicator values related to anomaly detection in the database's operational indicator data are organized into a vector form according to a preset order. Each dimension in the anomaly feature vector is consistent with the feature vector dimensions of historical cases in the anomaly scenario library for distance calculation. For example, the anomaly feature vector can be represented as x, where each component of x is the value of the corresponding indicator under the current abnormal event. The indicators included in the anomaly feature vector are consistent with the indicator set used when constructing the anomaly scenario library, including indicators involved in the overall performance indicator group, resource usage indicator group, single SQL performance indicator group, and process status indicator group.
[0062] Step 402: Based on the weight coefficients corresponding to each indicator of each abnormal scenario, determine the average weighted distance and minimum weighted distance between the abnormal feature vector and the feature vectors of all historical cases under each abnormal scenario.
[0063] In some embodiments, each anomalous scenario is configured with weight coefficients corresponding to various indicators. These weight coefficients are used to adjust the contribution of the corresponding indicator in the distance calculation. For each anomalous scenario, a set of historical cases associated with that scenario is first obtained, with each historical case corresponding to a feature vector. The weighted distance between the anomalous feature vector and the historical case feature vectors is calculated. The weighted distance formula is: Where x represents the abnormal feature vector, ; y represents the feature vector of historical cases belonging to the current scenario. ; This represents the weight coefficient corresponding to the i-th feature dimension in the current scene. ≥0; n represents the total number of feature dimensions. The matrix expression of this weighted distance formula is: Where W is an n×n diagonal matrix, , used to represent the weight distribution of each dimension. The weight coefficients for key indicators are greater than 1, while the weight coefficients for non-key indicators are less than 1, and the average of the weight coefficients for all indicators is 1. For each abnormal scenario, the average weighted distance between the abnormal feature vector and the feature vectors of all historical cases in that scenario is calculated. The average weighted distance is the average of the weighted distances between the abnormal feature vector and the feature vectors of all historical cases in that scenario. The minimum weighted distance between the abnormal feature vector and the feature vectors of all historical cases in that scenario is also calculated. The minimum weighted distance is the weighted distance between the abnormal feature vector and the feature vector of the nearest historical case in that scenario.
[0064] Step 403: Based on the average of the average weighted distance and the minimum weighted distance corresponding to each abnormal scenario, determine the comprehensive distance between the abnormal event and each abnormal scenario.
[0065] In some embodiments, for each anomalous scenario, the average weighted distance and minimum weighted distance corresponding to that scenario are averaged to obtain the comprehensive distance of the anomalous scenario. The comprehensive distance calculation formula is: D_scene=(D_avg+D_min) / 2, where D_avg represents the average weighted distance between the anomalous feature vector and the feature vectors of all historical cases in the current scenario, D_min represents the minimum weighted distance between the anomalous feature vector and the feature vector of the nearest historical case in the current scenario, and D_scene represents the comprehensive distance of the current anomalous scenario. The comprehensive distance is used to comprehensively reflect the proximity of the anomalous event to the overall center of the scenario and the most similar case within the scenario. The above calculation is performed on each anomalous scenario to obtain the comprehensive distance between the anomalous event and each anomalous scenario respectively.
[0066] Step 404: According to the order of comprehensive distance from smallest to largest, determine the preset number of abnormal scenarios as the target abnormal scenarios, obtain and output the processing plan corresponding to the target abnormal scenario and the analysis report corresponding to the historical case with the smallest weighted distance in the target abnormal scenario.
[0067] In some embodiments, a smaller overall distance indicates a greater similarity between the abnormal event and the abnormal scenario. The abnormal scenarios are sorted from smallest to largest based on their overall distance, and a predetermined number of these scenarios are selected as target abnormal scenarios. For example, the predetermined number could be 3, meaning the top 3 abnormal scenarios with the smallest overall distance are selected as target abnormal scenarios. For each target abnormal scenario, a corresponding handling plan is obtained and output to the database administrator for reference. Simultaneously, for each target abnormal scenario, the historical case with the smallest weighted distance to the abnormal feature vector is determined from the historical case set associated with that scenario. An analysis report corresponding to this historical case is obtained and output. The analysis report may include abnormal keywords, database product type, matched abnormal scenario, analysis process, handling details and effects, root cause of the abnormality, subsequent fundamental solutions, experience summary, and explanations of technical terms. The handling plan and analysis report together serve as reference information to assist the database administrator in making abnormal handling decisions, and the database administrator selects which to execute based on the actual situation.
[0068] The above methods can provide database administrators with interpretable matching criteria and handling references, reducing reliance on human experience and preventing the system from automatically making judgments that replace human decision-making.
[0069] Optionally, based on any of the above embodiments or optional methods, the step of obtaining feedback information on processing the abnormal event according to the processing plan, and updating the abnormal scenario database based on the feedback information, includes: If the feedback information indicates that the target abnormal scenario is correctly matched, then the abnormal event and the abnormal feature vector are added as new historical cases to the historical case set corresponding to the target abnormal scenario. If the feedback information indicates that the target abnormal scenario is mismatched, then the division of the key indicators and non-key indicators of the target abnormal scenario and / or the weight coefficients corresponding to each indicator are adjusted. If the feedback information indicates that the abnormal event does not belong to any existing abnormal scenario in the abnormal scenario library, then a new abnormal scenario is created based on the abnormal event and added to the abnormal scenario library.
[0070] In some embodiments, after obtaining feedback information on handling abnormal events according to the handling plan, the abnormal scenario database is updated based on the feedback information. Feedback information may include the root cause of the abnormality, handling details, handling effects, and experience summaries. Different update methods are adopted depending on the type of feedback information. If the feedback information indicates that the target abnormal scenario matches correctly, i.e., the actual type of the abnormal event is consistent with the target abnormal scenario, the abnormal event and its abnormal feature vector are added as new historical cases to the historical case set corresponding to the target abnormal scenario, enriching the number of cases for that scenario. After addition, the average feature vector and distance calculations under that scenario will be incorporated into the new case, making the case database for that scenario more representative. If the feedback information indicates that the target abnormal scenario does not match correctly, i.e., the actual type of the abnormal event is inconsistent with the target abnormal scenario, the division of key and non-key indicators and / or the weight coefficients corresponding to each indicator in the target abnormal scenario are adjusted. The adjustment method can be determined by the database administrator based on the actual situation of the abnormal event, re-analyzing historical cases under the target abnormal scenario, extracting more discriminative indicators as key indicators, or increasing or decreasing the weight coefficients of some indicators. If the feedback information indicates that the abnormal event does not belong to any existing abnormal scenario in the abnormal scenario library, meaning that the abnormal event corresponds to a new type of abnormality, then a new abnormal scenario is created based on the abnormal event and added to the abnormal scenario library. When creating a new abnormal scenario, scenario feature labels, associated historical case sets, the division of key and non-key indicators, the weight coefficients corresponding to each indicator, and the handling plan are configured for the new abnormal scenario. Among them, the abnormal event and the abnormal feature vector are added to the associated historical case set as the first historical case of the new abnormal scenario, and the key indicators and weight coefficients of the new abnormal scenario are initialized based on expert analysis.
[0071] Using the above methods, the abnormal scenario database can be continuously updated based on feedback information after actual handling. When a match is correct, the representativeness of the scenario is enhanced by adding historical cases. When a match is incorrect, the scenario discrimination capability is corrected by adjusting the index division and weight coefficient. When a new type of anomaly occurs, the coverage of the abnormal scenario database is expanded by adding new scenarios. This allows the abnormal scenario database to continuously evolve based on actual operational experience, thereby improving the accuracy of subsequent anomaly matching.
[0072] Optionally, based on any of the above embodiments or alternative methods, the method provided in this disclosure does not depend on a specific database product architecture or implementation method, and can be applied to centralized or distributed relational databases, cloud-native database systems, NoSQL databases, etc. The processes of collecting operational indicator data, dividing indicator groups, matching abnormal events with various abnormal scenarios in the abnormal scenario library, and updating the abnormal scenario library based on feedback information are all implemented based on the database operational indicator data itself, without involving changes to the internal architecture of the database. Therefore, this disclosure can be applied to different types of database systems.
[0073] Optionally, based on any of the above embodiments or optional methods, before adding the abnormal event and abnormal feature vector as new historical cases to the historical case set of the corresponding scenario, this embodiment of the disclosure further includes: submitting the analysis report corresponding to the abnormal event for expert review; only after the review is passed will the step of adding the abnormal event and abnormal feature vector as new historical cases to the historical case set of the corresponding scenario be performed. The analysis report may include abnormal keywords, database product type, matched abnormal scenario, analysis process, handling details and handling effects, root cause of the abnormality, subsequent fundamental solutions, experience summary, and explanation of professional terms, etc. Through expert review, the quality of newly added historical cases can be improved, and the impact of erroneous cases on the accuracy of matching the abnormal scenario database can be reduced.
[0074] Corresponding to the database anomaly handling method described above, this invention also proposes a database anomaly handling device. Since the device embodiments of this invention correspond to the method embodiments described above, details not disclosed in the device embodiments can be referred to in the method embodiments described above, and will not be repeated here.
[0075] Figure 5 This is a schematic diagram of the structure of a database exception handling device provided in an embodiment of the present disclosure, as shown below. Figure 5 As shown, it includes: The data acquisition unit 51 is used to collect operational indicator data from the database; The detection unit 52 is used to divide the operation indicator data into multiple indicator groups, perform anomaly detection on each indicator group, and generate an anomaly event when an anomaly is detected in any indicator group; wherein, the multiple indicator groups include at least two of the following: overall performance indicator group, resource usage indicator group, single SQL performance indicator group, and process status indicator group. The matching unit 53 is used to determine the target abnormal scene and the corresponding processing plan based on the matching degree between the abnormal event and each abnormal scene in the preset abnormal scene library. The update unit 54 is used to obtain feedback information on the handling of the abnormal event according to the processing plan, and update the abnormal scenario library based on the feedback information.
[0076] The database anomaly handling device provided in this embodiment can divide the database's operational indicator data into multiple indicator groups and perform anomaly detection on each group. When an anomaly is detected in any indicator group, an anomaly event is generated. Then, the target anomaly scene and its corresponding handling plan are determined by the matching degree between the anomaly event and each anomaly scene in the preset anomaly scene library. The anomaly scene library is updated based on the feedback information after the handling plan is executed, thereby covering anomaly detection in different operational dimensions of the database, reducing false alarms or missed alarms caused by fixed thresholds, and providing corresponding handling plans for anomaly events through a scene matching mechanism, reducing reliance on human experience. At the same time, the anomaly scene library is continuously updated through feedback information, so that anomaly handling experience can be accumulated and reused.
[0077] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 6 As shown, the detection unit 52 includes: The first detection module 521 is used to perform anomaly detection on the overall performance index group based on a pre-trained unsupervised or semi-supervised anomaly detection model. The second detection module 522 is used to perform anomaly detection on the resource usage index group based on preset upper and lower thresholds of resource utilization rate and the rate of change per unit time. The third detection module 523 is used to perform anomaly detection on the single SQL performance index group based on the high quantile threshold determined by historical data from the same period. The fourth detection module 524 is used to perform anomaly detection on the process status indicator group based on the preset normal operating range and / or alarm information.
[0078] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 6 As shown, the device further includes: The acquisition module 525 is used to acquire historical normal sample data of the database at preset time intervals before the first detection module 521 performs anomaly detection on the overall performance index group based on a pre-trained unsupervised or semi-supervised anomaly detection model; wherein, the historical normal sample data is the operation index data of historical periods with the same business cycle characteristics as the current time. Training module 526 is used to train the unsupervised or semi-supervised anomaly detection model based on the historical normal sample data to obtain the pre-trained unsupervised or semi-supervised anomaly detection model.
[0079] Furthermore, in one possible implementation of this disclosure, the first detection module 521 is further configured to: Input the current feature vector of the overall performance index group into the pre-trained unsupervised or semi-supervised anomaly detection model, calculate the average path length and map it to the anomaly score; When the abnormal score exceeds a threshold determined based on historical normal samples, the overall performance index group is determined to be abnormal.
[0080] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 6 As shown, the device further includes: The construction unit 55 is used to construct the preset abnormal scenario library before the matching unit 53 determines the target abnormal scenario and corresponding handling plan based on the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library; the abnormal scenario library contains multiple abnormal scenarios; each abnormal scenario is configured with scenario feature tags, associated historical case sets, key indicators and non-key indicators, weight coefficients corresponding to each indicator and handling plan. In the same abnormal scenario, the weight coefficient of the key indicator is greater than that of the non-key indicator, and the average weight coefficient of all indicators is 1.
[0081] Furthermore, in one possible implementation of the embodiments of this disclosure, such as Figure 6 As shown, the matching unit 53 includes: Extraction module 531 is used to extract the abnormal feature vector corresponding to the abnormal event; The first determining module 532 is used to determine the average weighted distance and the minimum weighted distance between the abnormal feature vector and the feature vectors of all historical cases under each abnormal scenario, based on the weight coefficients corresponding to each indicator of each abnormal scenario. The second determining module 533 is used to determine the comprehensive distance between the abnormal event and each abnormal scenario based on the average of the average weighted distance and the minimum weighted distance corresponding to each abnormal scenario. The output module 534 is used to determine a preset number of abnormal scenarios as the target abnormal scenarios in order of increasing comprehensive distance, obtain and output the processing plan corresponding to the target abnormal scenario and the analysis report corresponding to the historical case with the smallest weighted distance in the target abnormal scenario.
[0082] Furthermore, in one possible implementation of this disclosure, the updating unit 54 is further configured to: If the feedback information indicates that the target abnormal scenario is correctly matched, then the abnormal event and the abnormal feature vector are added as new historical cases to the historical case set corresponding to the target abnormal scenario. If the feedback information indicates that the target abnormal scenario is mismatched, then the division of the key indicators and non-key indicators of the target abnormal scenario and / or the weight coefficients corresponding to each indicator are adjusted. If the feedback information indicates that the abnormal event does not belong to any existing abnormal scenario in the abnormal scenario library, then a new abnormal scenario is created based on the abnormal event and added to the abnormal scenario library.
[0083] It should be noted that the foregoing explanation of the method embodiments also applies to the apparatus of the embodiments of this disclosure, and the principle is the same. Therefore, the embodiments of this disclosure are not limited thereto.
[0084] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0085] Figure 7 A schematic block diagram of an example electronic device 1500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0086] like Figure 7 As shown, the electronic device 1500 includes a computing unit 1501, which can perform various appropriate actions and processes according to a computer program stored in ROM (Read-Only Memory) 1502 or loaded from storage unit 1508 into RAM (Random Access Memory) 1503. The RAM 1503 may also store various programs and data required for the operation of the electronic device 1500. The computing unit 1501, ROM 1502, and RAM 1503 are interconnected via bus 1504. An I / O (Input / Output) interface 1505 is also connected to bus 1504.
[0087] Multiple components in electronic device 1500 are connected to I / O interface 1505, including: input unit 1506, such as keyboard, mouse, etc.; output unit 1507, such as various types of monitors, speakers, etc.; storage unit 1508, such as disk, optical disk, etc.; and communication unit 1509, such as network card, modem, wireless transceiver, etc. Communication unit 1509 allows electronic device 1500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0088] The computing unit 1501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1501 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 1501 performs the various methods and processes described above, such as database exception handling methods. For example, in some embodiments, the database exception handling method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1500 via ROM 1502 and / or communication unit 1509. When the computer program is loaded into RAM 1503 and executed by the computing unit 1501, one or more steps of the methods described above may be performed. Alternatively, in other embodiments, the computing unit 1501 may be configured to perform the aforementioned database exception handling method by any other suitable means (e.g., by means of firmware).
[0089] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0090] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0091] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0092] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0093] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.
[0094] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0095] It's important to note that artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0096] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.
[0097] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A database exception handling method, characterized in that, include: Collect operational metrics data from the database; The operational metric data is divided into multiple metric groups, and anomaly detection is performed on each metric group. When an anomaly is detected in any metric group, an anomaly event is generated. The multiple metric groups include at least two of the following: overall performance metric group, resource usage metric group, single SQL performance metric group, and process status metric group. Based on the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library, the target abnormal scenario and the corresponding handling plan are determined. Obtain feedback information on handling the abnormal event according to the processing plan, and update the abnormal scenario database based on the feedback information.
2. The method according to claim 1, characterized in that, The anomaly detection for each indicator group includes: Anomaly detection is performed on the overall performance index group based on a pre-trained unsupervised or semi-supervised anomaly detection model. Anomaly detection is performed on the resource usage indicator group based on preset upper and lower thresholds of resource utilization rate and the rate of change per unit time. Anomaly detection is performed on the single SQL performance indicator group based on the high percentile threshold determined from historical data of the same period. Based on the preset normal operating range and / or alarm information, anomaly detection is performed on the process status indicator group.
3. The method according to claim 2, characterized in that, Before the pre-trained unsupervised or semi-supervised anomaly detection model performs anomaly detection on the overall performance index group, the method further includes: Historical normal sample data of the database is obtained at preset time intervals; wherein, the historical normal sample data is the operation indicator data of historical periods with the same business cycle characteristics as the current time. The unsupervised or semi-supervised anomaly detection model is trained based on the historical normal sample data to obtain the pre-trained unsupervised or semi-supervised anomaly detection model.
4. The method according to claim 3, characterized in that, The pre-trained unsupervised or semi-supervised anomaly detection model performs anomaly detection on the overall performance index group, including: Input the current feature vector of the overall performance index group into the pre-trained unsupervised or semi-supervised anomaly detection model, calculate the average path length and map it to the anomaly score; When the abnormal score exceeds a threshold determined based on historical normal samples, the overall performance index group is determined to be abnormal.
5. The method according to claim 1, characterized in that, Before determining the target abnormal scenario and its corresponding handling plan based on the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library, the method further includes: Construct the preset abnormal scenario library; the abnormal scenario library contains multiple abnormal scenarios; each abnormal scenario is configured with scenario feature tags, associated historical case sets, key indicators and non-key indicators, weight coefficients corresponding to each indicator, and processing plans; In the same abnormal scenario, the weight coefficient of the key indicator is greater than that of the non-key indicator, and the average weight coefficient of all indicators is 1.
6. The method according to claim 5, characterized in that, The step of determining the target abnormal scenario and its corresponding handling plan based on the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library includes: Extract the abnormal feature vector corresponding to the abnormal event; Based on the weight coefficients corresponding to each indicator in each abnormal scenario, the average weighted distance and minimum weighted distance between the abnormal feature vector and the feature vectors of all historical cases in each abnormal scenario are determined respectively. Based on the average of the average weighted distance and the minimum weighted distance corresponding to each of the abnormal scenarios, the comprehensive distance between the abnormal event and each of the abnormal scenarios is determined. Based on the order of comprehensive distance from smallest to largest, a preset number of abnormal scenarios are determined as the target abnormal scenarios. The corresponding handling plan for the target abnormal scenarios and the analysis report corresponding to the historical case with the smallest weighted distance in the target abnormal scenarios are obtained and output.
7. The method according to claim 6, characterized in that, The step of obtaining feedback information on handling the abnormal event according to the processing plan, and updating the abnormal scenario database based on the feedback information, includes: If the feedback information indicates that the target abnormal scenario is correctly matched, then the abnormal event and the abnormal feature vector are added as new historical cases to the historical case set corresponding to the target abnormal scenario. If the feedback information indicates that the target abnormal scenario is mismatched, then the division of the key indicators and non-key indicators of the target abnormal scenario and / or the weight coefficients corresponding to each indicator are adjusted. If the feedback information indicates that the abnormal event does not belong to any existing abnormal scenario in the abnormal scenario library, then a new abnormal scenario is created based on the abnormal event and added to the abnormal scenario library.
8. A database exception handling device, characterized in that, include: The data acquisition unit is used to collect operational indicator data from the database. The detection unit is used to divide the operational indicator data into multiple indicator groups, perform anomaly detection on each indicator group, and generate an anomaly event when an anomaly is detected in any indicator group; wherein, the multiple indicator groups include at least two of the following: overall performance indicator group, resource usage indicator group, single SQL performance indicator group, and process status indicator group. The matching unit is used to determine the target abnormal scenario and the corresponding handling plan based on the matching degree between the abnormal event and each abnormal scenario in the preset abnormal scenario library. The update unit is used to obtain feedback information on the handling of the abnormal event according to the processing plan, and update the abnormal scenario library based on the feedback information.
9. An electronic device, characterized in that, include: At least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-7.
