Database downtime method and apparatus, electronic device, and storage medium

By prioritizing the database instance with the most global lock owners, sequentially shutting down and isolating transactions, and monitoring the status in real time, the problem of low database shutdown efficiency and system impact in existing technologies is solved, achieving an automated and unaffected shutdown process.

CN115495437BActive Publication Date: 2026-02-06CHINA CONSTRUCTION BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211162986.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-23
Publication Date
2026-02-06
Estimated Expiration
2042-09-23

AI Technical Summary

Technical Problem

Existing technologies for database instance shutdown are inefficient and cannot effectively guarantee that the system will not be affected. In particular, downtime affects system availability, while manual methods rely heavily on human expertise.

Method used

The system identifies the target database instance with the most global lock owners from the database instances awaiting shutdown, prioritizes it, and then shuts it down sequentially. This isolates transactions of the current database instance, monitors the shutdown status and lock owner transfer progress in real time, and automates the shutdown process.

Benefits of technology

It enables automated database instance shutdown without downtime or manual intervention, improving efficiency, ensuring system stability, and guaranteeing business continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115495437B_ABST
    Figure CN115495437B_ABST
Patent Text Reader

Abstract

The application discloses a database downtime method and device, electronic equipment and a storage medium. The method comprises the following steps: determining a target database instance with the most global lock masters from each database instance to be shut down; ranking the target database instance at the first position, and ranking the remaining database instances after the target database instance to obtain a downtime ranking result; determining the database instances in the downtime ranking result as current database instances in sequence; isolating transactions on a business virtual machine where the current database instance is located; shutting down the current database instance; monitoring the downtime states of each process to be shut down corresponding to the current database instance and the transfer progress of the global lock master of the current database instance in real time; when each process to be shut down is completed and the global lock master is completed, a new current database instance is determined until there is no database instance to be shut down.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of database management, and particularly relates to a database downtime method and device, electronic equipment and storage medium. BACKGROUND

[0002] The host platform database software is usually deployed in a cluster architecture to realize high concurrency and high availability of business continuity construction requirements, so multiple business virtual machines are deployed, and multiple database instances are usually deployed on each business virtual machine according to needs. Correspondingly, the deployed database instances can also be subjected to downtime processing according to needs.

[0003] The current downtime method for database instances is mainly to actively apply for a downtime window to shut down the system, and then to perform downtime on the database instances, so as to ensure that the downtime operation will not have any impact. Another way is to perform downtime operation manually and manually observe the specific downtime situation to enable manual intervention when problems occur to avoid impact.

[0004] However, the first method needs to be shut down, so that the business cannot be normally provided, affecting the system availability time. The second method is relatively low in efficiency and too dependent on the level of implementers, and cannot effectively ensure that the system will not be affected. SUMMARY

[0005] Based on the deficiencies of the prior art, the present application provides a database downtime method and device, electronic equipment and storage medium to solve the problems of relatively low efficiency and inability to ensure that the system will not be affected in the prior art.

[0006] In order to achieve the above purpose, the present application provides the following technical solutions:

[0007] The first aspect of the present application provides a database downtime method, comprising:

[0008] determining a target database instance with the most global lock masters from each database instance to be down;

[0009] ranking the target database instance in the first place, and ranking the remaining database instances except the target database instance after the target database instance to obtain a downtime ranking result;

[0010] determining the database instance ranked in the first place in each database instance not down in the current downtime ranking result as a new current database instance;

[0011] isolating transactions on a business virtual machine where the current database instance is located;

[0012] stopping the current database instance;

[0013] monitoring a stopping state of each process to be stopped corresponding to the current database instance and a transfer progress of a global lock owner of the current database instance in real time;

[0014] when it is monitored that each process to be stopped corresponding to the current database instance is completed and the global lock owner of the current database instance is completed, it is judged whether there is still a database instance to be stopped in the current stopping sequence result;

[0015] if it is judged that there is still a database instance to be stopped in the current stopping sequence result, it is returned to execute the database instance to be stopped in the current stopping sequence result, and the database instance sorted in the front is determined as a new current database instance until there is no database instance to be stopped in the stopping sequence result.

[0016] Optionally, in the database stopping method, the database instance sorted after the target database instance in the stopping sequence result, comprises:

[0017] each database instance except the target database is sorted after the target database instance according to the number of global lock owners from large to small to obtain the stopping sequence result.

[0018] Optionally, in the database stopping method, the target database instance with the most global lock owners is determined from the database instances to be stopped, comprising:

[0019] information of each database instance is obtained based on a name of an IRLM process corresponding to each database instance to be stopped;

[0020] the database instance with the largest value of a target field in the information of each database instance is determined as the target database instance; wherein the target field is a field of the number of global lock owners of a standard database instance.

[0021] Optionally, in the database stopping method, the transaction on the business virtual machine where the current database instance is located is isolated, comprising:

[0022] based on a name of a transaction middleware CICS AOR process running on the business virtual machine where the current database instance is located, a state of the transaction middleware CICS AOR process is set to a static state.

[0023] Optionally, in the database decommissioning method described above, the real-time monitoring of the decommissioning state of each to-be-decommissioned process corresponding to the current database instance and the transfer progress of the global lock owner of the current database instance comprises:

[0024] real-time monitoring of each target information code appearing in the decommissioning system log of the current database instance; wherein the target information code is used to represent that the corresponding process has been completed;

[0025] If it is monitored that each target information code corresponding to each to-be-decommissioned process has appeared in the decommissioning system log of the current database instance, and the transfer progress of the global lock owner of the current database instance, it is determined that each to-be-decommissioned process corresponding to the current database instance has completed decommissioning, and the global lock owner of the current database instance has completed transfer.

[0026] The second aspect of the present application provides a database decommissioning device, comprising:

[0027] a first determination unit configured to determine a target database instance with the most global lock owners from each database instance to be decommissioned;

[0028] a first sorting unit configured to sort the target database instance in the first place, and sort each database instance other than the target database instance after the target database instance, to obtain a decommissioning sorting result;

[0029] a selection unit configured to determine the database instance sorted in the first place among each database instance that has not been decommissioned in the current decommissioning sorting result as a new current database instance;

[0030] an isolation unit configured to isolate transactions on the business virtual machine where the current database instance is located;

[0031] a decommissioning unit configured to decommission the current database instance;

[0032] a monitoring unit configured to real-time monitor the decommissioning state of each to-be-decommissioned process corresponding to the current database instance and the transfer progress of the global lock owner of the current database instance;

[0033] a judgment unit configured to, when it is monitored that each to-be-decommissioned process corresponding to the current database instance has completed decommissioning, and the global lock owner of the current database instance has completed transfer, judge whether there is still a database instance that has not been decommissioned in the current decommissioning sorting result;

[0034] The returning unit is configured to, when it is determined that there is still a database instance that has not been taken down in the current taking-down sequence result, return the selecting unit to execute the determining of the database instance at the front of the database instances that have not been taken down in the current taking-down sequence result as a new current database instance until there is no database instance that has not been taken down in the taking-down sequence result.

[0035] Optionally, in the database taking-down device, when the first sorting unit executes the sorting of the database instances other than the target database instance after the target database instance to obtain a taking-down sequence result, the first sorting unit is configured to:

[0036] sort the database instances other than the target database instance after the target database instance according to the number of global lock masters in descending order to obtain a taking-down sequence result.

[0037] Optionally, in the database taking-down device, the first determining unit comprises:

[0038] The querying unit is configured to query information of each database instance based on the name of the IRLM process corresponding to each database instance to be taken down.

[0039] The first determining subunit is configured to determine the database instance with the largest value of a target field in the information of each database instance as the target database instance, wherein the target field is a field of the number of global lock masters of a standard database instance.

[0040] Optionally, in the database taking-down device, the isolating unit comprises:

[0041] The isolating subunit is configured to set the state of a transaction middleware CICSAOR process running on the business virtual machine where the current database instance is located to a static state based on the name of the transaction middleware CICSAOR process.

[0042] Optionally, in the database taking-down device, the monitoring unit comprises:

[0043] The monitoring subunit is configured to monitor each target information code appearing in the taking-down system log of the current database instance in real time, wherein the target information code is used to represent that the corresponding processing has been completed.

