CN111026734B - Database management method, system, device and storage medium - Google Patents

Database management method, system, device and storage medium Download PDF

Info

Publication number
CN111026734B
CN111026734B CN201911260444.8A CN201911260444A CN111026734B CN 111026734 B CN111026734 B CN 111026734B CN 201911260444 A CN201911260444 A CN 201911260444A CN 111026734 B CN111026734 B CN 111026734B
Authority
CN
China
Prior art keywords
locking
preset
database
average
duration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911260444.8A
Other languages
Chinese (zh)
Other versions
CN111026734A (en
Inventor
訾瑞杰
董济农
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Beilong Yunhai Network Data Technology Co ltd
Original Assignee
Beijing Beilong Yunhai Network Data Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Beilong Yunhai Network Data Technology Co ltd filed Critical Beijing Beilong Yunhai Network Data Technology Co ltd
Priority to CN201911260444.8A priority Critical patent/CN111026734B/en
Publication of CN111026734A publication Critical patent/CN111026734A/en
Application granted granted Critical
Publication of CN111026734B publication Critical patent/CN111026734B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/217Database tuning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a database management method, a system, a device and a storage medium. The management method comprises the following steps: after the database table is locked, acquiring the table locking time at the current time and the table locking times of the database table within a first preset time before the current time; judging whether the meter locking time length is greater than a preset meter locking time length threshold value or not and whether the meter locking times are greater than a preset meter locking times threshold value or not; and if the table locking time length is greater than a preset table locking time length threshold value and/or the table locking times are greater than a preset table locking time threshold value, unlocking the database table. According to the embodiment of the invention, after the database table is locked, the table locking time length of the database table and the table locking times of the database table within the preset time length are obtained, and when the table locking time length is longer or the table locking times exceed the corresponding preset threshold, the database table of the table locking is unlocked, so that the whole database is prevented from being crashed due to the overstock of the data request of the database table of the locked table, and the good operation of the system is further ensured.

Description

Database management method, system, device and storage medium
Technical Field
The present invention relates to the field of information security technologies, and in particular, to a database management method, system, apparatus, and storage medium.
Background
With the development of information technology, the applications and websites of various industries are continuously increased, related government and institution units put out related 'shared service networks' according to the requirements of the country, and related websites publish information shared by related projects or achievements.
With the development of the IT technology, applications built by various industries depending on a 'database' are gradually increased, the interaction between each application and the database is quite frequent, the database is often locked, and after the locked table appears, the relevant applications access the locked table again and then are in a state of waiting until the relevant table is unlocked. During the table locking period, if a large number of sessions continuously access the table, the number of sessions of related applications continuously rises until the card is dead, and related databases are paralyzed.
Disclosure of Invention
In order to solve the problems in the prior art, at least one embodiment of the present invention provides a database management method, system, apparatus and storage medium.
In a first aspect, an embodiment of the present invention provides a database management method, where the management method includes:
after the database table is locked, acquiring the table locking time at the current time and the table locking times of the database table within a first preset time before the current time;
judging whether the meter locking duration is greater than a preset meter locking duration threshold or not and whether the meter locking times are greater than a preset meter locking times threshold or not;
and if the table locking time length is greater than a preset table locking time length threshold value and/or the table locking times are greater than a preset table locking time threshold value, unlocking the database table.
Based on the above technical solutions, the embodiments of the present invention may be further improved as follows.
With reference to the first aspect, in a first embodiment of the first aspect, the management method further includes:
calculating the table locking duration of each time in a first preset time range to obtain the average table locking duration serving as the preset table locking duration threshold;
and calculating the average lock table times within the first preset time according to the lock table times within a second preset time range to serve as the preset lock table time threshold.
With reference to the first embodiment of the first aspect, in a second embodiment of the first aspect, calculating an average lock table duration according to the lock table duration of each lock table within a first preset time range, where the average lock table duration is used as the preset lock table duration threshold, includes:
acquiring the total times of locking the table of the database table and the table locking duration of each table locking within a first preset time range before the current time;
the average lock table duration is calculated by the following formula:
Figure GDA0002667366990000021
wherein, T is the average table locking duration, T1 is the table locking duration when the table locking occurs for the first time, T2 is the table locking duration when the table locking occurs for the second time, tn is the table locking duration when the table locking occurs for the nth time, and n is the total table locking times of the database table within the first preset time range;
and taking the average meter locking duration as the preset meter locking duration threshold.
With reference to the first embodiment of the first aspect, in a third embodiment of the first aspect, calculating, according to the number of times of locking a table in a second preset time range, an average number of times of locking the table in the first preset duration as the preset threshold of the number of times of locking the table includes:
acquiring the average table locking times of the database table within a second preset time range before the current time within a continuous second preset time;
if the average table locking times of the first preset time length are increased or decreased gradually along with the increase of time, taking the average table locking times of the first preset time length in the last second preset time length in the second preset time range as a threshold value of the preset table locking times;
if the first preset time length average lock table times are not increased or decreased gradually along with the increase of time, calculating the average value of the first preset time length average lock table times in all the second preset time lengths in the second preset time range to serve as the preset lock table times threshold.
With reference to the first aspect, in a fourth embodiment of the first aspect, the management method further includes:
acquiring the unlocking times of unlocking the database table within a third preset time before the current time;
judging whether the unlocking times are larger than a preset unlocking time threshold value or not;
when the unlocking times are larger than a preset unlocking time threshold value, generating a fault analysis report; wherein the fault analysis report includes: the method comprises the steps of obtaining a database name corresponding to a database table, the table locking times of the database table within a first preset time length and the table locking time length of each table locking of the database table.
With reference to the fourth embodiment of the first aspect, in a fifth embodiment of the first aspect, the management method further includes:
acquiring the total unlocking times of the database table within a third preset time range before the current time;
and obtaining the average unlocking times of a third preset duration according to the total unlocking times, wherein the average unlocking times are used as the preset unlocking time threshold.
With reference to the first aspect or the first, second, third, fourth, or fifth example of the first aspect, in a sixth embodiment of the first aspect, the unlocking the database table includes:
and sending a termination instruction to the database table to terminate all the sessions associated with the database table.
In a second aspect, an embodiment of the present invention provides a database management system, where the management system includes:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring the table locking times of a database table within a first preset time length and the table locking time length of each table locking;
the judging unit is used for judging whether the meter locking time length is greater than a preset meter locking time length threshold value or not and whether the meter locking times is greater than a preset meter locking times threshold value or not;
and the processing unit is used for unlocking the database table if the table locking time length is greater than a preset table locking time length threshold value and/or the table locking times are greater than a preset table locking time threshold value.
In a third aspect, an embodiment of the present invention provides a database management apparatus, including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor, configured to implement the database management method according to any one of the embodiments of the first aspect when executing a program stored in a memory.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement the database management method according to any one of the embodiments of the first aspect.
Compared with the prior art, the technical scheme of the invention has the following advantages: according to the embodiment of the invention, after the database table is locked, the table locking time length of the database table and the table locking times of the database table within the preset time length are obtained, and when the table locking time length is longer or the table locking times exceed the corresponding preset threshold, the database table of the table locking is unlocked, so that the whole database is prevented from being crashed due to the overstock of the data request of the database table of the locked table, and the good operation of the system is further ensured.
Drawings
FIG. 1 is a flow chart of a database management method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a database management method according to another embodiment of the present invention;
FIG. 3 is a flowchart illustrating a database management method according to another embodiment of the present invention;
FIG. 4 is a second flowchart illustrating a database management method according to another embodiment of the present invention;
FIG. 5 is a flow chart of a database management method according to another embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a database management system according to another embodiment of the present invention;
fig. 7 is a schematic structural diagram of a database management apparatus according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a database management method. Referring to fig. 1, the management method includes the steps of:
s11, when the database table is locked, acquiring the table locking time at the current time and the table locking times of the database table within a first preset time before the current time.
In this embodiment, with the development of IT technology, applications built by various industries depending on "databases" are gradually increased, interaction between each application and the databases is also quite frequent, which often causes a situation that a table is locked in the databases, and after the table is locked, related applications access the locked table again, the locked table will be in a state of waiting until the locked table is unlocked. During the table locking period, if a large number of sessions continuously access the table, the number of sessions of related applications continuously rises until the card is dead, and related databases are paralyzed. In the scheme, after the database table is locked, the table locking time at the current moment is obtained, that is, the table locking time of the database table is obtained, and the table locking times of the database within the first preset time when the table is locked are obtained, for example, the table locking times within one month, the table locking times on the same day, and the table locking times within a plurality of days can be obtained when the table locking condition occurs, the first preset time in the scheme can be freely set by a user, and the scheme does not limit the time.
S12, judging whether the meter locking time length is larger than a preset meter locking time length threshold value or not, and whether the meter locking times is larger than the preset meter locking times threshold value or not.
In this embodiment, after the database table is locked, the corresponding data request cannot be processed, each request at this time may be overstocked and retained, and when the database is stuck, the related database may be paralyzed, so that by setting the corresponding table locking time length threshold and table locking frequency threshold, it is determined whether the table locking time length of the database is longer than the preset table locking time length threshold, and it is determined whether the table locking frequency is greater than the preset table locking frequency threshold, where the table locking time length threshold and the table locking frequency threshold may be calculated according to past historical data.
S13, if the table locking time length is larger than a preset table locking time length threshold value, and/or the table locking times are larger than a preset table locking times threshold value, unlocking the database table.
In this embodiment, when any one of the preset lock table duration threshold value and the lock table frequency greater than the preset lock table frequency threshold value appears, the database table is unlocked in time, and the database table which is not unlocked for a long time is crashed, or the database table which is frequently locked is not capable of processing the request in time, so that the database is crashed.
In this embodiment, an average lock table duration is calculated according to the lock table duration of each lock table within a first preset time range, and is used as the preset lock table duration threshold; the first preset time range can be a time range within one week, within one month, within one year and the like, and the average meter locking time length is calculated through the meter locking time length of each meter locking.
In this embodiment, the average lock schedule number in the first preset time duration is calculated according to the lock schedule number in the second preset time duration as the preset lock schedule number threshold, where the second preset time duration may be a time duration within a week, a month, a year, and the like, each lock schedule in the second preset time duration is obtained, and the average lock schedule number in the first preset time duration is calculated according to this, for example, the second preset time duration may be a time duration within a year, the first preset time duration is a month, then the average lock schedule number in the first preset time duration is calculated according to the lock schedule number in the second preset time duration, which is the average lock schedule number in a year, for example, the total lock schedule number in a year is 120, the average lock schedule number in that month is (120 divided by 12), which is only for explaining the average lock schedule number in the first preset time duration in the second preset time duration, and is not particularly limited.
In this embodiment, after the database table is locked, there is a possibility that the access cannot be backlogged because the access cannot be processed, and finally the database crashes, so in this embodiment, after the database table meets the conditions in the above embodiment, the database table is unlocked, and the operation of unlocking may be to send a termination instruction to the database table, and terminate all sessions associated with the database table.
As shown in fig. 2, in a specific embodiment, calculating an average lock table duration according to the lock table duration of each lock table within a first preset time range, as the preset lock table duration threshold, specifically includes the following steps:
and S21, acquiring the total times of table locking of the database table and the table locking duration of each table locking within a first preset time range before the current time.
In this embodiment, the first preset time range before the current time may be a historical time range matched with the current time, for example, the first preset time range may be a time range in a month before the current time, that is, the total times of locking tables of the database table in the month before the current time and the table locking duration of each table locking are obtained; the total number of times of locking the table in the previous year corresponding to the month to which the current time belongs and the table locking duration of each table locking, for example, the current time is 6 months, the first preset time range is the total number of times of locking the table in the previous year in 6 months and the table locking duration of each table locking, and since the access of the internet data also has corresponding linear change, for example, the access amount of the data from the shopping website to a specific date is increased, the access amounts of other dates are similar, and the greater the access amount of the data is, the greater the probability that the table of the database is locked is, the number of times of locking the table of the database table changes along with the data access amount of the website, and the corresponding table locking data is obtained through the historical data to plan the current usage policy.
S22, calculating the average lock table duration through the following formula:
Figure GDA0002667366990000071
the method comprises the steps of obtaining a database table, wherein T is average table locking time length, T1 is table locking time length when the table locking is carried out for the first time, T2 is table locking time length when the table locking is carried out for the second time, tn is table locking time length when the table locking is carried out for the nth time, and n is total table locking times of the database table in a first preset time range.
In this embodiment, the table locking duration of each table locking of the database table within the first preset time range is accumulated to obtain the total table locking duration, and the average table locking duration within the first preset time range is obtained by dividing the total table locking duration by the total table locking times, where the selection of the first preset time range may be set by a user or preset, and this scheme is not particularly limited.
And S23, taking the average meter locking duration as the preset meter locking duration threshold.
In this embodiment, an average table locking duration may be obtained according to the history, and since the table locking duration of the database table cannot be too long, the average table locking duration is used as the preset table locking duration threshold in this scheme.
As shown in fig. 3, in a specific embodiment, calculating the average lock table frequency within the first preset duration according to the lock table frequency within the second preset time range, as the preset lock table frequency threshold, includes:
and S31, acquiring the average table locking times of the database table in a second continuous preset time within a second preset time range before the current time.
In this embodiment, the second predetermined time range may be a time range of one week, one month, one year, etc., and the second predetermined time range may be a time period of one week, one month, one year, etc., and the first predetermined time period is the first predetermined time period in the above embodiments, for example, the second predetermined time range is one year, the second predetermined time period is one month, the first predetermined time period is one day, then, the first preset-duration average lock table frequency acquired by the scheme is the continuous daily average lock table frequency of each month in any one year, for example, the daily average lock table frequency of 1 month, the daily average lock table frequency of 2 months, and the daily average lock table frequency of 3 months, the larger the data volume of the average lock table frequency is, the higher the precision is, but the calculation efficiency is also correspondingly reduced, therefore, the number of the acquired average lock times of the first preset duration can be preset.
S32a, if the average lock count of the first preset duration increases or decreases with time, taking the average lock count of the first preset duration in the second preset duration last in the second preset time range as the threshold of the preset lock count.
In this embodiment, the average lock table times of each first preset duration are sequenced according to a time sequence, when it is determined that the average lock table times of the first preset duration are increased or decreased progressively, the average lock table number of the first preset duration in the last second preset duration within the second preset duration range is taken as a preset lock table times threshold, referring to the example in the above step, that is, the average lock table times of the last month in the average lock table times of the successive selected days of each month in the current year is taken as a preset lock table times threshold, and as the average lock table times of the first preset duration are increased or decreased progressively, the closer the average lock table times of the first preset duration are to the current time, the more the average lock table times of the first preset duration can be used to determine whether the lock table times of the current time exceed the threshold.
S32b, if the first preset time length average lock table times are not increased or decreased gradually along with the increase of time, calculating the average value of the first preset time length average lock table times in all the second preset time lengths in the second preset time range to serve as the preset lock table times threshold.
In this embodiment, if the average lock count of the first preset duration fluctuates up and down with time, the average value of the average lock count of each first preset duration is calculated as the preset lock count threshold, and in combination with the above embodiment, that is, the average lock count of each month is accumulated and then divided by the counted number of months to obtain the average value, which is used as the preset lock count threshold.
As shown in fig. 4, an embodiment of the present invention provides a database management method. Referring to fig. 4, the management method includes the steps of:
s41, when the database table is locked, acquiring the table locking time at the current time and the table locking times of the database table within a first preset time before the current time.
Regarding step S41, refer to the description in step S11 for details, which are not repeated herein.
S42, judging whether the meter locking time length is larger than a preset meter locking time length threshold value or not, and whether the meter locking times is larger than the preset meter locking times threshold value or not.
Regarding step S42, refer to the description in step S12 for details, which are not repeated herein.
S43, if the table locking time length is larger than a preset table locking time length threshold value, and/or the table locking times are larger than a preset table locking times threshold value, unlocking the database table.
Regarding step S43, refer to the description in step S13 for details, which are not repeated herein.
And S44, obtaining the unlocking times of the database table in a third preset time before the current time.
And S45, judging whether the unlocking times are larger than a preset unlocking time threshold value.
S46, generating a fault analysis report when the unlocking times are larger than a preset unlocking time threshold; wherein the fault analysis report includes: the method comprises the steps of obtaining a database name corresponding to a database table, the table locking times of the database table within a first preset time length and the table locking time length of each table locking of the database table.
In this embodiment, when it is determined that the unlocking times of the database table for unlocking are greater than the preset unlocking time threshold, it is stated that the unlocking times of the database table do not conform to the past history situation, and at this time, a fault analysis report is generated in time to assist a user in troubleshooting potential faults that may exist, so as to avoid system crash.
As shown in fig. 5, in this embodiment, the method for obtaining the preset unlocking time threshold includes the following steps:
and S51, acquiring the total unlocking times of the database table in a third preset time range before the current time.
And S52, obtaining the average unlocking times of a third preset duration according to the total unlocking times, and using the average unlocking times as the preset unlocking time threshold.
In this embodiment, the third preset time range may be all the time since the database table was created, or may be a time range of a certain year, a certain month, a certain week, or the like, and the unlocking time threshold is obtained in this way, so that the historical data is referred to, and the current database table is prevented from being abnormal.
As shown in fig. 6, an embodiment of the present invention provides a database management system, including: an acquisition unit 11, a judgment unit 12 and a processing unit 13.
In this embodiment, the obtaining unit 11 is configured to obtain the number of times of locking a table of a database within a first preset duration and the table locking duration of each table locking.
In this embodiment, the determining unit 12 is configured to determine whether the lock table duration is greater than a preset lock table duration threshold, and whether the lock table frequency is greater than the preset lock table frequency threshold.
In this embodiment, the processing unit 13 is configured to unlock the database table if the table locking duration is greater than a preset table locking duration threshold, and/or the table locking times are greater than the preset table locking times threshold.
In this embodiment, the management system further includes: the first threshold value calculating unit is used for calculating the average meter locking duration according to the meter locking duration of each meter locking in a first preset time range, and the average meter locking duration is used as the preset meter locking duration threshold value; and calculating the average lock table times within the first preset time according to the lock table times within a second preset time range to serve as the preset lock table time threshold.
In this embodiment, the first threshold calculation unit is specifically configured to obtain the total table locking times of the database table and the table locking duration of each table locking within a first preset time range before the current time;
the average lock table duration is calculated by the following formula:
Figure GDA0002667366990000111
wherein, T is the average table locking duration, T1 is the table locking duration when the table locking occurs for the first time, T2 is the table locking duration when the table locking occurs for the second time, tn is the table locking duration when the table locking occurs for the nth time, and n is the total table locking times of the database table within the first preset time range;
and taking the average meter locking duration as the preset meter locking duration threshold.
In this embodiment, the first threshold calculation unit is specifically configured to obtain an average table locking frequency of the database table within a second preset time range before the current time within a continuous second preset time; if the average table locking times of the first preset time length are increased or decreased gradually along with the increase of time, taking the average table locking times of the first preset time length in the last second preset time length in the second preset time range as a threshold value of the preset table locking times; if the first preset time length average lock table times are not increased or decreased gradually along with the increase of time, calculating the average value of the first preset time length average lock table times in all the second preset time lengths in the second preset time range to serve as the preset lock table times threshold.
In this embodiment, the management system further includes: the fault reporting unit is used for acquiring the unlocking times of unlocking the database table within a third preset time before the current time; judging whether the unlocking times are larger than a preset unlocking time threshold value or not; when the unlocking times are larger than a preset unlocking time threshold value, generating a fault analysis report; wherein the fault analysis report includes: the method comprises the steps of obtaining a database name corresponding to a database table, the table locking times of the database table within a first preset time length and the table locking time length of each table locking of the database table.
In this embodiment, the management system further includes: the second threshold calculation unit is used for acquiring the total unlocking times of the database table within a third preset time range before the current time; and obtaining the average unlocking times of a third preset duration according to the total unlocking times, wherein the average unlocking times are used as the preset unlocking time threshold.
In this embodiment, the management system further includes: and the unlocking unit is used for sending a termination instruction to the database table and terminating all the sessions associated with the database table.
As shown in fig. 7, an embodiment of the present invention provides a database management apparatus, including: the processor 1110, the communication interface 1120, the memory 1130 and the communication bus 1140, wherein the processor 1110, the communication interface 1120 and the memory 1130 complete communication with each other through the communication bus 1140;
a memory 1130 for storing computer programs;
the processor 1110, when executing the program stored in the memory 1130, implements a database management method as follows:
after the database table is locked, acquiring the table locking time at the current time and the table locking times of the database table within a first preset time before the current time;
judging whether the meter locking duration is greater than a preset meter locking duration threshold or not and whether the meter locking times are greater than a preset meter locking times threshold or not;
and if the table locking time length is greater than a preset table locking time length threshold value and/or the table locking times are greater than a preset table locking time threshold value, unlocking the database table.
In the electronic device provided by the embodiment of the present invention, the processor 1110 implements, by executing the program stored in the memory 1130, that after the table of the database is locked, the table locking time length of the database table and the table locking times of the database table within the preset time length are obtained, and when the table locking time length is longer or the table locking times exceed the corresponding preset threshold, the database table of the table is unlocked, so that the whole database is prevented from being crashed due to backlog of data requests of the table-locked database, and further, good operation of the system is ensured.
The communication bus 1140 mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 1140 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 7, but this is not intended to represent only one bus or type of bus.
The communication interface 1120 is used for communication between the electronic device and other devices.
The memory 1130 may include a Random Access Memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory 1130 may also be at least one memory device located remotely from the processor 1110.
The processor 1110 may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the integrated circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
An embodiment of the present invention provides a computer-readable storage medium storing one or more programs, which are executable by one or more processors to implement a database management method according to any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the invention are brought about in whole or in part when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (ssd)), among others.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (9)

