Automatic database repair method, device, terminal equipment and computer medium

By configuring detection nodes within the ORACLE database operating system and building a heartbeat table to detect abnormal conditions and perform repairs, the problem of the database being unable to repair itself in extreme situations is solved, and automatic repair effects in extreme situations are achieved.

CN117271194BActive Publication Date: 2025-09-12CHINA MERCHANTS BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311332083.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-13
Publication Date
2025-09-12
Estimated Expiration
2043-10-13

AI Technical Summary

Technical Problem

In extreme cases (such as the hang or down state), the ORACLE database cannot detect abnormalities in its own service capabilities, resulting in the inability to self-repair.

Method used

By configuring detection nodes in the operating system, building a heartbeat table to detect the real-time status of the target task node and the operating system, determining the type of abnormal status, and determining the adjustment plan based on these status types for repair.

Benefits of technology

In extreme cases, it can detect and automatically repair ORACLE database service capability anomalies to ensure that the database returns to normal status.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117271194B_ABST
    Figure CN117271194B_ABST
Patent Text Reader

Abstract

The present application discloses a method, apparatus, terminal device and computer medium for automatically repairing a database, and relates to the field of data processing technology. The method comprises: calling a detection node to detect a target task node to construct a first heartbeat table, and determining a first real-time state of the target task node through the first heartbeat table; when the first real-time state is an abnormal state, detecting the target task node to construct a second heartbeat table, and determining a first abnormal state type of the target task node through the second heartbeat table; when the first real-time state is an abnormal state, detecting an operating system to determine a second real-time state of the operating system, and when the second real-time state is an abnormal state, determining a second abnormal state type corresponding to the operating system; determining a target adjustment scheme based on the first abnormal state type and the second abnormal state type, and adjusting the target task node and / or the operating system according to the target adjustment scheme.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, apparatus, terminal device, and computer-readable storage medium for automatically repairing a database. Background Art

[0002] With the continuous development of cloud technology, the emergency response strategy configured in the ORACLE database has gradually changed from fault repair as the primary goal to rapid demarcation, isolation, and business recovery as the primary goal.

[0003] In related technologies, the ORACLE database can detect abnormalities in its own network, disk, or process service capabilities by detecting network heartbeat signals or disk heartbeat signals, and then perform repair operations based on the abnormalities to restore its own service capabilities.

[0004] However, when the ORACLE database adopts the above method, once the ORACLE database is in an extreme situation such as an up state or a down state, it is often unable to detect abnormalities in its own service capabilities, and the ORACLE database is therefore unable to repair itself based on the abnormalities. Summary of the Invention

[0005] The main purpose of this application is to provide a method, apparatus, terminal device and computer-readable storage medium for automatically repairing a database, aiming to enable the terminal device to detect abnormalities in the service capabilities of the target database even under extreme circumstances, and then enable the terminal device to automatically repair the target database based on the abnormalities.

[0006] To achieve the above objectives, the present application provides a method for automatically repairing a database. The method is applied to a target database connected to an operating system, wherein the operating system includes a detection node, and the target database includes a target task node. The method comprises the following steps:

[0007] Calling the detection node to detect the target task node to construct a first heartbeat table, and determining a first real-time state of the target task node through the first heartbeat table;

[0008] When the first real-time state is an abnormal state, detecting the target task node to construct a second heartbeat table, and determining the first abnormal state type of the target task node through the second heartbeat table;

[0009] When the first real-time state is the abnormal state, detecting the operating system to determine a second real-time state of the operating system, and when the second real-time state is the abnormal state, determining a second abnormal state type corresponding to the operating system;

[0010] A target adjustment scheme is determined based on the first abnormal state type and the second abnormal state type, and the target task node and / or the operating system are adjusted according to the target adjustment scheme so that the real-time status corresponding to the target task node and / or the operating system is switched from the abnormal state to the normal state.

[0011] Furthermore, the step of determining the first real-time status of the target task node through the first heartbeat table includes:

[0012] Obtaining a standard heartbeat table, and determining whether the first heartbeat table is in a normal update state based on the standard heartbeat table;

[0013] If it is determined that the first heartbeat table is not in the normal update state, it is determined that the first real-time state of the target task node is an abnormal state.

[0014] Furthermore, the target database further includes a query window, and the step of determining the first abnormal state type of the target task node through the second heartbeat table includes:

[0015] determining whether the second heartbeat table is in the normal update state based on the standard heartbeat table;

[0016] If it is determined that the second heartbeat table is not in the normal update state, accessing the query window to obtain the first query result;

[0017] A first abnormal state type of the target task node is determined based on the first query result.

[0018] Furthermore, the first abnormal state type includes a first abnormal type and a second abnormal type;

[0019] The step of determining the first abnormal state type of the target task node based on the first query result includes:

[0020] If the first query result is that the target task node is in the target database, determining that the first abnormal state type of the target task node is the first abnormal type;

[0021] If the first query result is that the target task node is not in the target database, it is determined that the first abnormal state type of the target task node is the second abnormal type.

[0022] Furthermore, the step of determining a target adjustment solution based on the first abnormal state type and the second abnormal state type includes:

[0023] Obtain the preset standard adjustment plan matrix;

[0024] The standard adjustment solution matrix is ​​queried based on the first abnormal state type and the second abnormal state type to determine a target adjustment solution among the standard adjustment solutions included in the standard adjustment solution matrix.

[0025] Furthermore, before the step of calling the detection node to detect the target task node to construct a first heartbeat table, the method further includes:

[0026] Obtaining a plurality of preset defined time values, and constructing a time threshold script based on the plurality of defined time values;

[0027] The detection node is controlled to detect the target task node according to the time threshold script, so that the detection node constructs a first heartbeat table within the time threshold corresponding to the time threshold script.