[0044] The second determining unit is configured to determine that each of the to-be-decommissioned processes corresponding to the current database instance is completed decommissioning and the global lock owner of the current database instance is completed transferring when it is monitored that the target information code corresponding to each of the to-be-decommissioned processes has appeared in the system down log of the current database instance and the transfer progress of the global lock owner of the current database instance.

[0045] The third aspect of the present application provides an electronic device, comprising:

[0046] a memory and a processor;

[0047] The memory is configured to store a program.

[0048] The processor is configured to execute the program, and the program, when executed, is specifically configured to implement the database decommissioning method according to any one of the preceding aspects.

[0049] The fourth aspect of the present application provides a computer storage medium for storing a computer program, and the computer program, when executed, is configured to implement the database decommissioning method according to any one of the preceding aspects.

[0050] The database decommissioning method provided by the present application determines the target database instance with the most global lock owners from each of the to-be-decommissioned database instances, so as to sort the target database instance in the first place and sort the remaining database instances other than the target database instance after the target database instance, to obtain a decommissioning sorting result. The database instance in the front of the current decommissioning sorting result is determined as a new current database instance, so as to decommission each of the database instances in turn. The transactions on the business virtual machine where the current database instance is located are isolated, so as to avoid affecting the transactions, and then the current database instance is decommissioned, and the decommissioning state of each of the to-be-decommissioned processes corresponding to the current database instance and the transfer progress of the global lock owner of the current database instance are monitored in real time. When it is monitored that each of the to-be-decommissioned processes corresponding to the current database instance is completed decommissioning and the global lock owner of the current database instance is completed transferring, it is determined whether there is still a database instance that is not decommissioned in the current decommissioning sorting result. If it is determined that there is still a database instance that is not decommissioned in the current decommissioning sorting result, the next database instance that is not decommissioned in the current decommissioning sorting result is determined as a new current database instance for processing, until there is no database instance that is not decommissioned in the decommissioning sorting result. Thus, a decommissioning mode in which the database instances are decommissioned automatically in turn is realized, without the need for shutdown and manual intervention, the efficiency of decommissioning is effectively improved, and the system is effectively ensured not to be affected. BRIEF DESCRIPTION OF DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only represent some embodiments of the present application, and for those skilled in the art, other drawings can be obtained based on the provided drawings without any creative effort.

[0052] Figure 1 A flow chart of a database shutdown method provided by an embodiment of the present application;

[0053] Figure 2 A flow chart of a method for determining a target database instance with the most global lock owners provided by an embodiment of the present application;

[0054] Figure 3 An architecture schematic diagram of a database shutdown device provided by an embodiment of the present application;

[0055] Figure 4 An architecture schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0056] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments only represent some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort fall within the scope of protection of the present application.

[0057] In the present application, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms “include”, “contain” or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement “including a…” does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0058] The embodiments of the present application provide a database shutdown method, as shown in Figure 1 The method comprises the following steps:

[0059] S101. From each database instance to be shutdown, a target database instance with the most global lock owners is determined.

[0060] It should be noted that the database instance with the most global lock masters has the longest lock transfer process duration, and the number of global locks held is much larger than that of other database instances, and the difference is usually an order of magnitude higher than the global locks held by other database instances. Therefore, preferentially shutting down the database instance can reduce interference with the database instance during the shutdown process of other database instances, and the probability of immediate transfer phenomenon that may occur. Moreover, by selecting the database instance for preferential shutdown, the global locks held by the database instance can be distributed to all other database instances in the database cluster after the shutdown operation is completed, so that the global lock distribution in the cluster is relatively balanced.

[0061] Therefore, it is necessary to first determine the target database instance with the most global lock masters from the database instances to be shut down, so as to preferentially shut down the target database instance.

[0062] Optionally, in another embodiment of the present application, a specific implementation of step S101 includes the following steps, as shown in the following table: Figure 2

[0063] S201, obtaining information of each database instance based on the name of the IRLM process corresponding to each database instance to be shut down.

[0064] It should be noted that the internal resource lock manager process (Internal Resource Lock Manager Address Space, IRLM) is mainly responsible for managing the lock resources of the database, and each database corresponds to an IRLM process. Therefore, the information about the resource lock of each database instance can be obtained by the name of the IRLM process corresponding to each database instance.

[0065] Optionally, the information of each database instance can be obtained by the following command:

[0066] “-MODIFY irlmproc, STATUS, ALLI”.

[0067] In the command, “irlmproc” is the name of the IRLM process corresponding to the database instance.

[0068] Optionally, since the name of the IRLM process corresponding to each database instance is fixed, the command can be prepared in advance by a solidified task for concurrent execution, without the need for manual repeated input.

[0069] S202, determining the database instance with the largest value of the target field in the information of each database instance as the target database instance.

[0070] ​The target field is a field of the number of global lock masters of the standard database instance. Specifically, in the embodiment of the present application, the target field refers to the GLM-CNT field. Therefore, in the structure of the command output, the database instance with the largest GLM-CNT field is determined as the target database instance.

[0071] S102, ranking the target database instance in the first place and ranking the remaining database instances except the target database instance after the target database instance to obtain a down ranking result.

[0072] It should be noted that in the embodiment of the present application, each database instance is processed in turn for down, and the target database instance needs to be processed first. Therefore, the target database instance is ranked in the first place, and the remaining database instances except the target database instance are ranked after the target database instance to obtain a down ranking result.

[0073] It should be noted that since the number of global lock masters of other data volume instances differs not much, the ranking of other database instances can be sorted according to different strategies according to requirements.

[0074] Optionally, in another embodiment of the present application, ranking the remaining database instances except the target database instance after the target database instance to obtain an implementation of the down ranking result can be specifically:

[0075] Ranking the remaining database instances except the target database instance after the target database instance in the order of the number of global lock masters from large to small to obtain a down ranking result.

[0076] In the embodiment of the present application, other database instances are also ranked according to the number of global lock masters, that is, the entire down ranking result is obtained by ranking in the order of the number of global lock masters from large to small.

[0077] Optionally, since the GLM-CNT field, when determining the target database instance, the GLM-CNT field needs to be sorted. Therefore, step S102 can be specifically: querying the information of each database instance by a command, then sorting the returned results in the order of GLM-CNT field from large to small. The database instance corresponding to the returned result ranked in the first place is determined as the target database instance, and the down ranking result can be generated according to the sorting result of the GLM-CNT field.

[0078] S103, determining the database instance ranked in the first place among the database instances not down in the current down ranking result as a new current database instance.

[0079] In the embodiment of the present application, each database instance is processed in turn according to the sequencing result, so the database instance that is downed and sequenced first is determined as the current database instance to be processed.

[0080] S104, isolating the transaction on the business virtual machine where the current database instance is located.

[0081] It should be noted that the transaction on the business virtual machine may involve the database instance during processing, and if the database instance is downed during transaction processing, the transaction processing will be affected, so in the embodiment of the present application, the transaction on the business virtual machine where the current database instance is located needs to be isolated, that is, no new transaction request is received, so that the current database instance can be downed after the current transaction processing is completed.

[0082] Optionally, in another embodiment of the present application, a specific implementation of step S104 comprises:

[0083] Based on the name of the transaction middleware CICS AOR process running on the business virtual machine where the current database instance is located, the state of the transaction middleware CICS AOR process is set to a quiescent state.

[0084] It should be noted that since the transaction middleware CICS AOR process is responsible for receiving transaction requests, the state of the transaction middleware CICS AOR process can be set from active to quiescent, so that no new transaction request is received. The name of the transaction middleware CICS AOR process on the business virtual machine is different and fixed, so the state of the transaction middleware CICS AOR process can be set to quiescent based on the name of the transaction middleware CICS AOR process running on the business virtual machine where the current database instance is located.

[0085] The state can be set through the command "EYUAPI ('PERFORM SET ACTION (QUIESCE)')". Since the name of the process is also fixed, the command can also be issued through the prepared fixed job.

[0086] S105, downing the current database instance.

[0087] Specifically, a down command is sent to the current database to start downing the current database instance.

[0088] Optionally, in order to avoid affecting normal processing transactions, before step S105, the connection state of each user connected to the current database instance can be checked by a command. When the command result returns 0, the formal down process is started.

[0089] S106, real-time monitoring of the down state of each process to be down of the current database instance corresponding to the current database instance and the transfer progress of the global lock owner of the current database instance.