1. A database management method, the management method comprising:
after the database table is locked, acquiring the table locking time at the current time and the table locking times of the database table within a first preset time before the current time;
judging whether the meter locking duration is greater than a preset meter locking duration threshold or not and whether the meter locking times are greater than a preset meter locking times threshold or not;
if the table locking duration is greater than a preset table locking duration threshold value and/or the table locking times are greater than a preset table locking times threshold value, unlocking the database table;
the management method further comprises the following steps:
calculating the average table locking times within the first preset time length according to the table locking times within a second preset time range, and using the average table locking times as a preset table locking time threshold;
wherein, calculating the average lock table times within the first preset duration according to the lock table times within a second preset time range, and using the average lock table times as the preset lock table times threshold value, includes:
acquiring the average table locking times of the database table within a second preset time range before the current time within a continuous second preset time;
if the average table locking times of the first preset time length are increased or decreased gradually along with the increase of time, taking the average table locking times of the first preset time length in the last second preset time length in the second preset time range as a threshold value of the preset table locking times;
if the first preset time length average lock table times are not increased or decreased gradually along with the increase of time, calculating the average value of the first preset time length average lock table times in all the second preset time lengths in the second preset time range to serve as the preset lock table times threshold.
2. The management method according to claim 1, wherein the management method further comprises:
and calculating the average meter locking duration according to the meter locking duration of each meter locking in the first preset time range, and using the average meter locking duration as the preset meter locking duration threshold.
3. The management method according to claim 2, wherein calculating an average lock table duration according to the lock table duration of each lock table within a first preset time range, as the preset lock table duration threshold, includes:
acquiring the total times of locking the table of the database table and the table locking duration of each table locking within a first preset time range before the current time;
the average lock table duration is calculated by the following formula:
Figure FDA0002697324790000021
wherein, T is the average table locking duration, T1 is the table locking duration when the table locking occurs for the first time, T2 is the table locking duration when the table locking occurs for the second time, tn is the table locking duration when the table locking occurs for the nth time, and n is the total table locking times of the database table within the first preset time range;
and taking the average meter locking duration as the preset meter locking duration threshold.
4. The management method according to claim 1, wherein the management method further comprises:
acquiring the unlocking times of unlocking the database table within a third preset time before the current time;
judging whether the unlocking times are larger than a preset unlocking time threshold value or not;
when the unlocking times are larger than a preset unlocking time threshold value, generating a fault analysis report; wherein the fault analysis report includes: the method comprises the steps of obtaining a database name corresponding to a database table, the table locking times of the database table within a first preset time length and the table locking time length of each table locking of the database table.
5. The management method according to claim 4, wherein the management method further comprises:
acquiring the total unlocking times of the database table within a third preset time range before the current time;
and obtaining the average unlocking times of a third preset duration according to the total unlocking times, wherein the average unlocking times are used as the preset unlocking time threshold.
6. The management method according to any one of claims 1 to 5, wherein the unlocking the database table comprises:
and sending a termination instruction to the database table to terminate all the sessions associated with the database table.
7. A database management system, the management system comprising:
the acquisition unit is used for acquiring the table locking times of the database table and the table locking duration of each table locking within a first preset duration after the database table is locked;
the judging unit is used for judging whether the meter locking time length is greater than a preset meter locking time length threshold value or not and whether the meter locking times is greater than a preset meter locking times threshold value or not;
the processing unit is used for unlocking the database table if the table locking time length is greater than a preset table locking time length threshold value and/or the table locking times are greater than a preset table locking time threshold value;
the management system further comprises: the first threshold value calculating unit is used for calculating the average lock table times within the first preset time length according to the lock table times within a second preset time range and taking the average lock table times as the preset lock table times threshold value;
the first threshold calculation unit is specifically configured to obtain an average table locking frequency of the database table within a second preset time range before the current time within a first preset time period; if the average table locking times of the first preset time length are increased or decreased gradually along with the increase of time, taking the average table locking times of the first preset time length in the last second preset time length in the second preset time range as a threshold value of the preset table locking times; if the first preset time length average lock table times are not increased or decreased gradually along with the increase of time, calculating the average value of the first preset time length average lock table times in all the second preset time lengths in the second preset time range to serve as the preset lock table times threshold.
8. A database management apparatus, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing the database management method according to any one of claims 1 to 6 when executing a program stored in a memory.
9. A computer-readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the database management method of any of claims 1-6.
CN201911260444.8A 2019-12-10 2019-12-10 Database management method, system, device and storage medium Active CN111026734B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911260444.8A CN111026734B (en) 2019-12-10 2019-12-10 Database management method, system, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911260444.8A CN111026734B (en) 2019-12-10 2019-12-10 Database management method, system, device and storage medium

