Oracle stored procedure performance testing methods and devices, processors

By obtaining unit test cases and performance metric thresholds for Oracle stored procedures, problematic unit test cases were identified, performance test reports were generated, and remediation solutions were obtained. This solved the problem of poor performance testing results for Oracle stored procedures, enabling early detection and low-cost remediation.

CN115269430BActive Publication Date: 2026-03-31INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-10
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In existing technologies, performance testing of Oracle stored procedures yields poor results, problems are discovered late, repair costs are high, there is a high reliance on the skills of professional personnel, and there is a lack of continuous integration and regression testing capabilities.

Method used

By obtaining multiple unit test cases and performance metric thresholds for Oracle stored procedures, unit test cases with performance metrics exceeding the thresholds are selected for performance testing, performance test reports are generated, and the causes and solutions for performance issues are obtained using an expert database and sent to users for repair.

Benefits of technology

It enables early detection of performance issues, reduces repair costs, improves testing effectiveness, supports continuous integration and regression testing, and reduces reliance on professional personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115269430B_ABST
    Figure CN115269430B_ABST
Patent Text Reader

Abstract

This application discloses a performance testing method, apparatus, and processor for Oracle stored procedures, relating to the field of big data. The method includes: obtaining multiple unit test cases corresponding to the Oracle stored procedure, wherein the Oracle stored procedure is the stored procedure to be tested for performance, and the multiple unit test cases are used to test the performance of the Oracle stored procedure; obtaining thresholds corresponding to the performance metrics of the Oracle stored procedure to obtain a target threshold; and performing performance testing on the Oracle stored procedure based on the multiple unit test cases and the target threshold. This application solves the problem of poor test results when performing performance testing on Oracle stored procedures in related technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data, and more specifically, to a performance testing method and apparatus for Oracle stored procedures, and a processor. Background Technology

[0002] In related technologies, performance testing of Oracle stored procedures is often conducted in the later stages of a project, or even after integration testing is completed. Professional performance testers use tools or perform load testing manually to complete the performance testing of Oracle stored procedures.

[0003] However, performing performance testing on Oracle stored procedures in the later stages of a project or during integration testing often results in late-stage discovery of performance issues, higher remediation costs, and a lack of continuous integration and regression testing capabilities. Furthermore, the scope of performance testing, the localization, resolution, and repair of performance problems rely heavily on specialized personnel, demanding significant expertise from them. Therefore, performance testing of Oracle stored procedures often yields poor results.

[0004] There is currently no effective solution to the problem of poor performance when performing performance tests on Oracle stored procedures in related technologies. Summary of the Invention

[0005] The main purpose of this application is to provide a performance testing method, apparatus, and processor for Oracle stored procedures, in order to solve the problem of poor testing results when performing performance testing on Oracle stored procedures in related technologies.

[0006] To achieve the above objectives, according to one aspect of this application, a performance testing method for an Oracle stored procedure is provided. The method includes: obtaining multiple unit test cases corresponding to the Oracle stored procedure, wherein the Oracle stored procedure is a stored procedure to be tested for performance, and the multiple unit test cases are used to test the performance of the Oracle stored procedure; obtaining a threshold corresponding to a performance metric of the Oracle stored procedure to obtain a target threshold; and performing performance testing on the Oracle stored procedure based on the multiple unit test cases and the target threshold.

[0007] Further, the performance testing of the Oracle stored procedure based on the plurality of unit test cases and the target threshold includes: selecting at least one target unit test case from the plurality of unit test cases based on the plurality of unit test cases and the target threshold, wherein when the at least one target unit test case is executed, the value of the performance indicator of the Oracle stored procedure is greater than the target threshold; and performing performance testing on the Oracle stored procedure based on the at least one target unit test case to obtain a performance test report.

[0008] Further, selecting at least one target unit test case from the plurality of unit test cases based on the plurality of unit test cases and the target threshold includes: executing each unit test case to obtain a plurality of target values, wherein the target values ​​are the values ​​corresponding to the performance indicators of the Oracle stored procedure when executing each unit test case; and selecting the at least one target unit test case from the plurality of unit test cases based on the plurality of target values ​​and the target threshold.

[0009] Further, selecting the at least one target unit test case from the plurality of unit test cases based on the plurality of target values ​​and the target threshold includes: determining whether there is a value among the plurality of target values ​​that is greater than the target threshold; if there is a value among the plurality of target values ​​that is greater than the target threshold, the unit test case corresponding to the target value that is greater than the target threshold is taken as the at least one target unit test case.

[0010] Furthermore, the performance test of the Oracle stored procedure based on the at least one target unit test case to obtain a performance test report includes: re-executing the at least one target unit test case to obtain the log information corresponding to the Oracle stored procedure when executing the at least one target unit test case; obtaining the performance metrics of each code segment in the Oracle stored procedure; and obtaining the performance test report based on the log information and the performance metrics of each code segment.

[0011] Furthermore, based on the log information and the performance metrics of each code segment, the performance test report is obtained by: parsing the log information to obtain the time consumption ranking and corresponding execution plan of each code segment in the Oracle stored procedure; and generating the performance test report based on the time consumption ranking, corresponding execution plan, and performance metrics of each code segment in the Oracle stored procedure.

[0012] Furthermore, after performing performance testing on the Oracle stored procedure based on the at least one target unit test case and obtaining a performance test report, the method further includes: obtaining the target performance problem corresponding to the Oracle stored procedure based on the performance test report; obtaining a target database, wherein the target database is used to store multiple performance problems corresponding to the Oracle stored procedure, the cause of each performance problem, and the repair solution for each performance problem; obtaining target information from the target database based on the target performance problem, wherein the target information includes at least the target cause of the target performance problem in the Oracle stored procedure and the target repair solution for repairing the target performance problem; and sending the target information to the target user to remind the target user to repair the target performance problem corresponding to the Oracle stored procedure based on the target cause and the target repair solution.

[0013] To achieve the above objectives, according to another aspect of this application, a performance testing apparatus for an Oracle stored procedure is provided. The apparatus includes: a first acquisition unit, configured to acquire multiple unit test cases corresponding to an Oracle stored procedure, wherein the Oracle stored procedure is a stored procedure to be subjected to performance testing, and the multiple unit test cases are used to test the performance of the Oracle stored procedure; a second acquisition unit, configured to acquire threshold values ​​corresponding to performance indicators of the Oracle stored procedure to obtain a target threshold; and a first testing unit, configured to perform performance testing on the Oracle stored procedure based on the multiple unit test cases and the target threshold.

[0014] Further, the first testing unit includes: a first filtering subunit, used to filter at least one target unit test case from the plurality of unit test cases based on the plurality of unit test cases and the target threshold, wherein when the at least one target unit test case is executed, the value of the performance indicator of the Oracle stored procedure is greater than the target threshold; and a first testing subunit, used to perform performance testing on the Oracle stored procedure based on the at least one target unit test case, and obtain a performance test report.

[0015] Further, the first filtering subunit includes: a first execution module, configured to execute each unit test case to obtain multiple target values, wherein the target values ​​are the values ​​corresponding to the performance indicators of the Oracle stored procedure when executing each unit test case; and a first filtering module, configured to filter out at least one target unit test case from the multiple unit test cases based on the multiple target values ​​and the target threshold.

[0016] Further, the first filtering module includes: a first judgment submodule, used to judge whether there is a value greater than the target threshold among the plurality of target values; and a first determination submodule, used to, if there is a value greater than the target threshold among the plurality of target values, use the unit test case corresponding to the target value greater than the target threshold as the at least one target unit test case.

[0017] Further, the first test subunit includes: a second execution module, used to re-execute the at least one target unit test case to obtain log information corresponding to the Oracle stored procedure when executing the at least one target unit test case; a first acquisition module, used to acquire the performance metrics of each code segment in the Oracle stored procedure; and a first determination module, used to obtain the performance test report based on the log information and the performance metrics of each code segment.

[0018] Furthermore, the first determining module includes: a first parsing submodule, used to parse the log information to obtain the time consumption ranking and corresponding execution plan of each code segment in the Oracle stored procedure; and a first generating submodule, used to generate the performance test report based on the time consumption ranking, corresponding execution plan and performance indicators of each code segment in the Oracle stored procedure.

[0019] Furthermore, the apparatus further includes: a first determining unit, configured to, after performing performance testing on the Oracle stored procedure based on the at least one target unit test case and obtaining a performance test report, determine the target performance problem corresponding to the Oracle stored procedure based on the performance test report; a third obtaining unit, configured to obtain a target database, wherein the target database is used to store multiple performance problems corresponding to the Oracle stored procedure, the cause of each performance problem, and the repair solution for each performance problem; a fourth obtaining unit, configured to obtain target information from the target database based on the target performance problem, wherein the target information includes at least the target cause of the target performance problem in the Oracle stored procedure and the target repair solution for repairing the target performance problem; and a first sending unit, configured to send the target information to a target user to remind the target user to repair the target performance problem corresponding to the Oracle stored procedure based on the target cause and the target repair solution.

[0020] To achieve the above objectives, according to another aspect of this application, a processor is provided for running a program, wherein the program, when running, executes the performance testing method for the Oracle stored procedure described in any of the above-described embodiments.

[0021] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, the electronic device including one or more processors and a memory, the memory being used to store one or more programs, wherein, when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the performance testing method for Oracle stored procedures described in any of the above.

[0022] This application employs the following steps: obtaining multiple unit test cases for an Oracle stored procedure, wherein the Oracle stored procedure is the stored procedure to be tested for performance, and the multiple unit test cases are used to test the performance of the Oracle stored procedure; obtaining the thresholds corresponding to the performance metrics of the Oracle stored procedure to obtain the target thresholds; and performing performance testing on the Oracle stored procedure based on the multiple unit test cases and the target thresholds. This solves the problem of poor test results when performing performance testing on Oracle stored procedures in related technologies. By obtaining multiple unit test cases and target thresholds corresponding to the performance metrics of the Oracle stored procedure, and performing performance testing on the Oracle stored procedure based on the multiple unit test cases and the target thresholds, the test results for Oracle stored procedure performance testing can be improved. Attached Figure Description

[0023] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0024] Figure 1 This is a flowchart of a performance testing method for Oracle stored procedures provided in the embodiments of this application;

[0025] Figure 2 This is a flowchart of an optional Oracle stored procedure performance testing method provided according to an embodiment of this application;

[0026] Figure 3 This is a schematic diagram of an Oracle stored procedure performance testing apparatus provided according to an embodiment of this application;

[0027] Figure 4 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0028] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0029] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0031] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent information from the aforementioned user or organization.

[0032] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0033] Stored procedures: In large database systems, a set of SQL statements is stored in the database to perform a specific function. It is compiled once and remains valid indefinitely. Users execute it by specifying the stored procedure's name and providing parameters (if the stored procedure has parameters). Stored procedures are an important object in the database.

[0034] Oracle stored procedures: Oracle database technology, the concept of which is a stored subroutine.

[0035] DBMS_Profiler: Specifically designed for analyzing the time overhead of various code segments within an Oracle stored procedure.

[0036] Trace file: A log file generated using Oracle commands.

[0037] Punit: A tool for unit testing of PLSLQ (Procedural Language / SQL) stored procedures, based on UtPlugin.

[0038] UtPlugin: A unit testing tool for PL / SQL stored procedures.

[0039] The present invention will now be described in conjunction with preferred implementation steps. Figure 1 This is a flowchart of a performance testing method for Oracle stored procedures provided in an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:

[0040] Step S101: Obtain multiple unit test cases corresponding to the Oracle stored procedure. The Oracle stored procedure is the stored procedure to be tested for performance, and the multiple unit test cases are used to test the performance of the Oracle stored procedure.

[0041] For example, based on existing unit testing tools such as UTPlugin and Punit, unit test cases for stored procedures can be written. Furthermore, the test case information can include data preparation, data recovery, calling the test stored procedure, assertions, and other components.

[0042] Step S102: Obtain the threshold corresponding to the performance metric of the Oracle stored procedure to obtain the target threshold.

[0043] For example, thresholds can be set for the performance metrics of the Oracle stored procedures to be tested, and the performance metrics of the Oracle stored procedures can include performance metrics such as execution time, CPU, and memory wait monitoring.

[0044] Step S103: Perform performance testing on the Oracle stored procedure based on multiple unit test cases and target thresholds.

[0045] For example, test cases are executed in a performance testing environment, and performance tests are performed on the Oracle stored procedures to be tested based on the pre-defined performance metric thresholds for the Oracle stored procedures.

[0046] By using the steps S101 to S103 described above, multiple unit test cases corresponding to the Oracle stored procedure and target thresholds corresponding to the performance indicators of the Oracle stored procedure are obtained. Based on the multiple unit test cases and target thresholds, performance testing of the Oracle stored procedure is performed, thereby improving the testing effect of performance testing of the Oracle stored procedure.

[0047] How to perform performance testing on Oracle stored procedures is crucial for this application. Therefore, the performance testing method for Oracle stored procedures provided in this application includes the following steps: based on multiple unit test cases and a target threshold, at least one target unit test case is selected from the multiple unit test cases, wherein when executing at least one target unit test case, the performance index of the Oracle stored procedure is greater than the target threshold; the performance of the Oracle stored procedure is performed based on at least one target unit test case, and a performance test report is obtained.

[0048] For example, test cases are executed in a performance testing environment, and problematic unit test cases are identified based on the performance metrics and thresholds of the Oracle stored procedures during execution. Then, performance tests are performed on the Oracle stored procedures based on these problematic unit test cases, resulting in a performance test report.

[0049] In summary, by starting with unit testing, executing stored procedures through unit testing, and monitoring the performance metrics of these procedures, the goal of advancing stored procedure performance testing from the integration testing phase to the unit testing phase is achieved. This solves the problems of late performance testing discovery, difficulty in problem localization, and high repair costs.

[0050] To quickly and accurately obtain target unit test cases, the performance testing method for Oracle stored procedures provided in this application embodiment can also obtain target unit test cases through the following steps: executing each unit test case to obtain multiple target values, wherein the target value is the value corresponding to the performance index of the Oracle stored procedure when executing each unit test case; and selecting at least one target unit test case from multiple unit test cases based on multiple target values ​​and target thresholds.

[0051] For example, test cases can be executed in a performance testing environment, and data entry points can be added during the execution process to identify problematic unit test cases.

[0052] The above approach makes it easy to obtain unit test cases with problems, thereby enabling better performance testing of Oracle stored procedures.

[0053] To obtain target unit test cases quickly and accurately, the performance testing method for Oracle stored procedures provided in this application embodiment can also obtain target unit test cases through the following steps: determining whether there is a value greater than a target threshold among multiple target values; if there is a value greater than the target threshold among multiple target values, taking the unit test case corresponding to the target value greater than the target threshold as at least one target unit test case.

[0054] For example, when executing multiple unit test cases, it is determined whether the performance metrics of the Oracle stored procedure exceed a threshold. If they do, the unit test cases that exceed the threshold are filtered out and identified as problematic unit test cases.

[0055] The above approach can improve the accuracy of obtaining problematic unit test cases.

[0056] To obtain a performance test report quickly and accurately, the performance test method for Oracle stored procedures provided in this application embodiment can also obtain a performance test report through the following steps: re-execute at least one target unit test case to obtain the log information corresponding to the Oracle stored procedure when executing at least one target unit test case; obtain the performance indicators of each code segment in the Oracle stored procedure; and obtain a performance test report based on the log information and the performance indicators of each code segment.

[0057] For example, based on the problematic unit test cases identified through screening, Oracle's Dbms_profiler monitoring and event 10046 (used for generating log files) are enabled, and the problematic unit test cases are rescheduled for generating performance analysis reports.

[0058] The above solutions can improve the accuracy of the generated performance test reports and increase testing efficiency.

[0059] To obtain a performance test report quickly and accurately, the performance test method for Oracle stored procedures provided in this application embodiment can also obtain a performance test report through the following steps: parsing the log information to obtain the time consumption ranking and corresponding execution plan of each code segment in the Oracle stored procedure; generating a performance test report based on the time consumption ranking, corresponding execution plan and performance indicators of each code segment in the Oracle stored procedure.

[0060] For example, the trace log obtained from event 10046 is first formatted using tkprof so that users can clearly read the information in the log. Then, the time order of the SQL statements and the corresponding execution plan are obtained through rule matching. At the same time, combined with the performance metrics of the code lines stored in dbms_profiler, a performance test report is generated.

[0061] The above method can quickly and accurately generate test reports for performance testing of Oracle stored procedures.

[0062] To quickly and accurately fix performance issues in Oracle stored procedures, the performance testing method for Oracle stored procedures provided in this application embodiment can also fix these issues through the following steps: After performing performance testing on the Oracle stored procedure based on at least one target unit test case and obtaining a performance test report, the target performance issue corresponding to the Oracle stored procedure is determined based on the performance test report; a target database is obtained, wherein the target database is used to store multiple performance issues corresponding to the Oracle stored procedure, the cause of each performance issue, and the repair solution for each performance issue; based on the target performance issue, target information is obtained from the target database, wherein the target information includes at least the target cause of the target performance issue in the Oracle stored procedure and the target repair solution for fixing the target performance issue; the target information is sent to the target user to remind the target user to fix the target performance issue corresponding to the Oracle stored procedure based on the target cause and the target repair solution.

[0063] For example, after identifying a performance issue in an Oracle stored procedure through performance testing reports, the root cause and remedial solutions can be obtained from the expert database (the target database mentioned above). Then, email notifications can be sent to remind developers to promptly resolve the issue.

[0064] In summary, by providing specific problem statements, causes, and solutions through diagnostic analysis reports, the cost of problem remediation is greatly reduced, and continuous integration and regression testing of performance can be achieved.

[0065] For example, Figure 2 This is a flowchart of an optional Oracle stored procedure performance testing method provided according to an embodiment of this application, such as... Figure 2 As shown, the performance testing methods for optional Oracle stored procedures can be divided into five parts, specifically:

[0066] (1) Test Case Generation Module: The test case generation module is mainly based on existing unit testing tools such as UTPlugin and Punit to realize the writing of unit test cases for stored procedures. The complete test case information includes data preparation, data recovery, calling the test stored procedure, assertions, etc. At the same time, the performance indicators of the test stored procedure are set with thresholds during the writing stage, including performance indicators such as execution time, CPU, memory, etc.

[0067] (2) Case execution module: Based on the cases generated in module 1, the cases are executed in the performance testing environment. During the execution process, data points are embedded to filter out problems that exceed the threshold.

[0068] (3) Performance replay template: Based on the issues in Module 2, enable Oracle's Dbms_profiler monitoring and event 10046, reschedule unit test cases, and generate performance analysis reports.

[0069] (4) Performance Analysis Module: Based on the expert database, the performance analysis report in Module 3 is analyzed. For the 10046 event, the trace log is first formatted using tkprof, and the execution time of the SQL statements and the corresponding execution plan are obtained through rule matching. At the same time, combined with the performance indicators of the code lines stored in dbms_profiler, the causes of performance problems and the solutions to the problems are obtained from the expert database.

[0070] (5) Report Push Module: Based on the email push module, send email reminders to developers when performance analysis reports are completed. This reminds developers to fix issues promptly.

[0071] In addition, the above modules can be integrated into the Jenkins pipeline (an open-source tool for performing tasks on a schedule), thereby enabling performance control and continuous regression of stored procedures.

[0072] In summary, the Oracle stored procedure performance testing method provided in this application addresses the problem of poor testing results in related technologies by obtaining multiple unit test cases corresponding to the Oracle stored procedure (where the Oracle stored procedure is the stored procedure to be tested) and using these unit test cases to test its performance. The method also obtains thresholds corresponding to the performance metrics of the Oracle stored procedure to arrive at target thresholds. Based on these unit test cases and target thresholds, the performance of the Oracle stored procedure is tested, thereby improving the effectiveness of performance testing for Oracle stored procedures.

[0073] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0074] This application also provides a performance testing apparatus for Oracle stored procedures. It should be noted that this apparatus can be used to execute the performance testing method for Oracle stored procedures provided in this application. The performance testing apparatus for Oracle stored procedures provided in this application is described below.

[0075] Figure 3 This is a schematic diagram of a performance testing apparatus for Oracle stored procedures according to an embodiment of this application. Figure 3 As shown, the device includes: a first acquisition unit 301, a second acquisition unit 302, and a first test unit 303.

[0076] Specifically, the first acquisition unit 301 is used to acquire multiple unit test cases corresponding to the Oracle stored procedure, wherein the Oracle stored procedure is a stored procedure to be tested for performance, and the multiple unit test cases are used to test the performance of the Oracle stored procedure.

[0077] The second acquisition unit 302 is used to acquire the threshold corresponding to the performance index of the Oracle stored procedure to obtain the target threshold.

[0078] The first test unit 303 is used to perform performance tests on Oracle stored procedures based on multiple unit test cases and target thresholds.

[0079] The performance testing apparatus for Oracle stored procedures provided in this application embodiment acquires multiple unit test cases corresponding to the Oracle stored procedure through a first acquisition unit 301. The Oracle stored procedure is the stored procedure to be tested for performance, and the multiple unit test cases are used to test the performance of the Oracle stored procedure. A second acquisition unit 302 acquires the threshold corresponding to the performance indicators of the Oracle stored procedure to obtain a target threshold. A first testing unit 303 performs performance testing on the Oracle stored procedure based on the multiple unit test cases and the target threshold, thus solving the problem of poor test results when performing performance testing on Oracle stored procedures in related technologies. By acquiring multiple unit test cases corresponding to the Oracle stored procedure and the target threshold corresponding to the performance indicators of the Oracle stored procedure, and performing performance testing on the Oracle stored procedure based on the multiple unit test cases and the target threshold, the test results for performing performance testing on Oracle stored procedures can be improved.

[0080] Optionally, in the performance testing apparatus for Oracle stored procedures provided in this application embodiment, the first testing unit includes: a first screening subunit, used to screen at least one target unit test case from multiple unit test cases based on multiple unit test cases and a target threshold, wherein when executing at least one target unit test case, the value of the performance index of the Oracle stored procedure is greater than the target threshold; and the first testing subunit is used to perform performance testing on the Oracle stored procedure based on at least one target unit test case to obtain a performance test report.

[0081] Optionally, in the performance testing apparatus for Oracle stored procedures provided in this application embodiment, the first screening subunit includes: a first execution module, used to execute each unit test case to obtain multiple target values, wherein the target value is the value corresponding to the performance index of the Oracle stored procedure when executing each unit test case; and a first screening module, used to screen at least one target unit test case from multiple unit test cases based on multiple target values ​​and target thresholds.

[0082] Optionally, in the performance testing apparatus for Oracle stored procedures provided in this application embodiment, the first screening module includes: a first judgment submodule, used to determine whether there is a value greater than a target threshold among multiple target values; and a first determination submodule, used to, if there is a value greater than the target threshold among multiple target values, take the unit test case corresponding to the target value greater than the target threshold as at least one target unit test case.

[0083] Optionally, in the performance testing apparatus for Oracle stored procedures provided in this application embodiment, the first testing subunit includes: a second execution module, used to re-execute at least one target unit test case to obtain log information corresponding to the Oracle stored procedure when executing at least one target unit test case; a first acquisition module, used to acquire the performance metrics of each code segment in the Oracle stored procedure; and a first determination module, used to obtain a performance test report based on the log information and the performance metrics of each code segment.

[0084] Optionally, in the performance testing apparatus for Oracle stored procedures provided in this application embodiment, the first determining module includes: a first parsing submodule, used to parse log information to obtain the time consumption ranking and corresponding execution plan of each code segment in the Oracle stored procedure; and a first generating submodule, used to generate a performance test report based on the time consumption ranking, corresponding execution plan, and performance indicators of each code segment in the Oracle stored procedure.

[0085] Optionally, in the performance testing apparatus for Oracle stored procedures provided in this application embodiment, the apparatus further includes: a first determining unit, configured to determine the target performance problem corresponding to the Oracle stored procedure based on the performance test report obtained after performing performance testing on the Oracle stored procedure based on at least one target unit test case; a third obtaining unit, configured to obtain a target database, wherein the target database is used to store multiple performance problems corresponding to the Oracle stored procedure, the cause of each performance problem, and the repair solution for each performance problem; a fourth obtaining unit, configured to obtain target information from the target database based on the target performance problem, wherein the target information includes at least the target cause of the target performance problem in the Oracle stored procedure and the target repair solution for repairing the target performance problem; and a first sending unit, configured to send the target information to the target user to remind the target user to repair the target performance problem corresponding to the Oracle stored procedure based on the target cause and the target repair solution.

[0086] The performance testing device for Oracle stored procedures includes a processor and a memory. The first acquisition unit 301, the second acquisition unit 302, and the first test unit 303 are all stored in the memory as program units. The processor executes the program units stored in the memory to achieve the corresponding functions.

[0087] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and adjusting kernel parameters can improve the performance of Oracle stored procedures.

[0088] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0089] This invention provides a processor for running a program, wherein the program executes a performance testing method for an Oracle stored procedure.

[0090] like Figure 4As shown, an embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: obtaining multiple unit test cases corresponding to an Oracle stored procedure, wherein the Oracle stored procedure is a stored procedure to be tested for performance, and the multiple unit test cases are used to test the performance of the Oracle stored procedure; obtaining a threshold corresponding to the performance index of the Oracle stored procedure to obtain a target threshold; and performing performance testing on the Oracle stored procedure based on the multiple unit test cases and the target threshold.

[0091] When the processor executes the program, it also performs the following steps: Based on the plurality of unit test cases and the target threshold, the performance test of the Oracle stored procedure includes: selecting at least one target unit test case from the plurality of unit test cases based on the plurality of unit test cases and the target threshold, wherein, when executing the at least one target unit test case, the value of the performance indicator of the Oracle stored procedure is greater than the target threshold; and performing a performance test on the Oracle stored procedure based on the at least one target unit test case to obtain a performance test report.

[0092] When the processor executes the program, it also performs the following steps: selecting at least one target unit test case from the plurality of unit test cases based on the plurality of unit test cases and the target threshold, including: executing each unit test case to obtain a plurality of target values, wherein the target value is the value corresponding to the performance index of the Oracle stored procedure when executing each unit test case; selecting the at least one target unit test case from the plurality of unit test cases based on the plurality of target values ​​and the target threshold.

[0093] When the processor executes the program, it also performs the following steps: selecting at least one target unit test case from the plurality of unit test cases based on the plurality of target values ​​and the target threshold, including: determining whether there is a value greater than the target threshold among the plurality of target values; if there is a value greater than the target threshold among the plurality of target values, taking the unit test case corresponding to the target value greater than the target threshold as the at least one target unit test case.

[0094] When the processor executes the program, it also performs the following steps: performing performance testing on the Oracle stored procedure based on the at least one target unit test case, and obtaining a performance test report, including: re-executing the at least one target unit test case to obtain log information corresponding to the Oracle stored procedure when executing the at least one target unit test case; obtaining performance metrics for each code segment in the Oracle stored procedure; and obtaining the performance test report based on the log information and the performance metrics for each code segment.

[0095] When the processor executes the program, it also performs the following steps: Based on the log information and the performance metrics of each code segment, the performance test report is obtained, including: parsing the log information to obtain the time consumption ranking and corresponding execution plan of each code segment in the Oracle stored procedure; and generating the performance test report based on the time consumption ranking, corresponding execution plan, and performance metrics of each code segment in the Oracle stored procedure.

[0096] When the processor executes the program, it also performs the following steps: after performing performance testing on the Oracle stored procedure based on the at least one target unit test case and obtaining a performance test report, the method further includes: based on the performance test report, obtaining the target performance problem corresponding to the Oracle stored procedure; obtaining a target database, wherein the target database is used to store multiple performance problems corresponding to the Oracle stored procedure, the cause of each performance problem, and the repair solution for each performance problem; based on the target performance problem, obtaining target information from the target database, wherein the target information includes at least the target cause of the target performance problem in the Oracle stored procedure and the target repair solution for repairing the target performance problem; and sending the target information to the target user to remind the target user to repair the target performance problem corresponding to the Oracle stored procedure based on the target cause and the target repair solution.

[0097] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0098] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: obtaining multiple unit test cases corresponding to an Oracle stored procedure, wherein the Oracle stored procedure is a stored procedure to be tested for performance, and the multiple unit test cases are used to test the performance of the Oracle stored procedure; obtaining a threshold corresponding to the performance index of the Oracle stored procedure to obtain a target threshold; and performing performance testing on the Oracle stored procedure based on the multiple unit test cases and the target threshold.

[0099] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: Based on the plurality of unit test cases and the target threshold, perform performance testing on the Oracle stored procedure, including: selecting at least one target unit test case from the plurality of unit test cases based on the plurality of unit test cases and the target threshold, wherein, when executing the at least one target unit test case, the value of the performance indicator of the Oracle stored procedure is greater than the target threshold; and perform performance testing on the Oracle stored procedure based on the at least one target unit test case to obtain a performance test report.

[0100] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: selecting at least one target unit test case from the plurality of unit test cases based on the plurality of unit test cases and the target threshold, including: executing each unit test case to obtain a plurality of target values, wherein the target values ​​are the values ​​corresponding to the performance indicators of the Oracle stored procedure when executing each unit test case; selecting the at least one target unit test case from the plurality of unit test cases based on the plurality of target values ​​and the target threshold.

[0101] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: selecting at least one target unit test case from the plurality of unit test cases based on the plurality of target values ​​and the target threshold, including: determining whether there is a value greater than the target threshold among the plurality of target values; if there is a value greater than the target threshold among the plurality of target values, taking the unit test case corresponding to the target value greater than the target threshold as the at least one target unit test case.

[0102] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: performing performance testing on the Oracle stored procedure based on the at least one target unit test case, and obtaining a performance test report including: re-executing the at least one target unit test case to obtain log information corresponding to the Oracle stored procedure when executing the at least one target unit test case; obtaining performance metrics for each code segment in the Oracle stored procedure; and obtaining the performance test report based on the log information and the performance metrics for each code segment.

[0103] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: obtaining the performance test report based on the log information and the performance indicators of each code segment, including: parsing the log information to obtain the time consumption ranking and corresponding execution plan of each code segment in the Oracle stored procedure; and generating the performance test report based on the time consumption ranking, corresponding execution plan, and performance indicators of each code segment in the Oracle stored procedure.

[0104] When executed on a data processing device, the method is also adapted to execute an initialization procedure with the following steps: after performing performance testing on the Oracle stored procedure based on the at least one target unit test case and obtaining a performance test report, the method further includes: based on the performance test report, obtaining the target performance problem corresponding to the Oracle stored procedure; obtaining a target database, wherein the target database is used to store multiple performance problems corresponding to the Oracle stored procedure, the cause of each performance problem, and the repair solution for each performance problem; based on the target performance problem, obtaining target information from the target database, wherein the target information includes at least the target cause of the target performance problem in the Oracle stored procedure and the target repair solution for repairing the target performance problem; and sending the target information to the target user to remind the target user to repair the target performance problem corresponding to the Oracle stored procedure based on the target cause and the target repair solution.

[0105] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0106] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1A device that provides the functions specified in one or more boxes.

[0107] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0108] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0109] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0110] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0111] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0112] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0113] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0114] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method of performance testing of an Oracle stored procedure, characterized by, The method comprises the following steps: obtaining a plurality of unit test cases corresponding to an Oracle stored procedure, wherein the Oracle stored procedure is a stored procedure to be tested for performance, and the plurality of unit test cases are used to test the performance of the Oracle stored procedure; obtaining a threshold value corresponding to a performance indicator of the Oracle stored procedure to obtain a target threshold value; performing performance testing on the Oracle stored procedure according to the plurality of unit test cases and the target threshold value; wherein performing performance testing on the Oracle stored procedure according to the plurality of unit test cases and the target threshold value comprises: selecting at least one target unit test case from the plurality of unit test cases according to the plurality of unit test cases and the target threshold value, wherein the value of the performance indicator of the Oracle stored procedure when executing the at least one target unit test case is greater than the target threshold value; performing performance testing on the Oracle stored procedure based on the at least one target unit test case to obtain a performance test report; selecting at least one target unit test case from the plurality of unit test cases according to the plurality of unit test cases and the target threshold value comprises: executing each unit test case to obtain a plurality of target values, wherein the target value is the value corresponding to the performance indicator of the Oracle stored procedure when each unit test case is executed; selecting the at least one target unit test case from the plurality of unit test cases according to the plurality of target values and the target threshold value.

2. The method of claim 1, wherein, Selecting the at least one target unit test case from the plurality of unit test cases according to the plurality of target values and the target threshold value comprises: determining whether there is a value greater than the target threshold value in the plurality of target values; if there is a value greater than the target threshold value in the plurality of target values, the unit test case corresponding to the target value greater than the target threshold value is taken as the at least one target unit test case.

3. The method of claim 1, wherein, Performing performance testing on the Oracle stored procedure based on the at least one target unit test case to obtain a performance test report comprises: re-executing the at least one target unit test case to obtain log information corresponding to the Oracle stored procedure when the at least one target unit test case is executed; obtaining a performance indicator of each piece of code in the Oracle stored procedure; obtaining the performance test report according to the log information and the performance indicator of each piece of code.

4. The method of claim 3, wherein, Obtaining the performance test report according to the log information and the performance indicator of each piece of code comprises: parsing the log information to obtain a time-consuming sorting and a corresponding execution plan of each piece of code in the Oracle stored procedure; generating the performance test report according to the time-consuming sorting, the corresponding execution plan and the performance indicator of each piece of code in the Oracle stored procedure.

5. The method of claim 1, wherein, After performing performance testing on the Oracle stored procedure based on the at least one target unit test case to obtain a performance test report, the method further comprises: According to the performance test report, a target performance problem corresponding to the Oracle stored procedure is obtained; A target database is acquired, wherein the target database is used to store a plurality of performance problems corresponding to the Oracle stored procedure, a cause corresponding to each performance problem, and a repair scheme corresponding to each performance problem; According to the target performance problem, target information is acquired from the target database, wherein the target information at least includes a target cause of the target performance problem of the Oracle stored procedure and a target repair scheme for repairing the target performance problem; The target information is sent to a target user to remind the target user to repair the target performance problem corresponding to the Oracle stored procedure according to the target cause and the target repair scheme.

6. An apparatus for performance testing of an Oracle stored procedure, the apparatus comprising: Comprise: A first acquisition unit is configured to acquire a plurality of unit test cases corresponding to an Oracle stored procedure, wherein the Oracle stored procedure is a stored procedure to be tested for performance, and the plurality of unit test cases are used to test the performance of the Oracle stored procedure. A second acquisition unit is configured to acquire a threshold value corresponding to a performance indicator of the Oracle stored procedure to obtain a target threshold value. A first test unit is configured to perform performance testing on the Oracle stored procedure according to the plurality of unit test cases and the target threshold value. The first test unit comprises: a first screening subunit configured to screen at least one target unit test case from the plurality of unit test cases according to the plurality of unit test cases and the target threshold value, wherein when the at least one target unit test case is executed, the value of the performance indicator of the Oracle stored procedure is greater than the target threshold value; and a first test subunit configured to perform performance testing on the Oracle stored procedure based on the at least one target unit test case to obtain a performance test report. The first screening subunit comprises: a first execution module configured to execute each unit test case to obtain a plurality of target values, wherein the target value is the value corresponding to the performance indicator of the Oracle stored procedure when each unit test case is executed; and a first screening module configured to screen at least one target unit test case from the plurality of unit test cases according to the plurality of target values and the target threshold value.

7. A processor, comprising: The processor is configured to run a program, wherein the program is executed to perform the performance testing method of the Oracle stored procedure according to any one of claims 1 to 5.

8. An electronic device, comprising: Comprise one or more processors and a memory, wherein the memory is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the performance testing method of the Oracle stored procedure according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Storage process testing method and device, equipment and medium

    CN113392024A

  • Metadata acquisition performance test method and device, equipment and medium

    CN114168440A