WO2020006868A1 - 表空间自动告警的方法、装置、终端设备及可读存储介质 - Google Patents

表空间自动告警的方法、装置、终端设备及可读存储介质 Download PDF

Info

Publication number
WO2020006868A1
WO2020006868A1 PCT/CN2018/105557 CN2018105557W WO2020006868A1 WO 2020006868 A1 WO2020006868 A1 WO 2020006868A1 CN 2018105557 W CN2018105557 W CN 2018105557W WO 2020006868 A1 WO2020006868 A1 WO 2020006868A1
Authority
WO
WIPO (PCT)
Prior art keywords
space
amount
time
monitoring
preset
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.)
Ceased
Application number
PCT/CN2018/105557
Other languages
English (en)
French (fr)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2020006868A1 publication Critical patent/WO2020006868A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information
    • G06F11/327Alarm or error message display
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/80Database-specific techniques

Definitions

  • the present application belongs to the technical field of data processing, and in particular, relates to a method, a device, a terminal device, and a computer-readable storage medium for automatic alerting of a table space.
  • embodiments of the present application provide a method, an apparatus, a terminal device, and a computer-readable storage medium for automatic alarm of a table space, so as to solve the problems of low security and accuracy of the table space alarm in the prior art.
  • a second aspect of the embodiments of the present application provides an apparatus for automatically alerting a table space, which may include a unit for implementing the steps of the method for automatically alerting a table space.
  • a third aspect of the embodiments of the present application provides a terminal device including a memory and a processor.
  • the memory stores computer-readable instructions executable on the processor, and the processor executes the computer-readable instructions. The steps of the method for realizing the above table space automatic alarm when reading instructions.
  • the actual amount of free space is used as the amount of early warning space.
  • the amount of free space is used as the amount of early warning space, essentially taking into account the actual space available in the table space and the file directory, and using the smaller space as the amount of space to be alerted.
  • the alarm process is adapted to the actual data storage situation, and the security and accuracy of the table space alarm are improved.
  • FIG. 2 is a flowchart of a method for automatically alerting a table space in Embodiment 2 of the present application
  • FIG. 5 is a structural block diagram of an apparatus for automatically alerting a table space in Embodiment 5 of the present application;
  • FIG. 6 is a schematic diagram of a terminal device in Embodiment 6 of the present application.
  • FIG. 1 is a flowchart of implementing a method for automatically alerting a table space according to an embodiment of the present application. As shown in Figure 1, the method includes the following steps:
  • S101 Monitor a table space, and query an amount of free space of the table space, where the amount of free space is a remaining capacity of the table space.
  • a database is a warehouse that organizes, stores, and manages data according to the data structure, and a table space refers to the logical division of the database.
  • a table space can only belong to one database.
  • all database objects are stored in a specified table space. in.
  • the capacity of the table space needs to be monitored to prevent the available capacity of the table space from being too small and affecting the storage of business data.
  • the table space is monitored and the amount of free space in the table space is queried. The amount of free space refers to the remaining capacity of the table space.
  • a table space contains one or more physical files.
  • a physical file is an actual file that is visible to the host where the database is located. For each physical file, it belongs to only one table space.
  • the physical file of the table space is determined, and the determination of the physical file can also be performed by creating a SQL of a query statement including the table name of the table space to be queried and the physical file. SELECT statement and execute the SQL SELECT statement implementation.
  • the available capacity may also be the available capacity preset by the user for the file directory. It is worth mentioning that if the actual amount of available space can be the available capacity of the logical volume to which the file directory belongs, you can check the available capacity of the file directory by using the du command or the df command.
  • the actual available space amount with the smallest numerical value is used as the actual available space amount of the table space.
  • the actual available space is 5G.
  • the actual available space with the smallest value is used as the actual available space of the table space, which improves the actual available space. Degree of security.
  • the amount of free space and the actual amount of available space After obtaining the amount of free space and the actual amount of available space, compare the amount of free space with the amount of actual available space, and use the smaller one as the table space to be warned, that is, if the amount of free space is greater than or If it is equal to the actual available space, the actual available space is used as the table space to be alerted; if the free space is less than the actual available space, the smaller amount of free space is used as the table space's alert space, where The amount of space to be alarmed refers to the amount of space available for the table space used for alarms.
  • an alarm mechanism is set in advance for the table space, and when the amount of space to be alarmed meets the first condition, the alarm mechanism is automatically triggered to output an alarm prompt.
  • the alarm mechanism is pre-configured in the database.
  • the alarm mechanism can be the mechanism for automatically sending alarm emails or the mechanism for automatically sending alarm short messages, and an alarm script can be created. During the execution of the alarm script, the steps S101 to S104 are performed. After determining that the amount of space to be alarmed meets the first condition, an alarm mechanism is triggered to output an alarm prompt, thereby improving the convenience of the alarm and realizing automatic alarm.
  • an automatic expansion mechanism is set in advance for the table space.
  • an automatic expansion mechanism is triggered to expand the capacity of the table space.
  • an automatic extension mechanism may be set for the table space in the Oracle database, and the automatic extension mechanism may be implemented by setting an autoextend (automatic extension) attribute in the Oracle database.
  • FIG. 2 is a flowchart of implementing a table space automatic alarm method provided in Embodiment 2 of the present application. Compared to the embodiment corresponding to FIG. 1, this embodiment obtains S201 to S203 after refining S104, and the details are as follows:
  • S201 Obtain a plurality of occupied space amounts of the table space in the historical time period, and calculate a plurality of data addition rates of the table space in the historical time period based on the plurality of occupied space amounts, each of which The amount of occupied space corresponds to a sub-time period within the historical time period.
  • the amount of space in the tablespace usually has regularity. For example, at the beginning and end of each month, due to the large number of business changes, the amount of space usually shows an upward trend. Therefore, in the embodiments of this application
  • the historical period is composed of multiple sub-periods, and each amount of occupied space corresponds to a sub-period in the historical period.
  • the historical time period and sub-time period can be set freely according to the alarm requirements. For example, if you want to warn about the usage of the table space in days, you can determine that the historical time period is a certain month of history.
  • the sub-periods are the first day, the second day, ..., and the last day of the month.
  • the specific method is to calculate a current amount of occupied space corresponding to the previous sub-time period. Ratio of the amount of occupied space, and use this ratio as the data addition rate for the sub-period corresponding to the current amount of occupied space.
  • the amount of occupied space on the second day is 10G and the amount of occupied space on the first day is 5G
  • the amount of occupied space can also be executed by executing SQL SELECT statement or build zabbix monitoring system and other methods to obtain.
  • multiple historical time periods may be acquired.
  • multiple historical time periods may be twelve months in the past year, and for each month, the amount of occupied space for each day (sub-period) of the month is obtained.
  • S202 When the amount of space to be alarmed is less than or equal to a preset threshold, obtain a current monitoring time, and determine a data addition rate corresponding to the sub-time period in which the monitoring time is located.
  • the alarm is not immediately performed, but the current monitoring time is obtained, and the sub-period of the monitoring time is determined, such as the historical time period. Multiple sub-time periods are the first day to the last day of the month (of course, it can also be set from Monday to Sunday in a week according to the actual application scenario), and the current monitoring time is xx year xx month 15 Day, it can be determined that the sub-time period corresponding to the monitoring time is the fifteenth day.
  • the data addition rate of the sub-period determined by step S201 is obtained (if the calculation is based on multiple historical time periods in step S201, the data addition rate is the final data addition rate).
  • the second condition may be that the data addition rate is greater than a specific value, such as greater than 100% or greater than 150%.
  • a filling time is calculated based on the data addition rate corresponding to the monitoring time and the corresponding amount of occupied space and the amount of space to be alarmed, and the filling time is output, and the filling time is from the monitoring The time is up to the time consumed when the amount of space to be alerted is zero.
  • the filling time is calculated and output The fill time.
  • the amount of occupied space of the table space at the monitoring time is 8G
  • the amount of space to be alarmed is 2G
  • the data addition rate of the sub-period of the monitoring time (assuming the sub-period is in days, that is, a certain day) 150%
  • the filling time is 5/6 days, which is based on the data addition rate corresponding to the monitoring time. After 5/6 days, the amount of table space to be alarmed is reduced to zero.
  • FIG. 3 is a flowchart for implementing a method for automatically alerting a table space provided in Embodiment 3 of the present application. Compared with the embodiment corresponding to FIG. 2, this embodiment refines S203 to obtain S301 to S302, which are detailed as follows:
  • the current monitoring time is obtained, and the amount of occupied space of the table space at the monitoring time and the amount of space to be alarmed are obtained, based on multiple data corresponding to multiple sub-time periods Add rate (in this step, you can also only obtain the data addition rate corresponding to the sub-time period after the sub-time period where the monitoring time is located) and the amount of occupied space and the amount of space to be alarmed corresponding to the monitoring time.
  • the data addition rates corresponding to the two sub-periods after the sub-period of the monitoring time are 120% and 90%
  • the amount of occupied space of the table space at the monitoring time is 5G
  • the table space is after the sub-time period of the monitoring time.
  • the amount of occupied space of the table space at the monitoring time and the amount of space to be alarmed are obtained, and based on the obtained multiple data addition rates and the corresponding amount of monitoring time.
  • the amount of occupied space and the corresponding amount of to-be-warned space respectively, calculate the N-to-be-warned space of the table space in the N sub-time periods after the sub-time period where the monitored time is located, where N is an integer greater than zero. If any of the amount of space is less than or equal to a preset second threshold, an alarm prompt is output.
  • the embodiment of the present application realizes prediction of the amount of space to be alarmed in the N sub-periods in the future, and provides an alarm prompt based on the prediction result, which improves Accuracy of alerting for future periods.
  • FIG. 4 is a flowchart of a method for automatically alerting a table space provided in Embodiment 4 of the present application. Compared with the embodiment corresponding to FIG. 1, this embodiment obtains S401 to S402 after refining S101, and the details are as follows:
  • the monitoring of the table space in the database can be achieved by setting up a zabbix monitoring system.
  • zabbix is an open source distributed monitoring system, which is suitable for the scenario of monitoring one or more targets.
  • the zabbix monitoring system mainly includes a zabbix server and a zabbix client.
  • the zabbix server is a core component of zabbix and is responsible for receiving data sent by the zabbix client.
  • the zabbix client is deployed on the target host and is used to collect data from the host.
  • a zabbix server is set up on the host (user-operated host) that needs to obtain query results, and a zabbix client is set up on the host where the table space is located.
  • the setup process can be achieved by installing the zabbix installation package and configuring zabbix. Environmental realization.
  • S402 Obtain a preset query script and create a zabbix monitoring item based on the query script. During the execution of the zabbix monitoring item, obtain the free space amount of the table space in the zabbix client.
  • the query script includes a SQL statement for detecting the amount of free space in the table space (the SQL statement for detecting the physical file of the table space can also be included).
  • the format of the query script is It is a shell script.
  • a shell script is a program file that generates a set of standard commands under the Linux / Unix system, so that it can be executed at one time. Add the created query script to the zabbix client configuration file and restart the zabbix client.
  • a zabbix monitoring system is set up. Specifically, a zabbix client is set up on the host where the table space is located, and a query script is added to the configuration file of the zabbix client. Set up a zabbix server on the host, and create a query script-based zabbix monitoring item on the zabbix server and execute the zabbix monitoring item. During the execution process, the zabbix server can automatically obtain the table space in the zabbix client. The amount of free space. In the embodiment of the present application, by setting up a zabbix monitoring system and creating monitoring items, it is not necessary to manually enter a SQL statement when monitoring the table space, which improves the convenience of obtaining the amount of free space.
  • the first output unit 54 is configured to output an alarm prompt when the amount of space to be alarmed meets a preset first condition.
  • the first output unit 54 includes:
  • a calculation unit configured to obtain a plurality of occupied space amounts of the table space in a historical time period, and calculate a plurality of data addition rates of the table space in the historical time period based on the plurality of occupied space amounts, Wherein each of the occupied space amounts to a sub-time period within the historical time period;
  • a space amount calculation unit is configured to obtain the occupied space amount and the to-be-alarm space amount of the table space at the monitoring time, and based on the multiple data addition rates and the monitoring time corresponding to the monitoring time. Amount of occupied space and the amount of to-be-warned space, respectively, to calculate the N pieces of to-be-warned space of the table space in the N sub-time periods after the sub-time period where the monitoring time is located, where N Is an integer greater than zero;
  • the second output unit further includes:
  • the query unit 51 includes:
  • a building unit configured to build a zabbix client on a host where the table space is located;
  • An execution unit configured to obtain a preset query script and create a zabbix monitoring item based on the query script; and during the execution of the zabbix monitoring item, obtain the free space of the table space in the zabbix client Amount of space.
  • the computer-readable instructions 62 may be divided into one or more modules / units, the one or more modules / units are stored in the memory 61 and executed by the processor 60, To complete this application.
  • the one or more modules / units may be a series of computer-readable instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer-readable instructions 62 in the terminal device 6.
  • the computer-readable instructions 62 may be divided into a query unit, an acquisition unit, a comparison unit, and a first output unit, and the specific functions of each unit are as described above.
  • the terminal device may include, but is not limited to, a processor 60 and a memory 61.
  • FIG. 6 is only an example of the terminal device 6, and does not constitute a limitation on the terminal device 6, and may include more or less components than shown in the figure, or combine some components or different components.
  • the terminal device may further include an input / output device, a network access device, a bus, and the like.
  • the processor 60 may be a central processing unit (Central Processing Unit (CPU), or other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (Application Specific Integrated Circuits) Specific Integrated Circuit (ASIC), off-the-shelf Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • CPU Central Processing Unit
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuits
  • FPGA off-the-shelf Programmable Gate Array
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6.
  • the memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (SD) provided on the terminal device 6. Card, flash card, etc. Further, the memory 61 may further include both an internal storage unit of the terminal device 6 and an external storage device.
  • the memory 61 is configured to store the computer-readable instructions and other programs and data required by the terminal device.
  • the memory 61 may also be used to temporarily store data that has been output or is to be output.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit.
  • the above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium , Including a number of instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
  • the foregoing storage media include: U disks, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or compact discs, and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本方案适用于数据处理技术领域,提供了表空间自动告警的方法、装置、终端设备及计算机可读存储介质,包括:监测表空间,并查询所述表空间的空闲空间量;确定所述表空间的物理文件和所述物理文件所在的文件目录,并获取所述文件目录的实际可用空间量;将所述空闲空间量与所述实际可用空间量进行比对,若所述空闲空间量大于或等于所述实际可用空间量,则将所述实际可用空间量作为所述表空间的待告警空间量;若所述空闲空间量小于所述实际可用空间量,则将所述空闲空间量作为所述表空间的待告警空间量;当所述待告警空间量满足预设的第一条件时,输出报警提示。本方案以较小的可用量为基础进行告警,提升了表空间告警的安全性。

Description

表空间自动告警的方法、装置、终端设备及可读存储介质
本申请要求于2018年07月06日提交中国专利局、申请号为201810736693.9、发明名称为“表空间自动告警的方法及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于数据处理技术领域,尤其涉及一种表空间自动告警的方法、装置、终端设备及计算机可读存储介质。
背景技术
数据库是按照数据结构来组织、存储和管理数据的仓库,在某些类型的数据库中,存在表空间(tablespaces)这一概念。表空间是数据库的逻辑划分,一个表空间只能属于一个数据库,并且所有的数据库对象都存放在指定的表空间中。表空间在构建时被设定了最大容量,在使用表空间的过程中,需要防止表空间的容量占用过大。
在现有技术中,通常是通过手动查询表空间的现有容量和最大容量,并根据现有容量和最大容量得到表空间的可用容量,根据该可用容量进行告警操作。但是,表空间对应的实际存储数据的文件目录的空间可能因其他的数据更新操作发生变化,容易造成文件目录的可用空间实际小于表空间的可用容量,导致表空间告警的安全性和准确性低。
技术问题
有鉴于此,本申请实施例提供了一种表空间自动告警的方法、装置、终端设备及计算机可读存储介质,以解决现有技术中表空间告警的安全性和准确性低的问题。
技术解决方案
本申请实施例的第一方面提供了一种表空间自动告警的方法,包括:
监测表空间,并查询所述表空间的空闲空间量,所述空闲空间量为所述表空间的剩余容量;
确定所述表空间的物理文件和所述物理文件所在的文件目录,并获取所述文件目录的实际可用空间量;
将所述空闲空间量与所述实际可用空间量进行比对,若所述空闲空间量大于或等于所述实际可用空间量,则将所述实际可用空间量作为所述表空间的待告警空间量;若所述空闲空间量小于所述实际可用空间量,则将所述空闲空间量作为所述表空间的待告警空间量;
当所述待告警空间量满足预设的第一条件时,输出报警提示。
本申请实施例的第二方面提供了一种表空间自动告警的装置,可以包括用于实现上述表空间自动告警的方法的步骤的单元。
本申请实施例的第三方面提供了一种终端设备,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述表空间自动告警的方法的步骤。
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述表空间自动告警的方法的步骤。
有益效果
本申请实施例通过获取表空间的空闲空间量和表空间对应的文件目录的实际可用空间量,在空闲空间量大于或等于实际可用空间量时,将实际可用空间量作为预警空间量,在空闲空间量小于实际可用空间量时,将空闲空间量作为预警空间量,实质上综合考虑了表空间中和文件目录中实际可用的空间,并将其中较小的空间作为待告警空间量进行告警,使得告警过程贴合实际的数据存储情况,提升了表空间告警的安全性和准确性。
附图说明
图1是本申请实施例一中表空间自动告警的方法的实现流程图;
图2是本申请实施例二中表空间自动告警的方法的实现流程图;
图3是本申请实施例三中表空间自动告警的方法的实现流程图;
图4是本申请实施例四中表空间自动告警的方法的实现流程图;
图5是本申请实施例五中表空间自动告警的装置的结构框图;
图6是本申请实施例六中终端设备的示意图。
本发明的实施方式
为了对本申请的技术特征、目的和效果有更加清楚的理解,现对照附图详细说明本申请的具体实施方式。
请参阅图1,图1是本申请实施例提供的一种表空间自动告警的方法的实现流程图。如图1所示,该方法包括以下步骤:
S101:监测表空间,并查询所述表空间的空闲空间量,所述空闲空间量为所述表空间的剩余容量。
数据库是按照数据结构来组织、存储和管理数据的仓库,而表空间是指数据库的逻辑划分,一个表空间只能属于一个数据库,对于数据库来说,所有的数据库对象都存放在指定的表空间中。在实际应用如业务场景中,需要对表空间的容量进行监控,以防止表空间可用的容量过小,对业务数据的存储造成影响。在本申请实施例中,对表空间进行监测,并查询表空间的空闲空间量,空闲空间量是指表空间的剩余容量。为了便于说明,后文以数据库为Oracle数据库,表空间为Oracle数据库的逻辑存储单元进行阐述,但应获知的是,其他采用表空间作为存储单元进行存储的数据库也可应用在本实施例中。在查询Oralce数据库中表空间的空闲空间量时,可通过结构化查询语言(Structured Query Language,SQL)语句进行查询,具体可连接表空间所在的Oracle数据库,创建包括待查询的表空间的表名和空闲空间量的查询语句的SQL SELECT语句,并执行该SQL SELECT语句。当然,空闲空间量的查询方法并不限于上述例子,比如还可通过搭建zabbix系统实现查询,具体内容在后文进行阐述。
S102:确定所述表空间的物理文件和所述物理文件所在的文件目录,并获取所述文件目录的实际可用空间量。
表空间包含一个或多个物理文件,物理文件是实际存在的文件,对于数据库所在的主机来说是可视的,并且对于每个物理文件来说,其只属于一个表空间。在本申请实施例中,确定表空间的物理文件,物理文件的确定同样可通过创建包括待查询的表空间的表名和物理文件的查询语句的SQL SELECT语句,并执行该SQL SELECT语句实现。在查询到数据库的表空间的物理文件后,进一步在数据库所在主机上查找物理文件所在的文件目录,并获取文件目录的实际可用空间量,其中,实际可用空间量可以是文件目录属于的逻辑卷的可用容量,也可以是用户针对该文件目录预先设定的可用容量。值得一提的是,若实际可用空间量可以是文件目录属于的逻辑卷的可用容量,则可通过du命令或df命令查看文件目录的可用容量。
可选地,若表空间的物理文件存在多个,则确定与多个物理文件对应的多个实际可用空间量,并将数值最小的实际可用空间量作为表空间的实际可用空间量。以实际可用空间量为文件目录属于的逻辑卷的可用容量举例来说,若表空间的物理文件包括三个,第一个物理文件的文件目录所在的逻辑卷为逻辑卷A,可用容量为10G(吉字节),第二个物理文件的文件目录所在的逻辑卷为逻辑卷B,可用容量为15G,第三个物理文件的文件目录所在的逻辑卷为逻辑卷C,可用容量为5G,则得到表空间的实际可用空间量为5G。上述方法在表空间拥有多个物理文件时,在多个物理文件对应的多个实际可用空间量中,将数值最小的实际可用空间量作为表空间的实际可用空间量,提升了实际可用空间量的安全程度。
S103:将所述空闲空间量与所述实际可用空间量进行比对,若所述空闲空间量大于或等于所述实际可用空间量,则将所述实际可用空间量作为所述表空间的待告警空间量;若所述空闲空间量小于所述实际可用空间量,则将所述空闲空间量作为所述表空间的待告警空间量。
在获取到空闲空间量和实际可用空间量后,将空闲空间量与实际可用空间量进行数值比对,并将其中数值较小的作为表空间的待告警空间量,即如果空闲空间量大于或等于实际可用空间量,则将实际可用空间量作为表空间的待告警空间量;如果空闲空间量小于实际可用空间量,则将数值较小的空闲空间量作为表空间的待告警空间量,其中,待告警空间量是指用于告警的表空间可用的空间量。
S104:当所述待告警空间量满足预设的第一条件时,输出报警提示。
在本申请实施例中,对表空间进行监测并得到待告警空间量的操作可以实时进行,也可以根据预设的时间间隔持续进行,比如每隔30分钟间隔监测一次。当得到的待告警空间量满足预设的第一条件时,输出报警提示,其中,第一条件可以是待告警空间量小于或等于预设阈值,当然也可以根据实际应用场景进行制定,本申请实施例对此不做限定。
可选地,对表空间预先设置告警机制,当待告警空间量满足第一条件时,自动触发告警机制以输出报警提示。在数据库内预先配置告警机制,告警机制可以是自动发送告警邮件的机制或自动发送告警短信的机制等,并可创建告警脚本,在告警脚本的执行过程中,执行步骤S101至步骤S104的操作,其中在判断出待告警空间量满足第一条件后,触发告警机制以输出报警提示,从而提升告警的便利性,实现自动告警。
可选地,对表空间预先设置自动扩展机制,当待告警空间量满足第一条件时,触发自动扩展机制以扩展表空间的容量。在本申请实施例中,可对Oracle数据库内的表空间设置自动扩展机制,自动扩展机制可通过设置Oralce数据库中的autoextend(自动扩展)属性实现。由于在实际应用场景中,在对表空间设置自动扩展时,通常设定的表空间的最大容量较小,故待告警空间量通常为表空间的空闲空间量,故可设定自动扩展机制为当监测到空闲空间量小于或等于预设阈值时,自动触发,以扩展表空间的容量,满足数据的存储需求。此外,还可在自动扩展机制中设置每次增加的空间量,以对扩展过程进行控制。
通过图1所示实施例可知,在本申请实施例中,通过监测表空间并查询表空间的空闲空间量,并确定表空间的物理文件,从而获取物理文件所在文件目录的实际可用空间量,为了获得数值较小的空间量,将空闲空间量与实际可用空间量进行比对,若空闲空间量大于或等于实际可用空间量,则将实际可用空间量作为表空间的待告警空间量;若空闲空间量小于实际可用空间量,则将空闲空间量作为表空间的待告警空间量,最后当监测得到的待告警空间量满足预设的第一条件时,输出报警提示,本申请实施例将空闲空间量与实际可用空间量中较小的量作为待告警空间量,防止仅对空闲空间量进行告警提示,导致实际可用空间已不可用时,提示的空闲空间量仍可用的情况发生,提升了告警的安全性。
请参阅图2,图2是本申请实施例二提供的一种表空间自动告警的方法的实现流程图。相对于图1对应的实施例,本实施例对S104进行细化后得到S201~S203,详述如下:
S201:获取所述表空间在历史时间段内的多个已占用空间量,并基于所述多个已占用空间量计算所述表空间在历史时间段内的多个数据添加率,其中每个所述已占用空间量对应所述历史时间段内的一个子时间段。
在实际应用场景如业务场景中,表空间中的空间量变化通常存在规律性,比如在每个月的月初和月末,由于业务变更较多,空间量通常呈现上升趋势,故在本申请实施例中,获取表空间在历史时间段内的多个已占用空间量,其中历史时间段由多个子时间段组成,每个已占用空间量对应历史时间段中的一个子时间段。历史时间段和子时间段可根据告警需求自由制定,比如若要针对以天数为单位的表空间的使用情况进行告警,则可确定历史时间段为历史的某一个月,而该历史时间段的多个子时间段分别是该月的第一天,第二天,……,最后一天。在获取到多个已占用空间量后,基于多个已占用空间量计算表空间在每个子时间段的数据添加率,具体方法是计算某个当前的已占用空间量与前一个子时间段对应的已占用空间量的比值,并将该比值作为当前的已占用空间量对应子时间段的数据添加率。为了便于说明,假设第二天的已占用空间量为10G,第一天的已占用空间量为5G,则第二天的数据添加率为10G/5G=200%(为了计算第一天的数据添加率,可以预先获取上个月最后一天的已占用空间量)。值得一提的是,已占用空间量同样可通过执行SQL SELECT语句或搭建zabbix监控系统等方法进行获取。
可选地,获取多个历史时间段的多个已占用空间量,并对得到的多个历史时间段在同一子时间段的多个数据添加率取均值,将得到的结果作为表空间在该子时间段的最终数据添加率。在本申请实施例中,为了提升计算出的数据添加率的准确性,可获取多个历史时间段。举例来说,多个历史时间段可以是过去一年的十二个月,而对于每一个月,获取该月的每一天(子时间段)的已占用空间量。在计算出每个月的从第一天至最后一天的数据添加率后,将十二个月中的第一天对应的多个数据添加率取均值,并作为表空间的第一天的最终数据添加率,将十二个月中的第二天对应的多个数据添加率取均值,并作为表空间的第二天的最终数据添加率……直至计算出表空间每一天的最终数据添加率为止。此外,还可对不同的历史时间段设置权值,对多个历史时间段在同一子时间段的多个数据添加率进行加权求和,将得到的结果作为表空间在该子时间段的最终数据添加率。
S202:当所述待告警空间量小于或等于预设阈值时,获取当前的监测时间,并确定所述监测时间所在的所述子时间段对应的数据添加率。
对待告警空间量进行监测,当得到的待告警空间量小于或等于预设阈值时,不立刻进行告警,而是获取当前的监测时间,并确定监测时间所在的子时间段,例如历史时间段的多个子时间段为一个月中的第一天至最后一天(当然也可以是一星期内的星期一至星期日等,根据实际应用场景进行设定),而当前的监测时间是xx年xx月15日,则可确定监测时间对应的子时间段为第十五天。在确定子时间段后,获取通过步骤S201确定的该子时间段的数据添加率(如果在步骤S201中是根据多个历史时间段进行计算,则该数据添加率为最终数据添加率)。
S203:,当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示。
确定监测时间所在子时间段的数据添加率后,判断该数据添加率是否满足预设的第二条件时,如果满足,则输出报警提示。其中,第二条件可以是数据添加率大于某个特定的数值,如大于100%或大于150%等。
可选地,基于所述监测时间对应的数据添加率和对应的所述已占用空间量及所述待告警空间量计算填充时间,并输出所述填充时间,所述填充时间是从所述监测时间起到所述待告警空间量为零时所耗费的时间。除了输出报警提示之外,在本申请实施例中,还可基于监测时间对应的数据添加率,并获取表空间在监测时间的已占用空间量和待告警空间量,从而计算填充时间,并输出该填充时间。举例来说,表空间在监测时间的已占用空间量为8G,待告警空间量为2G,监测时间所在子时间段(假设子时间段以天数为单位,即为某一天)的数据添加率为150%,则填充时间为5/6天,即基于监测时间对应的数据添加率,当经过5/6天后,表空间的待告警空间量降低为零。通过输出填充时间,便于用户获知待告警空间量的发展趋势并作出对应的应对措施。
通过图2所示实施例可知,在本申请实施例中,通过获取表空间在历史时间段内的多个已占用空间量,并基于多个已占用空间量计算表空间在历史时间段内每个子时间段的数据添加率,当监测到待告警空间量小于或等于预设阈值时,获取当前的监测时间,并确定监测时间所在的子时间段对应的数据添加率,若判断出该数据添加率满足预设的第二条件时,输出报警提示,本申请实施例通过对历史时间段的数据进行计算,得到表空间在每个子时间段的数据变化趋势,即数据添加率,并通过数据添加率进行告警,适用于表空间数据变化存在规律性的实际应用场景,提升了在专用场景的适用性。
请参阅图3,图3是本申请实施例三提供的一种表空间自动告警的方法的实现流程图。相对于图2对应的实施例,本实施例对S203进行细化后得到S301~S302,详述如下:
S301:获取所述表空间在所述监测时间的所述已占用空间量及所述待告警空间量,并基于所述多个数据添加率、所述监测时间对应的所述已占用空间量及所述待告警空间量,分别计算所述表空间在所述监测时间所在所述子时间段后的N个所述子时间段的N个所述待告警空间量,其中N是大于零的整数。
当待告警空间量小于或等于预设阈值后,获取当前的监测时间,并获取表空间在监测时间的已占用空间量和待告警空间量,基于与多个子时间段一一对应的多个数据添加率(在本步骤中,也可以只获取在监测时间所在子时间段之后的子时间段对应的数据添加率)和监测时间对应的已占用空间量及待告警空间量,计算表空间在监测时间所在子时间段后的N个子时间段的N个待告警空间量,N为大于零的整数。举例来说,在监测时间所在子时间段之后的两个子时间段对应的数据添加率分别为120%和90%,表空间在监测时间的已占用空间量为5G,待告警空间量为2G,则可计算出表空间在监测时间所在子时间段之后的第一个子时间段的待告警空间量为(5G+2G)-5G×120%=1G,表空间在监测时间所在子时间段之后的第二个子时间段的待告警空间量为(5G+2G)-5G×120%×90%=1.6G。
S302:当N个所述待告警空间量的任一个小于或等于预设的第二阈值时,输出所述报警提示。
在计算出N个待告警空间量后,将N个待告警空间量分别与预设的第二阈值进行比对,如果N个待告警空间量中的某一个小于或等于第二阈值,则输出报警提示。此外,还可输出小于或等于第二阈值的待告警空间量以及对应的子时间段,提示用户在该子时间段进行数据清理或其他应对操作。
通过图3所示实施例可知,在本申请实施例中,通过获取表空间在监测时间的已占用空间量及待告警空间量,并基于已获取的多个数据添加率、监测时间对应的已占用空间量以及对应的待告警空间量,分别计算表空间在所监测时间所在子时间段后的N个子时间段的N个待告警空间量,其中N是大于零的整数,若N个待告警空间量的任一个小于或等于预设的第二阈值,则输出报警提示,本申请实施例实现了对未来N个子时间段的待告警空间量的预测,并根据预测结果进行报警提示,提升了对未来时段进行告警的准确性。
请参阅图4,图4是本申请实施例四提供的一种表空间自动告警的方法的实现流程图。相对于图1对应的实施例,本实施例对S101进行细化后得到S401~S402,详述如下:
S401:在所述表空间所在的主机上搭建zabbix客户端。
在本申请实施例中,可通过搭建zabbix监控系统实现对数据库中表空间的监控,其中,zabbix是一款开源的分布式监控系统,适用于对一个或多个目标进行监控的场景。zabbix监控系统主要包括zabbix服务端和zabbix客户端,zabbix服务端是zabbix的核心组件,负责接收zabbix客户端发送的数据;zabbix客户端部署在目标的主机上,用于采集该主机的数据。在本申请实施例中,在需要获取查询结果的主机(用户操作的主机)上建立zabbix服务端,并在表空间所在的主机上建立zabbix客户端,建立过程可通过安装zabbix安装包并配置zabbix环境实现。
S402:获取预设的查询脚本,并创建基于所述查询脚本的zabbix监控项,在所述zabbix监控项的执行过程中,获取所述zabbix客户端中所述表空间的所述空闲空间量。
为了对表空间进行监控,首先获取预设的查询脚本,查询脚本中包括用于检测表空间空闲空间量的SQL语句(还可以包括检测表空间物理文件的SQL语句),其中,查询脚本的格式为Shell脚本,Shell脚本是将Linux/Unix系统下的规范命令进行集合生成的程序文件,从而可以进行一次性执行。将已创建的查询脚本添加至zabbix客户端的配置文件中,并重启zabbix客户端。同时,在zabbix服务端配置与查询脚本对应的发现规则,即建立与查询脚本对应的监控项(监控项中指向查询脚本的名称),通过对监控项赋予执行权限,并运行该监控项,zabbix服务端便可获取到表空间的空闲空间量。值得一提的是,还可在zabbix服务端中配置监控项的运行时间或运行间隔,以满足对表空间的监测需求,比如每天早上八点运行一次监控项或每隔半个小时运行一次监控项。
通过图4所示实施例可知,在本申请实施例中,搭建zabbix监控系统,具体在表空间所在的主机上搭建zabbix客户端,将查询脚本添加至zabbix客户端的配置文件,在欲获取查询结果的主机上搭建zabbix服务端,并在zabbix服务端上创建基于查询脚本的zabbix监控项,并执行该zabbix监控项,在执行过程中,zabbix服务端便可自动获取到zabbix客户端中表空间的空闲空间量,本申请实施例通过搭建zabbix监控系统以及创建监控项,使得无需在监测表空间时手动输入SQL语句,提升了获取空闲空间量的便利性。
对应于上文实施例所述的一种表空间自动告警的方法,图5示出了本申请实施例提供的一种表空间自动告警的装置的一个结构框图,参照图5,该装置包括:
查询单元51,用于监测表空间,并查询所述表空间的空闲空间量,所述空闲空间量为所述表空间的剩余容量;
获取单元52,用于确定所述表空间的物理文件和所述物理文件所在的文件目录,并获取所述文件目录的实际可用空间量;
比对单元53,用于将所述空闲空间量与所述实际可用空间量进行比对,若所述空闲空间量大于或等于所述实际可用空间量,则将所述实际可用空间量作为所述表空间的待告警空间量;若所述空闲空间量小于所述实际可用空间量,则将所述空闲空间量作为所述表空间的待告警空间量;
第一输出单元54,用于当所述待告警空间量满足预设的第一条件时,输出报警提示。
可选地,所述第一输出单元54,包括:
计算单元,用于获取所述表空间在历史时间段内的多个已占用空间量,并基于所述多个已占用空间量计算所述表空间在历史时间段内的多个数据添加率,其中每个所述已占用空间量对应所述历史时间段内的一个子时间段;
添加率确定单元,用于当所述待告警空间量小于或等于预设阈值时,获取当前的监测时间,并确定所述监测时间所在的所述子时间段对应的数据添加率;
第二输出单元,用于当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示。
可选地,所述第二输出单元,包括:
空间量计算单元,用于获取所述表空间在所述监测时间的所述已占用空间量及所述待告警空间量,并基于所述多个数据添加率、所述监测时间对应的所述已占用空间量及所述待告警空间量,分别计算所述表空间在所述监测时间所在所述子时间段后的N个所述子时间段的N个所述待告警空间量,其中N是大于零的整数;
第三输出单元,用于当N个所述待告警空间量的任一个小于或等于预设的第二阈值时,输出所述报警提示。
可选地,所述第二输出单元,还包括:
第四输出单元,用于基于所述监测时间对应的数据添加率和对应的所述已占用空间量及所述待告警空间量计算填充时间,并输出所述填充时间,所述填充时间是从所述监测时间起到所述待告警空间量为零时所耗费的时间。
可选地,所述查询单元51,包括:
搭建单元,用于在所述表空间所在的主机上搭建zabbix客户端;
执行单元,用于获取预设的查询脚本,并创建基于所述查询脚本的zabbix监控项,在所述zabbix监控项的执行过程中,获取所述zabbix客户端中所述表空间的所述空闲空间量。
图6是本申请实施例提供的终端设备的示意图。如图6所示,该实施例的终端设备6包括:处理器60以及存储器61,所述存储器61中存储有可在所述处理器60上运行的计算机可读指令62,例如表空间自动告警的程序。所述处理器60执行所述计算机可读指令62时实现上述各个表空间自动告警的方法实施例中的步骤,例如图1所示的步骤S101至S104。或者,所述处理器60执行所述计算机可读指令62时实现上述装置实施例中各单元的功能,例如图5所示单元51至54的功能。
示例性的,所述计算机可读指令62可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器61中,并由所述处理器60执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机可读指令62在所述终端设备6中的执行过程。例如,所述计算机可读指令62可以被分割成查询单元、获取单元、比对单元及第一输出单元,各单元具体功能如上所述。
所述终端设备可包括,但不仅限于,处理器60、存储器61。本领域技术人员可以理解,图6仅仅是终端设备6的示例,并不构成对终端设备6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入输出设备、网络接入设备、总线等。
所称处理器60可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器 (Digital Signal Processor,DSP)、专用集成电路 (Application Specific Integrated Circuit,ASIC)、现成可编程门阵列 (Field-Programmable Gate Array,FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器61可以是所述终端设备6的内部存储单元,例如终端设备6的硬盘或内存。所述存储器61也可以是所述终端设备6的外部存储设备,例如所述终端设备6上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器61还可以既包括所述终端设备6的内部存储单元也包括外部存储设备。所述存储器61用于存储所述计算机可读指令以及所述终端设备所需的其他程序和数据。所述存储器61还可以用于暂时地存储已经输出或者将要输出的数据。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种表空间自动告警的方法,其特征在于,包括:
    监测表空间,并查询所述表空间的空闲空间量,所述空闲空间量为所述表空间的剩余容量;
    确定所述表空间的物理文件和所述物理文件所在的文件目录,并获取所述文件目录的实际可用空间量;
    将所述空闲空间量与所述实际可用空间量进行比对,若所述空闲空间量大于或等于所述实际可用空间量,则将所述实际可用空间量作为所述表空间的待告警空间量;若所述空闲空间量小于所述实际可用空间量,则将所述空闲空间量作为所述表空间的待告警空间量;
    当所述待告警空间量满足预设的第一条件时,输出报警提示。
  2. 如权利要求1所述的方法,其特征在于,所述当所述待告警空间量满足预设的第一条件时,输出报警提示,包括:
    获取所述表空间在历史时间段内的多个已占用空间量,并基于所述多个已占用空间量计算所述表空间在历史时间段内的多个数据添加率,其中每个所述已占用空间量对应所述历史时间段内的一个子时间段;
    当所述待告警空间量小于或等于预设阈值时,获取当前的监测时间,并确定所述监测时间所在的所述子时间段对应的数据添加率;
    当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示。
  3. 如权利要求2所述的方法,其特征在于,所述当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示,包括:
    获取所述表空间在所述监测时间的所述已占用空间量及所述待告警空间量,并基于所述多个数据添加率、所述监测时间对应的所述已占用空间量及所述待告警空间量,分别计算所述表空间在所述监测时间所在所述子时间段后的N个所述子时间段的N个所述待告警空间量,其中N是大于零的整数;
    当N个所述待告警空间量的任一个小于或等于预设的第二阈值时,输出所述报警提示。
  4. 如权利要求2所述的方法,其特征在于,所述当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示,还包括:
    基于所述监测时间对应的数据添加率和对应的所述已占用空间量及所述待告警空间量计算填充时间,并输出所述填充时间,所述填充时间是从所述监测时间起到所述待告警空间量为零时所耗费的时间。
  5. 如权利要求1所述的方法,其特征在于,所述监测表空间,并查询所述表空间的空闲空间量,包括:
    在所述表空间所在的主机上搭建zabbix客户端;
    获取预设的查询脚本,并创建基于所述查询脚本的zabbix监控项,在所述zabbix监控项的执行过程中,获取所述zabbix客户端中所述表空间的所述空闲空间量。
  6. 一种表空间自动告警的装置,其特征在于,包括:
    查询单元,用于监测表空间,并查询所述表空间的空闲空间量,所述空闲空间量为所述表空间的剩余容量;
    获取单元,用于确定所述表空间的物理文件和所述物理文件所在的文件目录,并获取所述文件目录的实际可用空间量;
    比对单元,用于将所述空闲空间量与所述实际可用空间量进行比对,若所述空闲空间量大于或等于所述实际可用空间量,则将所述实际可用空间量作为所述表空间的待告警空间量;若所述空闲空间量小于所述实际可用空间量,则将所述空闲空间量作为所述表空间的待告警空间量;
    第一输出单元,用于当所述待告警空间量满足预设的第一条件时,输出报警提示。
  7. 如权利要求6所述的装置,其特征在于,所述第一输出单元,包括:
    计算单元,用于获取所述表空间在历史时间段内的多个已占用空间量,并基于所述多个已占用空间量计算所述表空间在历史时间段内的多个数据添加率,其中每个所述已占用空间量对应所述历史时间段内的一个子时间段;
    添加率确定单元,用于当所述待告警空间量小于或等于预设阈值时,获取当前的监测时间,并确定所述监测时间所在的所述子时间段对应的数据添加率;
    第二输出单元,用于当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示。
  8. 如权利要求7所述的装置,其特征在于,所述第二输出单元,包括:
    空间量计算单元,用于获取所述表空间在所述监测时间的所述已占用空间量及所述待告警空间量,并基于所述多个数据添加率、所述监测时间对应的所述已占用空间量及所述待告警空间量,分别计算所述表空间在所述监测时间所在所述子时间段后的N个所述子时间段的N个所述待告警空间量,其中N是大于零的整数;
    第三输出单元,用于当N个所述待告警空间量的任一个小于或等于预设的第二阈值时,输出所述报警提示。
  9. 如权利要求7所述的装置,其特征在于,所述第二输出单元,还包括:
    第四输出单元,用于基于所述监测时间对应的数据添加率和对应的所述已占用空间量及所述待告警空间量计算填充时间,并输出所述填充时间,所述填充时间是从所述监测时间起到所述待告警空间量为零时所耗费的时间。
  10. 如权利要求6所述的装置,其特征在于,所述查询单元,包括:
    搭建单元,用于在所述表空间所在的主机上搭建zabbix客户端;
    执行单元,用于获取预设的查询脚本,并创建基于所述查询脚本的zabbix监控项,在所述zabbix监控项的执行过程中,获取所述zabbix客户端中所述表空间的所述空闲空间量。
  11. 一种终端设备,其特征在于,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:
    监测表空间,并查询所述表空间的空闲空间量,所述空闲空间量为所述表空间的剩余容量;
    确定所述表空间的物理文件和所述物理文件所在的文件目录,并获取所述文件目录的实际可用空间量;
    将所述空闲空间量与所述实际可用空间量进行比对,若所述空闲空间量大于或等于所述实际可用空间量,则将所述实际可用空间量作为所述表空间的待告警空间量;若所述空闲空间量小于所述实际可用空间量,则将所述空闲空间量作为所述表空间的待告警空间量;
    当所述待告警空间量满足预设的第一条件时,输出报警提示。
  12. 如权利要求11所述的终端设备,其特征在于,所述当所述待告警空间量满足预设的第一条件时,输出报警提示,包括:
    获取所述表空间在历史时间段内的多个已占用空间量,并基于所述多个已占用空间量计算所述表空间在历史时间段内的多个数据添加率,其中每个所述已占用空间量对应所述历史时间段内的一个子时间段;
    当所述待告警空间量小于或等于预设阈值时,获取当前的监测时间,并确定所述监测时间所在的所述子时间段对应的数据添加率;
    当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示。
  13. 如权利要求12所述的终端设备,其特征在于,所述当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示,包括:
    获取所述表空间在所述监测时间的所述已占用空间量及所述待告警空间量,并基于所述多个数据添加率、所述监测时间对应的所述已占用空间量及所述待告警空间量,分别计算所述表空间在所述监测时间所在所述子时间段后的N个所述子时间段的N个所述待告警空间量,其中N是大于零的整数;
    当N个所述待告警空间量的任一个小于或等于预设的第二阈值时,输出所述报警提示。
  14. 如权利要求12所述的终端设备,其特征在于,所述当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示,还包括:
    基于所述监测时间对应的数据添加率和对应的所述已占用空间量及所述待告警空间量计算填充时间,并输出所述填充时间,所述填充时间是从所述监测时间起到所述待告警空间量为零时所耗费的时间。
  15. 根据权利要求11所述的终端设备,其特征在于,所述监测表空间,并查询所述表空间的空闲空间量,包括:
    在所述表空间所在的主机上搭建zabbix客户端;
    获取预设的查询脚本,并创建基于所述查询脚本的zabbix监控项,在所述zabbix监控项的执行过程中,获取所述zabbix客户端中所述表空间的所述空闲空间量。
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:
    监测表空间,并查询所述表空间的空闲空间量,所述空闲空间量为所述表空间的剩余容量;
    确定所述表空间的物理文件和所述物理文件所在的文件目录,并获取所述文件目录的实际可用空间量;
    将所述空闲空间量与所述实际可用空间量进行比对,若所述空闲空间量大于或等于所述实际可用空间量,则将所述实际可用空间量作为所述表空间的待告警空间量;若所述空闲空间量小于所述实际可用空间量,则将所述空闲空间量作为所述表空间的待告警空间量;
    当所述待告警空间量满足预设的第一条件时,输出报警提示。
  17. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:
    获取所述表空间在历史时间段内的多个已占用空间量,并基于所述多个已占用空间量计算所述表空间在历史时间段内的多个数据添加率,其中每个所述已占用空间量对应所述历史时间段内的一个子时间段;
    当所述待告警空间量小于或等于预设阈值时,获取当前的监测时间,并确定所述监测时间所在的所述子时间段对应的数据添加率;
    当所述监测时间对应的数据添加率满足预设的第二条件时,输出所述报警提示。
  18. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:
    获取所述表空间在所述监测时间的所述已占用空间量及所述待告警空间量,并基于所述多个数据添加率、所述监测时间对应的所述已占用空间量及所述待告警空间量,分别计算所述表空间在所述监测时间所在所述子时间段后的N个所述子时间段的N个所述待告警空间量,其中N是大于零的整数;
    当N个所述待告警空间量的任一个小于或等于预设的第二阈值时,输出所述报警提示。
  19. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述计算机可读指令被至少一个处理器执行时还实现如下步骤:
    基于所述监测时间对应的数据添加率和对应的所述已占用空间量及所述待告警空间量计算填充时间,并输出所述填充时间,所述填充时间是从所述监测时间起到所述待告警空间量为零时所耗费的时间。
  20. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:
    在所述表空间所在的主机上搭建zabbix客户端;
    获取预设的查询脚本,并创建基于所述查询脚本的zabbix监控项,在所述zabbix监控项的执行过程中,获取所述zabbix客户端中所述表空间的所述空闲空间量。
PCT/CN2018/105557 2018-07-06 2018-09-13 表空间自动告警的方法、装置、终端设备及可读存储介质 Ceased WO2020006868A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810736693.9A CN109165146B (zh) 2018-07-06 2018-07-06 表空间自动告警的方法及终端设备
CN201810736693.9 2018-07-06

Publications (1)

Publication Number Publication Date
WO2020006868A1 true WO2020006868A1 (zh) 2020-01-09

Family

ID=64897437

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/105557 Ceased WO2020006868A1 (zh) 2018-07-06 2018-09-13 表空间自动告警的方法、装置、终端设备及可读存储介质

Country Status (2)

Country Link
CN (1) CN109165146B (zh)
WO (1) WO2020006868A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110134680B (zh) * 2019-04-04 2022-11-29 平安科技(深圳)有限公司 空间监控方法、装置、计算机设备及存储介质
CN119473721B (zh) * 2024-10-31 2025-10-17 北京百度网讯科技有限公司 系统运行控制方法、装置、电子设备以及存储介质
CN119576636B (zh) * 2025-01-27 2025-05-16 山东云海国创云计算装备产业创新中心有限公司 告警内容的发送方法及装置、存储介质及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040117408A1 (en) * 2002-12-17 2004-06-17 Capital One Financial Corporation Systems, methods and articles of manufacture for determining available space in a database
CN1871586A (zh) * 2003-10-29 2006-11-29 甲骨文国际公司 追踪数据库中的空间占用
CN104486109A (zh) * 2014-12-09 2015-04-01 大唐移动通信设备有限公司 一种故障检测、恢复方法及装置
CN104636450A (zh) * 2015-01-26 2015-05-20 上海新炬网络信息技术有限公司 一种数据库表空间监控方法
CN105095496A (zh) * 2015-08-24 2015-11-25 浪潮软件股份有限公司 一种通过zabbix监控mysql表空间的方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9165021B2 (en) * 2009-04-14 2015-10-20 International Business Machines Corporation Managing database object placement on multiple storage devices
CN104699807B (zh) * 2015-03-23 2018-05-15 上海新炬网络信息技术股份有限公司 一种oracle数据表空间的自动监控扩容方法
CN107133331A (zh) * 2017-05-11 2017-09-05 郑州云海信息技术有限公司 基于shell脚本实现的数据库自动扩容方法及装置
CN107947998B (zh) * 2017-12-19 2021-03-12 河南信安通信技术股份有限公司 一种基于应用系统的实时监测系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040117408A1 (en) * 2002-12-17 2004-06-17 Capital One Financial Corporation Systems, methods and articles of manufacture for determining available space in a database
CN1871586A (zh) * 2003-10-29 2006-11-29 甲骨文国际公司 追踪数据库中的空间占用
CN104486109A (zh) * 2014-12-09 2015-04-01 大唐移动通信设备有限公司 一种故障检测、恢复方法及装置
CN104636450A (zh) * 2015-01-26 2015-05-20 上海新炬网络信息技术有限公司 一种数据库表空间监控方法
CN105095496A (zh) * 2015-08-24 2015-11-25 浪潮软件股份有限公司 一种通过zabbix监控mysql表空间的方法

Also Published As

Publication number Publication date
CN109165146B (zh) 2021-08-17
CN109165146A (zh) 2019-01-08

Similar Documents

Publication Publication Date Title
US11741100B2 (en) Providing matching security between data stores in a database system
JP6865219B2 (ja) 連続クエリ処理におけるイベントバッチ処理、出力シーケンス化、およびログベースの状態記憶
CN106844165B (zh) 告警方法及装置
US20210289043A1 (en) Efficient context monitoring
EP3759611A1 (en) Data retention handling for data object stores
WO2020000676A1 (zh) 数据库自动告警的方法、装置、终端设备及可读存储介质
US9514162B2 (en) Smart polling frequency
EP3422186A1 (en) Method, device and system for preventing memory data loss
WO2020006868A1 (zh) 表空间自动告警的方法、装置、终端设备及可读存储介质
CN115525631A (zh) 数据库数据迁移方法、装置、设备、存储介质
CN112925659B (zh) 消息处理方法、装置、设备及计算机存储介质
WO2019127772A1 (zh) 数据字典展示方法、装置、终端设备及存储介质
CN110865877B (zh) 一种任务请求的响应方法及设备
CN113722177B (zh) 时序指标异常检测方法、装置、系统、设备及存储介质
CN114281872A (zh) 分布式序列号的生成方法、装置、设备及可读存储介质
CN113094224B (zh) 服务器资产管理方法、装置、计算机设备和存储介质
CN115567363B (zh) 一种系统的告警处理方法、装置及介质
CN116521694A (zh) 一种数据维护方法、智能终端及存储介质
CN108255710B (zh) 一种脚本的异常检测方法及其终端
CN110855484B (zh) 自动检测业务量变化的方法、系统、电子设备和存储介质
CN110633165B (zh) 故障处理方法、装置、系统服务器及计算机可读存储介质
CN117891824A (zh) 一种数据表调整方法、装置、设备及存储介质
KR102464688B1 (ko) 모니터링 결과의 이벤트 등급 결정 방법 및 장치
CN115174667A (zh) 大数据的推送方法、系统和电子设备
US12608381B2 (en) System and method for executing computational queries

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18925669

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18925669

Country of ref document: EP

Kind code of ref document: A1