[0090] It should be noted that for the down of the database instance, the main is to stop the down of each process to be down of the database instance, and to transfer the global lock owner managed by it to other database instances for management. Therefore, by monitoring the down state of each process to be down of the current database instance corresponding to the current database instance and the transfer progress of the global lock owner of the current database instance, it can be determined whether the down of the current database is completed.

[0091] Among them, the process to be down mainly includes MSTR process, DBM1 process and IRLM process, and of course can also include other optional processes.

[0092] Optionally, in another embodiment of the present application, a specific implementation of step S106 includes:

[0093] Real-time monitoring of each target information code appearing in the down system log of the current database instance.

[0094] Among them, the target information code is used to represent that the corresponding processing has been completed, for example, for the transfer processing of the global lock owner, the corresponding target information code is IXL024I message code, that is, when the global lock owner is transferred, the IXL024I message code will be generated in the log to record that the global lock owner transfer work has been completed.

[0095] Therefore, if it is monitored that each process to be down corresponding to the target information code has appeared in the down system log of the current database instance, and the transfer progress of the global lock owner of the current database instance, it is determined that each process to be down corresponding to the current database instance is completed, and the global lock owner of the current database instance is completed.

[0096] Optionally, since the GLM-CNT field can reflect the number of global lock owners of the current database instance, it can also be determined whether the global lock owner of the current database instance has been transferred by monitoring whether the GLM-CNT field is zero. Of course, in order to ensure the accuracy of the monitoring result, the global lock owner of the current database instance can also be monitored by the GLM-CNT field and the target information code whether it has been transferred.

[0097] S107, judging whether each to-be-shutdown process corresponding to the current database instance is completed and the global lock master of the current database instance is completed to transfer.

[0098] When each to-be-shutdown process corresponding to the current database instance is completed and the global lock master of the current database instance is completed to transfer, it is indicated that the current database instance is completed to shutdown, and the next database instance to be shutdown can be processed. Therefore, step S108 is executed.

[0099] S108, judging whether there is still a database instance to be shutdown in the current shutdown sequencing result.

[0100] If it is judged that there is still a database instance to be shutdown in the current shutdown sequencing result, step S103 is returned to determine the next database instance to be processed and to process the database instance.

[0101] If it is judged that there is still a database instance to be shutdown in the current shutdown sequencing result, step S109 is executed.

[0102] S109, determining that all database instances are completed to shutdown.

[0103] The method provided by the embodiment of the application determines a target database instance with the most global lock masters from each database instance to be shutdown, so as to sequence the target database instance in the first position and sequence each database instance except the target database instance after the target database instance, to obtain a shutdown sequencing result. A database instance in the front of each database instance to be shutdown in the current shutdown sequencing result is determined as a new current database instance, so as to sequentially shutdown each database instance. A transaction on a business virtual machine where the current database instance is located is isolated to avoid affecting the transaction, and then the current database instance is shutdown, and the shutdown state of each to-be-shutdown process corresponding to the current database instance and the transfer progress of the global lock master of the current database instance are monitored in real time. When each to-be-shutdown process corresponding to the current database instance is completed and the global lock master of the current database instance is completed to transfer, it is judged whether there is still a database instance to be shutdown in the current shutdown sequencing result. If it is judged that there is still a database instance to be shutdown in the current shutdown sequencing result, the next database instance to be shutdown in each database instance to be shutdown in the current shutdown sequencing result is determined as a new current database instance, and the database instance is processed until there is no database instance to be shutdown in the shutdown sequencing result. Thus, a way of automatically and sequentially shutting down database instances is realized, without shutdown and manual intervention, effectively improving the shutdown efficiency and effectively ensuring that the system is not affected.

[0104] Another embodiment of the present application provides a database downtime device, as shown, comprising: Figure 3

[0105] A first determining unit 301 is configured to determine a target database instance with the most global lock masters from each database instance to be down.

[0106] A first sorting unit 302 is configured to sort the target database instance in the first place, and sort each database instance other than the target database instance after the target database instance, to obtain a downtime sorting result.

[0107] A selecting unit 303 is configured to determine a database instance sorted in the first place among each database instance not down in the current downtime sorting result as a new current database instance.

[0108] An isolating unit 304 is configured to isolate transactions on a business virtual machine where the current database instance is located.

[0109] A downtime unit 305 is configured to down the current database instance.

[0110] A monitoring unit 306 is configured to monitor a downtime state of each process to be down corresponding to the current database instance and a transfer progress of the global lock master of the current database instance in real time.

[0111] A judging unit 307 is configured to judge whether there is still a database instance not down in the current downtime sorting result when it is monitored that each process to be down corresponding to the current database instance is completed downtime and the global lock master of the current database instance is completed transfer.

[0112] A returning unit 308 is configured to return the selecting unit 303 to execute the operation of determining the database instance sorted in the first place among each database instance not down in the current downtime sorting result as the new current database instance until there is no database instance not down in the downtime sorting result when it is judged that there is still a database instance not down in the current downtime sorting result.

[0113] Optionally, in the database downtime device provided by another embodiment of the present application, when the first sorting unit executes the operation of sorting each database instance other than the target database instance after the target database instance to obtain the downtime sorting result, the operation is:

[0114] sorting each database instance other than the target database instance after the target database instance according to the order of the number of global lock masters from large to small to obtain the downtime sorting result.

[0115] Optionally, in the database downtime device provided by another embodiment of the present application, the first determining unit comprises:​

[0116] The query unit is configured to query information of each database instance based on the name of the IRLM process corresponding to each database instance to be shut down.

[0117] The first determination sub-unit is configured to determine, as a target database instance, a database instance with the largest value of a target field in the information of each database instance. The target field is a field of the number of global lock owners of the standard database instance.

[0118] Optionally, in the database shutdown device provided in another embodiment of the present application, the isolation unit comprises:

[0119] The isolation sub-unit is configured to set the state of the transaction middleware CICS AOR process to a static state based on the name of the transaction middleware CICS AOR process running on the business virtual machine where the current database instance is located.

[0120] Optionally, in the database shutdown device provided in another embodiment of the present application, the monitoring unit comprises:

[0121] The monitoring sub-unit is configured to monitor each target information code appearing in the shutdown system log of the current database instance in real time. The target information code is used to represent that the corresponding processing has been completed.

[0122] The second determination unit is configured to determine that each to-be-shutdown process corresponding to the current database instance has completed shutdown, and the global lock owner of the current database instance has completed transfer, when it is monitored that the target information code corresponding to each to-be-shutdown process has appeared in the shutdown system log of the current database instance, and the transfer progress of the global lock owner of the current database instance.

[0123] It should be noted that the specific working processes of each unit provided in the above embodiments of the present application can be correspondingly referred to the corresponding steps in the above method embodiments, which will not be described here again.

[0124] Another embodiment of the present application provides an electronic device, as shown in the figure, comprising: Figure 4

[0125] The memory 401 and the processor 402.

[0126] The memory 401 is configured to store a program.

[0127] The processor 402 is configured to execute the program stored in the memory 401, and the program, when executed, is specifically configured to implement the database shutdown method provided in any one of the above embodiments.

[0128] ​Another embodiment of the present application provides a computer storage medium, configured to store a computer program, wherein the computer program is executed to implement the method for shutting down the database according to any one of the above embodiments.

[0129] Computer storage media includes permanent and non-permanent, removable and non-removable media, which can be realized by any method or technology to store information. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. According to the definition herein, computer readable media does not include transitory computer readable media, such as modulated data signals and carriers.

[0130] The skilled person can further realize that the units and algorithm steps of the examples described in connection with the embodiments disclosed herein can be realized in electronic hardware, computer software, or a combination of both. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general terms above. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0131] The above description of the disclosed embodiments enables a person skilled in the art to implement or use the present application. Various modifications to the embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method of gracefully shutting down a database, the method comprising: The application comprises the following steps: determining a target database instance with the most global lock masters from each database instance to be taken down; ranking the target database instance in the first place and ranking each of the remaining database instances except the target database instance after the target database instance to obtain a down-ranking result; determining the database instance ranked in the first place among each of the database instances not taken down in the current down-ranking result as a new current database instance; isolating transactions on the business virtual machine where the current database instance is located; taking down the current database instance; monitoring the down state of each process to be taken down corresponding to the current database instance and the transfer progress of the global lock master of the current database instance in real time; when it is monitored that each of the processes to be taken down corresponding to the current database instance is completed and the global lock master of the current database instance is completed, determining whether there is still a database instance not taken down in the current down-ranking result; if it is determined that there is still a database instance not taken down in the current down-ranking result, returning to execute the step of determining the database instance ranked in the first place among each of the database instances not taken down in the current down-ranking result as a new current database instance until there is no database instance not taken down in the down-ranking result; wherein the step of determining a target database instance with the most global lock masters from each database instance to be taken down comprises the following steps: querying information of each database instance based on the name of the IRLM process corresponding to each database instance to be taken down; determining the database instance with the maximum value of the target field in the information of each database instance as the target database instance; wherein the target field is a field for standardizing the number of global lock masters.

2. The method of claim 1, wherein, The step of ranking each of the remaining database instances except the target database instance after the target database instance to obtain a down-ranking result comprises the following step: ranking each of the remaining database instances except the target database instance after the target database instance in the order of the number of global lock masters from large to small to obtain a down-ranking result.

3. The method of claim 1, wherein, The step of isolating transactions on the business virtual machine where the current database instance is located comprises the following step: setting the state of the transaction middleware CICS AOR process running on the business virtual machine where the current database instance is located to a static state based on the name of the transaction middleware CICS AOR process.

4. The method of claim 1, wherein, The step of monitoring the down state of each process to be taken down corresponding to the current database instance and the transfer progress of the global lock master of the current database instance in real time comprises the following step: monitoring each target information code appearing in the down system log of the current database instance in real time; wherein the target information code is used to represent that the corresponding processing is completed. If the target information code corresponding to each of the to-be-decommissioned processes appears in the system down log of the current database instance and the transfer progress of the global lock owner of the current database instance are monitored, it is determined that each of the to-be-decommissioned processes corresponding to the current database instance is completed decommissioning, and the transfer of the global lock owner of the current database instance is completed.

5. A database shutdown apparatus, characterized by comprising: The method comprises the following steps: A first determining unit is configured to determine a target database instance with the most global lock owners from each of the database instances to be decommissioned. A first sorting unit is configured to sort the target database instance in the first place, and sort each of the database instances other than the target database instance after the target database instance, to obtain a decommissioning sorting result. A selecting unit is configured to determine the database instance in the front of each of the database instances not decommissioned in the current decommissioning sorting result as a new current database instance. An isolating unit is configured to isolate transactions on a business virtual machine where the current database instance is located. A decommissioning unit is configured to decommission the current database instance. A monitoring unit is configured to monitor the decommissioning state of each of the to-be-decommissioned processes corresponding to the current database instance and the transfer progress of the global lock owner of the current database instance in real time. A judging unit is configured to judge whether there is still the database instance not decommissioned in the current decommissioning sorting result when it is monitored that each of the to-be-decommissioned processes corresponding to the current database instance is completed decommissioning and the transfer of the global lock owner of the current database instance is completed. A returning unit is configured to return the selecting unit to execute the step of determining the database instance in the front of each of the database instances not decommissioned in the current decommissioning sorting result as the new current database instance until there is no database instance not decommissioned in the decommissioning sorting result when it is judged that there is still the database instance not decommissioned in the current decommissioning sorting result. The first determining unit comprises: A querying unit is configured to query the information of each of the database instances based on the name of the IRLM process corresponding to each of the database instances to be decommissioned. A first determining sub-unit is configured to determine the database instance with the largest value of a target field in the information of each of the database instances as the target database instance, wherein the target field is a field for standardizing the number of global lock owners.

6. The apparatus of claim 5, wherein, When the first sorting unit executes the step of sorting each of the database instances other than the target database instance after the target database instance to obtain the decommissioning sorting result, the first sorting unit is configured to: Sort each of the database instances other than the target database instance after the target database instance in the order of the number of global lock owners from large to small, to obtain the decommissioning sorting result.

7. An electronic device, comprising: The method comprises the following steps: A memory and a processor; The memory is configured to store a program; The processor is configured to execute the program, and the program is configured to implement the decommissioning method of the database according to any one of claims 1 to 4 when executed.

8. A computer storage medium, characterized in that A computer program product for storing a computer program which, when executed, implements a method of shutting down a database as claimed in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Decision tree model-based data processing method and related equipment

    CN114219596A

  • Replicating Data to a Database

    US20130238556A1