Publications (2)

Publication Number Publication Date
CN111026734A CN111026734A (en) 2020-04-17
CN111026734B true CN111026734B (en) 2020-11-13

Family

ID=70205674

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911260444.8A Active CN111026734B (en) 2019-12-10 2019-12-10 Database management method, system, device and storage medium

Country Status (1)

Country Link
CN (1) CN111026734B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105183852A (en) * 2015-09-08 2015-12-23 网易(杭州)网络有限公司 Database migration method and device
EP2901322B1 (en) * 2012-09-28 2016-05-25 Oracle International Corporation Techniques for activity tracking, data classification, and in database archiving
CN105808556A (en) * 2014-12-29 2016-07-27 深圳云之家网络有限公司 Operating method for database and database engine
CN106570027A (en) * 2015-10-10 2017-04-19 阿里巴巴集团控股有限公司 Transactional task processing method and device
CN109815227A (en) * 2018-12-13 2019-05-28 平安科技(深圳)有限公司 Data lock management method, device, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103514164B (en) * 2012-06-15 2016-12-21 阿里巴巴集团控股有限公司 Data migration method and system
CN109087059A (en) * 2018-07-09 2018-12-25 合肥嘉仕诚能源科技有限公司 A kind of unmanned method of servicing of meeting room and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2901322B1 (en) * 2012-09-28 2016-05-25 Oracle International Corporation Techniques for activity tracking, data classification, and in database archiving
CN105808556A (en) * 2014-12-29 2016-07-27 深圳云之家网络有限公司 Operating method for database and database engine
CN105183852A (en) * 2015-09-08 2015-12-23 网易(杭州)网络有限公司 Database migration method and device
CN106570027A (en) * 2015-10-10 2017-04-19 阿里巴巴集团控股有限公司 Transactional task processing method and device
CN109815227A (en) * 2018-12-13 2019-05-28 平安科技(深圳)有限公司 Data lock management method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111026734A (en) 2020-04-17

