CN108255703A - A kind of fault repairing method and its terminal of SQL scripts - Google Patents

A kind of fault repairing method and its terminal of SQL scripts Download PDF

Info

Publication number
CN108255703A
CN108255703A CN201711084967.2A CN201711084967A CN108255703A CN 108255703 A CN108255703 A CN 108255703A CN 201711084967 A CN201711084967 A CN 201711084967A CN 108255703 A CN108255703 A CN 108255703A
Authority
CN
China
Prior art keywords
sql scripts
control file
inquiry
failure
fault
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201711084967.2A
Other languages
Chinese (zh)
Other versions
CN108255703B (en
Inventor
吴丽娜
肖涵月
何恩赐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN201711084967.2A priority Critical patent/CN108255703B/en
Publication of CN108255703A publication Critical patent/CN108255703A/en
Application granted granted Critical
Publication of CN108255703B publication Critical patent/CN108255703B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases

Landscapes

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

Abstract

The present invention is suitable for database technical field, provides a kind of fault repairing method and its terminal of SQL scripts, including:If monitoring failure SQL scripts, the script mark of failure SQL scripts is obtained;It is identified according to the script, the corresponding operation control file of inquiry failure SQL scripts;Based on the calling resource occupation record to prestore, corresponding consumption characteristic value when determining to perform each operation control file;The corresponding abnormal consumption ratio of failure SQL scripts;If abnormal consumption ratio is more than preset proportion threshold value, it is abnormal to judge that the inquiry factor sequence in the failure SQL scripts occurs;If less than or equal to preset proportion threshold value, identify that the operation control file that the consumption characteristic value is more than preset threshold value is Fault Control file.The present invention solves the fault restoration technology of existing SQL scripts, the problem of relying on the artificial fault restoration of professional knowledge progress of maintenance personnel, reduce the efficiency of SQL script failures response.

Description

A kind of fault repairing method and its terminal of SQL scripts
Technical field
The invention belongs to database technical field more particularly to a kind of fault repairing methods and its terminal of SQL scripts.
Background technology
SQL scripts as the conventional means of data query, are widely used in network service field, each SQL scripts Data search strategy mainly determines by inquiring factor sequence in the SQL scripts, database will according to inquired in SQL scripts because The sequencing of each inquiry factor, when determining data query, the keyword of which type is first searched for, which is searched again in subsequence The keyword of one type, therefore each sequence for inquiring the factor in SQL scripts, will directly determine efficiency and the service of its operation The speed of response.On the other hand, in order to improve the efficiency of data query, user according to the search of itself can be accustomed to and search for mesh , it is that each SQL scripts formulate an operation control file, when including call request of initiation in the strategy, the SQL scripts Number of run and assign in the SQL scripts it is each inquiry the preset parameter value of the factor, so as to fulfill the mesh of " key inquiry " 's.
May be due to inquiry factor arrangement order each in the SQL scripts if a certain SQL scripts failure situation It is unreasonable to cause or caused by the corresponding operation control file of the SQL scripts carries out configuration error.It is however existing SQL scripts fault restoration technology, need manually to investigate the SQL scripts included in database manually one by one, failure Detection efficiency is relatively low, and after detecting the SQL scripts of failure, and the professional knowledge for being also relied on maintenance personnel carries out artificial failure and repaiies It is multiple, it also further reduced the efficiency of SQL script failures response.
Invention content
In view of this, an embodiment of the present invention provides a kind of fault repairing methods and its terminal of SQL scripts, existing to solve The fault restoration technology of some SQL scripts needs manually to investigate the SQL scripts included in database manually one by one, therefore It is relatively low to hinder detection efficiency, and after detecting the SQL scripts of failure, the professional knowledge for being also relied on maintenance personnel carries out artificial failure The problem of repairing, also further reduced the efficiency of SQL script failures response.
The first aspect of the embodiment of the present invention provides a kind of fault repairing method of SQL scripts, the event of the SQL scripts Barrier restorative procedure includes:
If monitoring failure SQL scripts, the script mark of the failure SQL scripts is obtained;
It is identified according to the script, obtains the corresponding operation control file of the failure SQL scripts;Wherein, the operation Control file is specifically used for:When determining that script calling terminal often initiates a script call operation, the failure SQL scripts are performed Cycle-index and when determining that cycle performs the failure SQL scripts every time, each inquiry factor in failure SQL scripts The value taken;
Based on the calling resource occupation record to prestore, corresponding consumption feature when determining to perform each operation control file Value;Wherein, to the occupancy situation of device resource when the consumption characteristic value is for representing to call the operation control file;
The consumption characteristic value number that the consumption characteristic value is more than preset threshold value is obtained, obtains the failure SQL The corresponding abnormal consumption ratio of script;
If the abnormal consumption ratio is more than preset proportion threshold value, judge inquiry in the failure SQL scripts because There is exception in subsequence, adjusts the inquiry factor sequence;The inquiry factor sequence is specifically used for:When script calls terminal tune When performing data query operation with SQL scripts, according to sequence of each inquiry factor in the inquiry factor sequence, determine each The inquiry order of a inquiry factor;
If the abnormal consumption ratio is less than or equal to preset proportion threshold value, it is pre- to identify that the consumption characteristic value is more than If the operation control file of threshold value be Fault Control file, and repair the Fault Control file.
The second aspect of the embodiment of the present invention provides a kind of terminal device, including memory, processor and is stored in In the memory and the computer program that can run on the processor, when the processor performs the computer program Realize following steps:
If monitoring failure SQL scripts, the script mark of the failure SQL scripts is obtained;
It is identified according to the script, obtains the corresponding operation control file of the failure SQL scripts;Wherein, the operation Control file is specifically used for:When determining that script calling terminal often initiates a script call operation, the failure SQL scripts are performed Cycle-index and when determining that cycle performs the failure SQL scripts every time, each inquiry factor in failure SQL scripts The value taken;
Based on the calling resource occupation record to prestore, corresponding consumption feature when determining to perform each operation control file Value;Wherein, to the occupancy situation of device resource when the consumption characteristic value is for representing to call the operation control file;
The consumption characteristic value number that the consumption characteristic value is more than preset threshold value is obtained, obtains the failure SQL The corresponding abnormal consumption ratio of script;
If the abnormal consumption ratio is more than preset proportion threshold value, judge inquiry in the failure SQL scripts because There is exception in subsequence, adjusts the inquiry factor sequence;The inquiry factor sequence is specifically used for:When script calls terminal tune When performing data query operation with SQL scripts, according to sequence of each inquiry factor in the inquiry factor sequence, determine each The inquiry order of a inquiry factor;
If the abnormal consumption ratio is less than or equal to preset proportion threshold value, it is pre- to identify that the consumption characteristic value is more than If the operation control file of threshold value be Fault Control file, and repair the Fault Control file.
The third aspect of the embodiment of the present invention provides a kind of computer readable storage medium, the computer-readable storage Media storage has computer program, and the computer program realizes following steps when being executed by processor:
If monitoring failure SQL scripts, the script mark of the failure SQL scripts is obtained;
It is identified according to the script, obtains the corresponding operation control file of the failure SQL scripts;Wherein, the operation Control file is specifically used for:When determining that script calling terminal often initiates a script call operation, the failure SQL scripts are performed Cycle-index and when determining that cycle performs the failure SQL scripts every time, each inquiry factor in failure SQL scripts The value taken;
Based on the calling resource occupation record to prestore, corresponding consumption feature when determining to perform each operation control file Value;Wherein, to the occupancy situation of device resource when the consumption characteristic value is for representing to call the operation control file;
The consumption characteristic value number that the consumption characteristic value is more than preset threshold value is obtained, obtains the failure SQL The corresponding abnormal consumption ratio of script;
If the abnormal consumption ratio is more than preset proportion threshold value, judge inquiry in the failure SQL scripts because There is exception in subsequence, adjusts the inquiry factor sequence;The inquiry factor sequence is specifically used for:When script calls terminal tune When performing data query operation with SQL scripts, according to sequence of each inquiry factor in the inquiry factor sequence, determine each The inquiry order of a inquiry factor;
If the abnormal consumption ratio is less than or equal to preset proportion threshold value, it is pre- to identify that the consumption characteristic value is more than If the operation control file of threshold value be Fault Control file, and repair the Fault Control file.
Implementing a kind of fault repairing method of SQL scripts provided in an embodiment of the present invention and its terminal has below beneficial to effect Fruit:
The embodiment of the present invention detects the operating condition of each SQL scripts by terminal device, if monitoring, there are failures SQL scripts, then startup separator reparation flow, obtains the corresponding script mark of failure SQL scripts, then passes through the script mark Know, inquire the operation control file corresponding to failure SQL scripts, determine that database institute when calling failure SQL scripts is right The regulative strategy answered then controls the corresponding consumption characteristic value of file according to each operation, and it is due to SQL feet to position the secondary failure Caused by this itself or it is caused by relative parameters setting is unreasonable in certain operation control files.Therefore, terminal device After the corresponding consumption characteristic value of each operation control file is calculated, the consumption characteristic value and preset threshold value are carried out Compare, determine the consumption characteristic value number for being more than default threshold value, its abnormal consumption ratio is then determined, if the abnormal consumption Ratio is more than preset proportion threshold value, then it represents that most operation control file is in the situation of abnormal consumption, therefore will It represents and parameter setting is unreasonable in inoperative control file, but failure SQL scripts are in itself there are problem, so as to cause Call each operation of the SQL scripts that file is controlled to be abnormal consumption;It is preset conversely, if abnormal consumption ratio is less than or equal to Proportion threshold value, then it represents that only part operation control file therefore can be determined that not SQL scripts there are abnormal consumption situation Itself there is exception, but the loop parameter setting in part operation control file is unreasonable caused, therefore to abnormal consumption Operation control file carry out reparation adjusting.Therefore, terminal device is held by identifying the consumption Anomalies Genesis of failure SQL scripts Row is corresponding to repair operation, so as to improve the accuracy of reparation.Compared with the fault restoration technology of existing SQL scripts, therefore Barrier is repaired whole flow process and is performed automatically by terminal device, and the administrative staff without database carry out manual operation, so as to improve The efficiency of fault restoration.On the other hand, since the process of fault restoration does not depend on the professional skill level of maintenance personnel, terminal Equipment can repair failure SQL scripts by repairing algorithm accordingly, so as to reduce the maintenance cost of system.
Description of the drawings
It to describe the technical solutions in the embodiments of the present invention more clearly, below will be to embodiment or description of the prior art Needed in attached drawing be briefly described, it should be apparent that, the accompanying drawings in the following description be only the present invention some Embodiment, for those of ordinary skill in the art, without having to pay creative labor, can also be according to these Attached drawing obtains other attached drawings.
Fig. 1 is a kind of realization flow chart of the fault repairing method for SQL scripts that first embodiment of the invention provides;
Fig. 2 is the specific implementation stream of the fault repairing method S105 for SQL scripts that second embodiment of the invention provides a kind of Cheng Tu;
Fig. 3 is the specific implementation stream of the fault repairing method S106 for SQL scripts that third embodiment of the invention provides a kind of Cheng Tu;
Fig. 4 is the specific implementation stream of the fault repairing method S106 for SQL scripts that fourth embodiment of the invention provides a kind of Cheng Tu;
Fig. 5 is the specific implementation stream of the fault repairing method S101 for SQL scripts that fifth embodiment of the invention provides a kind of Cheng Tu;
Fig. 6 is a kind of structure diagram of the fault restoration terminal for SQL scripts that one embodiment of the invention provides;
Fig. 7 is a kind of schematic diagram for terminal device that one embodiment of the invention provides.
Specific embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, with reference to the accompanying drawings and embodiments, it is right The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and It is not used in the restriction present invention.
The embodiment of the present invention detects the operating condition of each SQL scripts by terminal device, if monitoring, there are failures SQL scripts, then startup separator reparation flow, obtains the corresponding script mark of failure SQL scripts, then passes through the script mark Know, inquire the operation control file corresponding to failure SQL scripts, determine that database institute when calling failure SQL scripts is right The regulative strategy answered then controls the corresponding consumption characteristic value of file according to each operation, and it is due to SQL feet to position the secondary failure Caused by this itself or it is caused by relative parameters setting is unreasonable in certain operation control files.Therefore, terminal device After the corresponding consumption characteristic value of each operation control file is calculated, the consumption characteristic value and preset threshold value are carried out Compare, determine the consumption characteristic value number for being more than default threshold value, its abnormal consumption ratio is then determined, if the abnormal consumption Ratio is more than preset proportion threshold value, then it represents that most operation control file is in the situation of abnormal consumption, therefore will It represents and parameter setting is unreasonable in inoperative control file, but failure SQL scripts are in itself there are problem, so as to cause Call each operation of the SQL scripts that file is controlled to be abnormal consumption;It is preset conversely, if abnormal consumption ratio is less than or equal to Proportion threshold value, then it represents that only part operation control file therefore can be determined that not SQL scripts there are abnormal consumption situation Itself there is exception, but the loop parameter setting in part operation control file is unreasonable caused, therefore to abnormal consumption Operation control file carry out reparation adjusting.Therefore, terminal device is held by identifying the consumption Anomalies Genesis of failure SQL scripts Row is corresponding to repair operation, so as to improve the accuracy of reparation, solves the fault restoration technology of existing SQL scripts, needs Manually the SQL scripts included in data library are investigated manually one by one, fault detection efficiency is relatively low, and detects failure SQL scripts after, the professional knowledge for being also relied on maintenance personnel carries out artificial fault restoration, also further reduced SQL scripts therefore The problem of hindering the efficiency of response.
In embodiments of the present invention, the executive agent of flow is the fault restoration terminal of SQL scripts, and terminal device includes hand The terminals such as machine, computer equipment, tablet computer, server, particularly, the terminal device are specially one to be laid on Database Systems In SQL scripts fault restoration terminal, by obtaining the operating condition of each SQL scripts in the database, and to each SQL Script carries out fault restoration and attended operation, in the Database Systems, comprising multiple data servers, and each database service Device calls the SQL scripts in SQL script resources banks, completes corresponding search, data extraction operation.Fig. 1 shows the present invention the The realization flow chart of the fault repairing method for the SQL scripts that one embodiment provides, details are as follows:
In S101, if monitoring failure SQL scripts, the script mark of the failure SQL scripts is obtained.
In the present embodiment, SQL scripts can run in the database of terminal device, in this case, terminal to be detected Terminal device as provided in an embodiment of the present invention detects each SQL scripts in local data base and whether there is abnormal conditions; SQL scripts can also be run in other database servers outside terminal device, and in this case, terminal device is i.e. as one Independent detection terminal, the SQL scripts monitored in the database server whether there is abnormal conditions.Particularly, terminal device A Database Systems can also be detected, multiple database servers, and each database server are included in the Database Systems Corresponding SQL scripts are extracted from same SQL scripts resources bank and carry out inquiry operation.Wherein, it is deposited in SQL scripts resources bank Multiple SQL scripts are contained, for meeting the query demand of different user, such as user needs to inquire the season relevant number of bonus According to then by the way that the first SQL scripts is called to be inquired;User needs to count the continuation of insurance situation of vehicle insurance client, then by calling the Two SQL scripts are inquired.
In the present embodiment, terminal device will obtain database with preset frequency or with preset monitoring trigger condition In each SQL scripts operating parameter, compared according to the operating parameter of each SQL scripts and preset operating parameter threshold value Compared with, determine in the SQL scripts of above-mentioned monitoring whether there is failure SQL scripts.If it monitors, there are failure SQL scripts, to perform The relevant operation of S101;Conversely, if the operating parameter of each SQL scripts is in normal parameter area, terminal device The arrival on next monitoring opportunity is waited for, and repeats above-mentioned steps.
In the present embodiment, the trigger condition of script monitoring includes triggering and automatic trigger both of which manually.Wherein, It triggers manually and is specially:Administrator generate on the terminal device the monitoring of script enabled instruction or by user terminal to Terminal device sends a script monitoring enabled instruction, if after terminal device receives the abnormality detection enabled instruction, performs The relevant operation of S101.And automatic trigger is specially:Terminal device is provided with script monitoring startup opportunity, if terminal device detects It is matched to current state with preset abnormality detection startup opportunity, then performs the relevant operation of S101.
In the present embodiment, the corresponding script mark of each SQL scripts, the identity as each script.It should Script identifies:Script name, script exclusive identification code, the corresponding cryptographic Hash of script exclusive identification code, script number etc. There is the character of identity or character string.Terminal device monitor a certain SQL scripts be failure SQL scripts when, be It determines the relevant operating condition of failure SQL scripts and relevant information, will obtain the corresponding script mark of failure SQL scripts Know, by carrying out information inquiry.
Optionally, the exception monitoring operation of SQL scripts, can transfer to other-end equipment Ei to complete.In this case, SQL The exception monitoring terminal of script, there are during failure SQL scripts, transmission fault restoration is being asked to the present invention in determining database The terminal device that embodiment provides, the script comprising failure SQL scripts identifies in fault restoration request, fault restoration request In may include a failure SQL script, two or more failure SQL scripts can also be included.Terminal device is receiving this After the fault restoration request that the exception monitoring terminal of SQL scripts is sent, the relevant operation of S101 will be performed.
It in S102, is identified according to the script, obtains the corresponding operation control file of the failure SQL scripts;Wherein, The operation control file is specifically used for:When determining that script calling terminal often initiates a script call operation, the event is performed It is each in the failure SQL scripts when hindering the cycle-index of SQL scripts and determining that cycle performs the failure SQL scripts every time The value that the inquiry factor is taken.
In the present embodiment, database, will be according to the corresponding operation of SQL scripts when actually calling each SQL scripts File is controlled to perform call operation.By typically just defining the included inquiry factor in SQL scripts and with certain The each inquiry factor of sequential arrangement, but the parameter value that is taken of each inquiry factor and recycled number is called every time, it is root It is determined according to the content to be inquired each time of database.Therefore, for clear and definite the above, database will be based on the SQL feet One operation control file of this generation, the operation are controlled in file comprising in a call operation, perform the cycle of the SQL scripts In number and every time circulate operation, each value inquired the factor and taken.
For example, user when calling a SQL script, needs to compare the ratio of insuring of In Guangzhou Area and Shenzhen area, Two inquiry factors, respectively " area " and " whether insuring " are included i.e. in the SQL scripts.In order to realize above-mentioned comparison two The ratio of insuring in area, database will generate an operation control file, and the cycle-index of operation control file is 2, first The inquiry factor value in " area " is " Guangzhou " during secondary cycle, and the value of the inquiry factor of " whether insuring " is "Yes", so as to obtain The ratio of insuring of In Guangzhou Area is taken;And whether the inquiry factor value in " area " is " Shenzhen " when recycling for the second time, " insuring " The inquiry factor value for "Yes", so as to obtain the ratio of insuring of Shenzhen area, inserted coins ratio according to above-mentioned two, you can Realize the comparison of two regional situations of insuring.All situations as described above, database is when calling first time SQL script, often It needs to recycle multi-pass operation, and assigns the value that each inquiry factor is different in the SQL scripts.
In the present embodiment, a failure SQL script can correspond to multiple operation control files, realize that database difference is done Query function.Terminal device will be identified by the corresponding script of failure SQL scripts, be controlled in library and be obtained and the foot from operation The corresponding operation control file of this mark.It should be noted that an operation control file is generated based on a SQL script , i.e., each operation control file only corresponds to a script mark.
In S103, based on the calling resource occupation record to prestore, determine to perform corresponding during each operation control file Consume characteristic value;Wherein, to the occupancy of device resource when the consumption characteristic value is for representing to call the operation control file Situation.
In the present embodiment, terminal device then records corresponding disappear each time when database performs operation control file Characteristic value is consumed, then generates the calling resource occupation record to prestore.Terminal device is obtaining the fortune corresponding to failure SQL scripts After row control file, it will inquire calling resource occupation record according to the corresponding file identification of operation control file, determine the fortune The row number that is called of control file and while calling each time corresponding consumption characteristic value, then according to when repeatedly calling pairs The corresponding consumption characteristic value of operation control file is calculated in the consumption characteristic value answered.
Optionally, in the present embodiment, the calling resource occupation record that terminal device obtains is specially this monitoring cycle Interior occupancy resource record, due in this monitoring cycle, determining failure SQL scripts, there are abnormalities, that is, represent tool Body abnormal consumption situation is also to be present in the call operation of this monitoring cycle, and therefore, terminal device also only counts this In monitoring cycle, the consumption characteristic value corresponding to each operation control file so as to reduce the operand of statistics, also improves The efficiency of fault restoration.Particularly, it is corresponding if operation control file in part is within this calling period and is not called upon It is 0 to consume characteristic value.
Optionally, in the present embodiment, what is recorded in calling occupancy consumption record is that database calls operation control every time Corresponding operating state parameter during file, in this case, terminal device will each run the corresponding operating status of control file Parameter is imported into preset consumption characteristic value transformation model, and the corresponding consumption feature of each running state parameter is calculated Value.
In S104, the consumption characteristic value number that the consumption characteristic value is more than preset threshold value is obtained, obtains institute State the corresponding abnormal consumption ratio of failure SQL scripts.
In the present embodiment, each operation is controlled the corresponding consumption characteristic value of file and preset consumption threshold by terminal device Value is compared, and determines that consumption characteristic value is more than the consumption characteristic value number of preset threshold value, and it is big to consume characteristic value In preset threshold value operation control file identification be Fault Control file, then according to the number of Fault Control file with And the total number of operation control file, obtain the abnormal consumption ratio corresponding to failure SQL scripts.
For example, failure SQL scripts are corresponding with 10 operation control files, wherein preset threshold value is 50%, and Terminal device detects that the consumption characteristic value of 4 operation control files is more than 50%, then the number for identifying Fault Control file is 4, it is 0.4 then to obtain the corresponding abnormal consumption ratio of failure SQL scripts.
Optionally, in the present embodiment, terminal device controls file to match corresponding threshold value for each operation, i.e., eventually End equipment identifies the file identification of operation control file first in the operation for performing S104, then from the operation text to prestore In the consumption list of part standard, inquiry this document identifies corresponding threshold value, and the corresponding consumption of operation control file is special The corresponding threshold value of value indicative is compared, and determines whether operation control file is Fault Control file.Specifically, should In the consumption list of operating file standard, each operation controls the corresponding threshold value of file being averaged for file to be controlled to disappear for the operation Consume characteristic value.
In the present embodiment, terminal device is after the abnormal consumption ratio is obtained, by the abnormal consumption ratio with it is preset Proportion threshold value is compared;If abnormal consumption ratio is more than preset proportion threshold value, the relevant operation of S105 is performed;Conversely, If abnormal consumption ratio is less than or equal to preset proportion threshold value, the relevant operation of S106 is performed.
In S105, if the abnormal consumption ratio is more than preset proportion threshold value, judge in the failure SQL scripts Inquiry factor sequence occur abnormal, adjust the inquiry factor sequence;The inquiry factor sequence is specifically used for:When script tune It is suitable in the inquiry factor sequence according to each inquiry factor when calling SQL scripts execution data query operation with terminal Sequence determines the inquiry order of each inquiry factor.
In the present embodiment, terminal device determines that the abnormal consumption ratio is more than preset proportion threshold value, then it represents that the event Most operation control file is in abnormal consumption situation in barrier SQL scripts, may thereby determine that the fault condition not It is individual case, but the common feature of each operation control file based on failure SQL scripts, therefore terminal device will be sentenced There is exception in inquiry factor sequence in fixed failure SQL scripts, so as to cause the fortune of SQL scripts generation is mostly based on Row control file is in the situation of abnormal consumption.
In the present embodiment, SQL scripts include inquiry factor sequence, and the inquiry factor sequence is by with certain tactic The multiple queries factor is formed.Database, will be according to the inquiry factor each in the inquiry factor sequence when calling the SQL scripts Order chooses data corresponding with the parameter value for inquiring the factor successively.
For example, serial number 1 first inquiry the factor be specially " area ", the inquiry factor during certain inquiry, Corresponding parameter value is " Shenzhen ", and the second of the serial number 2 inquiry factor is specially " gender ", during this time is inquired, Corresponding parameter value is " female ".Therefore, database, first can be by this each inquiry factor of inquiry when calling the SQL scripts Corresponding parameter value is imported into the SQL scripts, and is chosen and the matched number of the above-mentioned inquiry factor successively from database According to.First, database will inquire the data for including " Shenzhen " this parameter, obtain the first query result;And it is tied from the first inquiry In fruit, choose the data that gender is " female ", obtain the second query result, by the above process iteration successively, then to the end Query result, complete primary complete inquiry operation.
It can therefore be seen that during due to obtaining the first query result, database, which needs to traverse total data, to be obtained first and looks into Ask as a result, and during second of inquiry operation, then choose corresponding data again from the first query result.Therefore, if first looks into Ask the factor data screening it is less efficient, then the data volume included in the first query result is larger, database server need by More caching stores first query result, and the second inquiry factor is when carrying out data decimation, corresponding data Radix amount is also larger, therefore operation consumption can be caused larger, thus while the inquiry factor included in SQL scripts is fixed, But the operational efficiency that different arrangements will directly affect SQL scripts.Therefore, if it is determined that the inquiry factor sequence of failure SQL scripts Row are abnormal, then need to be adjusted the inquiry factor sequence, by the higher inquiry factor of data screening efficiency come compared with Preceding position, the position after the less efficient inquiry factor of data screening is come relatively, then so that entire inquiry factor sequence Search efficiency highest, reduce inquiry consumption.
In S106, if the abnormal consumption ratio is less than or equal to preset proportion threshold value, identify that the consumption is special The operation control file that value indicative is more than preset threshold value is Fault Control file, and repair the Fault Control file.
In the present embodiment, terminal device is determining the abnormal consumption ratio less than or equal to preset proportion threshold value When, then it represents that the abnormal consumption situation is on the operation control file for betide fraction, i.e., not SQL scripts exist in itself It is abnormal, but some portion of possible parameter setting mistake of operation control file, occur so as to cause abnormal conditions, therefore terminal is set It is standby that abnormal operation control file progress fault restoration will be consumed to the part.
In the present embodiment, terminal device identification consumption characteristic value is more than the operation control file of preset threshold value Fault Control file, and the control parameter in each Fault Control file is obtained, which includes:Script cycle-index with And every time cycle when institute is each inquires the value that is taken of the factor.Terminal device is based on control parameter and preset reparation algorithm, Optimization of operating parameters is carried out to each operation control file respectively, to repair Fault Control file.
Optionally, after S105 or S106, terminal device will also obtain the operating status of the failure SQL scripts after reparation Parameter, and judge whether the Expenditure Levels of the SQL scripts are in normal range (NR), if so, identifying that the secondary reparation has been completed;It if should Expenditure Levels after SQL scripts are repaired still exceed normal range (NR), then return to the relevant operation of S103, continue to execute fault identification and repair Multiple operation until recycle time is more than predetermined threshold value, then sends fault handling information and gives the database corresponding maintenance personnel, with Just maintenance personnel is repaired manually.
Above as can be seen that a kind of fault repairing method of SQL scripts provided in an embodiment of the present invention passes through terminal device The operating condition of each SQL scripts is detected, if monitoring the SQL scripts there are failure, startup separator repairs flow, and obtaining should The corresponding script mark of failure SQL scripts, is then identified by the script, inquires the operation control corresponding to failure SQL scripts File processed determines the database regulative strategy corresponding when calling failure SQL scripts, then according to each operation control text The corresponding consumption characteristic value of part, it is since SQL scripts are caused in itself or are certain operation control files to position the secondary failure Caused by middle relative parameters setting is unreasonable.Therefore, terminal device is calculating the corresponding consumption of each operation control file After characteristic value, which with preset threshold value is compared, determines that the consumption for being more than default threshold value is special Value indicative number then determines its abnormal consumption ratio, if the abnormal consumption ratio is more than preset proportion threshold value, then it represents that big portion The operation control file divided is in the situation of abnormal consumption, therefore will represent that simultaneously inoperative controls parameter setting in file not conform to Reason, but there are problems in itself for failure SQL scripts, are sent out so as to cause each operation control file of the SQL scripts is called Raw abnormal consumption;Conversely, if abnormal consumption ratio is less than or equal to preset proportion threshold value, then it represents that only part operation control File can be determined that not SQL scripts exist abnormal in itself there are abnormal consumption situation, but part operation control file In loop parameter setting it is unreasonable caused by, therefore reparation adjusting is carried out to the operation of abnormal consumption control file.Therefore, eventually End equipment by identifying the consumption Anomalies Genesis of failure SQL scripts, perform it is corresponding repair operation, so as to improve the standard of reparation True property.Compared with the fault restoration technology of existing SQL scripts, fault restoration whole flow process is performed automatically by terminal device, Administrative staff without database carry out manual operation, so as to improve the efficiency of fault restoration.On the other hand, since failure is repaiied The professional skill that multiple process does not depend on maintenance personnel is horizontal, and terminal device can be by repairing algorithm to failure SQL feet accordingly This is repaired, so as to reduce the maintenance cost of system.
Fig. 2 shows the specific realities of the fault repairing method S105 of a kind of SQL scripts that second embodiment of the invention provides Existing flow chart.It is shown in Figure 2, relative to embodiment described in Fig. 1, a kind of fault restoration of SQL scripts provided in this embodiment S105 further includes S201 and S204 in method, and specific details are as follows:
Further, the inquiry factor sequence in the judgement failure SQL scripts occurs abnormal, adjusts the inquiry Factor sequence, including
In S201, according to each inquiry factor that inquiry factor sequence includes in the failure SQL scripts, data are obtained The parameter value that the factor is taken is inquired in library described in each data.
In the present embodiment, terminal device determines number by according to each inquiry factor included in the inquiry factor sequence According to the parameter value that the inquiry factor in data each in library is taken, then determine the inquiry factor in the database comprising how many Different parameter values obtains corresponding parameter value number.
For example, a certain inquiry factor is " area ", in the database, the value that certain partial data " area " is taken is " wide State ", the value that certain partial data " area " is taken be " Shenzhen ", the value that certain partial data " area " is taken be " Hong Kong ", remainder The value that divided data " area " is taken is " Macao ", therefore, is somebody's turn to do " area " inquiry factor and includes 4 different parameters in the database Value, i.e. its corresponding parameter value number are 4.And be " gender " for the inquiry factor, then it can determine its corresponding parameter value Number is 2, i.e., value is " man " or value is " female ".Thus, it could be seen that the inquiry factor that parameter value number is bigger, corresponding data Screening efficiency is then higher or utilizes above-mentioned example, and " area " inquiry factor can averagely filter out four points from database One of data, and " gender " inquiry factor may only then filter out the data of half from database.
In S202, the parameter value number of each inquiry factor of statistics, and according to the parameter value number, calculate each The corresponding discrimination of a inquiry factor;Wherein, the discrimination is inquired for representing described in database described in factor pair The screening efficiency of data.
In the present embodiment, terminal device, will be according to the ginseng after the corresponding parameter value number of each inquiry factor is obtained Numerical value number imported into preset discrimination transformation model, so as to calculate the corresponding discrimination of each inquiry factor.Wherein, join The bigger inquiry factor of numerical value number, corresponding discrimination are bigger.Since discrimination is intended to indicate that the inquiry factor logarithm According to the screening efficiency of data in library, therefore by being illustrated in S201 it was determined that the screening efficiency of parameter value number is higher, therefore Its corresponding discrimination is also bigger.
It should be noted that each the parameter value number of the inquiry factor and discrimination are for a certain database , it is a relative characteristic value.Parameter value number of the i.e. a certain inquiry factor in first database is 5, but in another data Parameter value number in library can be 9, i.e., more different values are included in another database.Similarly, discrimination also has There is this feature.For being comparable to a certain database due to the parameter value number and discrimination of the inquiry factor, if number It changes according to the data included in library, will also influence the corresponding discrimination of the inquiry factor and parameter value number.Such as it counts Data are increased, delete data or partial data is substituted according to library, then may change and inquire what the factor included in database The type of parameter value, so as to change the parameter value number and discrimination of each inquiry factor.It can be seen that SQL scripts are sent out It is raw abnormal, corresponding inquiry factor sequence in SQL scripts is frequently due to, and carry out not according to the update of data in database Adjustment.
Optionally, the discrimination of each inquiry factor, the discrimination computation model can be calculated by discrimination computation model For:
Wherein, discriminations of the S (x) for the inquiry factor, parameter value number of the Q (x) for the inquiry factor, institute State the data cover rate that f (x) is the inquiry factor, the fAlwaysFor the total amount of data that database includes, the fxFor comprising institute State the data volume of the inquiry factor.
In S203, based on the numerical value of the corresponding discrimination of each inquiry factor, it is arranged in order from large to small, generates standard Inquire factor sequence.
In the present embodiment, terminal device is after the corresponding discrimination of each inquiry factor is obtained, then according to each area The numerical values recited of indexing, is arranged in order from large to small, since generation standard queries factor sequence.Wherein, discrimination is larger looks into Ask the factor, serial number more before, conversely, the smaller inquiry factor of discrimination, serial number more after.
Optionally, if the two or more inquiry factors, corresponding discrimination numerical values recited is identical, then above-mentioned inquiry because Relative position between son can arbitrary arrangement, such as inquiry factors A is respectively to the corresponding discriminations of F:8th, 12,8,5,8,6, then Standard queries factor sequence after adjustment can be:BACEFD, BAECFD or BECAFD, as long as tri- inquiry factors of AEC are equal After coming B, before FD.Terminal device can also be according to the big of the identical inquiry factor its parameter value number of discrimination It is small, putting in order between the above-mentioned inquiry factor is set.It is still illustrated by above-mentioned example, its correspondence of inquiry factors A CE Discrimination be 8, but the parameter value number that the parameter value number of A is 7, C is 9, and the parameter value number of E is 6, then above-mentioned three Relative order between person can be:CAE.
In S204, the standard queries factor sequence is replaced into the inquiry factor sequence in the failure SQL scripts.
In the present embodiment, terminal device has small arrive by according to each numerical values recited for inquiring the corresponding discrimination of the factor It is arranged in order greatly, obtains the inquiry factor sequence of standard, and using the inquiry factor sequence of the standard as the inquiry of the SQL scripts Factor sequence so as to repair the SQL scripts of the failure, improves its search efficiency.
In the present embodiment, if certain inquiry factors secure corresponding ginseng in the inquiry factor sequence of failure SQL scripts Numerical value, then terminal device the corresponding preset parameter value of each inquiry factor is configured to the standard queries factor after being replaced successfully In sequence, to keep the query strategy of the SQL scripts after repairing consistent.
In embodiments of the present invention, according to the corresponding discrimination of the inquiry factor each in inquiry factor sequence, data are generated The highest inquiry factor sequence of screening efficiency, and the inquiry factor sequence is replaced with to the inquiry factor sequence of failure SQL scripts, So as to reduce the occupation condition run when controlling file that data base call is generated based on SQL scripts, so as to repair event The SQL scripts of barrier improve the accuracy rate of fault restoration.
The specific implementation of S106 in a kind of fault repairing method for the SQL scripts that Fig. 3 third embodiment of the invention provides Flow chart.It is shown in Figure 3, relative to embodiment described in Fig. 1, a kind of fault restoration side of SQL scripts provided in this embodiment In method, include S301~S302 in S106, specific details are as follows:
Further, the operation control file that the identification consumption characteristic value is more than preset threshold value is failure File is controlled, and repairs the Fault Control file, including:
In S301, the corresponding control parameter change record of the Fault Control file is obtained.
In the present embodiment, terminal device can also record the control parameter change record of each operation control file. The control parameter change record records the information such as parameter, change founder, the change time of operation control document change, with Just user knows the service condition of operation control file by the change record, if the user there are unauthorized more corrects one's mistakes the fortune The account executive of row control file and database can be according to the control parameter change record, the control file of reduction operation at any time To corresponding version.
In the present embodiment, since Fault Control file is just to determine that its consumption is abnormal in this monitoring cycle, that is, exist The Fault Control file is remained to by database normal call before monitoring cycle, thus may determine that near the monitoring cycle, The Fault Control file was changed by certain customers, therefore by restoring corresponding control parameter in the Fault Control file, i.e., The Fault Control file can be repaired, therefore the corresponding control parameter change record of the Fault Control file will be obtained, and perform The relevant operation of S302.
In S302, according to the backward of the control parameter change record creation time, the control parameter is gradually restored The changed content that change record includes, and the corresponding consumption characteristic value of the Fault Control file is monitored, until the failure is transported The corresponding consumption characteristic value of row strategy is less than or equal to preset threshold value.
In the present embodiment, terminal device is each by the backward of the creation time according to each control parameter change record Changed content in one control parameter change record of secondary reduction, so that failure operation control file is gradually reverted to normally In the range of, so as to be repaired to fault condition.
In the present embodiment, it is primary will to obtain dry run after restoring after one changed content of every reduction for terminal device Fault Control file obtains the running state parameter of database when running the Fault Control file, and is joined according to the operating status Number calculates its corresponding consumption characteristic value, if the consumption characteristic value is less than or equal to preset threshold value, then it represents that abnormal feelings Condition has repaired success, terminates the relevant operation of S302;If conversely, the first consumption characteristic value is still greater than preset threshold value, The reduction of next changed content is then carried out, repeats aforesaid operations.
In embodiments of the present invention, terminal device is realized by restoring the changed content in Fault Control file to exception The purpose repaired of operation control script, repaired so as to fulfill to automatic fault situation, improve abnormal processing Efficiency and response speed.
The specific implementation stream of the fault repairing method S106 for the SQL scripts that Fig. 4 fourth embodiment of the invention provides a kind of Cheng Tu.It is shown in Figure 4, relative to embodiment described in Fig. 1, a kind of fault repairing method of SQL scripts provided in this embodiment Middle S106 includes S401 and S402, and specific details are as follows:
Further, the operation control file that the identification consumption characteristic value is more than preset threshold value is failure File is controlled, and repairs the Fault Control file, including:
In S401, the operation for choosing the consumption characteristic value minimum controls file as preferred operating file.
In the present embodiment, terminal device carries out fault restoration except through restoring the changed content of Fault Control file Outside, it can also be extended in failure operation file by will preferably run corresponding operational parameter value in control file, so as to Realize the purpose optimized to the control parameter of Fault Control file.Therefore, terminal device is firstly the need of determining failure SQL The corresponding preferred operating file of script.
In the present embodiment, terminal device will choose the operation control file of consumption characteristic value minimum as preferred operation text Part is fewer due to consuming, then it represents that the database search efficiency highest corresponding when running operation control file.Certainly, Terminal device can also choose preferred operating file according to other decision rules, such as by choosing the run time recycled every time Minimum operation controls file as preferred operating file;Each inquiry operation memory can also be chosen and CPU consumption is minimum Operation control file as preferred control file.Terminal device can be chosen and the monitoring pattern according to different monitoring patterns The running state parameter of concern is as the decision condition for identifying preferred operating file.Optionally, the running state parameter of the selection It can be two or more state operational factors.
In S402, by the cycle-index included in the preferred operating file and it is each inquiry the factor parameter value, It is applied to the Fault Control file.
In the present embodiment, terminal device will obtain the control parameter further included in preferred operating file, secondary including recycling The value that several and each inquiry factor is taken, and modified according to above-mentioned two parameter to Fault Control file, to repair The fault condition of Fault Control file.Specifically, this is applied to Fault Control file and is specially:Terminal device will preferably run text Control parameter in part replaces the control parameter in Fault Control file.
In embodiments of the present invention, terminal device, and will be right in the preferred operation file by determining preferred operating file The operational parameter control answered is applied in Fault Control file, is realized the purpose repaired to failure, is improved fault restoration Accuracy.
Fig. 5 shows the specific reality of the fault repairing method S101 for SQL scripts that fifth embodiment of the invention provides a kind of Existing flow chart.It is shown in Figure 5, relative to Fig. 1 to Fig. 4 illustrated embodiment, a kind of failure of SQL scripts provided in this embodiment If monitoring failure SQL scripts described in restorative procedure, the script mark of the failure SQL scripts is obtained, including S501~ S503, details are as follows:
Further, if the monitoring failure SQL scripts, the script mark of the failure SQL scripts is obtained, including:
In S501, the running state parameter of each SQL scripts is obtained.
In the present embodiment, the trigger condition of abnormality detection includes triggering and automatic trigger both of which manually.Wherein, It triggers manually and is specially:Administrator generates an abnormality detection enabled instruction or by user terminal to end on the terminal device End equipment sends an abnormality detection enabled instruction, if after terminal device receives the abnormality detection enabled instruction, performs The relevant operation of S501.And automatic trigger is specially:Terminal device is provided with abnormality detection and starts opportunity, if terminal device detects It is matched to current state with preset abnormality detection startup opportunity, then performs the relevant operation of S501.
Optionally, in this embodiment, it can be a preset detection cycle that the abnormality detection, which starts opportunity, terminal device It is monitoring that current time meets the detection cycle, is then performing the relevant operation of S501.The abnormality detection startup opportunity may be used also Think an operation threshold value, such as resources occupation rate, terminal device is monitoring that the current time operation of terminal to be detected disappears Consumption value is greater than or equal to preset operation threshold value, then performs the relevant operation of S501.Since the consumption of equipment is excessive, generally It is caused by SQL script exceptions, trigger condition can be used as by running the situation of consumption, the side with period triggering Formula is compared, and can reduce unnecessary testing process, so as to improve the resource utilization of equipment.
In S502, the running state parameter of the SQL scripts is directed into preset consumption level transformation model, is calculated The corresponding consumption level of each SQL scripts;Wherein, the consumption level sets for during the expression calling SQL scripts Duis The occupancy situation of standby resource.
In the present embodiment, terminal device, will be according to each fortune after the running state parameter for obtaining each SQL scripts Row state parameter obtains the Expenditure Levels of SQL scripts, therefore the multiple ginsengs that will be included in the corresponding running state parameter of SQL scripts Numerical value imported into preset consumption Feature Conversion model, to calculate its corresponding consumption level by running state parameter, leads to Cross the Expenditure Levels that the consumption level characterizes the SQL scripts.
Optionally, which is specially:
Ex=α1Ct(SQL)+α2T(SQL)+α3Buff(SQL)+α4Q(SQL)
Wherein, first consumption characteristic values of the Ex for SQL scripts, α1、α2、α3And α4It is corresponding for each running state parameter Weighted value, Ct (SQL) are that the calculation resources of SQL scripts occupy parameter, and T (SQL) is the average operating time parameter of SQL scripts, Buff (SQL) is the EMS memory occupation parameter of SQL scripts, and Q (SQL) is the number of run of SQL scripts.
In S503, the SQL script of the consumption level more than preset grade threshold is chosen as failure SQL feet This.
In the present embodiment, terminal device is after the corresponding consumption level of each SQL scripts is calculated, by each consumption etc. Grade is compared with preset grade threshold, if the corresponding consumption level of a certain SQL scripts is less than or equal to preset grade threshold Value, then it represents that the Expenditure Levels of the SQL scripts are in normal condition, and it is normal SQL scripts to identify the SQL scripts;If conversely, certain The corresponding consumption level of one SQL scripts is more than preset grade threshold, then it represents that the Expenditure Levels of the SQL scripts have exceeded normally Range, the SQL scripts in abnormal consumption, therefore will be by the SQL scripts be failure SQL scripts.Terminal device will be from SQL feet In this resources bank, the failure SQL scripts of this detection judgement are extracted, fault restoration is carried out to it.
In embodiments of the present invention, terminal device is converted to corresponding consumption etc. according to the running state parameter of each SQL Grade, and consumption level and preset threshold value are compared, so that it is determined that whether the SQL scripts are failure SQL scripts, it is real Now to the automatic fault selftesting of failure SQL scripts, so as to reduce artificial intervention, fault restoration efficiency is improved.
It should be understood that the size of the serial number of each step is not meant to the priority of execution sequence, each process in above-described embodiment Execution sequence should determine that the implementation process without coping with the embodiment of the present invention forms any limit with its function and internal logic It is fixed.
Fig. 6 shows a kind of structure diagram of the fault restoration terminal for SQL scripts that one embodiment of the invention provides, should The each unit that the fault restoration terminal of SQL scripts includes is used to perform each step in the corresponding embodiments of Fig. 1.Referring specifically to The associated description in embodiment corresponding to Fig. 1 and Fig. 1.For convenience of description, part related to the present embodiment is illustrated only.
Referring to Fig. 6, the fault restoration terminal of the SQL scripts includes:
If script mark acquiring unit 61 for monitoring failure SQL scripts, obtains the foot of the failure SQL scripts This mark;
Operation control file obtaining unit 62, for being identified according to the script, it is corresponding to obtain the failure SQL scripts Operation control file;Wherein, the operation control file is specifically used for:Determine that script calls terminal often to initiate a script and calls It, should when performing the cycle-index of the failure SQL scripts and determining that cycle performs the failure SQL scripts every time during operation The value that each inquiry factor is taken in failure SQL scripts;
Characteristic value acquiring unit 63 is consumed, for based on the calling resource occupation record to prestore, determining to perform each operation Corresponding consumption characteristic value when controlling file;Wherein, when the consumption characteristic value is for representing to call the operation control file To the occupancy situation of device resource;
Abnormal consumption ratio-dependent unit 64, for obtaining the consumption that the consumption characteristic value is more than preset threshold value Characteristic value number obtains the corresponding abnormal consumption ratio of the failure SQL scripts;
It inquires factor sequence and repairs unit 65, if being more than preset proportion threshold value for the abnormal consumption ratio, sentence There is exception in inquiry factor sequence in the fixed failure SQL scripts, adjusts the inquiry factor sequence;The inquiry factor sequence Row are specifically used for:When script calls terminal that SQL scripts is called to perform data query operation, according to each inquiry factor described The sequence in factor sequence is inquired, determines the inquiry order of each inquiry factor;
Fault Control file repairs unit 66, if being less than or equal to preset ratio threshold for the abnormal consumption ratio Value then identifies that the operation control file that the consumption characteristic value is more than preset threshold value is Fault Control file, and repair The Fault Control file.
Optionally, the inquiry factor sequence repairs unit 65, further includes:
Factor statistics unit is inquired, for each inquiry included according to factor sequence is inquired in the failure SQL scripts The factor obtains the parameter value that the inquiry factor is taken described in each data in database;
Discrimination computing unit, for counting the parameter value number of each inquiry factor, and according to the parameter value Number calculates the corresponding discrimination of each inquiry factor;Wherein, the discrimination inquires factor pair institute for representing described State the screening efficiency of data in database;
Standard queries factor sequence determination unit, for the numerical value based on the corresponding discrimination of each inquiry factor, by big It is arranged in order to small, generates standard queries factor sequence;
Factor sequence adjustment unit is inquired, for the standard queries factor sequence to be replaced in the failure SQL scripts Inquiry factor sequence.
Optionally, Fault Control file repairs unit 66, including:
Parameter modification records acquiring unit, for obtaining the corresponding control parameter change record of the Fault Control file;
Changed content reduction unit for the backward according to the control parameter change record creation time, gradually restores The changed content that the control parameter change record includes, and the corresponding consumption characteristic value of the Fault Control file is monitored, directly It is less than or equal to preset threshold value to the corresponding consumption characteristic value of the failure operation strategy.
Optionally, the Fault Control file is repaired unit 66 and is included:
It is preferred that operating file selection unit, for choosing the operation control file of the consumption characteristic value minimum as preferred Operating file;
It is preferred that operating file promotes unit, for by the cycle-index included in the preferred operating file and each looking into The parameter value of the factor is ask, is applied to the Fault Control file.
Optionally, the script mark acquiring unit 61 includes:
Running state parameter acquiring unit, for obtaining the running state parameter of each SQL scripts;
Consumption level computing unit, for the running state parameter of the SQL scripts to be directed into preset consumption level Transformation model calculates the corresponding consumption level of each SQL scripts;Wherein, the consumption level is for described in expression calling To the occupancy situation of device resource during SQL scripts;
Failure SQL script monitoring unit, for choosing the SQL feet that the consumption level is more than preset grade threshold This is as failure SQL scripts.
Therefore, the fault restoration terminal of SQL scripts provided in an embodiment of the present invention again may be by terminal device detection The operating condition of each SQL scripts, if monitoring the SQL scripts there are failure, startup separator repairs flow, obtains the failure The corresponding script mark of SQL scripts, is then identified by the script, inquires the operation control text corresponding to failure SQL scripts Part determines the database regulative strategy corresponding when calling failure SQL scripts, then controls file pair according to each operation The consumption characteristic value answered, it is since SQL scripts are caused in itself or are phase in certain operation control files to position the secondary failure Caused by related parameter setting is unreasonable.Therefore, terminal device is calculating the corresponding consumption feature of each operation control file After value, which with preset threshold value is compared, determines the consumption characteristic value for being more than default threshold value Number then determines its abnormal consumption ratio, if the abnormal consumption ratio is more than preset proportion threshold value, then it represents that most Operation control file is in the situation of abnormal consumption, therefore will represent that parameter setting is unreasonable in simultaneously inoperative control file, But there are problems in itself for failure SQL scripts, so as to cause calling, each operation control file generation of the SQL scripts is different Often consumption;Conversely, if abnormal consumption ratio is less than or equal to preset proportion threshold value, then it represents that only part operation control file There are abnormal consumption situation, therefore it can be determined that not SQL scripts exist abnormal in itself, but in part operation control file Caused by loop parameter setting is unreasonable, therefore reparation adjusting is carried out to the operation control file of abnormal consumption.Therefore, terminal is set The standby consumption Anomalies Genesis by identifying failure SQL scripts performs corresponding repair and operates, so as to improve the accurate of reparation Property, it solves the fault restoration technology of existing SQL scripts, needs manually to carry out the SQL scripts included in database one by one Investigation manually, fault detection efficiency is relatively low, and after detecting the SQL scripts of failure, is also relied on the professional knowledge of maintenance personnel The problem of carrying out artificial fault restoration, also further reduced the efficiency of SQL script failures response.
Fig. 7 is a kind of schematic diagram for terminal device that another embodiment of the present invention provides.As shown in fig. 7, the embodiment Terminal device 7 includes:It processor 70, memory 71 and is stored in the memory 71 and can be transported on the processor 70 Capable computer program 72, such as the fault restoration program of SQL scripts.When the processor 70 performs the computer program 72 Realize the step in the fault repairing method embodiment of above-mentioned each SQL scripts, such as S101 shown in FIG. 1 to S106.Alternatively, The processor 70 realizes the function of each unit in above-mentioned each device embodiment, such as Fig. 6 when performing the computer program 72 Shown 61 to 66 function of module.
Illustratively, the computer program 72 can be divided into one or more units, one or more of Unit is stored in the memory 71, and is performed by the processor 70, to complete the present invention.One or more of lists Member can complete the series of computation machine program instruction section of specific function, which is used to describe the computer journey Implementation procedure of the sequence 72 in the terminal device 7.It is obtained for example, the computer program 72 can be divided into script mark Unit, operation control file obtaining unit, consumption characteristic value acquiring unit, abnormal consumption ratio-dependent unit, inquiry factor sequence Row repair unit and Fault Control file repairs unit, and each unit concrete function is as follows:
If script mark acquiring unit for monitoring failure SQL scripts, obtains the script of the failure SQL scripts Mark;
Operation control file obtaining unit, for being identified according to the script, obtains the corresponding fortune of the failure SQL scripts Row control file;Wherein, the operation control file is specifically used for:Determine that script calls terminal often to initiate a script and calls behaviour When making, when performing the cycle-index of the failure SQL scripts and determining that cycle performs the failure SQL scripts every time, the event The value that each inquiry factor is taken in barrier SQL scripts;
Characteristic value acquiring unit is consumed, for based on the calling resource occupation record to prestore, determining to perform each operation control Corresponding consumption characteristic value during file processed;Wherein, it is described consumption characteristic value for represent call it is described operation control file when pair The occupancy situation of device resource;
Abnormal consumption ratio-dependent unit, for obtaining the consumption spy that the consumption characteristic value is more than preset threshold value Value indicative number obtains the corresponding abnormal consumption ratio of the failure SQL scripts;
It inquires factor sequence and repairs unit, if being more than preset proportion threshold value for the abnormal consumption ratio, judge There is exception in inquiry factor sequence in the failure SQL scripts, adjusts the inquiry factor sequence;The inquiry factor sequence It is specifically used for:When script calls terminal that SQL scripts is called to perform data query operation, looked into according to each inquiry factor described The sequence in factor sequence is ask, determines the inquiry order of each inquiry factor;
Fault Control file repairs unit, if being less than or equal to preset proportion threshold value for the abnormal consumption ratio, Then identify that the operation control file that the consumption characteristic value is more than preset threshold value is Fault Control file, and described in reparation Fault Control file.
The terminal device 7 can be that the calculating such as desktop PC, notebook, palm PC and cloud server are set It is standby.The terminal device may include, but be not limited only to, processor 70, memory 71.It will be understood by those skilled in the art that Fig. 7 The only example of terminal device 7 does not form the restriction to terminal device 7, can include than illustrating more or fewer portions Part either combines certain components or different components, such as the terminal device can also include input-output equipment, net Network access device, bus etc..
Alleged processor 70 can be central processing unit (Central Processing Unit, CPU), can also be Other general processors, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field- Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic, Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processor Deng.
The memory 71 can be the internal storage unit of the terminal device 7, such as the hard disk of terminal device 7 or interior It deposits.The memory 71 can also be the External memory equipment of the terminal device 7, such as be equipped on the terminal device 7 Plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card dodge Deposit card (Flash Card) etc..Further, the memory 71 can also both include the storage inside list of the terminal device 7 Member also includes External memory equipment.The memory 71 is used to store needed for the computer program and the terminal device Other programs and data.The memory 71 can be also used for temporarily storing the data that has exported or will export.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also That each unit is individually physically present, can also two or more units integrate in a unit.Above-mentioned integrated list The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
If the integrated module/unit realized in the form of SFU software functional unit and be independent product sale or In use, it can be stored in a computer read/write memory medium.Based on such understanding, the present invention realizes above-mentioned implementation All or part of flow in example method, can also instruct relevant hardware to complete, the meter by computer program Calculation machine program can be stored in a computer readable storage medium, the computer program when being executed by processor, it can be achieved that on The step of stating each embodiment of the method..Wherein, the computer program includes computer program code, the computer program Code can be source code form, object identification code form, executable file or certain intermediate forms etc..Computer-readable Jie Matter can include:Can carry the computer program code any entity or device, recording medium, USB flash disk, mobile hard disk, Magnetic disc, CD, computer storage, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It is it should be noted that described The content that computer-readable medium includes can carry out appropriate increasing according to legislation in jurisdiction and the requirement of patent practice Subtract, such as in certain jurisdictions, according to legislation and patent practice, computer-readable medium does not include electric carrier signal and electricity Believe signal.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although with reference to aforementioned reality Example is applied the present invention is described in detail, it will be understood by those of ordinary skill in the art that:It still can be to aforementioned each Technical solution recorded in embodiment modifies or carries out equivalent replacement to which part technical characteristic;And these are changed Or replace, the spirit and scope for various embodiments of the present invention technical solution that it does not separate the essence of the corresponding technical solution should all It is included within protection scope of the present invention.

Claims (10)

1. a kind of fault repairing method of SQL scripts, which is characterized in that including:
If monitoring failure SQL scripts, the script mark of the failure SQL scripts is obtained;
It is identified according to the script, obtains the corresponding operation control file of the failure SQL scripts;Wherein, the operation control File is specifically used for:When determining that script calling terminal often initiates a script call operation, following for the failure SQL scripts is performed When ring number and the determining execution failure SQL scripts of cycle every time, each inquiry factor is taken in failure SQL scripts Value;
Based on the calling resource occupation record to prestore, corresponding consumption characteristic value when determining to perform each operation control file;Its In, to the occupancy situation of device resource when the consumption characteristic value is for representing to call the operation control file;
The consumption characteristic value number that the consumption characteristic value is more than preset threshold value is obtained, obtains the failure SQL scripts Corresponding abnormal consumption ratio;
If the abnormal consumption ratio is more than preset proportion threshold value, the inquiry factor sequence in the failure SQL scripts is judged Existing exception is listed, adjusts the inquiry factor sequence;The inquiry factor sequence is specifically used for:When script calls terminal to call When SQL scripts perform data query operation, according to sequence of each inquiry factor in the inquiry factor sequence, determine each The inquiry order of the inquiry factor;
If the abnormal consumption ratio is less than or equal to preset proportion threshold value, it is preset to identify that the consumption characteristic value is more than The operation control file of threshold value is Fault Control file, and repair the Fault Control file.
2. fault repairing method according to claim 1, which is characterized in that in the judgement failure SQL scripts It inquires factor sequence and exception occurs, adjust the inquiry factor sequence, including:
The each inquiry factor included according to factor sequence is inquired in the failure SQL scripts, obtains each data in database Described in the parameter value that is taken of the inquiry factor;
Count the parameter value number of each inquiry factor, and according to the parameter value number, calculate each inquiry because The corresponding discrimination of son;Wherein, the discrimination is used to represent the screening effect of data in database described in the inquiry factor pair Rate;
Based on the numerical value of the corresponding discrimination of each inquiry factor, it is arranged in order from large to small, generates standard queries factor sequence;
The standard queries factor sequence is replaced into the inquiry factor sequence in the failure SQL scripts.
3. fault repairing method according to claim 1, which is characterized in that the identification consumption characteristic value is more than pre- If the operation control file of threshold value be Fault Control file, and repair the Fault Control file, including:
Obtain the corresponding control parameter change record of the Fault Control file;
According to the backward of the control parameter change record creation time, gradually restore what the control parameter change record included Changed content, and the corresponding consumption characteristic value of the Fault Control file is monitored, disappear until the failure operation strategy is corresponding It consumes characteristic value and is less than or equal to preset threshold value.
4. fault repairing method according to claim 1, which is characterized in that the identification consumption characteristic value is more than pre- If the operation control file of threshold value be Fault Control file, and repair the Fault Control file, including:
The operation for choosing the consumption characteristic value minimum controls file as preferred operating file;
By the parameter value of the cycle-index included in the preferred operating file and each inquiry factor, it is applied to the failure Control file.
5. according to claim 1-4 any one of them fault repairing methods, which is characterized in that if the monitoring failure SQL feet This, then obtain the script mark of the failure SQL scripts, including:
Obtain the running state parameter of each SQL scripts;
The running state parameter of the SQL scripts is directed into preset consumption level transformation model, calculates each SQL feet This corresponding consumption level;Wherein, to the occupancy feelings of device resource when the consumption level is for representing to call the SQL scripts Condition;
The SQL script of the consumption level more than preset grade threshold is chosen as failure SQL scripts.
6. a kind of terminal device, which is characterized in that the terminal device includes memory, processor and is stored in the storage In device and the computer program that can run on the processor, the processor are realized as follows when performing the computer program Step:
If monitoring failure SQL scripts, the script mark of the failure SQL scripts is obtained;
It is identified according to the script, obtains the corresponding operation control file of the failure SQL scripts;Wherein, the operation control File is specifically used for:When determining that script calling terminal often initiates a script call operation, following for the failure SQL scripts is performed When ring number and the determining execution failure SQL scripts of cycle every time, each inquiry factor is taken in failure SQL scripts Value;
Based on the calling resource occupation record to prestore, corresponding consumption characteristic value when determining to perform each operation control file;Its In, to the occupancy situation of device resource when the consumption characteristic value is for representing to call the operation control file;
The consumption characteristic value number that the consumption characteristic value is more than preset threshold value is obtained, obtains the failure SQL scripts Corresponding abnormal consumption ratio;
If the abnormal consumption ratio is more than preset proportion threshold value, the inquiry factor sequence in the failure SQL scripts is judged Existing exception is listed, adjusts the inquiry factor sequence;The inquiry factor sequence is specifically used for:When script calls terminal to call When SQL scripts perform data query operation, according to sequence of each inquiry factor in the inquiry factor sequence, determine each The inquiry order of the inquiry factor;
If the abnormal consumption ratio is less than or equal to preset proportion threshold value, it is preset to identify that the consumption characteristic value is more than The operation control file of threshold value is Fault Control file, and repair the Fault Control file.
7. terminal device according to claim 6, which is characterized in that the inquiry in the judgement failure SQL scripts There is exception in factor sequence, adjusts the inquiry factor sequence, including:
The each inquiry factor included according to factor sequence is inquired in the failure SQL scripts, obtains each data in database Described in the parameter value that is taken of the inquiry factor;
Count the parameter value number of each inquiry factor, and according to the parameter value number, calculate each inquiry because The corresponding discrimination of son;Wherein, the discrimination is used to represent the screening effect of data in database described in the inquiry factor pair Rate;
Based on the numerical value of the corresponding discrimination of each inquiry factor, it is arranged in order from large to small, generates standard queries factor sequence;
The standard queries factor sequence is replaced into the inquiry factor sequence in the failure SQL scripts.
8. terminal device according to claim 6, which is characterized in that the identification consumption characteristic value is more than preset The operation control file of threshold value is Fault Control file, and repair the Fault Control file, including:
Obtain the corresponding control parameter change record of the Fault Control file;
According to the backward of the control parameter change record creation time, gradually restore what the control parameter change record included Changed content, and the corresponding consumption characteristic value of the Fault Control file is monitored, disappear until the failure operation strategy is corresponding It consumes characteristic value and is less than or equal to preset threshold value.
9. terminal device according to claim 6, which is characterized in that the identification consumption characteristic value is more than preset The operation control file of threshold value is Fault Control file, and repair the Fault Control file, including:
The operation for choosing the consumption characteristic value minimum controls file as preferred operating file;
By the parameter value of the cycle-index included in the preferred operating file and each inquiry factor, it is applied to the failure Control file.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, and feature exists In when the computer program is executed by processor the step of realization such as any one of claim 1 to 5 the method.
CN201711084967.2A 2017-11-07 2017-11-07 SQL script fault repairing method and terminal thereof Active CN108255703B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711084967.2A CN108255703B (en) 2017-11-07 2017-11-07 SQL script fault repairing method and terminal thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711084967.2A CN108255703B (en) 2017-11-07 2017-11-07 SQL script fault repairing method and terminal thereof

Publications (2)

Publication Number Publication Date
CN108255703A true CN108255703A (en) 2018-07-06
CN108255703B CN108255703B (en) 2020-01-14

Family

ID=62722120

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711084967.2A Active CN108255703B (en) 2017-11-07 2017-11-07 SQL script fault repairing method and terminal thereof

Country Status (1)

Country Link
CN (1) CN108255703B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376025A (en) * 2018-09-03 2019-02-22 平安普惠企业管理有限公司 Abnormality eliminating method, device, computer equipment and storage medium
CN110222071A (en) * 2019-06-06 2019-09-10 上海达梦数据库有限公司 A kind of data query method, apparatus, server and storage medium
CN112131035A (en) * 2020-09-29 2020-12-25 河北科技师范学院 Self-service computer troubleshooting system
CN112783867A (en) * 2021-01-29 2021-05-11 李阳 Database optimization method for meeting real-time big data service requirements and cloud server

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040249830A1 (en) * 2003-06-06 2004-12-09 Dmitry Sonkin Database object script generation method and system
CN101789002A (en) * 2010-01-22 2010-07-28 浪潮(北京)电子信息产业有限公司 Database compatibility test device and method for server
CN104363236A (en) * 2014-11-21 2015-02-18 西安邮电大学 Automatic vulnerability validation method
CN104503880A (en) * 2014-12-16 2015-04-08 新余兴邦信息产业有限公司 Method and device for realizing MySQL database monitoring option script

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040249830A1 (en) * 2003-06-06 2004-12-09 Dmitry Sonkin Database object script generation method and system
CN101789002A (en) * 2010-01-22 2010-07-28 浪潮(北京)电子信息产业有限公司 Database compatibility test device and method for server
CN104363236A (en) * 2014-11-21 2015-02-18 西安邮电大学 Automatic vulnerability validation method
CN104503880A (en) * 2014-12-16 2015-04-08 新余兴邦信息产业有限公司 Method and device for realizing MySQL database monitoring option script

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376025A (en) * 2018-09-03 2019-02-22 平安普惠企业管理有限公司 Abnormality eliminating method, device, computer equipment and storage medium
CN110222071A (en) * 2019-06-06 2019-09-10 上海达梦数据库有限公司 A kind of data query method, apparatus, server and storage medium
CN110222071B (en) * 2019-06-06 2021-11-02 上海达梦数据库有限公司 Data query method, device, server and storage medium
CN112131035A (en) * 2020-09-29 2020-12-25 河北科技师范学院 Self-service computer troubleshooting system
CN112783867A (en) * 2021-01-29 2021-05-11 李阳 Database optimization method for meeting real-time big data service requirements and cloud server

Also Published As

Publication number Publication date
CN108255703B (en) 2020-01-14

Similar Documents

Publication Publication Date Title
CN108985553B (en) Abnormal user identification method and equipment
CN108255703A (en) A kind of fault repairing method and its terminal of SQL scripts
CN105242956B (en) Virtual functions service chaining deployment system and its dispositions method
CN110070461B (en) Health degree evaluation method and system for electric power information system
CN109614262B (en) Service checking method, device and computer readable storage medium
CN108055281A (en) Account method for detecting abnormality, device, server and storage medium
US8145449B2 (en) Computer product, apparatus, and method for system management
CN106201722A (en) The load regulation method of server and system
CN108256810B (en) Insurance business approval process processing method and device
Babu et al. Detecting unusual customer consumption profiles in power distribution systems—APSPDCL
CN109523124A (en) Asset data processing method, device, computer equipment and storage medium
CN106462902A (en) Adaptive coupling-system based on a flexible risk transfer structure and corresponding method thereof
CN111031000B (en) Processing method, device and system of business wind control system and storage medium
CN117151726A (en) Fault repairing method, repairing device, electronic equipment and storage medium
CN105825130B (en) A kind of information security method for early warning and device
CN105431815A (en) Input-output prioritization for database workload
CN111651652B (en) Emotion tendency identification method, device, equipment and medium based on artificial intelligence
CN117640203A (en) Power grid information safety protection method and system
US9998495B2 (en) Apparatus and method for verifying detection rule
CN108255710A (en) The method for detecting abnormality and its terminal of a kind of script
WO2015055373A2 (en) Case-based reasoning
CN108255704A (en) A kind of script calls the exception response method and its terminal of event
CN107908555A (en) A kind of method for detecting abnormality and its terminal of SQL scripts
CN107797924A (en) A kind of method for detecting abnormality and its terminal of SQL scripts
CN107957942B (en) SQL script fault repairing method and terminal thereof

Legal Events

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