[0028] Furthermore, before the step of adjusting the target task node and / or the operating system according to the target adjustment scheme, the method further includes:

[0029] Get the preset anti-duplicate time limit;

[0030] The target task node and / or the operating system are set based on the anti-repetition time limit so that the target task node and / or the operating system cannot be repeatedly adjusted within the anti-repetition time limit.

[0031] In addition, to achieve the above-mentioned purpose, the present application also provides an automatic database repair device, which is applied to a target database connected to an operating system, wherein the operating system includes a detection node, and the target database includes a target task node. The device includes:

[0032] A first detection module is configured to call the detection node to detect the target task node to construct a first heartbeat table, and determine a first real-time state of the target task node through the first heartbeat table;

[0033] A second detection module is configured to detect the target task node to construct a second heartbeat table when the first real-time state is an abnormal state, and determine the first abnormal state type of the target task node through the second heartbeat table;

[0034] a third detection module, configured to detect the operating system to determine a second real-time state of the operating system when the first real-time state is the abnormal state, and to determine a second abnormal state type corresponding to the operating system when the second real-time state is the abnormal state;

[0035] A system repair module is used to determine a target adjustment plan based on the first abnormal state type and the second abnormal state type, and adjust the target task node and / or the operating system according to the target adjustment plan so that the real-time status corresponding to the target task node and / or the operating system is switched from the abnormal state to the normal state.

[0036] In addition, to achieve the above-mentioned purpose, the present application also provides a terminal device, which includes: a memory and a processor, wherein the memory stores an automatic database repair program that can be run on the processor, and when the automatic database repair program is executed by the processor, the steps of the automatic database repair method as described above are implemented.

[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a computer-readable storage medium, on which an automatic database repair program is stored. When the automatic database repair program is executed by a processor, the steps of the automatic database repair method as described above are implemented.

[0038] The automatic database repair method, apparatus, terminal device, and computer-readable storage medium provided in the embodiments of the present application are applied to a target database connected to an operating system, wherein the operating system includes a detection node, and the target database includes a target task node. The target task node is detected by calling the detection node to construct a first heartbeat table, and the first real-time state of the target task node is determined by the first heartbeat table; when the first real-time state is an abnormal state, the target task node is detected to construct a second heartbeat table, and the first abnormal state type of the target task node is determined by the second heartbeat table; when the first real-time state is the abnormal state, the operating system is detected to determine the second real-time state of the operating system, and when the second real-time state is the abnormal state, the second abnormal state type corresponding to the operating system is determined; a target adjustment scheme is determined based on the first abnormal state type and the second abnormal state type, and the target task node and / or the operating system are adjusted according to the target adjustment scheme to switch the real-time states corresponding to the target task node and / or the operating system from the abnormal state to the normal state.

[0039] In this embodiment, when the target database is running, the terminal device first calls the detection node configured in the operating system connected to the target database, detects the target task node in the target database to obtain the heartbeat signal generated by the target task node, and constructs a first heartbeat table based on the heartbeat signal generated by the target task node. The terminal device then determines whether the target task node is continuously generating heartbeat signals based on the first heartbeat table to determine the first real-time state corresponding to the target task node. Thereafter, when the terminal device determines that the first real-time state is an abnormal state, the target task node is detected again to construct a second heartbeat table. The terminal device then determines whether the target task node is continuously generating heartbeat signals based on the second heartbeat table. The terminal device determines the first abnormal state type to be an abnormal state, and when the terminal device determines that the first real-time state is an abnormal state, the terminal device detects the operating system to determine the second real-time state corresponding to the operating system. When the terminal device determines that the second real-time state is an abnormal state, the terminal device further determines the second abnormal state type corresponding to the operating system. Finally, the terminal device determines a target adjustment plan based on the obtained first abnormal state type and second abnormal state type, and repairs the target task node and / or operating system according to the target adjustment plan, so that the target task node and / or operating system can generate a heartbeat signal normally, thereby switching the real-time state corresponding to the target task node and / or the operating system from the abnormal state to the normal state.

[0040] In this way, the present application solves the technical problem in the related art that the abnormal situation of the service capability of the terminal device cannot be detected when the database is in an extreme state such as down or hang by enabling the terminal device to detect that the target task node in the database is in an extreme state such as down or hang. The technical effect of enabling the terminal device to detect the abnormal situation of the service capability of the target database even in extreme situations, and then enabling the terminal device to automatically repair the target database based on the abnormal situation is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 This is a schematic diagram of the structure of a terminal device in the hardware operating environment involved in the embodiment of the present application;

[0042] Figure 2 This is a flow chart of the first embodiment of the automatic database repair method of the present application;

[0043] Figure 3 This is a schematic diagram of the structure of a target database involved in an embodiment of the automatic database repair method of the present application;

[0044] Figure 4 A schematic diagram of a standard adjustment scheme matrix involved in an embodiment of the automatic database repair method of the present application;

[0045] Figure 5 This is a flow chart of a second embodiment of the automatic database repair method of the present application;

[0046] Figure 6 This is a flow chart of a third embodiment of the automatic database repair method of the present application;

[0047] Figure 7 This is a schematic diagram of the functional modules involved in an embodiment of the automatic repair device for the database of this application.

[0048] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0049] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.

[0050] Reference Figure 1 , Figure 1 This is a schematic diagram of the terminal device structure of the hardware operating environment involved in the embodiment of the present application.

[0051] It should be noted that the terminal device of the embodiment of the present application can be a terminal device that executes the automatic repair method of the database of the present application. The terminal device can specifically be a mobile terminal, a data storage control terminal, a PC or other terminal device that is internally configured with a discovery unit, a decision unit and a disposal unit.

[0052] like Figure 1 As shown, the terminal device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0053] Those skilled in the art will understand that Figure 1The structure shown in the figure does not constitute a limitation on the terminal device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0054] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module and an automatic repair program for a database.

[0055] exist Figure 1 In the terminal device shown, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the terminal device of the present application can be set in the terminal device, and the terminal device calls the automatic repair program of the database stored in the memory 1005 through the processor 1001, and executes the following embodiments provided in the embodiments of the present application.

[0056] Based on the above-mentioned terminal device, the overall concept of the automatic repair method of the database of this application is provided.

[0057] With the continuous development of cloud technology, the emergency response strategy configured in the ORACLE database has gradually changed from fault repair as the primary goal to rapid demarcation, isolation, and business recovery as the primary goal.

[0058] In related technologies, the ORACLE database can detect abnormalities in its own network, disk, or process service capabilities by detecting network heartbeat signals or disk heartbeat signals, and then perform repair operations based on the abnormalities to restore its own service capabilities.

[0059] However, when the ORACLE database adopts the above method, once the ORACLE database is in an extreme situation such as an up state or a down state, it is often unable to detect abnormalities in its own service capabilities, and the ORACLE database is therefore unable to repair itself based on the abnormalities.

[0060] In response to the above phenomenon, the present application proposes a method for automatically repairing a database, which is applied to a target database connected to an operating system, the operating system containing a detection node, and the target database containing a target task node. The method for automatically repairing the database includes the steps of: calling the detection node to detect the target task node to construct a first heartbeat table, and determining the first real-time state of the target task node through the first heartbeat table; when the first real-time state is an abnormal state, detecting the target task node to construct a second heartbeat table, and determining the first abnormal state type of the target task node through the second heartbeat table; when the first real-time state is the abnormal state, detecting the operating system to determine the second real-time state of the operating system, and when the second real-time state is the abnormal state, determining the second abnormal state type corresponding to the operating system; determining a target adjustment scheme based on the first abnormal state type and the second abnormal state type, and adjusting the target task node and / or the operating system according to the target adjustment scheme to switch the real-time states corresponding to the target task node and / or the operating system from the abnormal state to the normal state.

[0061] In this way, the present application solves the technical problem in the related art that the abnormal situation of the service capability of the terminal device cannot be detected when the database is in an extreme state such as down or hang by enabling the terminal device to detect that the target task node in the database is in an extreme state such as down or hang. The technical effect of enabling the terminal device to detect the abnormal situation of the service capability of the target database even in extreme situations, and then enabling the terminal device to automatically repair the target database based on the abnormal situation is achieved.

[0062] Based on the above-mentioned overall concept of the terminal device and the automatic repair method of the database of the present application, various embodiments of the automatic repair method of the database of the present application are further proposed.

[0063] The automatic repair method of the database of the present application is applied to a target database connected to an operating system, wherein the operating system includes a detection node, and the target database includes a target task node;

[0064] For details, please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of the target database involved in an embodiment of the automatic repair method of the database of this application, such as Figure 3As shown, the main database of the target database may contain one or more target task nodes heartbeat_tab, and the database is connected to the operating systems OS1 and OS2 respectively, and the operating systems OS1 and OS2 are respectively configured with a detection node agent and a target process db_instance;

[0065] Please refer to Figure 2 , Figure 2 This is a flow chart of the first embodiment of the automatic database repair method of the present application.

[0066] It should be understood that although a logical order is shown in the flowchart, in some cases, the automatic repair method of the database of the present application can of course also execute the steps shown or described in an order different from that shown here.

[0067] like Figure 2 As shown, in this embodiment, the automatic repair method of the database of the present application may include the following steps:

[0068] Step S10: calling the detection node to detect the target task node to construct a first heartbeat table, and determining a first real-time state of the target task node through the first heartbeat table;

[0069] In this embodiment, during the operation of the target database, the target task node configured in the target database generates a heartbeat signal according to a preset standard heartbeat table, and sends the heartbeat signal to the operating system connected to the target database; during the operation of the target database, the terminal device calls the detection node configured in the operating system through its own configured discovery unit to detect the target task node, so as to obtain the heartbeat signal sent by the target task node, and constructs a first heartbeat table based on the heartbeat signal sent by the target task node. The terminal device then determines whether the first real-time status of the target task node is normal or abnormal through the first heartbeat table.

[0070] For example, during the operation of ORACLE database, the target task node heartbeat_tab1 and the target task node heartbeat_tab2 configured therein generate heartbeat signals respectively according to the preset standard heartbeat table, and send the generated heartbeat signals to the detection node agent1 configured in the operating system OS1 and the detection node agent2 configured in the operating system OS2. Afterwards, when the target task node heartbeat_tab1 and the target task node heartbeat_tab2 simultaneously enter an abnormal state such as a hang state or a down state in which a heartbeat signal cannot be sent, the terminal device calls the detection node agent1 and the detection node agent2 for the target task node heartbeat_tab1 through the discovery unit configured by itself. beat_tab1 and the target task node heartbeat_tab2 are detected respectively to obtain the heartbeat signals generated by the target task node heartbeat_tab1 and the target task node heartbeat_tab2, and construct the first heartbeat table corresponding to the target task node heartbeat_tab1 and the target task node heartbeat_tab2. Since the target task nodes heartbeat_tab1 and heartbeat_tab2 will not generate heartbeat signals themselves after entering the abnormal state, the discovery unit can determine that the real-time states corresponding to the target task node heartbeat_tab1 and the target task node heartbeat_tab2 are both abnormal states based on the first heartbeat table.

[0071] Furthermore, in a feasible embodiment, the above step S10 may specifically include:

[0072] Step S101: obtaining a standard heartbeat table, and determining whether the first heartbeat table is in a normal update state based on the standard heartbeat table;

[0073] In this embodiment, during the operation of the target database, the discovery unit configured by the terminal device itself first reads the storage device configured by the terminal device itself to obtain the standard heartbeat table pre-stored by the technician. The discovery unit detects the generated first heartbeat table based on the standard heartbeat table, and thus determines whether the first heartbeat table is in a normal update state based on whether the update content corresponding to the first heartbeat table matches the standard heartbeat table.

[0074] Step S102: If it is determined that the first heartbeat table is not in the normal update state, determining that the first real-time state of the target task node is an abnormal state;

[0075] In this embodiment, if the discovery unit determines that the updated content of the first heartbeat table does not match the standard heartbeat table, it determines that the first heartbeat table is not in a normal update state, and the discovery unit further determines that the first real-time state corresponding to the target task node is an abnormal state.

[0076] Exemplarily, for example, during the operation of the ORACLE database, the discovery unit configured by the terminal device itself first reads the storage device configured by the terminal device itself to obtain the standard heartbeat table. The discovery unit then detects the first heartbeat tables corresponding to the generated target task nodes heartbeat_tab1 and heartbeat_tab2 based on the standard heartbeat table, thereby judging whether each first heartbeat table is in a normal update state based on whether the updated content corresponding to each first heartbeat table matches the standard heartbeat table. Afterwards, if the discovery unit determines that the updated content corresponding to each first heartbeat table does not match the standard heartbeat table, it judges that each first heartbeat table is not in a normal update state. The discovery unit thus determines that the target task nodes heartbeat_tab1 and heartbeat_tab2 cannot normally send heartbeat signals to the detection nodes agent1 and agent2. The terminal device then determines that the first real-time status corresponding to the target task nodes heartbeat_tab1 and heartbeat_tab2 is an abnormal state.

[0077] It should be noted that, in this embodiment and another embodiment, before the terminal device calls the above-mentioned detection node to detect the target task node through the discovery unit, the terminal device first obtains multiple standard heartbeat signals through the automatic scheduling platform configured by itself, and constructs a standard heartbeat table based on the multiple standard heartbeat signals, and then stores the standard heartbeat table in the storage device within the terminal device. At the same time, the automatic scheduling platform configures monitoring instructions based on the standard heartbeat table, and deploys the monitoring instructions in the detection node within the operating system, so that the detection node can detect the target database in real time when the target database is running, thereby determining the real-time status of the target task node in the target database.

[0078] Step S20: When the first real-time status is an abnormal state, detecting the target task node to construct a second heartbeat table, and determining the first abnormal state type of the target task node through the second heartbeat table;

[0079] In this embodiment, when the terminal device determines that the first real-time state corresponding to the target task node is an abnormal state, the terminal device calls the decision platform configured by itself to detect the target task node again to construct a second heartbeat table corresponding to the target task node. The decision platform then determines the first abnormal state type corresponding to the target task node through the second heartbeat table.

[0080] Exemplarily, for example, when the terminal device determines that the first real-time states corresponding to the target task nodes heartbeat_tab1 and heartbeat_tab2 are both abnormal states, the terminal device calls the decision platform configured by itself, and the decision platform bypasses the above-mentioned detection nodes agent1 and agent2, and directly logs in to the ORACLE database through sqlplus, thereby receiving the heartbeat signals respectively emitted by the target task nodes heartbeat_tab1 and heartbeat_tab2, and constructs each second heartbeat table based on the heartbeat signals respectively emitted by the target task nodes heartbeat_tab1 and heartbeat_tab2. The decision unit then determines whether the target task nodes heartbeat_tab1 and heartbeat_tab2 are in an abnormal state based on each second heartbeat table, and when it is determined that the target task nodes heartbeat_tab1 and heartbeat_tab2 are both in an abnormal state, determines whether the first abnormal state type corresponding to the target task nodes heartbeat_tab1 and heartbeat_tab2 is a hang state or a down state.

[0081] It should be noted that, in this embodiment and another embodiment, when the decision platform logs in to the ORACLE database through sqlplus, the decision platform first queries the open_mode of the ORACLE database and obtains the query result. When the decision platform determines that the query result is the mount / nomount state, it determines that the ORACLE database is in a normal start-stop state, and then determines that the ORACLE database is in a normal maintenance state, or the ORACLE database has been repaired and is completing the restart process. The decision platform then determines that the ORACLE database is in a normal state and determines that the abnormal result detected by the detection node agent1 is a false alarm. At the same time, the decision platform also needs to query the datebase_role of the ORACLE database to ensure that the database it detects is the master database contained in the ORACLE database.

[0082] In addition, in this embodiment and another embodiment, when the decision unit cannot access the target task nodes heartbeat_tab1 and heartbeat_tab2, the decision unit finds the VIP corresponding to the target task node heartbeat_tab3 or other target task nodes in the ORACLE database, and then logs in to the VIP through sqlplus to obtain the heartbeat signal emitted by the target task node heartbeat_tab3, and constructs a third heartbeat table based on the heartbeat signal emitted by the target task node heartbeat_tab3, thereby determining the first abnormal state type corresponding to the above-mentioned target task nodes heartbeat_tab1 and heartbeat_tab2 based on the third heartbeat table.

[0083] Furthermore, in a feasible embodiment, the target database further includes a query window, and the step of "determining the first abnormal state type of the target task node through the second heartbeat table" in the above step S20 may specifically include:

[0084] Step S201: determining whether the second heartbeat table is in the normal update state based on the standard heartbeat table;

[0085] In this embodiment, after constructing the second heartbeat table, the decision unit detects the second heartbeat table based on the above-mentioned standard heartbeat table, and thereby determines whether the second heartbeat table is in a normal update state based on whether the update content corresponding to the second heartbeat table matches the standard heartbeat table.

[0086] Step S202: if it is determined that the second heartbeat table is not in the normal update state, accessing the query window to obtain a first query result;

[0087] In this embodiment, if the decision unit determines that the updated content of the second heartbeat table does not match the standard heartbeat table, it determines that the second heartbeat table is not in a normal update state. The decision unit then queries the query window contained in the target database and generates a first query result.

[0088] Step S203: determining a first abnormal state type of the target task node based on the first query result;

[0089] In this embodiment, the decision unit determines the first abnormal state type corresponding to the target task node based on the generated first query result.

[0090] Exemplarily, for example, after constructing the second heartbeat table, the decision unit detects each second heartbeat table based on the above-mentioned standard heartbeat table, and thereby determines whether each second heartbeat table is in a normal update state based on whether the update content corresponding to each second heartbeat table matches the standard heartbeat table. Afterwards, if the decision platform determines that the update content corresponding to each second heartbeat table does not match the standard heartbeat table, it determines that each second heartbeat table is not in a normal update state. The decision unit then queries the gv$instance view contained in the ORACLE database to determine whether the target task nodes heartbeat_tab1 and heartbeat_tab2 are still in the ORACLE database, and generates a first query result. Finally, the decision unit determines, based on the first query result, whether the first abnormal state type corresponding to the target task nodes heartbeat_tab1 and heartbeat_tab2 is a hang state or a down state.

[0091] Furthermore, in a feasible embodiment, the first abnormal state type includes a first abnormality type and a second abnormality type; the above step S203 may specifically include:

[0092] Step S2031: If the first query result indicates that the target task node is in the target database, determining that the first abnormal state type of the target task node is the first abnormal type;

[0093] Step S2032: If the first query result is that the target task node is not in the target database, determining that the first abnormal state type of the target task node is the second abnormal state type;

[0094] Exemplarily, for example, when the decision unit determines that the first query result is that the target task nodes heartbeat_tab1 and / or heartbeat_tab2 are both in the ORACLE database, it is determined that the target task nodes heartbeat_tab1 and / or heartbeat_tab2 are simply unable to send a heartbeat signal, thereby determining that the first abnormal state types corresponding to the target task nodes heartbeat_tab1 and / or heartbeat_tab2 are both hang types;

[0095] If the decision unit determines that the first query result is that the target task node heartbeat_tab1 and / or heartbeat_tab2 is not in the ORACLE database, it is determined that the target task node heartbeat_tab1 and / or heartbeat_tab2 has been hung, and thus determines that the first abnormal state type corresponding to the target task node heartbeat_tab1 and / or heartbeat_tab is down state.

[0096] Step S30: When the first real-time state is the abnormal state, detecting the operating system to determine a second real-time state of the operating system, and when the second real-time state is the abnormal state, determining a second abnormal state type corresponding to the operating system;

[0097] In this embodiment, when the decision unit determines that the first real-time state corresponding to the target task node is an abnormal state, it detects the operating system connected to the target database to determine the second real-time state corresponding to the operating system. When the decision unit determines that the second real-time state is an abnormal state, it further determines the second abnormal state type corresponding to the operating system.

[0098] Exemplarily, for example, while the decision unit determines that the target task nodes heartbeat_tab1 and heartbeat_tab2 are each in an abnormal state, the decision unit separately detects the operating system OS1 and the operating system OS2 connected to the ORACLE database. During the detection of the operating system OS1, the decision unit queries the information in the errpt of the operating system OS1 in the past 60 minutes and detects the connectivity between the operating system OS1 and the operating system OS2. Similarly, during the detection of the operating system OS2, the decision unit queries the information in the errpt of the operating system OS2 in the past 60 minutes and detects the connectivity between the operating system OS2 and the operating system OS1, thereby determining whether the second real-time status corresponding to the operating system OS1 and the operating system OS2 is a normal state or an abnormal state. If the decision unit detects that the second real-time status corresponding to the operating system OS1 is an abnormal state and the second real-time status corresponding to the operating system OS2 is a normal state, the decision unit further determines whether the second abnormal state type corresponding to the operating system OS1 is a down state or a warn state.

[0099] Step S40: determining a target adjustment scheme based on the first abnormal state type and the second abnormal state type, and adjusting the target task node and / or the operating system according to the target adjustment scheme to switch the real-time status corresponding to the target task node and / or the operating system from the abnormal state to the normal state;

[0100] In this embodiment, the decision unit determines a target adjustment plan based on the acquired first abnormal state type and second abnormal state type, and inputs the target adjustment plan into the handling unit configured in the terminal device. The handling unit adjusts the target task node and / or operating system based on the target adjustment plan so that the target task node and / or operating system can normally send a heartbeat signal to the detection node or the decision unit, thereby ensuring that the corresponding real-time status of the target task node and / or operating system is converted from an abnormal state to a normal state.

[0101] Exemplarily, for example, when the decision unit determines that the target task node heartbeat_tab1 and the target task node heartbeat_tab2 are both in the hang state, the operating system OS1 is in the Warn state or the Down state, and the operating system OS2 is in the Normal state, the decision unit determines that the target adjustment plan is to restart the target task node heartbeat_tab1, and the decision unit then sends the target adjustment plan to the disposal module configured by the terminal device itself, and the disposal module restarts the target task node heartbeat_tab1 according to the target adjustment plan, so that each target task node and each operating system can generate a heartbeat signal normally, and thus the corresponding real-time status of each target task node and each operating system is converted from an abnormal state to a normal state.

[0102] Furthermore, in a feasible embodiment, the step of “determining a target adjustment solution based on the first abnormal state type and the second abnormal state type” in the above step S40 may specifically include:

[0103] Step S401: obtaining a preset standard adjustment scheme matrix;

[0104] In this embodiment, the decision unit first reads the storage device to obtain a standard adjustment solution matrix pre-stored by a technician, which includes a plurality of standard abnormal state types and standard adjustment solutions corresponding to the plurality of standard abnormal state types.