Similar Documents

Publication Publication Date Title
CN108615119B (en) Abnormal user identification method and equipment
CN111262795B (en) Service interface-based current limiting method and device, electronic equipment and storage medium
US9584395B1 (en) Adaptive metric collection, storage, and alert thresholds
US20150134591A1 (en) Method, apparatus, and computer program product for data quality analysis
US20130204650A1 (en) System and method for compliance management
CN108183933A (en) Information push method, apparatus and system, electronic equipment and computer storage media
WO2019136812A1 (en) Electronic device, data calling log generation and query method, and storage medium
WO2019205324A1 (en) Task allocation method and system, and terminal device
CN107819745B (en) Method and device for defending against abnormal traffic
CN108874876B (en) Message pushing method, computer readable storage medium and terminal equipment
CN111026734B (en) Database management method, system, device and storage medium
CN114334111B (en) Medical information management method, device, server and readable storage medium
CN109377391B (en) Information tracking method, storage medium and server
CN110825787A (en) Data reminding method and device, electronic equipment and storage medium
CN112488857B (en) Event identification method, device, electronic equipment and storage medium
CN110333968B (en) Data management method and device applied to database and computer equipment
CN114896082A (en) Message processing method and device, electronic equipment and storage medium
CN114257521A (en) Flow prediction method, device, electronic equipment and storage medium
CN113469825A (en) Data processing method and device, electronic equipment and computer readable medium
CN109584057B (en) Transaction detail data acquisition method, device and server
CN101894119B (en) Mass data storage system for monitoring
CN115002000B (en) Fault tolerance method, device, equipment and storage medium for abnormal interface
US11914704B2 (en) Method and system for detecting coordinated attacks against computing resources using statistical analyses
US11810164B1 (en) Computerized time-series analysis for inference of correlated input modifications
CN111737281B (en) Database query method, device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant