WO2018177036A1 - Database data archiving method and system, terminal, and computer readable storage medium - Google Patents

Database data archiving method and system, terminal, and computer readable storage medium Download PDF

Info

Publication number
WO2018177036A1
WO2018177036A1 PCT/CN2018/076198 CN2018076198W WO2018177036A1 WO 2018177036 A1 WO2018177036 A1 WO 2018177036A1 CN 2018076198 W CN2018076198 W CN 2018076198W WO 2018177036 A1 WO2018177036 A1 WO 2018177036A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
resource occupancy
occupancy rate
data archiving
task
Prior art date
Application number
PCT/CN2018/076198
Other languages
French (fr)
Chinese (zh)
Inventor
凌剑
姜云鹏
吴海波
马向东
丁杰
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2018177036A1 publication Critical patent/WO2018177036A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment

Definitions

  • the present application relates to the field of database technologies, and in particular, to a database data archiving method, system, terminal, and computer readable storage medium.
  • the data archiving of the database is performed by a timed task, that is, according to the preset task execution time, the data archiving task is started periodically, and the data archiving task is stopped periodically.
  • the data archiving task is easy to conflict with other JOB tasks in the database.
  • multiple tasks in parallel will result in a particularly high resource rate and performance degradation of the database during a certain period of time.
  • the resource usage rate of the time period without JOB task running is relatively low, which seriously wastes the resources of the database.
  • the main purpose of the present application is to provide a database data archiving method, system, terminal and computer readable storage medium, aiming at solving the technical problem of database resource waste.
  • the present application provides a database data archiving method, and the database data archiving method includes the following steps:
  • the data archiving task is started, and data archiving is performed;
  • the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
  • the present application further provides a database data archiving system, where the database data archiving system includes:
  • An acquiring module configured to acquire a resource occupancy rate of the database in real time, and detect a change trend of the database resource occupancy rate
  • a startup module configured to start a data archiving task and perform data archiving if detecting that the resource occupancy rate is reduced to a preset first threshold
  • the obtaining module is further configured to acquire the resource occupancy rate and its changing trend in real time when performing data archiving;
  • the stopping module is configured to stop the data archiving task if the resource occupancy rate is detected to increase to a preset second threshold.
  • the present application further provides a terminal, where the terminal includes: a memory, a processor, and a database data archiving program stored on the memory and operable on the processor, the database data
  • the terminal includes: a memory, a processor, and a database data archiving program stored on the memory and operable on the processor, the database data
  • the data archiving task is started, and data archiving is performed;
  • the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
  • the present application further provides a computer readable storage medium, where the database data storage program is stored, and the database data archive program is executed by the processor to implement the following steps:
  • the data archiving task is started, and data archiving is performed;
  • the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
  • the database data archiving method, system, terminal and computer readable storage medium proposed by the embodiments of the present application obtain the resource occupancy rate of the database in real time, monitor the resource occupancy of the database, and detect the change trend of the database resource occupancy rate;
  • the resource usage of the database is reduced to a preset first threshold, indicating that the database is currently in an idle state, then the data archiving task is started, data archiving is performed, and the idle period of the seamless docking database is realized; when data archiving is performed, real-time access is performed.
  • the resource occupancy rate of the database and its changing trend are to grasp the state of the resource occupancy rate of the database and respond in time; if the resource occupancy rate of the database increases to a preset second threshold, indicating that the database is currently in a busy state, the data is stopped. Archiving tasks to avoid preempting system resources with other processes in the database, resulting in system performance degradation.
  • the data inductive task in the present application is based on the change trend of the resource occupancy rate of the database and the preset threshold value is started or stopped in real time, and has high flexibility, can fully utilize the running resources of the database, avoid waste of idle period resources, and improve the use of database resources. rate. Moreover, according to the resource occupancy rate of the database, the data induction task can be avoided, and the peak period of resource usage of the database can be avoided, thereby improving the data processing efficiency of the database in each time period and improving the overall performance of the database.
  • FIG. 1 is a schematic flowchart of a first embodiment of a database data archiving method according to the present application
  • FIG. 2 is a schematic flowchart of a second embodiment of a database data archiving method according to the present application
  • FIG. 3 is a schematic flowchart of a step of acquiring the resource occupancy rate of the database in real time in FIG. 1;
  • FIG. 4 is a schematic flowchart of a fourth embodiment of a database data archiving method according to the present application.
  • FIG. 5 is a schematic diagram of functional modules of a first embodiment and a third embodiment of a database data archiving system of the present application;
  • FIG. 6 is a schematic diagram of functional modules of a second embodiment of a database data archiving system of the present application.
  • FIG. 7 is a schematic diagram of functional modules of a fourth embodiment of a database data archiving system of the present application.
  • FIG. 8 is a schematic structural diagram of a terminal in a hardware operating environment according to an embodiment of the present application.
  • a first embodiment of a database data archiving method of the present application provides a database data archiving method, where the database data archiving method includes:
  • Step S10 Obtain a resource occupancy rate of the database in real time, and detect a change trend of the database resource occupancy rate.
  • the application When archiving the data of the database, the application discards the traditional timing task, and follows the resource usage of the database, flexibly configures the running time of the archiving task, fully utilizes the idle resources of the database, and avoids the peak of the JOB task in the database. To improve the resource efficiency of the database.
  • the data archiving system acquires the resource occupancy rate of the database in real time.
  • the resource occupancy rate of the database can be obtained through the monitoring platform.
  • the monitoring platform calculates the real-time resource occupancy rate of the database by monitoring the key resources in the database, the usage of the read and write pages, the usage of the data blocks of the disk, and the usage rate of the buffer. Since the processes in the database may change in real time, the data archiving system needs to retrieve the resource occupancy rate of the database from the monitoring platform in real time to understand the resource usage of the database.
  • the data archiving system After obtaining the real-time resource occupancy rate of the database, the data archiving system detects the change trend of the resource occupancy rate.
  • the data archiving system can determine the real-time change trend of the resource occupancy rate according to the value of the resource occupancy of the current time and the value of the resource occupancy rate of the previous time or the difference. For example, if the resource occupancy rate at the current time is 50% and the resource occupancy rate at the previous time is 40%, the change trend of the resource occupancy rate may be determined to be increased.
  • the data archiving system can also detect the overall trend of the resource occupancy rate within the preset duration.
  • the preset duration can be flexibly set according to actual needs. Specifically, the data archiving system first determines the initial time according to the current time and the preset duration. For example, the current time is 12:0, the preset time is 4 minutes, and the initial time is 11:56. Then, according to the value of the resource occupancy of the current time and the value of the resource occupancy rate of the initial time or the difference, the real-time change trend of the resource occupancy rate is determined, and the obtained trend is the overall trend of the entire time interval from the initial time to the current time.
  • Step S20 If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed.
  • the data archiving system After obtaining the resource occupancy rate of the database, the data archiving system determines whether the data archiving task can be started according to the resource occupancy rate.
  • the data archiving system monitors the change trend of the database resource occupancy rate in real time.
  • the first threshold is a threshold for starting the data archiving task, and can be flexibly configured according to actual needs, for example, 30%.
  • step S30 when the data is archived, the resource occupancy rate and its changing trend are obtained in real time. If the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
  • the data archiving system While the data archiving system performs data archiving, the data archiving system obtains the resource occupancy rate in real time and continues to detect the resource occupancy rate change trend of the database. If the resource occupancy rate is continuously increased, when the preset second threshold is increased, for example, 80%, the data archiving system stops the data archiving task to prevent other processes in the database from preempting resources and affecting the performance of the database.
  • the first threshold and the second threshold may be flexibly configured according to actual needs. Preferably, the first threshold is less than the second threshold.
  • the data archiving task is frequently started and stopped, and the resource occupied by the data archiving task can be estimated in advance, and the data archiving task is determined. Resource occupancy rate.
  • the second threshold is configured according to the first threshold and the resource occupancy rate of the data archiving task, and the second threshold may be higher than the sum of the first threshold and the resource occupancy of the data archiving task. For example, if the first threshold is 30% and the resource occupancy rate of the data archiving task is 2%, the second threshold can be configured to be 35%, and a certain resource is reserved for the data archiving task or other JOB tasks.
  • the growth value of the database resource occupancy rate after starting the data archiving task is first obtained.
  • the database resource occupancy rate at the moment after the data archiving task is started and the database resource occupancy rate at the moment before the data archiving task is started may be calculated, and the growth rate of the database resource occupancy rate is calculated.
  • the second threshold is configured according to the preset first threshold and the calculated growth value. That is to say, the second threshold is configured according to the actual resource occupancy of the database, and the second threshold may be higher than the sum of the first threshold and the growth value. For example, if the first threshold is 30% and the resource occupancy rate increases by 2% after the data archiving task is started, the second threshold can be configured to be 35%, and a certain resource is reserved for the data archiving task or other JOB tasks. Thereafter, the data archiving system continues to detect the resource occupancy rate and trend of the database, and stops or restarts the data archiving task according to the resource occupancy rate.
  • the resource occupancy rate of the database is obtained in real time to monitor the resource occupancy of the database, and the change trend of the database resource occupancy rate is detected; if the resource occupancy rate of the database is reduced to a preset first threshold, indicating that the database is currently When entering the idle state, the data archiving task is started, and data archiving is performed to realize the idle period of the seamless docking database; when data archiving is performed, the resource occupancy rate of the database and its changing trend are acquired in real time, so as to grasp the resource occupancy state of the database.
  • the data induction task is based on the change trend of the database resource occupancy rate and the preset threshold value is started or stopped in real time, and has high flexibility, can fully utilize the running resources of the database, avoid waste of idle period resources, and improve the use of database resources. rate.
  • the data induction task can be avoided, and the peak period of resource usage of the database can be avoided, thereby improving the data processing efficiency of the database in each time period and improving the overall performance of the database.
  • the second embodiment of the database data archiving method of the present application provides a database data archiving method.
  • the database data archiving method further includes:
  • Step S40 Determine whether the current time is within a preset archiving period; if the current time is within a preset archiving period, step S10 is performed.
  • the archiving cycle can be preset, and the data is summarized only in the archiving cycle to avoid the suspended database inductive task. Although the data induction has been completed, the process still exists and wastes resources.
  • the preset archiving period may be a fixed time interval of each day, a fixed time interval of each week, a fixed time interval of each month, and the like, for example, from 1 to 7 of each month.
  • the resource occupancy rate of the database is obtained in real time, and the trend of the database resource occupancy rate is detected, thereby determining whether data archiving needs to be started.
  • the data archiving task is started, and data archiving is performed. It should be noted that, when entering the preset archiving period, if the change trend of the database resource occupancy rate is reduced, and the current resource occupancy rate is less than the first threshold, the data archiving task is started, and data archiving is performed.
  • control of the data archiving cycle is implemented to control centralized data archiving only in a fixed period, thereby avoiding waste of resources in the data archiving task.
  • Step S10 includes:
  • step S11 the JOB task in the database is counted, and the running information of each JOB task is obtained.
  • the resource usage of the database can also be calculated based on the JOB task in the database.
  • the step of "acquiring the resource occupancy rate of the database in real time” can be further refined to "statistically query the JOB task in the database, obtain the running information of each JOB task; and obtain the database at each moment according to the running information of each JOB task. Resource occupancy rate.”
  • JOB task refers to a specific task that is periodically executed in the database.
  • the periodicity may be daily, weekly, monthly, yearly, etc.; specific tasks may be deletion, storage, backup, and the like.
  • the data in the database is backed up at 1 am every Monday.
  • the running information of each JOB task is obtained. Further, the running information of the JOB task includes a running time, a starting frequency, and resource occupancy information of the JOB task.
  • the running time of the JOB task includes the start time and stop time of the JOB task; the start frequency of the JOB task is the time interval between the JOB task and the last running, for example, once a week, once every hour.
  • the resource occupancy information of the JOB task runtime includes the database running resource information occupied by the JOB task at runtime, such as the data range, the amount of data, and the application of the service.
  • Step S12 Acquire, according to the operation information of each JOB task, the resource occupancy rate of the database at each moment.
  • the resource occupancy rate of the database at each moment is calculated according to the running information of the JOB task in the database.
  • the database resource occupancy rate at this moment can be calculated according to the number of JOB tasks, the data range involved in each JOB task operation, the amount of data, and the weights corresponding to the pre-configured factors.
  • the resource occupancy rate of each time of the database can be calculated.
  • the resource occupancy rate of the database at each moment is calculated according to the JOB task in the database, thereby avoiding the peak period in which the JOB task occupies a high running resource, and archiving data only when the resource occupancy rate is low.
  • the fourth embodiment of the database data archiving method of the present application provides a database data archiving method.
  • the database data archiving method further includes:
  • Step S50 When it is detected that the JOB task in the database is updated, the operation information of the JOB task is updated, and the process proceeds to step S12.
  • the administrator can add, delete or modify the JOB task as needed to update the JOB task.
  • the data induction system detects that the JOB task of the database is updated, because the updated JOB task may change the execution time and other factors, it is necessary to update the operation information of the JOB task.
  • the resource occupancy rate of the database at each moment is recalculated, and the data inductive task of the database is started or stopped.
  • the JOB task information in the database is monitored. If the JOB task in the database is updated, the running information of the JOB task is updated to recalculate the resource occupancy rate of the database, and the resource occupancy rate of the database is performed. Correction.
  • a first embodiment of the database data archiving system of the present application provides a database data archiving system, where the database data archiving system includes:
  • the obtaining module 10 is configured to acquire the resource occupancy rate of the database in real time, and detect a change trend of the database resource occupancy rate.
  • the application When archiving the data of the database, the application discards the traditional timing task, and follows the resource usage of the database, flexibly configures the running time of the archiving task, fully utilizes the idle resources of the database, and avoids the peak of the JOB task in the database. To improve the resource efficiency of the database.
  • the obtaining module 10 acquires the resource occupancy rate of the database in real time.
  • the resource occupancy rate of the database can be obtained through the monitoring platform.
  • the monitoring platform calculates the real-time resource occupancy rate of the database by monitoring the key resources in the database, the usage of the read and write pages, the usage of the data blocks of the disk, and the usage rate of the buffer. Because the processes in the database may change in real time, the obtaining module 10 needs to retrieve the resource occupancy rate of the database from the monitoring platform in real time to understand the resource usage of the database.
  • the obtaining module 10 After obtaining the real-time resource occupancy rate of the database, the obtaining module 10 detects the change trend of the resource occupancy rate.
  • the obtaining module 10 may determine a real-time change trend of the resource occupancy rate according to the value of the resource occupancy of the current time and the value of the resource occupancy rate of the previous time or the difference. For example, if the resource occupancy rate at the current time is 50% and the resource occupancy rate at the previous time is 40%, the change trend of the resource occupancy rate may be determined to be increased.
  • the acquiring module 10 can also detect the overall trend of the resource occupancy rate within the preset duration.
  • the preset duration can be flexibly set according to actual needs. Specifically, the obtaining module 10 first determines an initial time according to the current time and the preset time length. For example, the current time is 12:0, the preset time is 4 minutes, and the initial time is 11:56. Then, the obtaining module 10 determines the real-time change trend of the resource occupancy rate according to the value of the resource occupancy and the initial time resource occupancy rate or the difference, and the obtained change trend is the whole time interval from the initial time to the current time. trend.
  • the startup module 20 is configured to start a data archiving task and perform data archiving if it is detected that the resource occupancy rate is reduced to a preset first threshold.
  • the startup module 20 determines whether the data archiving task can be started according to the resource occupancy rate.
  • the startup module 20 monitors the change trend of the database resource occupancy rate in real time.
  • the startup module 20 starts a data archiving task, and data such as historical data and logs. Archive.
  • the first threshold is a threshold for starting the data archiving task, and can be flexibly configured according to actual needs, for example, 30%.
  • the obtaining module 10 is further configured to acquire the resource occupancy rate and its changing trend in real time when performing data archiving.
  • the stopping module 30 is configured to stop the data archiving task if the resource occupancy rate is detected to increase to a preset second threshold.
  • the obtaining module 10 obtains the resource occupancy rate in real time, and continues to detect the resource occupancy rate change trend of the database. If the resource occupancy rate is continuously increased, when the preset second threshold is increased, for example, 80%, the stop module 30 stops the data archiving task to prevent other processes in the database from preempting resources and affecting the performance of the database.
  • the first threshold and the second threshold may be flexibly configured according to actual needs. Preferably, the first threshold is less than the second threshold.
  • the data archiving task is frequently started and stopped, and the stopping module 30 can estimate the resource occupied by the data archiving task in advance and determine the data. The resource usage of the archived task. Then, the stopping module 30 configures the second threshold according to the first threshold and the resource occupancy rate of the data archiving task, and the second threshold may be higher than the sum of the first threshold and the resource occupancy rate of the data archiving task. For example, if the first threshold is 30% and the resource occupancy rate of the data archiving task is 2%, the stopping module 30 can configure the second threshold to be 35%, and reserve certain resources for the data archiving task or other JOB tasks.
  • the stopping module 30 first acquires an increase value of the database resource occupancy rate after starting the data archiving task.
  • the database resource occupancy rate at the moment after the data archiving task is started and the database resource occupancy rate at the moment before the data archiving task is started may be calculated, and the growth rate of the database resource occupancy rate is calculated.
  • the stopping module 30 configures the second threshold according to the preset first threshold and the calculated growth value. That is to say, the second threshold is configured according to the actual resource occupancy of the database, and the second threshold may be higher than the sum of the first threshold and the growth value. For example, if the first threshold is 30% and the resource occupancy rate increases by 2% after the data archiving task is started, the stop module 30 can configure the second threshold to be 35%, and reserve a certain amount for the data archiving task or other JOB tasks. resource of. Thereafter, the obtaining module 10 continues to detect the resource occupancy rate and the changing trend of the database, and the stopping module 30 stops or restarts the data archiving task according to the resource occupancy rate.
  • the acquiring module 10 acquires the resource occupancy rate of the database in real time, monitors the resource occupancy of the database, and detects the change trend of the database resource occupancy rate; if the resource occupancy rate of the database decreases to a preset first threshold,
  • the startup module 20 starts the data archiving task and performs data archiving to realize the idle period of the seamless docking database.
  • the obtaining module 10 obtains the resource occupancy rate of the database and its changing trend in real time.
  • the stop module 30 stops the data archiving task, avoiding the database Other processes in the system seize system resources, resulting in system performance degradation.
  • the data induction task is based on the change trend of the database resource occupancy rate and the preset threshold value is started or stopped in real time, and has high flexibility, can fully utilize the running resources of the database, avoid waste of idle period resources, and improve the use of database resources. rate.
  • the data induction task can be avoided, and the peak period of resource usage of the database can be avoided, thereby improving the data processing efficiency of the database in each time period and improving the overall performance of the database.
  • the second embodiment of the database data archiving system of the present application provides a database data archiving system.
  • the database data archiving system further includes:
  • the period module 40 is configured to determine whether the current time is within a preset archival period
  • the obtaining module 10 is further configured to acquire a resource occupancy rate of the database in real time and detect a change trend of the database resource occupancy rate, if the current time is in a preset archival period.
  • the archiving cycle can be preset, and the data is summarized only in the archiving cycle to avoid the suspended database inductive task. Although the data induction has been completed, the process still exists and wastes resources.
  • the periodic module 40 needs to detect whether the current time is within a preset archival period.
  • the preset archiving period may be a fixed time interval of each day, a fixed time interval of each week, a fixed time interval of each month, and the like, for example, from 1 to 7 of each month.
  • the obtaining module 10 obtains the resource occupancy rate of the database in real time, detects the change trend of the database resource occupancy rate, and determines whether the data archiving needs to be started.
  • the startup module 20 starts a data archiving task and performs data archiving. If the current time is not within the preset archiving period, the cycle module 40 prohibits the initiation of the data archiving task.
  • the startup module 20 starts the data archiving task and performs data archiving. .
  • control of the data archiving cycle is implemented to control centralized data archiving only in a fixed period, thereby avoiding waste of resources in the data archiving task.
  • a third embodiment of the database data archiving system of the present application provides a database data archiving system based on the first embodiment or the second embodiment of the database data archiving system of the present application (this embodiment archives database data)
  • the first embodiment of the system is taken as an example.
  • the acquiring module 10 is further configured to:
  • the JOB task in the database is counted, and the running information of each JOB task is obtained. According to the running information of each JOB task, the resource occupancy rate of the database at each moment is obtained.
  • the resource usage of the database can also be calculated based on the JOB task in the database.
  • the "resource acquisition rate of the database in real time” can be further refined to "statistically record the JOB task in the database, obtain the operation information of each JOB task; and obtain the resource occupation of the database at each moment according to the operation information of each JOB task. rate".
  • the acquiring module 10 counts all JOB tasks currently existing in the database.
  • the JOB task refers to a specific task that is periodically executed in the database.
  • the periodicity may be daily, weekly, monthly, yearly, etc.; specific tasks may be deletion, storage, backup, and the like.
  • the data in the database is backed up at 1 am every Monday.
  • the obtaining module 10 obtains the running information of each JOB task. Further, the running information of the JOB task includes a running time, a starting frequency, and resource occupancy information of the JOB task.
  • the running time of the JOB task includes the start time and stop time of the JOB task; the start frequency of the JOB task is the time interval between the JOB task and the last running, for example, once a week, once every hour.
  • the resource occupancy information of the JOB task runtime includes the database running resource information occupied by the JOB task at runtime, such as the data range, the amount of data, and the application of the service.
  • the obtaining module 10 calculates the resource occupancy rate of the database at each moment according to the running information of the JOB task in the database.
  • the obtaining module 10 can acquire all the JOB tasks running at the same time in the database according to the running time and the starting frequency of each JOB task; then, according to the number of all JOB tasks running at this moment, and the resource occupation information of each JOB task running, Calculate the database resource occupancy at this moment.
  • the obtaining module 10 may calculate the database resources at the moment according to the number of JOB tasks, the data range involved in each JOB task operation, the amount of data, and the weights corresponding to the pre-configured factors. Occupancy rate.
  • the obtaining module 10 can calculate the resource occupancy rate of the database at each moment.
  • the resource occupancy rate of the database at each moment is calculated according to the JOB task in the database, thereby avoiding the peak period in which the JOB task occupies a high running resource, and archiving data only when the resource occupancy rate is low.
  • the fourth embodiment of the database data archiving system of the present application provides a database data archiving system.
  • the database data archiving system further includes:
  • the update module 50 is configured to update the operation information of the JOB task when it is detected that the JOB task in the database is updated.
  • the administrator can add, delete or modify the JOB task as needed to update the JOB task.
  • the update module 50 needs to update the operation information of the JOB task.
  • the obtaining module 10 After updating the running information of the JOB task, the obtaining module 10 recalculates the resource occupancy rate of the database at each moment according to the updated JOB task running information, and is used to start or stop the data inductive task of the database.
  • the JOB task information in the database is monitored. If the JOB task in the database is updated, the update module 50 updates the running information of the JOB task to recalculate the resource occupancy rate of the database and the resources of the database. The occupancy rate is corrected.
  • FIG. 8 is a schematic structural diagram of a terminal in a hardware operating environment according to an embodiment of the present application.
  • the terminal in this embodiment may be a terminal device such as a PC.
  • the terminal may include a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, and a memory 1004.
  • the communication bus 1002 is used to implement connection communication between these components.
  • the user interface 1003 can include a display, an input unit such as a keyboard, and the optional user interface 1003 can also include a standard wired interface, a wireless interface.
  • the memory 1004 may be a high speed RAM memory or a stable memory (non-volatile) Memory), such as disk storage.
  • the memory 1004 can also optionally be a storage device independent of the aforementioned processor 1001.
  • the terminal structure shown in FIG. 8 does not constitute a limitation to the terminal, and may include more or less components than those illustrated, or a combination of certain components, or different component arrangements.
  • an operating system, a user interface module, and a database archiving program may be included in the memory 1004 as a computer storage medium.
  • the user interface 1003 is mainly used to connect a client (the user's mobile terminal) to perform data communication with the client; and the processor 1001 can be used to call a database archiving program stored in the memory 1004, and Do the following:
  • the data archiving task is started, and data archiving is performed;
  • the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
  • processor 1001 may be configured to invoke a database archiving program stored in the memory 1004, and further perform the following operations:
  • the step is: acquiring the resource occupancy rate of the database in real time, and detecting a change trend of the resource occupancy rate.
  • processor 1001 may be configured to invoke a database archiving program stored in the memory 1004, and further perform the following operations:
  • the resource occupancy rate of the database at each moment is obtained.
  • processor 1001 may be configured to invoke a database archiving program stored in the memory 1004, and further perform the following operations:
  • the running information of the JOB task is updated, and the execution step is performed: the resource occupancy rate of the database at each moment is obtained according to the running information of the JOB task.
  • the running information of the JOB task includes a running time, a starting frequency, and resource occupancy information of the JOB task.
  • the embodiment of the present application further provides a computer readable storage medium, where the database readable storage medium stores a database data archiving program, and when the database data archiving program is executed by the processor, the following steps are implemented:
  • the data archiving task is started, and data archiving is performed;
  • the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
  • the step is: acquiring the resource occupancy rate of the database in real time, and detecting a change trend of the resource occupancy rate.
  • the resource occupancy rate of the database at each moment is obtained.
  • the running information of the JOB task is updated, and the execution step is performed: the resource occupancy rate of the database at each moment is obtained according to the running information of the JOB task.
  • the running information of the JOB task includes a running time, a starting frequency, and resource occupancy information of the JOB task.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better.
  • Implementation Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a cloud server or a network device, etc.) to perform the methods of various embodiments of the present application.

Abstract

Disclosed is a database data archiving method. The method comprises: obtaining a resource occupancy rate of a database in real time, and detecting a variation trend of the resource occupancy rate of the database; starting a data archiving task for data archiving if it is detected that the resource occupancy rate decreases to a preset first threshold; obtaining the resource occupancy rate and the variation trend thereof in real time during the data archiving, and stopping the data archiving task if it is detected that the resource occupancy rate increases to a preset second threshold. Also disclosed are a database data archiving system, a terminal, and a computer readable storage medium. The present application can take full advantage of operating resources of a database, and avoid the waste of resources during an idle period.

Description

数据库数据归档方法、系统、终端和计算机可读存储介质  Database data archiving method, system, terminal and computer readable storage medium
本申请要求于2017年3月31日提交中国专利局、申请号为201710213154.2、发明名称为“数据库数据归档方法和系统”的中国专利申请的优先权,其全部内容通过引用结合在申请中。The present application claims the priority of the Chinese Patent Application, filed on Jan. 31, 2017, filed Jan.
技术领域Technical field
本申请涉及数据库技术领域,尤其涉及一种数据库数据归档方法、系统、终端和计算机可读存储介质。The present application relates to the field of database technologies, and in particular, to a database data archiving method, system, terminal, and computer readable storage medium.
背景技术Background technique
随着数据库中数据文件的增多,数据库的工作性能会逐渐降低,而及时将数据库中的数据进行归档,能够提高并稳定数据库的性能。目前,数据库的数据归档都是通过定时任务进行的,也即,根据预设的任务执行时间,定时启动数据归档任务,定时停止数据归档任务。As the number of data files in the database increases, the performance of the database will gradually decrease, and the data in the database will be archived in time to improve and stabilize the performance of the database. At present, the data archiving of the database is performed by a timed task, that is, according to the preset task execution time, the data archiving task is started periodically, and the data archiving task is stopped periodically.
由于定时任务的灵活性不高,数据归档任务容易和数据库中的其他的JOB任务发生冲突,同一时间多个任务并行会导致数据库在某一时间段的资源率特别高,性能大大降低,而部分没有JOB任务运行的时间段资源占用率又比较低,严重浪费了数据库的资源。Due to the low flexibility of the timing task, the data archiving task is easy to conflict with other JOB tasks in the database. At the same time, multiple tasks in parallel will result in a particularly high resource rate and performance degradation of the database during a certain period of time. The resource usage rate of the time period without JOB task running is relatively low, which seriously wastes the resources of the database.
发明内容Summary of the invention
本申请的主要目的在于提供一种数据库数据归档方法、系统、终端和计算机可读存储介质,旨在解决数据库资源浪费的技术问题。The main purpose of the present application is to provide a database data archiving method, system, terminal and computer readable storage medium, aiming at solving the technical problem of database resource waste.
为实现上述目的,本申请提供一种数据库数据归档方法,所述数据库数据归档方法包括以下步骤:To achieve the above objective, the present application provides a database data archiving method, and the database data archiving method includes the following steps:
实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;Obtaining the resource occupancy rate of the database in real time, and detecting a change trend of the database resource occupancy rate;
若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed;
在进行数据归档时,实时获取所述资源占用率及其变化趋势,若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。When data archiving is performed, the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
此外,为实现上述目的,本申请还提供一种数据库数据归档系统,所述数据库数据归档系统包括:In addition, to achieve the above object, the present application further provides a database data archiving system, where the database data archiving system includes:
获取模块,用于实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;An acquiring module, configured to acquire a resource occupancy rate of the database in real time, and detect a change trend of the database resource occupancy rate;
启动模块,用于若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;a startup module, configured to start a data archiving task and perform data archiving if detecting that the resource occupancy rate is reduced to a preset first threshold;
所述获取模块,还用于在进行数据归档时,实时获取所述资源占用率及其变化趋势;The obtaining module is further configured to acquire the resource occupancy rate and its changing trend in real time when performing data archiving;
停止模块,用于若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。The stopping module is configured to stop the data archiving task if the resource occupancy rate is detected to increase to a preset second threshold.
此外,为实现上述目的,本申请还提供一种终端,所述终端包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的数据库数据归档程序,所述数据库数据归档程序被所述处理器执行时实现如下步骤:In addition, in order to achieve the above object, the present application further provides a terminal, where the terminal includes: a memory, a processor, and a database data archiving program stored on the memory and operable on the processor, the database data The following steps are implemented when the archiver is executed by the processor:
实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;Obtaining the resource occupancy rate of the database in real time, and detecting a change trend of the database resource occupancy rate;
若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed;
在进行数据归档时,实时获取所述资源占用率及其变化趋势,若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。When data archiving is performed, the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有数据库数据归档程序,所述数据库数据归档程序被处理器执行时实现如下步骤:In addition, in order to achieve the above object, the present application further provides a computer readable storage medium, where the database data storage program is stored, and the database data archive program is executed by the processor to implement the following steps:
实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;Obtaining the resource occupancy rate of the database in real time, and detecting a change trend of the database resource occupancy rate;
若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed;
在进行数据归档时,实时获取所述资源占用率及其变化趋势,若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。When data archiving is performed, the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
本申请实施例提出的一种数据库数据归档方法、系统、终端和计算机可读存储介质,通过实时获取数据库的资源占用率,以监测数据库的资源占用情况,检测数据库资源占用率的变化趋势;若数据库的资源占用率减小至预设的第一阈值,表明数据库当前进入空闲状态,则启动数据归档任务,进行数据归档,实现了无缝对接数据库的空闲期;在进行数据归档时,实时获取数据库的资源占用率及其变化趋势,以掌握数据库的资源占用率状态,及时应对;若数据库的资源占用率增大至预设的第二阈值,表明数据库当前进入繁忙状态,则停止所述数据归档任务,避免与数据库中的其他进程抢占系统资源,导致系统性能下降。本申请中数据归纳任务是基于数据库的资源占用率的变化趋势及预设阈值实时启动或停止的,灵活性高,能够充分利用数据库的运行资源,避免空闲期资源的浪费,提高数据库资源的使用率。并且,依据数据库的资源占用率调控数据归纳任务,能够避开数据库的资源使用高峰期,从而提高数据库在各时间段的数据处理效率,提高数据库的整体性能。The database data archiving method, system, terminal and computer readable storage medium proposed by the embodiments of the present application obtain the resource occupancy rate of the database in real time, monitor the resource occupancy of the database, and detect the change trend of the database resource occupancy rate; The resource usage of the database is reduced to a preset first threshold, indicating that the database is currently in an idle state, then the data archiving task is started, data archiving is performed, and the idle period of the seamless docking database is realized; when data archiving is performed, real-time access is performed. The resource occupancy rate of the database and its changing trend are to grasp the state of the resource occupancy rate of the database and respond in time; if the resource occupancy rate of the database increases to a preset second threshold, indicating that the database is currently in a busy state, the data is stopped. Archiving tasks to avoid preempting system resources with other processes in the database, resulting in system performance degradation. The data inductive task in the present application is based on the change trend of the resource occupancy rate of the database and the preset threshold value is started or stopped in real time, and has high flexibility, can fully utilize the running resources of the database, avoid waste of idle period resources, and improve the use of database resources. rate. Moreover, according to the resource occupancy rate of the database, the data induction task can be avoided, and the peak period of resource usage of the database can be avoided, thereby improving the data processing efficiency of the database in each time period and improving the overall performance of the database.
附图说明DRAWINGS
图1为本申请数据库数据归档方法第一实施例的流程示意图;1 is a schematic flowchart of a first embodiment of a database data archiving method according to the present application;
图2为本申请数据库数据归档方法第二实施例的流程示意图;2 is a schematic flowchart of a second embodiment of a database data archiving method according to the present application;
图3为图1中实时获取数据库的资源占用率的步骤的细化流程示意图;3 is a schematic flowchart of a step of acquiring the resource occupancy rate of the database in real time in FIG. 1;
图4为本申请数据库数据归档方法第四实施例的流程示意图;4 is a schematic flowchart of a fourth embodiment of a database data archiving method according to the present application;
图5为本申请数据库数据归档系统第一实施例、第三实施例的功能模块示意图;5 is a schematic diagram of functional modules of a first embodiment and a third embodiment of a database data archiving system of the present application;
图6为本申请数据库数据归档系统第二实施例的功能模块示意图;6 is a schematic diagram of functional modules of a second embodiment of a database data archiving system of the present application;
图7为本申请数据库数据归档系统第四实施例的功能模块示意图;7 is a schematic diagram of functional modules of a fourth embodiment of a database data archiving system of the present application;
图8是本申请实施例方案涉及的硬件运行环境的终端结构示意图。FIG. 8 is a schematic structural diagram of a terminal in a hardware operating environment according to an embodiment of the present application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings.
具体实施方式detailed description
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
参照图1,本申请数据库数据归档方法第一实施例提供一种数据库数据归档方法,所述数据库数据归档方法包括:Referring to FIG. 1 , a first embodiment of a database data archiving method of the present application provides a database data archiving method, where the database data archiving method includes:
步骤S10、实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势。Step S10: Obtain a resource occupancy rate of the database in real time, and detect a change trend of the database resource occupancy rate.
本申请在对数据库的数据进行归档时,舍弃了传统的定时任务,而是跟随数据库的资源使用情况,灵活配置归档任务的运行时间,充分利用数据库的空闲资源,避开数据库中JOB任务的高峰期,提高数据库的资源使用效率。When archiving the data of the database, the application discards the traditional timing task, and follows the resource usage of the database, flexibly configures the running time of the archiving task, fully utilizes the idle resources of the database, and avoids the peak of the JOB task in the database. To improve the resource efficiency of the database.
具体的,首先,数据归档系统实时获取数据库的资源占用率。Specifically, first, the data archiving system acquires the resource occupancy rate of the database in real time.
作为一种实施方式,数据库的资源占用率可以通过监控平台获取。监控平台通过监控数据库中的关键资源、读写页面的使用情况、磁盘的数据块使用情况、缓冲区的使用率等,计算得到数据库的实时资源占用率。由于数据库中的进程可能是实时变动的,因此,数据归档系统需要实时从监控平台调取数据库的资源占用率,以了解数据库的资源使用情况。As an implementation manner, the resource occupancy rate of the database can be obtained through the monitoring platform. The monitoring platform calculates the real-time resource occupancy rate of the database by monitoring the key resources in the database, the usage of the read and write pages, the usage of the data blocks of the disk, and the usage rate of the buffer. Since the processes in the database may change in real time, the data archiving system needs to retrieve the resource occupancy rate of the database from the monitoring platform in real time to understand the resource usage of the database.
在得到数据库的实时资源占用率后,数据归档系统检测资源占用率的变化趋势。After obtaining the real-time resource occupancy rate of the database, the data archiving system detects the change trend of the resource occupancy rate.
作为一种实施方式,数据归档系统可以根据当前时刻的资源占用与上一时刻资源占用率的数值大小或是差值,确定资源占用率的实时变化趋势。例如,当前时刻的资源占用率为50%,上一时刻的资源占用率为40%,则可以确定资源占用率的变化趋势为增大。As an implementation manner, the data archiving system can determine the real-time change trend of the resource occupancy rate according to the value of the resource occupancy of the current time and the value of the resource occupancy rate of the previous time or the difference. For example, if the resource occupancy rate at the current time is 50% and the resource occupancy rate at the previous time is 40%, the change trend of the resource occupancy rate may be determined to be increased.
当然,作为另一种实施方式,数据归档系统也可以检测预设时长内,资源占用率整体的变化趋势。其中,预设时长可以根据实际需要灵活设置。具体的,数据归档系统首先根据当前时刻及预设时长确定初始时刻。例如,当前时刻为12时0分,预设时长为4分钟,则初始时刻为11时56分。然后,根据当前时刻的资源占用与初始时刻资源占用率的数值大小或是差值,确定资源占用率的实时变化趋势,得到的变化趋势为初始时刻至当前时刻这整个时间区间的整体趋势。Of course, as another implementation manner, the data archiving system can also detect the overall trend of the resource occupancy rate within the preset duration. The preset duration can be flexibly set according to actual needs. Specifically, the data archiving system first determines the initial time according to the current time and the preset duration. For example, the current time is 12:0, the preset time is 4 minutes, and the initial time is 11:56. Then, according to the value of the resource occupancy of the current time and the value of the resource occupancy rate of the initial time or the difference, the real-time change trend of the resource occupancy rate is determined, and the obtained trend is the overall trend of the entire time interval from the initial time to the current time.
步骤S20、若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档。Step S20: If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed.
在得到数据库的资源占用率后,数据归档系统根据资源占用率判断当前是否可以启动数据归档任务。After obtaining the resource occupancy rate of the database, the data archiving system determines whether the data archiving task can be started according to the resource occupancy rate.
具体的,作为一种实施方式,数据归档系统实时监测数据库资源占用率的变化趋势。Specifically, as an implementation manner, the data archiving system monitors the change trend of the database resource occupancy rate in real time.
若数据库的资源占用率不断减小,则表明数据库的空闲资源越来越多,当资源占用率降低到预设的第一阈值时,启动数据归档任务,对历史数据、日志等数据进行归档。其中,第一阈值为启动数据归档任务的临界值,可根据实际需要灵活配置,例如30%等。If the resource usage of the database is continuously reduced, it indicates that there are more and more idle resources in the database. When the resource usage rate decreases to the preset first threshold, the data archiving task is started, and data such as historical data and logs are archived. The first threshold is a threshold for starting the data archiving task, and can be flexibly configured according to actual needs, for example, 30%.
步骤S30、在进行数据归档时,实时获取所述资源占用率及其变化趋势,若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。In step S30, when the data is archived, the resource occupancy rate and its changing trend are obtained in real time. If the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
在数据归档系统进行数据归档的同时,数据归档系统实时获取资源占用率,并且继续检测数据库的资源占用率变化趋势。若检测到资源占用率不断增大,当增大到预设的第二阈值时,例如80%,数据归档系统停止数据归档任务,以避免同数据库中的其他进程抢占资源,影响数据库的性能。需要说明的是,第一阈值和第二阈值可根据实际需要灵活配置。优选地,第一阈值小于第二阈值。While the data archiving system performs data archiving, the data archiving system obtains the resource occupancy rate in real time and continues to detect the resource occupancy rate change trend of the database. If the resource occupancy rate is continuously increased, when the preset second threshold is increased, for example, 80%, the data archiving system stops the data archiving task to prevent other processes in the database from preempting resources and affecting the performance of the database. It should be noted that the first threshold and the second threshold may be flexibly configured according to actual needs. Preferably, the first threshold is less than the second threshold.
进一步地,为了避免启动数据归档任务导致数据库资源占用率增大到第二阈值,致使数据归档任务频繁的启动、停止,可以预先估算数据归档任务运行时所占用的资源情况,确定数据归档任务的资源占用率。然后,根据第一阈值和数据归档任务的资源占用率,配置第二阈值,可以使第二阈值高于第一阈值与数据归档任务的资源占用率之和。例如,若第一阈值为30%,数据归档任务的资源占用率为2%,则可以配置第二阈值为35%,为数据归档任务或是其他JOB任务预留一定的资源。Further, in order to prevent the data resource occupation rate from increasing to a second threshold caused by starting the data archiving task, the data archiving task is frequently started and stopped, and the resource occupied by the data archiving task can be estimated in advance, and the data archiving task is determined. Resource occupancy rate. Then, the second threshold is configured according to the first threshold and the resource occupancy rate of the data archiving task, and the second threshold may be higher than the sum of the first threshold and the resource occupancy of the data archiving task. For example, if the first threshold is 30% and the resource occupancy rate of the data archiving task is 2%, the second threshold can be configured to be 35%, and a certain resource is reserved for the data archiving task or other JOB tasks.
优选地,作为另外一种实施方式,首先获取启动数据归档任务后数据库资源占用率的增长值。具体的,可以根据数据归档任务启动后一时刻的数据库资源占用率,和数据归档任务启动前一时刻的数据库资源占用率,计算得到数据库资源占用率的增长值。Preferably, as another implementation manner, the growth value of the database resource occupancy rate after starting the data archiving task is first obtained. Specifically, the database resource occupancy rate at the moment after the data archiving task is started and the database resource occupancy rate at the moment before the data archiving task is started may be calculated, and the growth rate of the database resource occupancy rate is calculated.
然后,根据预设的第一阈值和计算得到的增长值,配置第二阈值。也就是说,第二阈值是根据数据库的实际资源占用情况配置得到的,可以使第二阈值高于第一阈值与增长值之和。例如,若第一阈值为30%,数据归档任务启动后资源占用率的增长值为2%,则可以配置第二阈值为35%,为数据归档任务或是其他JOB任务预留一定的资源。此后,数据归档系统继续检测数据库的资源占用率及变化趋势,并根据资源占用率停止或再次启动数据归档任务。Then, the second threshold is configured according to the preset first threshold and the calculated growth value. That is to say, the second threshold is configured according to the actual resource occupancy of the database, and the second threshold may be higher than the sum of the first threshold and the growth value. For example, if the first threshold is 30% and the resource occupancy rate increases by 2% after the data archiving task is started, the second threshold can be configured to be 35%, and a certain resource is reserved for the data archiving task or other JOB tasks. Thereafter, the data archiving system continues to detect the resource occupancy rate and trend of the database, and stops or restarts the data archiving task according to the resource occupancy rate.
由此,实现了数据库的数据归档。As a result, data archiving of the database is achieved.
在本实施例中,实时获取数据库的资源占用率,以监测数据库的资源占用情况,检测数据库资源占用率的变化趋势;若数据库的资源占用率减小至预设的第一阈值,表明数据库当前进入空闲状态,则启动数据归档任务,进行数据归档,实现了无缝对接数据库的空闲期;在进行数据归档时,实时获取数据库的资源占用率及其变化趋势,以掌握数据库的资源占用率状态,及时应对;若数据库的资源占用率增大至预设的第二阈值,表明数据库当前进入繁忙状态,则停止所述数据归档任务,避免与数据库中的其他进程抢占系统资源,导致系统性能下降。本实施例中数据归纳任务是基于数据库资源占用率的变化趋势及预设阈值实时启动或停止的,灵活性高,能够充分利用数据库的运行资源,避免空闲期资源的浪费,提高数据库资源的使用率。并且,依据数据库的资源占用率调控数据归纳任务,能够避开数据库的资源使用高峰期,从而提高数据库在各时间段的数据处理效率,提高数据库的整体性能。In this embodiment, the resource occupancy rate of the database is obtained in real time to monitor the resource occupancy of the database, and the change trend of the database resource occupancy rate is detected; if the resource occupancy rate of the database is reduced to a preset first threshold, indicating that the database is currently When entering the idle state, the data archiving task is started, and data archiving is performed to realize the idle period of the seamless docking database; when data archiving is performed, the resource occupancy rate of the database and its changing trend are acquired in real time, so as to grasp the resource occupancy state of the database. If the resource occupancy rate of the database increases to a preset second threshold, indicating that the database is currently in a busy state, the data archiving task is stopped, and the system resources are prevented from being seized by other processes in the database, resulting in system performance degradation. . In this embodiment, the data induction task is based on the change trend of the database resource occupancy rate and the preset threshold value is started or stopped in real time, and has high flexibility, can fully utilize the running resources of the database, avoid waste of idle period resources, and improve the use of database resources. rate. Moreover, according to the resource occupancy rate of the database, the data induction task can be avoided, and the peak period of resource usage of the database can be avoided, thereby improving the data processing efficiency of the database in each time period and improving the overall performance of the database.
进一步地,参照图2,本申请数据库数据归档方法第二实施例提供一种数据库数据归档方法,基于上述图1所示的实施例,所述数据库数据归档方法还包括:Further, referring to FIG. 2, the second embodiment of the database data archiving method of the present application provides a database data archiving method. The database data archiving method further includes:
步骤S40、判断当前时间是否位于预设的归档周期内;若当前时间位于预设的归档周期内,则执行步骤S10。Step S40: Determine whether the current time is within a preset archiving period; if the current time is within a preset archiving period, step S10 is performed.
由于不同的数据库中的数据量的差异,不同的数据库进行数据归纳所需的时长不同;而且,由于数据库的使用需求,不同的时间段存入的数据量也不同,使得数据库并不需要一直进行数据的归纳。因此,可以预设归档周期,仅在归档周期内的对数据库进行数据归纳,以避免挂起的数据库归纳任务虽然已经完成了数据归纳,但进程依然存在,浪费资源。Due to the difference in the amount of data in different databases, different databases require different lengths of data to be summarized; moreover, due to the use of the database, the amount of data stored in different time periods is different, so that the database does not need to be continuously Induction of data. Therefore, the archiving cycle can be preset, and the data is summarized only in the archiving cycle to avoid the suspended database inductive task. Although the data induction has been completed, the process still exists and wastes resources.
具体的,作为一种实施方式,在启动数据归纳任务之前,需要检测当前时间是否位于预设的归档周期内。其中,预设的归档周期可以是每天的固定时间区间、每周的固定时间区间、每个月的固定时间区间等,例如,每个月的1日至7日。Specifically, as an implementation manner, before starting the data induction task, it is required to detect whether the current time is within a preset archival period. The preset archiving period may be a fixed time interval of each day, a fixed time interval of each week, a fixed time interval of each month, and the like, for example, from 1 to 7 of each month.
若当前时间位于预设的归档周期内,则实时获取数据库的资源占用率,检测数据库资源占用率的变化趋势,进而判断是否需要启动数据归档。在检测到数据库的资源占用率减小至预设的第一阈值时,启动数据归档任务,进行数据归档。需要说明的是,在进入预设的归档周期时,若数据库资源占用率的变化趋势为减小,且当前时刻的资源占用率小于第一阈值,则启动数据归档任务,进行数据归档。If the current time is in the preset archiving period, the resource occupancy rate of the database is obtained in real time, and the trend of the database resource occupancy rate is detected, thereby determining whether data archiving needs to be started. When it is detected that the resource occupancy rate of the database is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed. It should be noted that, when entering the preset archiving period, if the change trend of the database resource occupancy rate is reduced, and the current resource occupancy rate is less than the first threshold, the data archiving task is started, and data archiving is performed.
由此,实现了对数据归档任务的时间周期管控。Thereby, time period control of the data archiving task is realized.
在本实施例中,实现了对数据归档周期的管控,以控制仅在固定的周期内集中进行数据归档,避免数据归档任务空跑浪费资源。In this embodiment, the control of the data archiving cycle is implemented to control centralized data archiving only in a fixed period, thereby avoiding waste of resources in the data archiving task.
进一步地,参照图3,本申请数据库数据归档方法第三实施例提供一种数据库数据归档方法,基于上述图1或图2所示的实施例(本实施例以图1为例),所述步骤S10包括:Further, referring to FIG. 3, the third embodiment of the database data archiving method of the present application provides a database data archiving method, based on the embodiment shown in FIG. 1 or FIG. 2 (the embodiment is illustrated by using FIG. 1). Step S10 includes:
步骤S11、统计所述数据库中的JOB任务,获取各JOB任务的运行信息。In step S11, the JOB task in the database is counted, and the running information of each JOB task is obtained.
数据库的资源占用率还可以根据数据库中的JOB任务计算得到。“实时获取数据库的资源占用率”的步骤可以进一步细化为“统计所述数据库中的JOB任务,获取各JOB任务的运行信息;根据各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率”。The resource usage of the database can also be calculated based on the JOB task in the database. The step of "acquiring the resource occupancy rate of the database in real time" can be further refined to "statistically query the JOB task in the database, obtain the running information of each JOB task; and obtain the database at each moment according to the running information of each JOB task. Resource occupancy rate."
具体的,作为一种实施方式,首先,统计数据库中当前存在的全部JOB任务。需要说明的是,JOB任务指数据库中定期执行的特定的任务。其中,定期可以是每天、每周、每月、每年等周期;特定的任务可以是删除、存储、备份等。例如,每周一凌晨一点钟对数据库中的数据进行备份。Specifically, as an implementation manner, first, all JOB tasks currently existing in the database are counted. It should be noted that the JOB task refers to a specific task that is periodically executed in the database. The periodicity may be daily, weekly, monthly, yearly, etc.; specific tasks may be deletion, storage, backup, and the like. For example, the data in the database is backed up at 1 am every Monday.
在统计得到数据库中的全部JOB任务后,分别获取各JOB任务的运行信息。进一步地,所述JOB任务的运行信息包括JOB任务的运行时间、启动频率以及运行时的资源占用信息。其中,JOB任务的运行时间包括JOB任务的启动时间、停止时间;JOB任务的启动频率即为JOB任务每次运行时与上一次运行的时间间隔,例如每周一次、每个小时一次。JOB任务运行时的资源占用信息包括了JOB任务在运行时所占用的数据库运行资源信息,例如数据范围、数据量、服务的应用等。After all the JOB tasks in the database are obtained by statistics, the running information of each JOB task is obtained. Further, the running information of the JOB task includes a running time, a starting frequency, and resource occupancy information of the JOB task. The running time of the JOB task includes the start time and stop time of the JOB task; the start frequency of the JOB task is the time interval between the JOB task and the last running, for example, once a week, once every hour. The resource occupancy information of the JOB task runtime includes the database running resource information occupied by the JOB task at runtime, such as the data range, the amount of data, and the application of the service.
步骤S12、根据各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。Step S12: Acquire, according to the operation information of each JOB task, the resource occupancy rate of the database at each moment.
在得到JOB任务的运行信息后,根据数据库中JOB任务的运行信息,计算数据库在各个时刻的资源占用率。After obtaining the running information of the JOB task, the resource occupancy rate of the database at each moment is calculated according to the running information of the JOB task in the database.
首先,可以根据各JOB任务的运行时间、启动频率,获取数据库同一时刻运行的全部JOB任务;然后,根据此时刻运行的全部JOB任务的数量,以及各JOB任务运行的资源占用信息,计算此时刻的数据库资源占用率。在计算数据库的资源占用率时,可以根据JOB任务的数量、各JOB任务运行时涉及的数据范围、数据量等因素,以及预先配置的各因素对应的权重,计算此时刻的数据库资源占用率。First, according to the running time and starting frequency of each JOB task, all the JOB tasks running at the same time in the database can be obtained. Then, according to the number of all JOB tasks running at this time, and the resource occupation information of each JOB task running, the time is calculated. Database resource usage. When calculating the resource occupancy rate of the database, the database resource occupancy rate at this moment can be calculated according to the number of JOB tasks, the data range involved in each JOB task operation, the amount of data, and the weights corresponding to the pre-configured factors.
由此,可以计算得到数据库各时刻的资源占用率。Thereby, the resource occupancy rate of each time of the database can be calculated.
在本实施例中,实现了依据数据库中的JOB任务计算数据库在各时刻的资源占用率,从而能够避开JOB任务占用运行资源较高的高峰期,仅在资源占用率低的时候进行数据归档。In this embodiment, the resource occupancy rate of the database at each moment is calculated according to the JOB task in the database, thereby avoiding the peak period in which the JOB task occupies a high running resource, and archiving data only when the resource occupancy rate is low. .
进一步的,参照图4,本申请数据库数据归档方法第四实施例提供一种数据库数据归档方法,基于上述图3所示的实施例,所述数据库数据归档方法还包括:Further, referring to FIG. 4, the fourth embodiment of the database data archiving method of the present application provides a database data archiving method. The database data archiving method further includes:
步骤S50、在监测到所述数据库中的JOB任务发生更新时,更新所述JOB任务的运行信息,并转入执行步骤S12。Step S50: When it is detected that the JOB task in the database is updated, the operation information of the JOB task is updated, and the process proceeds to step S12.
管理员可以根据需要增加、删除或修改JOB任务,对JOB任务进行更新。The administrator can add, delete or modify the JOB task as needed to update the JOB task.
当数据归纳系统检测到数据库的JOB任务发生更新时,由于更新后的JOB任务可能执行时间等因素发生变化,因此需要对应更新JOB任务的运行信息。在更新JOB任务的运行信息后,根据更新后的JOB任务运行信息,重新计算数据库在各时刻的资源占用率,用于启动或停止数据库的数据归纳任务。When the data induction system detects that the JOB task of the database is updated, because the updated JOB task may change the execution time and other factors, it is necessary to update the operation information of the JOB task. After updating the running information of the JOB task, according to the updated JOB task running information, the resource occupancy rate of the database at each moment is recalculated, and the data inductive task of the database is started or stopped.
在本实施例中,监测数据库中的JOB任务信息,若监测到数据库中的JOB任务发生更新,则对应更新JOB任务的运行信息,以重新计算数据库的资源占用率,对数据库的资源占用率进行校正。In this embodiment, the JOB task information in the database is monitored. If the JOB task in the database is updated, the running information of the JOB task is updated to recalculate the resource occupancy rate of the database, and the resource occupancy rate of the database is performed. Correction.
参照图5,本申请数据库数据归档系统第一实施例提供一种数据库数据归档系统,所述数据库数据归档系统包括:Referring to FIG. 5, a first embodiment of the database data archiving system of the present application provides a database data archiving system, where the database data archiving system includes:
获取模块10,用于实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势。The obtaining module 10 is configured to acquire the resource occupancy rate of the database in real time, and detect a change trend of the database resource occupancy rate.
本申请在对数据库的数据进行归档时,舍弃了传统的定时任务,而是跟随数据库的资源使用情况,灵活配置归档任务的运行时间,充分利用数据库的空闲资源,避开数据库中JOB任务的高峰期,提高数据库的资源使用效率。When archiving the data of the database, the application discards the traditional timing task, and follows the resource usage of the database, flexibly configures the running time of the archiving task, fully utilizes the idle resources of the database, and avoids the peak of the JOB task in the database. To improve the resource efficiency of the database.
具体的,首先,获取模块10实时获取数据库的资源占用率。Specifically, first, the obtaining module 10 acquires the resource occupancy rate of the database in real time.
作为一种实施方式,数据库的资源占用率可以通过监控平台获取。监控平台通过监控数据库中的关键资源、读写页面的使用情况、磁盘的数据块使用情况、缓冲区的使用率等,计算得到数据库的实时资源占用率。由于数据库中的进程可能是实时变动的,因此,获取模块10需要实时从监控平台调取数据库的资源占用率,以了解数据库的资源使用情况。As an implementation manner, the resource occupancy rate of the database can be obtained through the monitoring platform. The monitoring platform calculates the real-time resource occupancy rate of the database by monitoring the key resources in the database, the usage of the read and write pages, the usage of the data blocks of the disk, and the usage rate of the buffer. Because the processes in the database may change in real time, the obtaining module 10 needs to retrieve the resource occupancy rate of the database from the monitoring platform in real time to understand the resource usage of the database.
在得到数据库的实时资源占用率后,获取模块10检测资源占用率的变化趋势。After obtaining the real-time resource occupancy rate of the database, the obtaining module 10 detects the change trend of the resource occupancy rate.
作为一种实施方式,获取模块10可以根据当前时刻的资源占用与上一时刻资源占用率的数值大小或是差值,确定资源占用率的实时变化趋势。例如,当前时刻的资源占用率为50%,上一时刻的资源占用率为40%,则可以确定资源占用率的变化趋势为增大。As an implementation manner, the obtaining module 10 may determine a real-time change trend of the resource occupancy rate according to the value of the resource occupancy of the current time and the value of the resource occupancy rate of the previous time or the difference. For example, if the resource occupancy rate at the current time is 50% and the resource occupancy rate at the previous time is 40%, the change trend of the resource occupancy rate may be determined to be increased.
当然,作为另一种实施方式,获取模块10也可以检测预设时长内,资源占用率整体的变化趋势。其中,预设时长可以根据实际需要灵活设置。具体的,获取模块10首先根据当前时刻及预设时长确定初始时刻。例如,当前时刻为12时0分,预设时长为4分钟,则初始时刻为11时56分。然后,获取模块10根据当前时刻的资源占用与初始时刻资源占用率的数值大小或是差值,确定资源占用率的实时变化趋势,得到的变化趋势为初始时刻至当前时刻这整个时间区间的整体趋势。Of course, as another implementation manner, the acquiring module 10 can also detect the overall trend of the resource occupancy rate within the preset duration. The preset duration can be flexibly set according to actual needs. Specifically, the obtaining module 10 first determines an initial time according to the current time and the preset time length. For example, the current time is 12:0, the preset time is 4 minutes, and the initial time is 11:56. Then, the obtaining module 10 determines the real-time change trend of the resource occupancy rate according to the value of the resource occupancy and the initial time resource occupancy rate or the difference, and the obtained change trend is the whole time interval from the initial time to the current time. trend.
启动模块20,用于若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档。The startup module 20 is configured to start a data archiving task and perform data archiving if it is detected that the resource occupancy rate is reduced to a preset first threshold.
在得到数据库的资源占用率后,启动模块20根据资源占用率判断当前是否可以启动数据归档任务。After obtaining the resource occupancy rate of the database, the startup module 20 determines whether the data archiving task can be started according to the resource occupancy rate.
具体的,作为一种实施方式,启动模块20实时监测数据库资源占用率的变化趋势。Specifically, as an implementation manner, the startup module 20 monitors the change trend of the database resource occupancy rate in real time.
若数据库的资源占用率不断减小,则表明数据库的空闲资源越来越多,当资源占用率降低到预设的第一阈值时,启动模块20启动数据归档任务,对历史数据、日志等数据进行归档。其中,第一阈值为启动数据归档任务的临界值,可根据实际需要灵活配置,例如30%等。If the resource usage of the database is continuously reduced, it indicates that there are more and more idle resources in the database. When the resource usage rate decreases to a preset first threshold, the startup module 20 starts a data archiving task, and data such as historical data and logs. Archive. The first threshold is a threshold for starting the data archiving task, and can be flexibly configured according to actual needs, for example, 30%.
所述获取模块10,还用于在进行数据归档时,实时获取所述资源占用率及其变化趋势。The obtaining module 10 is further configured to acquire the resource occupancy rate and its changing trend in real time when performing data archiving.
停止模块30,用于若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。The stopping module 30 is configured to stop the data archiving task if the resource occupancy rate is detected to increase to a preset second threshold.
在进行数据归档的同时,获取模块10实时获取资源占用率,并且继续检测数据库的资源占用率变化趋势。若检测到资源占用率不断增大,当增大到预设的第二阈值时,例如80%,停止模块30停止数据归档任务,以避免同数据库中的其他进程抢占资源,影响数据库的性能。需要说明的是,第一阈值和第二阈值可根据实际需要灵活配置。优选地,第一阈值小于第二阈值。While the data is being archived, the obtaining module 10 obtains the resource occupancy rate in real time, and continues to detect the resource occupancy rate change trend of the database. If the resource occupancy rate is continuously increased, when the preset second threshold is increased, for example, 80%, the stop module 30 stops the data archiving task to prevent other processes in the database from preempting resources and affecting the performance of the database. It should be noted that the first threshold and the second threshold may be flexibly configured according to actual needs. Preferably, the first threshold is less than the second threshold.
进一步地,为了避免启动数据归档任务导致数据库资源占用率增大到第二阈值,致使数据归档任务频繁的启动、停止,停止模块30可以预先估算数据归档任务运行时所占用的资源情况,确定数据归档任务的资源占用率。然后,停止模块30根据第一阈值和数据归档任务的资源占用率,配置第二阈值,可以使第二阈值高于第一阈值与数据归档任务的资源占用率之和。例如,若第一阈值为30%,数据归档任务的资源占用率为2%,则停止模块30可以配置第二阈值为35%,为数据归档任务或是其他JOB任务预留一定的资源。Further, in order to prevent the data resource occupation rate from increasing to a second threshold, the data archiving task is frequently started and stopped, and the stopping module 30 can estimate the resource occupied by the data archiving task in advance and determine the data. The resource usage of the archived task. Then, the stopping module 30 configures the second threshold according to the first threshold and the resource occupancy rate of the data archiving task, and the second threshold may be higher than the sum of the first threshold and the resource occupancy rate of the data archiving task. For example, if the first threshold is 30% and the resource occupancy rate of the data archiving task is 2%, the stopping module 30 can configure the second threshold to be 35%, and reserve certain resources for the data archiving task or other JOB tasks.
优选地,作为另外一种实施方式,停止模块30首先获取启动数据归档任务后数据库资源占用率的增长值。具体的,可以根据数据归档任务启动后一时刻的数据库资源占用率,和数据归档任务启动前一时刻的数据库资源占用率,计算得到数据库资源占用率的增长值。Preferably, as another implementation manner, the stopping module 30 first acquires an increase value of the database resource occupancy rate after starting the data archiving task. Specifically, the database resource occupancy rate at the moment after the data archiving task is started and the database resource occupancy rate at the moment before the data archiving task is started may be calculated, and the growth rate of the database resource occupancy rate is calculated.
然后,停止模块30根据预设的第一阈值和计算得到的增长值,配置第二阈值。也就是说,第二阈值是根据数据库的实际资源占用情况配置得到的,可以使第二阈值高于第一阈值与增长值之和。例如,若第一阈值为30%,数据归档任务启动后资源占用率的增长值为2%,则停止模块30可以配置第二阈值为35%,为数据归档任务或是其他JOB任务预留一定的资源。此后,获取模块10继续检测数据库的资源占用率及变化趋势,停止模块30根据资源占用率停止或再次启动数据归档任务。Then, the stopping module 30 configures the second threshold according to the preset first threshold and the calculated growth value. That is to say, the second threshold is configured according to the actual resource occupancy of the database, and the second threshold may be higher than the sum of the first threshold and the growth value. For example, if the first threshold is 30% and the resource occupancy rate increases by 2% after the data archiving task is started, the stop module 30 can configure the second threshold to be 35%, and reserve a certain amount for the data archiving task or other JOB tasks. resource of. Thereafter, the obtaining module 10 continues to detect the resource occupancy rate and the changing trend of the database, and the stopping module 30 stops or restarts the data archiving task according to the resource occupancy rate.
由此,实现了数据库的数据归档。As a result, data archiving of the database is achieved.
在本实施例中,获取模块10实时获取数据库的资源占用率,以监测数据库的资源占用情况,检测数据库资源占用率的变化趋势;若数据库的资源占用率减小至预设的第一阈值,表明数据库当前进入空闲状态,则启动模块20启动数据归档任务,进行数据归档,实现了无缝对接数据库的空闲期;在进行数据归档时,获取模块10实时获取数据库的资源占用率及其变化趋势,以掌握数据库的资源占用率状态,及时应对;若数据库的资源占用率增大至预设的第二阈值,表明数据库当前进入繁忙状态,则停止模块30停止所述数据归档任务,避免与数据库中的其他进程抢占系统资源,导致系统性能下降。本实施例中数据归纳任务是基于数据库资源占用率的变化趋势及预设阈值实时启动或停止的,灵活性高,能够充分利用数据库的运行资源,避免空闲期资源的浪费,提高数据库资源的使用率。并且,依据数据库的资源占用率调控数据归纳任务,能够避开数据库的资源使用高峰期,从而提高数据库在各时间段的数据处理效率,提高数据库的整体性能。In this embodiment, the acquiring module 10 acquires the resource occupancy rate of the database in real time, monitors the resource occupancy of the database, and detects the change trend of the database resource occupancy rate; if the resource occupancy rate of the database decreases to a preset first threshold, When the database is in the idle state, the startup module 20 starts the data archiving task and performs data archiving to realize the idle period of the seamless docking database. When the data is archived, the obtaining module 10 obtains the resource occupancy rate of the database and its changing trend in real time. To grasp the resource occupancy status of the database and respond in time; if the resource occupancy rate of the database increases to a preset second threshold, indicating that the database is currently in a busy state, the stop module 30 stops the data archiving task, avoiding the database Other processes in the system seize system resources, resulting in system performance degradation. In this embodiment, the data induction task is based on the change trend of the database resource occupancy rate and the preset threshold value is started or stopped in real time, and has high flexibility, can fully utilize the running resources of the database, avoid waste of idle period resources, and improve the use of database resources. rate. Moreover, according to the resource occupancy rate of the database, the data induction task can be avoided, and the peak period of resource usage of the database can be avoided, thereby improving the data processing efficiency of the database in each time period and improving the overall performance of the database.
进一步地,参照图6,本申请数据库数据归档系统第二实施例提供一种数据库数据归档系统,基于上述本申请数据库数据归档系统第一实施例,所述数据库数据归档系统还包括:Further, referring to FIG. 6, the second embodiment of the database data archiving system of the present application provides a database data archiving system. The database data archiving system further includes:
周期模块40,用于判断当前时间是否位于预设的归档周期内;The period module 40 is configured to determine whether the current time is within a preset archival period;
所述获取模块10,还用于若当前时间位于预设的归档周期内,则实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势。The obtaining module 10 is further configured to acquire a resource occupancy rate of the database in real time and detect a change trend of the database resource occupancy rate, if the current time is in a preset archival period.
由于不同的数据库中的数据量的差异,不同的数据库进行数据归纳所需的时长不同;而且,由于数据库的使用需求,不同的时间段存入的数据量也不同,使得数据库并不需要一直进行数据的归纳。因此,可以预设归档周期,仅在归档周期内的对数据库进行数据归纳,以避免挂起的数据库归纳任务虽然已经完成了数据归纳,但进程依然存在,浪费资源。Due to the difference in the amount of data in different databases, different databases require different lengths of data to be summarized; moreover, due to the use of the database, the amount of data stored in different time periods is different, so that the database does not need to be continuously Induction of data. Therefore, the archiving cycle can be preset, and the data is summarized only in the archiving cycle to avoid the suspended database inductive task. Although the data induction has been completed, the process still exists and wastes resources.
具体的,作为一种实施方式,在启动数据归纳任务之前,周期模块40需要检测当前时间是否位于预设的归档周期内。其中,预设的归档周期可以是每天的固定时间区间、每周的固定时间区间、每个月的固定时间区间等,例如,每个月的1日至7日。Specifically, as an implementation manner, before starting the data induction task, the periodic module 40 needs to detect whether the current time is within a preset archival period. The preset archiving period may be a fixed time interval of each day, a fixed time interval of each week, a fixed time interval of each month, and the like, for example, from 1 to 7 of each month.
若当前时间位于预设的归档周期内,则获取模块10实时获取数据库的资源占用率,检测数据库资源占用率的变化趋势,进而判断是否需要启动数据归档。在检测到数据库的资源占用率减小至预设的第一阈值时,启动模块20启动数据归档任务,进行数据归档。若当前时间不位于预设的归档周期内,则周期模块40禁止数据归档任务的启动。需要说明的是,在进入预设的归档周期时,若数据库资源占用率的变化趋势为减小,且当前时刻的资源占用率小于第一阈值,则启动模块20启动数据归档任务,进行数据归档。If the current time is in the preset archiving period, the obtaining module 10 obtains the resource occupancy rate of the database in real time, detects the change trend of the database resource occupancy rate, and determines whether the data archiving needs to be started. When it is detected that the resource occupancy of the database is reduced to a preset first threshold, the startup module 20 starts a data archiving task and performs data archiving. If the current time is not within the preset archiving period, the cycle module 40 prohibits the initiation of the data archiving task. It should be noted that, when the preset archiving period is entered, if the change trend of the database resource occupancy rate is decreased, and the current resource occupancy rate is less than the first threshold, the startup module 20 starts the data archiving task and performs data archiving. .
由此,实现了对数据归档任务的时间周期管控。Thereby, time period control of the data archiving task is realized.
在本实施例中,实现了对数据归档周期的管控,以控制仅在固定的周期内集中进行数据归档,避免数据归档任务空跑浪费资源。In this embodiment, the control of the data archiving cycle is implemented to control centralized data archiving only in a fixed period, thereby avoiding waste of resources in the data archiving task.
进一步地,参照图5,本申请数据库数据归档系统第三实施例提供一种数据库数据归档系统,基于上述本申请数据库数据归档系统第一实施例或第二实施例(本实施例以数据库数据归档系统第一实施例为例),所述获取模块10还用于,Further, referring to FIG. 5, a third embodiment of the database data archiving system of the present application provides a database data archiving system based on the first embodiment or the second embodiment of the database data archiving system of the present application (this embodiment archives database data) The first embodiment of the system is taken as an example. The acquiring module 10 is further configured to:
统计所述数据库中的JOB任务,获取所述各JOB任务的运行信息;根据所述各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。The JOB task in the database is counted, and the running information of each JOB task is obtained. According to the running information of each JOB task, the resource occupancy rate of the database at each moment is obtained.
数据库的资源占用率还可以根据数据库中的JOB任务计算得到。“实时获取数据库的资源占用率”可以进一步细化为“统计所述数据库中的JOB任务,获取各JOB任务的运行信息;根据各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率”。The resource usage of the database can also be calculated based on the JOB task in the database. The "resource acquisition rate of the database in real time" can be further refined to "statistically record the JOB task in the database, obtain the operation information of each JOB task; and obtain the resource occupation of the database at each moment according to the operation information of each JOB task. rate".
具体的,作为一种实施方式,首先,获取模块10统计数据库中当前存在的全部JOB任务。需要说明的是,JOB任务指数据库中定期执行的特定的任务。其中,定期可以是每天、每周、每月、每年等周期;特定的任务可以是删除、存储、备份等。例如,每周一凌晨一点钟对数据库中的数据进行备份。Specifically, as an implementation manner, first, the acquiring module 10 counts all JOB tasks currently existing in the database. It should be noted that the JOB task refers to a specific task that is periodically executed in the database. The periodicity may be daily, weekly, monthly, yearly, etc.; specific tasks may be deletion, storage, backup, and the like. For example, the data in the database is backed up at 1 am every Monday.
在统计得到数据库中的全部JOB任务后,获取模块10分别获取各JOB任务的运行信息。进一步地,所述JOB任务的运行信息包括JOB任务的运行时间、启动频率以及运行时的资源占用信息。其中,JOB任务的运行时间包括JOB任务的启动时间、停止时间;JOB任务的启动频率即为JOB任务每次运行时与上一次运行的时间间隔,例如每周一次、每个小时一次。JOB任务运行时的资源占用信息包括了JOB任务在运行时所占用的数据库运行资源信息,例如数据范围、数据量、服务的应用等。After the statistics all the JOB tasks in the database are obtained, the obtaining module 10 obtains the running information of each JOB task. Further, the running information of the JOB task includes a running time, a starting frequency, and resource occupancy information of the JOB task. The running time of the JOB task includes the start time and stop time of the JOB task; the start frequency of the JOB task is the time interval between the JOB task and the last running, for example, once a week, once every hour. The resource occupancy information of the JOB task runtime includes the database running resource information occupied by the JOB task at runtime, such as the data range, the amount of data, and the application of the service.
在得到JOB任务的运行信息后,获取模块10根据数据库中JOB任务的运行信息,计算数据库在各个时刻的资源占用率。After obtaining the running information of the JOB task, the obtaining module 10 calculates the resource occupancy rate of the database at each moment according to the running information of the JOB task in the database.
首先,获取模块10可以根据各JOB任务的运行时间、启动频率,获取数据库同一时刻运行的全部JOB任务;然后,根据此时刻运行的全部JOB任务的数量,以及各JOB任务运行的资源占用信息,计算此时刻的数据库资源占用率。在计算数据库的资源占用率时,获取模块10可以根据JOB任务的数量、各JOB任务运行时涉及的数据范围、数据量等因素,以及预先配置的各因素对应的权重,计算此时刻的数据库资源占用率。First, the obtaining module 10 can acquire all the JOB tasks running at the same time in the database according to the running time and the starting frequency of each JOB task; then, according to the number of all JOB tasks running at this moment, and the resource occupation information of each JOB task running, Calculate the database resource occupancy at this moment. When calculating the resource occupancy rate of the database, the obtaining module 10 may calculate the database resources at the moment according to the number of JOB tasks, the data range involved in each JOB task operation, the amount of data, and the weights corresponding to the pre-configured factors. Occupancy rate.
由此,获取模块10可以计算得到数据库各时刻的资源占用率。Thus, the obtaining module 10 can calculate the resource occupancy rate of the database at each moment.
在本实施例中,实现了依据数据库中的JOB任务计算数据库在各时刻的资源占用率,从而能够避开JOB任务占用运行资源较高的高峰期,仅在资源占用率低的时候进行数据归档。In this embodiment, the resource occupancy rate of the database at each moment is calculated according to the JOB task in the database, thereby avoiding the peak period in which the JOB task occupies a high running resource, and archiving data only when the resource occupancy rate is low. .
进一步地,参照图7,本申请数据库数据归档系统第四实施例提供一种数据库数据归档系统,基于上述本申请数据库数据归档系统第三实施例,所述数据库数据归档系统还包括:Further, referring to FIG. 7, the fourth embodiment of the database data archiving system of the present application provides a database data archiving system. The database data archiving system further includes:
更新模块50,用于在监测到所述数据库中的JOB任务发生更新时,更新所述JOB任务的运行信息。The update module 50 is configured to update the operation information of the JOB task when it is detected that the JOB task in the database is updated.
管理员可以根据需要增加、删除或修改JOB任务,对JOB任务进行更新。The administrator can add, delete or modify the JOB task as needed to update the JOB task.
当数据归纳系统检测到数据库的JOB任务发生更新时,由于更新后的JOB任务可能执行时间等因素发生变化,因此更新模块50需要对应更新JOB任务的运行信息。在更新JOB任务的运行信息后,获取模块10根据更新后的JOB任务运行信息,重新计算数据库在各时刻的资源占用率,用于启动或停止数据库的数据归纳任务。When the data induction system detects that the JOB task of the database is updated, because the updated JOB task may change the execution time and the like, the update module 50 needs to update the operation information of the JOB task. After updating the running information of the JOB task, the obtaining module 10 recalculates the resource occupancy rate of the database at each moment according to the updated JOB task running information, and is used to start or stop the data inductive task of the database.
在本实施例中,监测数据库中的JOB任务信息,若监测到数据库中的JOB任务发生更新,则更新模块50对应更新JOB任务的运行信息,以重新计算数据库的资源占用率,对数据库的资源占用率进行校正。In this embodiment, the JOB task information in the database is monitored. If the JOB task in the database is updated, the update module 50 updates the running information of the JOB task to recalculate the resource occupancy rate of the database and the resources of the database. The occupancy rate is corrected.
如图8所示,图8是本申请实施例方案涉及的硬件运行环境的终端结构示意图。本申请实施例终端可以是PC等终端设备。如图8所示,该终端可以包括:处理器1001,例如CPU,通信总线1002,用户接口1003,存储器1004。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选的用户接口1003还可以包括标准的有线接口、无线接口。存储器1004可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1004可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 8, FIG. 8 is a schematic structural diagram of a terminal in a hardware operating environment according to an embodiment of the present application. The terminal in this embodiment may be a terminal device such as a PC. As shown in FIG. 8, the terminal may include a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, and a memory 1004. Among them, the communication bus 1002 is used to implement connection communication between these components. The user interface 1003 can include a display, an input unit such as a keyboard, and the optional user interface 1003 can also include a standard wired interface, a wireless interface. The memory 1004 may be a high speed RAM memory or a stable memory (non-volatile) Memory), such as disk storage. The memory 1004 can also optionally be a storage device independent of the aforementioned processor 1001.
本领域技术人员可以理解,图8中示出的终端结构并不构成对终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。如图8所示,作为一种计算机存储介质的存储器1004中可以包括操作系统、用户接口模块以及数据库归档程序。在图8所示的终端中,用户接口1003主要用于连接客户端(用户的移动终端),与客户端进行数据通信;而处理器1001可以用于调用存储器1004中存储的数据库归档程序,并执行如下操作:It will be understood by those skilled in the art that the terminal structure shown in FIG. 8 does not constitute a limitation to the terminal, and may include more or less components than those illustrated, or a combination of certain components, or different component arrangements. As shown in FIG. 8, an operating system, a user interface module, and a database archiving program may be included in the memory 1004 as a computer storage medium. In the terminal shown in FIG. 8, the user interface 1003 is mainly used to connect a client (the user's mobile terminal) to perform data communication with the client; and the processor 1001 can be used to call a database archiving program stored in the memory 1004, and Do the following:
实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;Obtaining the resource occupancy rate of the database in real time, and detecting a change trend of the database resource occupancy rate;
若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed;
在进行数据归档时,实时获取所述资源占用率及其变化趋势,若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。When data archiving is performed, the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
进一步地,处理器1001可以用于调用存储器1004中存储的数据库归档程序,还执行如下操作:Further, the processor 1001 may be configured to invoke a database archiving program stored in the memory 1004, and further perform the following operations:
判断当前时间是否位于预设的归档周期内;Determine whether the current time is within a preset archiving period;
若当前时间位于预设的归档周期内,则执行步骤:实时获取数据库的资源占用率,检测所述资源占用率的变化趋势。If the current time is in the preset archiving period, the step is: acquiring the resource occupancy rate of the database in real time, and detecting a change trend of the resource occupancy rate.
进一步地,处理器1001可以用于调用存储器1004中存储的数据库归档程序,还执行如下操作:Further, the processor 1001 may be configured to invoke a database archiving program stored in the memory 1004, and further perform the following operations:
统计所述数据库中的JOB任务,获取各JOB任务的运行信息;Counting JOB tasks in the database to obtain running information of each JOB task;
根据各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。According to the operation information of each JOB task, the resource occupancy rate of the database at each moment is obtained.
进一步地,处理器1001可以用于调用存储器1004中存储的数据库归档程序,还执行如下操作:Further, the processor 1001 may be configured to invoke a database archiving program stored in the memory 1004, and further perform the following operations:
在监测到所述数据库中的JOB任务发生更新时,更新所述JOB任务的运行信息,并转入执行步骤:根据所述JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。When the JOB task in the database is updated, the running information of the JOB task is updated, and the execution step is performed: the resource occupancy rate of the database at each moment is obtained according to the running information of the JOB task.
进一步地,所述JOB任务的运行信息包括JOB任务的运行时间、启动频率以及运行时的资源占用信息。Further, the running information of the JOB task includes a running time, a starting frequency, and resource occupancy information of the JOB task.
本申请终端的具体实施例与上述数据库归档方法各实施例基本相同,在此不作赘述。The specific embodiment of the terminal of the present application is substantially the same as the foregoing embodiment of the database archiving method, and details are not described herein.
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有数据库数据归档程序,所述数据库数据归档程序被处理器执行时实现如下步骤:In addition, the embodiment of the present application further provides a computer readable storage medium, where the database readable storage medium stores a database data archiving program, and when the database data archiving program is executed by the processor, the following steps are implemented:
实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;Obtaining the resource occupancy rate of the database in real time, and detecting a change trend of the database resource occupancy rate;
若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed;
在进行数据归档时,实时获取所述资源占用率及其变化趋势,若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。When data archiving is performed, the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
进一步地,所述数据库数据归档程序被处理器执行时实现如下步骤:Further, when the database data archiving program is executed by the processor, the following steps are implemented:
判断当前时间是否位于预设的归档周期内;Determine whether the current time is within a preset archiving period;
若当前时间位于预设的归档周期内,则执行步骤:实时获取数据库的资源占用率,检测所述资源占用率的变化趋势。If the current time is in the preset archiving period, the step is: acquiring the resource occupancy rate of the database in real time, and detecting a change trend of the resource occupancy rate.
进一步地,所述数据库数据归档程序被处理器执行时实现如下步骤:Further, when the database data archiving program is executed by the processor, the following steps are implemented:
统计所述数据库中的JOB任务,获取各JOB任务的运行信息;Counting JOB tasks in the database to obtain running information of each JOB task;
根据各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。According to the operation information of each JOB task, the resource occupancy rate of the database at each moment is obtained.
进一步地,所述数据库数据归档程序被处理器执行时实现如下步骤:Further, when the database data archiving program is executed by the processor, the following steps are implemented:
在监测到所述数据库中的JOB任务发生更新时,更新所述JOB任务的运行信息,并转入执行步骤:根据所述JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。When the JOB task in the database is updated, the running information of the JOB task is updated, and the execution step is performed: the resource occupancy rate of the database at each moment is obtained according to the running information of the JOB task.
进一步地,所述JOB任务的运行信息包括JOB任务的运行时间、启动频率以及运行时的资源占用信息。Further, the running information of the JOB task includes a running time, a starting frequency, and resource occupancy information of the JOB task.
本申请计算机可读存储介质的具体实施例与上述数据库归档方法各实施例基本相同,在此不作赘述。The specific embodiment of the computer readable storage medium of the present application is substantially the same as the embodiment of the above database archiving method, and details are not described herein.
还需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It is also to be understood that the term "comprises", "comprising", or any other variants thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a And includes other elements not explicitly listed, or elements that are inherent to such a process, method, article, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,云端服务器或者网络设备等)执行本申请各个实施例的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better. Implementation. Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a cloud server or a network device, etc.) to perform the methods of various embodiments of the present application.
以上仅为本申请的可选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above is only an alternative embodiment of the present application, and thus does not limit the scope of the patent application, and the equivalent structure or equivalent process transformation of the specification and the drawings of the present application, or directly or indirectly applied to other related technologies. The fields are all included in the scope of patent protection of this application.

Claims (20)

  1. 一种数据库数据归档方法,其特征在于,所述数据库数据归档方法包括以下步骤: A database data archiving method, characterized in that the database data archiving method comprises the following steps:
    实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;Obtaining the resource occupancy rate of the database in real time, and detecting a change trend of the database resource occupancy rate;
    若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed;
    在进行数据归档时,实时获取所述资源占用率及其变化趋势,若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。When data archiving is performed, the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
  2. 如权利要求1所述的数据库数据归档方法,其特征在于,所述数据库数据归档方法还包括:The database data archiving method according to claim 1, wherein the database data archiving method further comprises:
    判断当前时间是否位于预设的归档周期内;Determine whether the current time is within a preset archiving period;
    若当前时间位于预设的归档周期内,则执行步骤:实时获取数据库的资源占用率,检测所述资源占用率的变化趋势。If the current time is in the preset archiving period, the step is: acquiring the resource occupancy rate of the database in real time, and detecting a change trend of the resource occupancy rate.
  3. 如权利要求1所述的数据库数据归档方法,其特征在于,所述实时获取数据库的资源占用率的步骤包括:The database data archiving method according to claim 1, wherein the step of acquiring the resource occupancy rate of the database in real time comprises:
    统计所述数据库中的JOB任务,获取各JOB任务的运行信息;Counting JOB tasks in the database to obtain running information of each JOB task;
    根据各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。According to the operation information of each JOB task, the resource occupancy rate of the database at each moment is obtained.
  4. 如权利要求3所述的数据库数据归档方法,其特征在于,所述数据库数据归档方法还包括:The database data archiving method according to claim 3, wherein the database data archiving method further comprises:
    在监测到所述数据库中的JOB任务发生更新时,更新所述JOB任务的运行信息,并转入执行步骤:根据所述JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。When the JOB task in the database is updated, the running information of the JOB task is updated, and the execution step is performed: the resource occupancy rate of the database at each moment is obtained according to the running information of the JOB task.
  5. 如权利要求4所述的数据库数据归档方法,其特征在于,所述JOB任务的运行信息包括JOB任务的运行时间、启动频率以及运行时的资源占用信息。The database data archiving method according to claim 4, wherein the running information of the JOB task includes a running time, a starting frequency, and resource occupancy information of the JOB task.
  6. 一种数据库数据归档系统,其特征在于,所述数据库数据归档系统包括:A database data archiving system, characterized in that the database data archiving system comprises:
    获取模块,用于实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;An acquiring module, configured to acquire a resource occupancy rate of the database in real time, and detect a change trend of the database resource occupancy rate;
    启动模块,用于若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;a startup module, configured to start a data archiving task and perform data archiving if detecting that the resource occupancy rate is reduced to a preset first threshold;
    所述获取模块,还用于在进行数据归档时,实时获取所述资源占用率及其变化趋势;The obtaining module is further configured to acquire the resource occupancy rate and its changing trend in real time when performing data archiving;
    停止模块,用于若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。The stopping module is configured to stop the data archiving task if the resource occupancy rate is detected to increase to a preset second threshold.
  7. 如权利要求6所述的数据库数据归档系统,其特征在于,所述数据库数据归档系统还包括:The database data archiving system of claim 6, wherein the database data archiving system further comprises:
    周期模块,用于判断当前时间是否位于预设的归档周期内;a period module, configured to determine whether the current time is within a preset archival period;
    所述获取模块,还用于若当前时间位于预设的归档周期内,则实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势。The acquiring module is further configured to acquire a resource occupancy rate of the database in real time and detect a change trend of the database resource occupancy rate, if the current time is in a preset archiving period.
  8. 如权利要求6所述的数据库数据归档系统,其特征在于,所述获取模块还用于,The database data archiving system according to claim 6, wherein the obtaining module is further configured to:
    统计所述数据库中的JOB任务,获取各JOB任务的运行信息;根据所述各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。The JOB task in the database is counted, and the running information of each JOB task is obtained. According to the running information of each JOB task, the resource occupancy rate of the database at each moment is obtained.
  9. 如权利要求8所述的数据库数据归档系统,其特征在于,所述数据库数据归档系统还包括:The database data archiving system according to claim 8, wherein the database data archiving system further comprises:
    更新模块,用于在监测到所述数据库中的JOB任务发生更新时,更新所述JOB任务的运行信息。And an update module, configured to update operation information of the JOB task when monitoring that the JOB task in the database is updated.
  10. 如权利要求9所述的数据库数据归档系统,其特征在于,所述JOB任务的运行信息包括JOB任务的运行时间、启动频率以及运行时的资源占用信息。The database data archiving system according to claim 9, wherein the operation information of the JOB task includes a running time of the JOB task, a startup frequency, and resource occupancy information at runtime.
  11. 一种终端,其特征在于,所述终端包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的数据库数据归档程序,所述数据库数据归档程序被所述处理器执行时实现如下步骤:A terminal, comprising: a memory, a processor, and a database data archiving program stored on the memory and operable on the processor, wherein the database data archiving program is used by the processor The following steps are implemented during execution:
    实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;Obtaining the resource occupancy rate of the database in real time, and detecting a change trend of the database resource occupancy rate;
    若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed;
    在进行数据归档时,实时获取所述资源占用率及其变化趋势,若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。When data archiving is performed, the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
  12. 如权利要求11所述的终端,其特征在于,所述数据库数据归档程序被所述处理器执行时还实现如下步骤:The terminal according to claim 11, wherein said database data archiving program is further executed as follows when said processor executes:
    判断当前时间是否位于预设的归档周期内;Determine whether the current time is within a preset archiving period;
    若当前时间位于预设的归档周期内,则执行步骤:实时获取数据库的资源占用率,检测所述资源占用率的变化趋势。If the current time is in the preset archiving period, the step is: acquiring the resource occupancy rate of the database in real time, and detecting a change trend of the resource occupancy rate.
  13. 如权利要求11所述的终端,其特征在于,所述数据库数据归档程序被所述处理器执行时还实现如下步骤:The terminal according to claim 11, wherein said database data archiving program is further executed as follows when said processor executes:
    统计所述数据库中的JOB任务,获取各JOB任务的运行信息;Counting JOB tasks in the database to obtain running information of each JOB task;
    根据各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。According to the operation information of each JOB task, the resource occupancy rate of the database at each moment is obtained.
  14. 如权利要求13所述的终端,其特征在于,所述数据库数据归档程序被所述处理器执行时还实现如下步骤:The terminal according to claim 13, wherein said database data archiving program is further executed as follows when said processor executes:
    在监测到所述数据库中的JOB任务发生更新时,更新所述JOB任务的运行信息,并转入执行步骤:根据所述JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。When the JOB task in the database is updated, the running information of the JOB task is updated, and the execution step is performed: the resource occupancy rate of the database at each moment is obtained according to the running information of the JOB task.
  15. 如权利要求14所述的终端,其特征在于,所述JOB任务的运行信息包括JOB任务的运行时间、启动频率以及运行时的资源占用信息。The terminal according to claim 14, wherein the operation information of the JOB task includes a running time of the JOB task, a startup frequency, and resource occupancy information at runtime.
  16. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有数据库数据归档程序,所述数据库数据归档程序被处理器执行时实现如下步骤:A computer readable storage medium, wherein the computer readable storage medium stores a database data archiving program, and when the database data archiving program is executed by the processor, the following steps are implemented:
    实时获取数据库的资源占用率,检测所述数据库资源占用率的变化趋势;Obtaining the resource occupancy rate of the database in real time, and detecting a change trend of the database resource occupancy rate;
    若检测到所述资源占用率减小至预设的第一阈值,则启动数据归档任务,进行数据归档;If it is detected that the resource occupancy rate is reduced to a preset first threshold, the data archiving task is started, and data archiving is performed;
    在进行数据归档时,实时获取所述资源占用率及其变化趋势,若检测到所述资源占用率增大至预设的第二阈值,则停止所述数据归档任务。When data archiving is performed, the resource occupancy rate and its changing trend are obtained in real time, and if the resource occupancy rate is detected to increase to a preset second threshold, the data archiving task is stopped.
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述数据库数据归档程序被处理器执行时还实现如下步骤:The computer readable storage medium of claim 16, wherein the database data archiving program is further executed by the processor to:
    判断当前时间是否位于预设的归档周期内;Determine whether the current time is within a preset archiving period;
    若当前时间位于预设的归档周期内,则执行步骤:实时获取数据库的资源占用率,检测所述资源占用率的变化趋势。If the current time is in the preset archiving period, the step is: acquiring the resource occupancy rate of the database in real time, and detecting a change trend of the resource occupancy rate.
  18. 如权利要求16所述的计算机可读存储介质,其特征在于,所述数据库数据归档程序被处理器执行时还实现如下步骤:The computer readable storage medium of claim 16, wherein the database data archiving program is further executed by the processor to:
    统计所述数据库中的JOB任务,获取各JOB任务的运行信息;Counting JOB tasks in the database to obtain running information of each JOB task;
    根据各JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。According to the operation information of each JOB task, the resource occupancy rate of the database at each moment is obtained.
  19. 如权利要求18所述的计算机可读存储介质,其特征在于,所述数据库数据归档程序被处理器执行时还实现如下步骤:The computer readable storage medium of claim 18, wherein the database data archiving program is further executed by the processor to:
    在监测到所述数据库中的JOB任务发生更新时,更新所述JOB任务的运行信息,并转入执行步骤:根据所述JOB任务的运行信息,获取所述数据库在各时刻的资源占用率。When the JOB task in the database is updated, the running information of the JOB task is updated, and the execution step is performed: the resource occupancy rate of the database at each moment is obtained according to the running information of the JOB task.
  20. 如权利要求19所述的计算机可读存储介质,其特征在于,所述JOB任务的运行信息包括JOB任务的运行时间、启动频率以及运行时的资源占用信息。 The computer readable storage medium according to claim 19, wherein the operation information of the JOB task includes a running time of the JOB task, a startup frequency, and resource occupancy information at runtime.
PCT/CN2018/076198 2017-03-31 2018-02-11 Database data archiving method and system, terminal, and computer readable storage medium WO2018177036A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710213154.2A CN108664524A (en) 2017-03-31 2017-03-31 database data archiving method and system
CN201710213154.2 2017-03-31

Publications (1)

Publication Number Publication Date
WO2018177036A1 true WO2018177036A1 (en) 2018-10-04

Family

ID=63675178

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/076198 WO2018177036A1 (en) 2017-03-31 2018-02-11 Database data archiving method and system, terminal, and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN108664524A (en)
WO (1) WO2018177036A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110837592B (en) * 2019-11-08 2021-01-26 京东数字科技控股有限公司 Method, apparatus and computer readable storage medium for data archiving

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101034364A (en) * 2007-04-02 2007-09-12 华为技术有限公司 Method, device and system for implementing RAM date backup
CN102841827A (en) * 2012-06-28 2012-12-26 宇龙计算机通信科技(深圳)有限公司 Method for backuping database files and communication terminal
CN105718317A (en) * 2016-01-15 2016-06-29 浪潮(北京)电子信息产业有限公司 Task scheduling method and task scheduling device
CN106250465A (en) * 2016-07-29 2016-12-21 沈阳华创风能有限公司 A kind of method and device improving database filing efficiency
CN106528582A (en) * 2015-09-15 2017-03-22 北京国双科技有限公司 Database backup method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692226B (en) * 2009-09-25 2012-07-04 中国人民解放军国防科学技术大学 Storage method of mass filing stream data
CN103064768B (en) * 2013-01-25 2015-11-25 北京捷成世纪科技发展江苏有限公司 A kind of data filing backup method based on tape and system
CN104881352A (en) * 2015-06-03 2015-09-02 上海新炬网络信息技术有限公司 System resource monitoring device based on mobile terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101034364A (en) * 2007-04-02 2007-09-12 华为技术有限公司 Method, device and system for implementing RAM date backup
CN102841827A (en) * 2012-06-28 2012-12-26 宇龙计算机通信科技(深圳)有限公司 Method for backuping database files and communication terminal
CN106528582A (en) * 2015-09-15 2017-03-22 北京国双科技有限公司 Database backup method and device
CN105718317A (en) * 2016-01-15 2016-06-29 浪潮(北京)电子信息产业有限公司 Task scheduling method and task scheduling device
CN106250465A (en) * 2016-07-29 2016-12-21 沈阳华创风能有限公司 A kind of method and device improving database filing efficiency

Also Published As

Publication number Publication date
CN108664524A (en) 2018-10-16

Similar Documents

Publication Publication Date Title
WO2018120429A1 (en) Resource update method, terminal, computer readable storage medium and resource update device
WO2018233370A1 (en) Method, system, device, and computer readable storage medium for synchronizing image
WO2019114269A1 (en) Method for resuming playing program, television device, and computer readable storage medium
WO2019061612A1 (en) Loan product promotion method and apparatus, and computer-readable storage medium
WO2015139232A1 (en) Application recommendation method, system and server
WO2015035777A1 (en) Software upgrade method and system for mobile terminal
WO2019051905A1 (en) Air conditioner control method, air conditioner, and computer readable storage medium
WO2018028135A1 (en) Downlink data information feedback method and relevant device
WO2019000801A1 (en) Data synchronization method, apparatus, and device, and computer readable storage medium
WO2018032679A1 (en) Setting method and device for timed startup and shutoff of television
WO2018014567A1 (en) Method for improving performance of virtual machine, and terminal, device and computer-readable storage medium
WO2018036057A1 (en) Method and device for background adaptive upgrading of software
WO2018227768A1 (en) Method, apparatus and device for managing ivr incoming line and computer readable storage medium
WO2017084302A1 (en) Method for playing boot video of a display terminal and display terminal
WO2017088427A1 (en) Audio output control method and device
WO2017032122A1 (en) Method and apparatus for detecting digital television set
WO2018076453A1 (en) Associated application display method, device and mobile terminal
WO2016127458A1 (en) Improved word similarity calculation method and device based on semantic dictionary
WO2019051891A1 (en) Schedule-based information pushing method and device, and computer-readable storage medium
WO2019071771A1 (en) Wireless signal fingerprint information calibration method, system, server and medium
WO2018233221A1 (en) Multi-window sound output method, television, and computer-readable storage medium
WO2019056733A1 (en) Concurrent volume control method, application server, system and storage medium
WO2018177036A1 (en) Database data archiving method and system, terminal, and computer readable storage medium
WO2019056566A1 (en) Air conditioning parameter determination method, air conditioning apparatus, and readable storage medium
WO2016101240A1 (en) Media data playing method and terminal

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: 18775818

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 20.01.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18775818

Country of ref document: EP

Kind code of ref document: A1