[0105] Step S402: querying the standard adjustment solution matrix based on the first abnormal state type and the second abnormal state type to determine a target adjustment solution from among the standard adjustment solutions included in the standard adjustment solution matrix;

[0106] In this embodiment, the decision unit queries the standard adjustment solution matrix based on the acquired first abnormal state type and second abnormal state type to determine the target adjustment solution among the standard adjustment solutions included in the standard adjustment solution matrix.

[0107] For example, see Figure 4 , Figure 4 This is a standard adjustment scheme matrix diagram of an embodiment of the automatic repair method of the database of this application. The decision unit first reads the above storage configuration to obtain the standard adjustment scheme matrix pre-stored by the technician. Figure 4 The standard adjustment scheme matrix shown includes multiple standard abnormal state types and standard adjustment schemes corresponding to the multiple standard abnormal state types. Afterwards, the decision unit queries the standard adjustment scheme matrix based on the fact that the target task node heartbeat_tab1 and the target task node heartbeat_tab2 are each in the hang state, the operating system OS1 is in the Warn state or the Down state, and the operating system OS2 is in the Normal state, thereby determining that the target adjustment scheme is to restart the target task node heartbeat_tab1.

[0108] In this embodiment, during the operation of the target database, the target task node configured in the target database generates a heartbeat signal according to a preset standard heartbeat table, and sends the heartbeat signal to the operating system connected to the target database; during the operation of the target database, the terminal device calls the detection node configured in the operating system through the discovery unit configured by itself to detect the target task node, so as to obtain the heartbeat signal emitted by the target task node, and constructs a first heartbeat table based on the heartbeat signal emitted by the target task node. The terminal device then determines through the first heartbeat table whether the first real-time status of the target task node is a normal state or an abnormal state. Afterwards, when the terminal device determines that the first real-time status corresponding to the target task node is an abnormal state, the terminal device calls the decision platform configured by itself to detect the target task node again, so as to construct a second heartbeat table corresponding to the target task node. The decision platform then uses the second heartbeat table to detect the target task node. The jump table determines the first abnormal state type corresponding to the target task node. After that, the decision unit detects the operating system connected to the target database while determining that the first real-time state corresponding to the target task node is an abnormal state to determine the second real-time state corresponding to the operating system. The decision unit further determines the second abnormal state type corresponding to the operating system when determining that the second real-time state is an abnormal state. Finally, the decision unit determines the target adjustment plan based on the obtained first abnormal state type and second abnormal state type, and inputs the target adjustment plan into the processing unit configured in the terminal device. The processing unit adjusts the target task node and / or operating system based on the target adjustment plan so that the target task node and / or operating system can normally send heartbeat signals to the detection node or decision unit, thereby ensuring that the real-time states corresponding to the target task node and / or operating system are converted from abnormal states to normal states.

[0109] In this way, the present application solves the technical problem in the related art that the abnormal situation of the service capability of the terminal device cannot be detected when the database is in an extreme state such as down or hang by enabling the terminal device to detect that the target task node in the database is in an extreme state such as down or hang. The technical effect of enabling the terminal device to detect the abnormal situation of the service capability of the target database even in extreme situations, and then enabling the terminal device to automatically repair the target database based on the abnormal situation is achieved.

[0110] Furthermore, based on the first embodiment of the automatic repair method for a database of the present application, a second embodiment of the automatic repair method for a database of the present application is proposed herein.

[0111] Please refer to Figure 5 , Figure 5 This is a flow chart of the second embodiment of the automatic repair method for the database of this application, as shown in FIG. Figure 5 As shown, in a feasible embodiment, before the above step S10, the automatic repair method of the database of the present application may further include:

[0112] Step A10: obtaining a plurality of preset defined time values, and constructing a time threshold script based on the plurality of defined time values;

[0113] In this embodiment, the terminal device calls its own configured handling unit to obtain multiple defined time values ​​pre-stored by the technician corresponding to the discovery unit, decision unit and handling unit, and constructs a time threshold script based on the multiple defined time values.

[0114] Step A20: controlling the detection node to detect the target task node according to the time threshold script, so that the detection node constructs a first heartbeat table within the time threshold corresponding to the time threshold script;

[0115] In this embodiment, the disposal unit uploads the constructed time threshold script to the terminal device, and the terminal device calls the discovery unit to control the above-mentioned detection node to detect the target task node based on the defined time value specified in the time threshold script, so that the discovery unit can construct the first heartbeat table within the defined time value corresponding to the discovery unit specified in the time threshold script and determine the first real-time status corresponding to the target task node.

[0116] Exemplarily, for example, the terminal device calls its own configured handling unit to obtain 24 defined time value timeouts pre-set by the technician corresponding to the discovery unit, decision unit and handling unit, respectively, and determines that the time length corresponding to each of the 24 defined time value timeouts is 5s. The handling unit then constructs a time threshold script based on the 24 defined time value timeouts. Afterwards, when the ORACLE database is running, the terminal device calls the discovery unit to control the detection nodes agent1 and agent2 to detect the target task node heartbeat_tab1 and the target task node heartbeat_tab2 respectively based on the time threshold script, thereby ensuring that the discovery unit can construct the first heartbeat table corresponding to the target task node heartbeat_tab1 and the target task node heartbeat_tab2 within 5s within the 1 defined time value timeout corresponding to the discovery unit, and determine the first real-time status corresponding to the target task node heartbeat_tab1 and the target task node heartbeat_tab2 respectively.

[0117] It should be noted that, in this embodiment and another embodiment, after obtaining the time threshold script, the terminal device can also control the decision unit based on the time threshold script to ensure that the decision unit can detect the first abnormal state type and the second abnormal state type corresponding to each target task node and each operating system within the multiple defined time values ​​corresponding to the decision unit in the time threshold script, and determine the target adjustment plan based on each first abnormal state type and the second abnormal state type. Similarly, the terminal device can also control the disposal unit based on the time threshold script to ensure that the disposal unit can complete the adjustment of the target task node within the multiple defined time values ​​corresponding to the decision unit in the time threshold script. In this way, the terminal device can ensure that the detection and adjustment tasks of the ORACLE database are completed within the 120 seconds specified by the time threshold script, thereby improving the adjustment and repair efficiency of the database.

[0118] Furthermore, based on the first embodiment and / or the second embodiment of the automatic repair method for a database of the present application, a third embodiment of the automatic repair method for a database of the present application is proposed herein.

[0119] Please refer to Figure 6 , Figure 6 This is a flow chart of the third embodiment of the automatic repair method for the database of this application, as shown in FIG. Figure 6 As shown, in a feasible embodiment, before the step of "adjusting the target task node and / or the operating system according to the target adjustment scheme" in step S40, the method further includes:

[0120] Step B10: Obtaining a preset anti-duplicate time limit;

[0121] In this embodiment, before the processing unit adjusts the target task node according to the target adjustment plan, the processing unit first obtains a preset anti-duplicate time limit.

[0122] Step B20: Setting the target task node and / or the operating system based on the anti-repeating time limit so that the target task node and / or the operating system cannot be repeatedly adjusted within the anti-repeating time limit;

[0123] In this embodiment, the processing unit sets the target task node and / or operating system based on the anti-repeating time limit, thereby ensuring that the target task node and / or operating system cannot be repeatedly adjusted by the processing unit within the equation time limit.

[0124] Exemplarily, for example, before restarting the target task node heartbeat_tab1 according to the target adjustment plan, the handling unit first obtains the anti-restart time limit preset by the technician as 10 minutes. Afterwards, the handling unit sets the target task node heartbeat_tab1, target task node heartbeat_tab2 operating system OS1 and operating system OS2 in the ORACLE database based on the anti-restart time limit, thereby ensuring that the target task node heartbeat_tab1, target task node heartbeat_tab2, operating system OS1 and operating system OS2 will not be restarted within 10 minutes.

[0125] It should be noted that, in this embodiment and another embodiment, after the processing unit sets the anti-duplicate time limit, the terminal device can also confirm the abnormal situation of the terminal device misjudging the target task node heartbeat_tab1 and / or heartbeat_tab2 and then the Hang state due to incorrect user password, full archive space, full file system, / etc / hosts configuration error and inability to obtain IP, slow data connection, etc., and construct an error code based on each abnormal situation, and query the preset whitelist database based on the error code, so that when it is determined that the error code is consistent with the standard error code contained in the whitelist database, it is determined that the detection error is stopped, thereby stopping the automatic repair operation of the ORACLE database. In this way, the terminal device can ensure that in the process of detecting the database, erroneous operations and repeated operations that cause the database to restart repeatedly are avoided.

[0126] In addition, to achieve the above purpose, the present application also provides an automatic repair device for a database, the automatic repair device for the database is applied to a target database connected to an operating system, the operating system includes a detection node, the target database includes a target task node, please refer to Figure 7 , Figure 7 This is a schematic diagram of the functional modules involved in an embodiment of the automatic repair device for the database of this application, such as Figure 7 As shown, the device includes:

[0127] A first detection module 10 is configured to call the detection node to detect the target task node to construct a first heartbeat table, and determine a first real-time state of the target task node through the first heartbeat table;

[0128] A second detection module 20 is configured to detect the target task node to construct a second heartbeat table when the first real-time state is an abnormal state, and determine the first abnormal state type of the target task node through the second heartbeat table;

[0129] a third detection module 30, configured to detect the operating system to determine a second real-time state of the operating system when the first real-time state is the abnormal state, and to determine a second abnormal state type corresponding to the operating system when the second real-time state is the abnormal state;

[0130] The system repair module 40 is used to determine a target adjustment plan based on the first abnormal state type and the second abnormal state type, and adjust the target task node and / or the operating system according to the target adjustment plan so that the real-time status corresponding to the target task node and / or the operating system is switched from the abnormal state to the normal state.

[0131] Furthermore, the first detection module 10 includes:

[0132] a first detection unit, configured to obtain a standard heartbeat table and determine whether the first heartbeat table is in a normal updating state based on the standard heartbeat table;

[0133] The first judging unit is configured to determine that the first real-time state of the target task node is an abnormal state if it is determined that the first heartbeat table is not in the normal update state.

[0134] Furthermore, the target database further includes a query window, a second detection module 20, including:

[0135] a second judging unit, configured to judge whether the second heartbeat table is in the normal updating state based on the standard heartbeat table;

[0136] a window query unit, configured to access the query window to obtain a first query result if it is determined that the second heartbeat table is not in the normal update state;

[0137] A third judgment unit is used to determine a first abnormal state type of the target task node based on the first query result.

[0138] Furthermore, the first abnormal state type includes a first abnormal type and a second abnormal type; the third judgment unit includes:

[0139] a first confirmation subunit, configured to determine that the first abnormal state type of the target task node is the first abnormal type if the first query result indicates that the target task node is in the target database;

[0140] The second confirmation subunit is configured to determine that the first abnormal state type of the target task node is the second abnormal state type if the first query result is that the target task node is not in the target database.

[0141] Furthermore, the system repair module 40 includes:

[0142] A matrix acquisition unit, used to acquire a preset standard adjustment scheme matrix;

[0143] A solution query unit is configured to query the standard adjustment solution matrix based on the first abnormal state type and the second abnormal state type, so as to determine a target adjustment solution among the standard adjustment solutions included in the standard adjustment solution matrix.

[0144] Furthermore, the first detection module 10 further includes:

[0145] A script construction unit, configured to obtain a plurality of preset defined time values ​​and construct a time threshold script based on the plurality of defined time values;

[0146] The script deployment unit is used to control the detection node to detect the target task node according to the time threshold script, so that the detection node constructs a first heartbeat table within the time threshold corresponding to the time threshold script.

[0147] Furthermore, the system repair module 40 further includes:

[0148] A parameter acquisition unit, used to obtain a preset anti-duplicate time limit;

[0149] A parameter setting unit is used to set the target task node and / or the operating system based on the anti-repetition time limit so that the target task node and / or the operating system cannot be repeatedly adjusted within the anti-repetition time limit.

[0150] In addition, the present application also provides a terminal device having an automatic database repair program that can run on a processor. When the terminal device executes the automatic database repair program, the steps of the automatic database repair method described in any of the above embodiments are implemented.

[0151] The specific embodiments of the terminal device of the present application are basically the same as the embodiments of the automatic repair method of the above-mentioned database, and will not be described in detail here.

[0152] In addition, the present application also provides a computer-readable storage medium, which stores an automatic database repair program. When the automatic database repair program is executed by a processor, it implements the steps of the automatic database repair method described in any of the above embodiments.

[0153] The specific embodiments of the computer-readable storage medium of the present invention are substantially the same as the embodiments of the automatic database repair method described above, and are not described in detail here.

[0154] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.

[0155] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0156] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0157] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for automatically repairing a database, characterized in that: The automatic database repair method is applied to a target database connected to an operating system, the operating system includes a detection node, and the target database includes a target task node. The automatic database repair method includes the following steps: Calling the detection node to detect the target task node to construct a first heartbeat table, and determining a first real-time state of the target task node through the first heartbeat table; When the first real-time state is an abnormal state, detecting the target task node to construct a second heartbeat table, and determining the first abnormal state type of the target task node through the second heartbeat table; When the first real-time state is the abnormal state, detecting the operating system to determine a second real-time state of the operating system, and when the second real-time state is the abnormal state, determining a second abnormal state type corresponding to the operating system; A target adjustment scheme is determined based on the first abnormal state type and the second abnormal state type, and the target task node and / or the operating system are adjusted according to the target adjustment scheme so that the real-time status corresponding to the target task node and / or the operating system is switched from the abnormal state to the normal state.

2. The automatic database repair method according to claim 1, characterized in that: The step of determining the first real-time status of the target task node through the first heartbeat table includes: Obtaining a standard heartbeat table, and determining whether the first heartbeat table is in a normal update state based on the standard heartbeat table; If it is determined that the first heartbeat table is not in the normal update state, it is determined that the first real-time state of the target task node is an abnormal state.

3. The automatic database repair method according to claim 2, characterized in that: The target database further includes a query window, and the step of determining the first abnormal state type of the target task node through the second heartbeat table includes: determining whether the second heartbeat table is in the normal update state based on the standard heartbeat table; If it is determined that the second heartbeat table is not in the normal update state, accessing the query window to obtain the first query result; A first abnormal state type of the target task node is determined based on the first query result.

4. The automatic database repair method according to claim 3, characterized in that: The first abnormal state type includes a first abnormality type and a second abnormality type; The step of determining the first abnormal state type of the target task node based on the first query result includes: If the first query result is that the target task node is in the target database, determining that the first abnormal state type of the target task node is the first abnormal type; If the first query result is that the target task node is not in the target database, it is determined that the first abnormal state type of the target task node is the second abnormal type.

5. The automatic database repair method according to claim 4, characterized in that: The step of determining a target adjustment solution based on the first abnormal state type and the second abnormal state type includes: Obtain the preset standard adjustment plan matrix; The standard adjustment solution matrix is ​​queried based on the first abnormal state type and the second abnormal state type to determine a target adjustment solution among the standard adjustment solutions included in the standard adjustment solution matrix.

6. The automatic database repair method according to claim 1, wherein: Before the step of calling the detection node to detect the target task node to construct a first heartbeat table, the method further includes: Obtaining a plurality of preset defined time values, and constructing a time threshold script based on the plurality of defined time values; The detection node is controlled to detect the target task node according to the time threshold script, so that the detection node constructs a first heartbeat table within the time threshold corresponding to the time threshold script.

7. The automatic database repair method according to claim 1, wherein: Before the step of adjusting the target task node and / or the operating system according to the target adjustment scheme, the method further includes: Get the preset anti-duplicate time limit; The target task node and / or the operating system are set based on the anti-repetition time limit so that the target task node and / or the operating system cannot be repeatedly adjusted within the anti-repetition time limit.

8. An automatic database repair device, characterized in that: The automatic repair device for a database is applied to a target database connected to an operating system, the operating system includes a detection node, and the target database includes a target task node. The device includes: A first detection module is configured to call the detection node to detect the target task node to construct a first heartbeat table, and determine a first real-time state of the target task node through the first heartbeat table; A second detection module is configured to detect the target task node to construct a second heartbeat table when the first real-time state is an abnormal state, and determine the first abnormal state type of the target task node through the second heartbeat table; a third detection module, configured to detect the operating system to determine a second real-time state of the operating system when the first real-time state is the abnormal state, and to determine a second abnormal state type corresponding to the operating system when the second real-time state is the abnormal state; A system repair module is used to determine a target adjustment plan based on the first abnormal state type and the second abnormal state type, and adjust the target task node and / or the operating system according to the target adjustment plan so that the real-time status corresponding to the target task node and / or the operating system is switched from the abnormal state to the normal state.

9. A terminal device, characterized in that: The terminal device includes: a memory and a processor, wherein the memory stores an automatic database repair program that can be run on the processor, and when the automatic database repair program is executed by the processor, the steps of the automatic database repair method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores an automatic database repair program, which, when executed by a processor, implements the steps of the automatic database repair method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Database fault processing method and device based on monitoring service and distributed cluster

    CN115994044A

  • Database exception processing method, device and equipment and computer readable storage medium

    CN116340045A