WO2018233037A1 - 数据库集成测试方法、装置、服务器及存储介质 - Google Patents

数据库集成测试方法、装置、服务器及存储介质 Download PDF

Info

Publication number
WO2018233037A1
WO2018233037A1 PCT/CN2017/099736 CN2017099736W WO2018233037A1 WO 2018233037 A1 WO2018233037 A1 WO 2018233037A1 CN 2017099736 W CN2017099736 W CN 2017099736W WO 2018233037 A1 WO2018233037 A1 WO 2018233037A1
Authority
WO
WIPO (PCT)
Prior art keywords
script
database
execution
baseline
file
Prior art date
Application number
PCT/CN2017/099736
Other languages
English (en)
French (fr)
Inventor
胡建双
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Priority to JP2019563048A priority Critical patent/JP6799695B2/ja
Publication of WO2018233037A1 publication Critical patent/WO2018233037A1/zh

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
    • 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

Definitions

  • the present invention relates to the field of database integration technologies, and in particular, to a database integration test method, apparatus, server, and storage medium.
  • a database integration test method, apparatus, server, and storage medium are provided.
  • a database integration testing method comprising the following steps:
  • the execution script file is extracted from the new version database file, and the execution script in the execution script file is deployed on the current database after data replacement, and the execution script is executed after the deployment is completed.
  • a database integration testing device comprising:
  • a file receiving module configured to receive a new version of the database file
  • a baseline data search module configured to acquire baseline database information corresponding to the new version database file, and search for database baseline data corresponding to the new version database file according to the baseline database information;
  • a data replacement module for replacing data in the current database with the database baseline data
  • a script deployment running module configured to extract an execution script file from the new version database file, deploy the execution script in the execution script file on the current database after data replacement, and run the execution after deployment is completed script.
  • a server includes a memory and a processor, the memory storing instructions that, when executed by the processor, cause the processor to perform the following steps:
  • Extracting a new version execution script file from the new version database file extracting a new version execution script file from the new version database file, deploying the new version execution script file according to a preset rule on the current database, and running the new version execution script file after the deployment is completed.
  • One or more non-volatile readable storage media storing computer-executable instructions, the computer-executable instructions being executed by one or more processors, such that the one or more processors perform the steps of:
  • Extracting a new version execution script file from the new version database file extracting a new version execution script file from the new version database file, deploying the new version execution script file according to a preset rule on the current database, and running the new version execution script file after the deployment is completed.
  • FIG. 1 is an application environment diagram of a database integration test method in an embodiment
  • FIG. 2 is a schematic diagram showing the internal structure of a computer device in an embodiment
  • FIG. 3 is a flow chart of a database integration test method in an embodiment
  • FIG. 5 is a flow chart of a database integration test method in still another embodiment
  • FIG. 6 is a schematic structural diagram of a database integration testing device in an embodiment
  • FIG. 7 is a schematic structural diagram of a database integration test apparatus in another embodiment
  • FIG. 8 is a schematic structural diagram of a database integration test apparatus in still another embodiment
  • FIG. 9 is a schematic structural diagram of a database integration test apparatus in still another embodiment.
  • server 102 is coupled to production server 104 via a corresponding network.
  • Server 102 can receive a new version of the database file sent by production server 104.
  • the production server 104 is used to develop a production database, or to update the version of the database of the old version, and the production server 104 sends the relevant file of the developed new version database to the server 102 for testing.
  • the new version of the database file includes the data and files necessary for building the database, such as database basic data, object data, and execution script files.
  • the server 102 obtains the baseline database information corresponding to the new version database file, searches the database baseline data corresponding to the new version database file according to the baseline database information, replaces the data in the current database with the database baseline data, and extracts and executes the data from the new version database file.
  • the script file is used to deploy the execution script in the execution script file on the current database after the data is replaced. After the deployment is completed, the execution script is executed to implement the database rapid integration test.
  • the server includes a processor, memory, and network interface connected by a system bus.
  • the processor is used to provide computing and control capabilities to support the operation of the entire server.
  • the memory is used to store data, instruction code, etc., store baseline database information for all version baseline databases, and database baseline data for each baseline database.
  • the network interface is used for external production servers and servers to communicate via a network connection.
  • At least one computer executable instruction is stored on the memory, the computer executable instructions being executable by the processor to implement the database integration test method provided in various embodiments of the present application.
  • Memory can include disk, CD, read-only memory (Read-Only) A nonvolatile storage medium such as a memory or a ROM, or a random storage memory (Random-Access-Memory, RAM).
  • the memory includes a non-volatile storage medium and an internal memory.
  • the server's non-volatile storage medium stores operating system, database, and computer executable instructions.
  • the database stores data relating to a database integration test method provided by the various embodiments described below.
  • the computer executable instructions are executable by a processor for implementing a database integration testing method as provided by various embodiments described below.
  • the internal memory in the terminal provides a cached operating environment for operating systems, databases, and computer executable instructions in a non-volatile storage medium.
  • FIG. 2 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied.
  • the specific server may include a ratio. More or fewer components are shown in the figures, or some components are combined, or have different component arrangements.
  • a database integration test method is provided. This embodiment is applied to the environment shown in FIG. 1 by the method, and is applied to the server shown in FIG. 2 for illustration.
  • the database integration test method includes the following steps:
  • Step 310 receiving a new version database file.
  • the server receives the new version of the database file submitted from the database production environment.
  • the new version of the database file includes the database basic data, object data, and execution script files, etc., and the data and files necessary to build the database.
  • the new version of the database in different versions in this embodiment is developed and produced based on the same basic version database, for example, the new version database may be V1.1 version, V1.2 version, V1.3 version, etc. They are all developed based on the V1.0 base version database.
  • the new version database refers to the database that needs to be tested.
  • the new version database file may be the database file that needs to be tested for the first time, or may be abnormal after the test script, and the developer may correct and re- Submitted database file.
  • Step 320 Obtain baseline database information corresponding to the new version database file, and search database baseline data corresponding to the new version database file according to the baseline database information.
  • the database files of all the base version databases are stored in the server.
  • the server can find the basic version database information based on the new version database according to the new version database information, and the database information can be the database name or the database version number, etc., so that the stored basic version database file can be found according to the basic version database information, from the basic
  • the database baseline data extracted to the underlying version database is extracted from the version database file.
  • the database baseline data includes the structure data of the database and other basic data, basic scripts, but does not include specific database object content data and execution script files of the new version of the database.
  • step 330 the data in the current database is replaced with database baseline data.
  • the current database refers to the database in the server's test environment that is being tested or waiting to be tested, and the current database and the new version database are developed based on the same underlying database.
  • the server stops the current database operation through the database command.
  • the server replaces the data summarized by the current database with the database baseline data of the base database, so as to roll back the data in the current test environment to the baseline data.
  • the server restarts the database with a database command.
  • Step 340 Extract the execution script file from the new version database file, deploy the execution script in the execution script file on the current database after the data replacement, and run the execution script after the deployment is completed.
  • the server extracts the execution script file from the obtained new version database file.
  • the execution script file contains multiple execution scripts, and the multiple execution scripts are all the scripts to be deployed and executed in the new version database.
  • the execution script is a database SQL script, and the execution script can also be a script of other formats.
  • the server extracts the script files one by one from the execution script file according to the preset rules, and deploys the extracted script files in the current database that has been rolled back to the baseline state. After all the execution scripts are deployed, the server is in the test environment. Build a complete new version of the database, after the database is built, the server starts running the execution script and monitors the running results in real time.
  • the server when receiving the new version database file submitted by the production environment and needing to be tested, the server obtains the baseline database information corresponding to the new version database file, and searches for the corresponding database baseline data corresponding to the storage, and the current The data in the database that completed the test is replaced with the found database baseline data to roll back the data in the current database to the baseline state, without having to build the database from scratch, and extract and automatically deploy new from the new version database file according to the preset rules.
  • the version of the execution script file requires less scripts to be deployed, which improves the efficiency of the new version of the database build work and the database execution script deployment work, and reduces the execution time of the script and improves the test efficiency due to the small amount of scripts.
  • the database integration test method further includes the following steps:
  • Step 350 Generate a baseline structure library according to the database structure data in the current database.
  • the new version database can go online through the test.
  • the server receives the baseline database build instruction, it indicates that the new version of the database needs to be used as the base database, so that the subsequently developed database is designed and developed based on this library.
  • the server After the server obtains the baseline database build instruction, it constructs an empty database and copies the database structure data in the current database to the constructed empty database to generate a baseline structure library.
  • Step 360 Obtain a baseline data list, extract basic data from the current database according to the baseline data list, and back up the basic data, and import the backed basic data into the baseline structure library to generate a baseline database.
  • the server obtains a baseline data list of the new version database, which may be submitted by the developer or pre-stored on the server.
  • the server matches the data names listed in the baseline data list with the data in the current database and extracts the successfully matched data from the current database.
  • the extracted basic data is backed up and named with the name or version number of the new database, so as to be the database baseline data of several new versions developed in the future.
  • the server imports the backed up basic data into the created baseline structure library to generate a baseline database.
  • the new version database can deploy the script file to be executed on the baseline database to build the new version database.
  • the baseline database is verified by the developer and can be put into use or released after verification.
  • the server performs compression processing on the extracted basic data, and performs backup processing after the compression processing. It can be compressed by reducing the table space, deleting unnecessary data, and so on. It can reduce the time of data backup and copying, and improve the efficiency of database construction.
  • the server may extract the structural data and the basic data to build the baseline structure library from the current database according to the baseline database construction instruction, so that the current structural library can be used as a new development version in the future.
  • the basis of the database Therefore, when the developer wants to build the baseline database according to the needs of the production work, the server can quickly and easily build the baseline database and back up and store the basic data by the method in the embodiment, and the operation is simple. And because the deployment of the baseline database has fewer deployment scripts, it also facilitates the maintenance of the later multi-version database and saves manpower.
  • the step of deploying the execution script in the new version execution script file in step 140 on the current database after data replacement includes:
  • the script name is read from the first configuration table, the name of the read script is matched with the name of the execution script, and the matching execution script is deployed in the current database;
  • the execution script is classified, the executed execution scripts are sorted, and the sorted execution scripts are deployed in the current database.
  • the first configuration table may be pre-stored locally on the server, or may be saved in a new version database file, and the server obtains the first configuration table.
  • the first configuration table is a script execution order configuration table.
  • the first configuration table lists the names of all execution scripts and specifies the order in which all execution scripts are deployed. All execution scripts of the database are uniformly named according to the standard naming standard. The name of the execution script includes the type information of the script, the execution function information, and the sequence code.
  • the server reads the execution script name in order from the first configuration table, and matches the read script name with the script name in the execution script file. When the matching is successful, the matching succeeds is extracted from the execution script file. Execute the script and deploy the matching execution scripts in the order in which the script names are read in the current database that has been replaced by the data until all execution scripts are deployed. When the execution script name read from the first configuration table does not match the corresponding execution script in the execution script file, the execution script name is skipped and the execution of the next execution script name is continued.
  • the server When the server cannot find the first configuration table from the local or new version database file, the server obtains a preset script classification sort table.
  • the terminal classifies the execution script according to the script type information in the execution script name. For example, the first two letters of the names of the scripts of different classifications are different, such as the beginning of the SR is a class, the beginning of the SQ is a class, and the beginning of the SD For another class, etc.
  • the execution scripts in each category are sorted according to the number from large to small or from small to large according to the sequence number of the execution script.
  • the server After the execution scripts in all categories are sorted, the server obtains the sort order of the script categories in the script sorting table.
  • the script at the beginning of SR precedes the script at the beginning of SQ
  • the script at the beginning of SQ precedes the script at the beginning of SD.
  • the server sorts the execution scripts between different categories according to the sort order of the script sorting table, and finally deploys the sorted execution scripts in the current database.
  • the execution script information is included in the script name of the execution script.
  • the server extracts the execution user information from the name of the execution script, and compares the two from the user information of the local execution user. If the user information is consistent, the following deployment operations are continued. When the user information is inconsistent, the operation permission reminder is performed, and the current operation is interrupted. Thereby, the operation authority of the execution user can be set to avoid malicious operations by unauthorized persons.
  • the server by setting the first configuration table in advance, the server performs name matching according to the script name in the configuration table and the script in the execution script file, and automatically deploys the successfully matched scripts in the current database according to the order in the table.
  • the execution script can be sorted by obtaining the script classification sorting table, thereby implementing the automatic deployment of the execution script in the new version database, without manual manual deployment, and improving the deployment work. Work efficiency and save manpower.
  • step 140 the following steps are further included:
  • Step 370 Obtain a second configuration table, where the second configuration table includes an abnormal keyword.
  • the server obtains a pre-stored second configuration table, and the second configuration table includes all abnormal keywords that may appear in all abnormal execution results, such as "SP2-", “CPY-”, “ORA-”, and "Warning". Word, from the exception keyword can determine the specific reason for the execution of the script to run an exception. When these keywords appear in the run script for these execution scripts, it indicates that the execution of the script is abnormal.
  • step 380 the running result of the execution script is monitored, and it is determined whether the abnormal keyword is included in the running result.
  • the new version database is completed, and the server starts running the execution script of the deployment and monitors the running result of the execution script in real time. After the execution of each execution script, the server obtains the running result, reads the exception keyword in the second configuration table one by one, and matches the obtained running result to determine whether the abnormal keyword is included in the running result.
  • Step 390 Obtain a script name of the execution script corresponding to the running result, generate an operation abnormality alarm according to the abnormal keyword and the script name, and send the abnormality alarm to the monitoring terminal.
  • the server determines that the running result contains any abnormal keyword in the second configuration table, it indicates that the execution of the script is abnormal, the server obtains the script name of the execution script that runs abnormally, and according to the abnormal keyword included in the running result. And the script name generates a running abnormal alarm, and the server obtains the contact information of the monitoring terminal, the contact information may be a terminal address, a mailbox information, etc., and the server sends an abnormal operation alarm to the monitoring terminal through the contact information, so that the monitoring personnel can obtain the execution of the abnormal operation. The information of the script and the reason for the abnormal operation. When the exception result is not included in the running result, no processing is performed.
  • the server can perform an abnormality alarm notification in real time, that is, during the execution of the execution script, as long as one execution script is abnormally monitored, an exception alarm is generated according to the execution script and the running result. And send it to the monitoring terminal in time.
  • an abnormality alarm notification in real time, that is, during the execution of the execution script, as long as one execution script is abnormally monitored, an exception alarm is generated according to the execution script and the running result. And send it to the monitoring terminal in time.
  • the server detects that there is an abnormal running result
  • the execution script and the corresponding running result of the abnormality are recorded, and after all the scripts are executed, all the abnormal results recorded are summarized.
  • a running abnormality alarm is generated, and the summarized running abnormality alarm is sent to the monitoring terminal.
  • the server can automatically perform the matching of the abnormal keyword in the monitored running result and determine whether the execution result of the execution script is abnormal, without manual verification, and
  • the abnormal result generation operation abnormality alarm is sent to the monitoring terminal, so that the monitoring terminal clearly knows which execution scripts of the abnormality occur according to the running abnormality alarm, and is convenient for the developer to correct the database script according to the running abnormality alarm.
  • the database integration test method further includes the steps of: monitoring a single script running time of executing the script; determining whether the single script running time exceeds a preset single script running time threshold; if yes, executing the script name and running of the script The time is recorded and added to the abnormal alarm; the total running time of the execution script is detected, and it is judged whether the total running time exceeds the preset running time threshold; if yes, the running of the executing script is interrupted and a running timeout alarm is sent to the monitoring terminal.
  • the server obtains a preset single script runtime threshold and a preset script total runtime threshold.
  • the server monitors the running time of each script's single script and records the running time of each script. After an execution script is completed, the terminal obtains the running time of the script, and compares the running time of the script with the preset single script running time threshold. When the running time of the script exceeds the preset single script running time threshold, The server gets the script name of the script and adds the script's script name and runtime record to the exception alert, so that the monitor can keep track of the running time of the single script.
  • the server also performs monitoring of the total running time of the execution script. After each execution script is completed, the server superimposes the running time of the execution script and the running time of the executed execution script, and judges the total of the superimposed execution. Whether the running time exceeds the preset running time threshold of the script. When the total running time does not exceed the preset running time threshold, continue to run the next execution script. When the total running time exceeds the preset running time threshold, the server is interrupted. Run the script to generate a run timeout alert and send a run timeout alert to the monitoring terminal.
  • the server monitors the running time of the single script and records the running time of the single script in the abnormal alarm, so that the monitoring developer can obtain the running time of each script, so that the developer can find the running time. Execute scripts that take too long to run and optimize. By monitoring the total running time of the deployment script, the server can interrupt the running of the script when the running time exceeds the threshold, and avoid the waste of test resources caused by the abnormal situation such as the infinite loop of the script.
  • a virtual machine is set up on the server, the current database is installed on the virtual machine, the database environment is set up on the virtual machine, the script is deployed, and the execution of the script is performed.
  • the new version database is developed on the host, the new version database file is submitted from the host to the virtual machine.
  • the database integration test workflow starts.
  • the trigger can be built on the virtual machine, and the trigger mode is set to trigger the database integration test workflow when a new database file is submitted.
  • multiple virtual machines can be set up on the server.
  • multiple versions of the developed database need to be tested at the same time, multiple versions of the database can be installed on different virtual machines. Synchronous testing, separate database environment construction on each virtual machine, to achieve concurrent testing of multi-version database, improve the efficiency of testing work.
  • a database integration testing device which can be run on a server, including: a file receiving module 610, a baseline data lookup module 620, a data replacement module 630, and script deployment. Run module 640. among them:
  • the file receiving module 610 is configured to receive a new version database file.
  • the baseline data searching module 620 is configured to obtain baseline database information corresponding to the new version database file, and search the database baseline data corresponding to the new version database file according to the baseline database information.
  • the data replacement module 630 is configured to replace data in the current database with database baseline data.
  • the script deployment running module 640 is configured to extract an execution script file from the new version database file, deploy the execution script in the execution script file on the current database after the data is replaced, and execute the execution script after the deployment is completed.
  • the apparatus further includes:
  • the structure library generating module 650 is configured to generate a baseline structure library according to the database structure data in the current database.
  • the baseline library generating module 660 is configured to obtain a baseline data list, extract basic data from the current database according to the baseline data list, and back up the basic data, and import the backed up basic data into the baseline structure library to generate a baseline database.
  • the script deployment run module 640 includes:
  • Matching the deployment module when the first configuration table is found, the script name is read from the first configuration table, the name of the read script is matched with the name of the execution script, and the matching execution script is deployed in the current database. in.
  • the sorting deployment module is configured to classify the execution scripts when the first configuration table is not found, sort the executed execution scripts, and deploy the sorted execution scripts in the current database.
  • the device further includes:
  • the configuration table obtaining module 670 is configured to obtain a second configuration table, where the second configuration table includes an abnormal keyword.
  • the result detecting module 680 is configured to monitor a running result of the execution script, and determine whether the abnormal keyword is included in the running result.
  • the abnormality alarm sending module 690 is configured to acquire a script name of the execution script corresponding to the operation result, generate an operation abnormality alarm according to the abnormal keyword and the script name, and send the abnormality alarm to the monitoring terminal.
  • the device further includes:
  • a single script time monitoring module 691 configured to monitor a single script running time of the execution script
  • the single script time judging module 693 is configured to determine whether the single script running time exceeds a preset single script running time threshold
  • a time recording module 695 configured to record and add a script name and a running time of the execution script to the abnormal alarm
  • the total time detecting module 697 is configured to detect a total running time of the execution script, and determine whether the total running time exceeds a preset running time threshold of the script;
  • the timeout alarm sending module 699 is configured to interrupt the running of the execution script and send a running timeout alarm to the monitoring terminal.
  • the various modules in the database integration test device described above may be implemented in whole or in part by software, hardware, and combinations thereof.
  • the network interface may be an Ethernet card or a wireless network card.
  • the above modules may be embedded in the hardware in the terminal or in the memory in the terminal, or may be stored in the memory in the terminal in a software form, so that the processor calls the execution of the operations corresponding to the above modules.
  • the processor can be a central processing unit (CPU), a microprocessor, a microcontroller, or the like.
  • the storage medium may be a magnetic disk, an optical disk, or a read-only storage memory (Read-Only) Memory, ROM), etc.

Landscapes

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

Abstract

一种数据库集成测试方法、装置、服务器及存储介质。其中,数据库集成测试方法具体包括以下步骤:接收新版本数据库文件(S310),获取新版本数据库文件对应的基线数据库信息,根据基线数据库信息查找新版本数据库文件对应的数据库基线数据(S320),将当前数据库中的数据替换为数据库基线数据(S330),从新版本数据库文件中抽取执行脚本文件,将执行脚本文件中的执行脚本部署在经过数据替换后的当前数据库上,部署完成后运行执行脚本(S340)。采用本方法能够降低脚本部署难度和测试执行时间。

Description

数据库集成测试方法、装置、服务器及存储介质
本申请要求于2017年6月20日提交中国专利局、申请号为2017104706440、发明名称为“数据库集成测试方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
【技术领域】
本发明涉及数据库集成技术领域,特别是涉及一种数据库集成测试方法、装置、服务器及存储介质。
【背景技术】
数据库在移交、发布的测试过程中,脚本执行异常的情况较为频繁发生,脚本执行出错后,需要修改数据库文件并重新验证修改后脚本的正确性。目前,在测试出现异常时,通常采用将数据库中的数据清空,把从建库到当前版本的所有历史数据和脚本重新部署的方式。并且,在重新进行脚本验证时,需要将从建库到当前版本的所有脚本都执行一遍。采用上述方法所有脚本需要统一维护部署,脚本部署难度大,且数据库集成测试的执行时间长,测试效率低。
【发明内容】
根据本申请的各种实施例,提供一种数据库集成测试方法、装置、服务器及存储介质。
一种数据库集成测试方法,所述方法包括以下步骤:
接收新版本数据库文件;
获取所述新版本数据库文件对应的基线数据库信息,根据所述基线数据库信息查找所述新版本数据库文件对应的数据库基线数据;
将当前数据库中的数据替换为所述数据库基线数据;及
从所述新版本数据库文件中抽取执行脚本文件,将所述执行脚本文件中的执行脚本部署在经过数据替换后的所述当前数据库上,部署完成后运行所述执行脚本。
一种数据库集成测试装置,所述装置包括:
文件接收模块,用于接收新版本数据库文件;
基线数据查找模块,用于获取所述新版本数据库文件对应的基线数据库信息,根据所述基线数据库信息查找所述新版本数据库文件对应的数据库基线数据;
数据替换模块,用于将当前数据库中的数据替换为所述数据库基线数据;及
脚本部署运行模块,用于从所述新版本数据库文件中抽取执行脚本文件,将所述执行脚本文件中的执行脚本部署在经过数据替换后的所述当前数据库上,部署完成后运行所述执行脚本。
一种服务器,包括存储器和处理器,所述存储器中存储有指令,所述指令被所述处理器执行时,使得所述处理器执行以下步骤:
接收新版本数据库文件;
获取所述新版本数据库文件对应的基线数据库信息,根据所述基线数据库信息查找所述新版本数据库文件对应的数据库基线数据;
将当前数据库中的数据替换为所述数据库基线数据;
从所述新版本数据库文件中抽取新版本执行脚本文件,将所述新版本执行脚本文件根据预设规则部署在所述当前数据库上,部署完成后运行所述新版本执行脚本文件。
一个或多个存储有计算机可执行指令的非易失性可读存储介质,所述计算机可执行指令被一个或多个处理器执行,使得所述一个或多个处理器执行以下步骤:
接收新版本数据库文件;
获取所述新版本数据库文件对应的基线数据库信息,根据所述基线数据库信息查找所述新版本数据库文件对应的数据库基线数据;
将当前数据库中的数据替换为所述数据库基线数据;
从所述新版本数据库文件中抽取新版本执行脚本文件,将所述新版本执行脚本文件根据预设规则部署在所述当前数据库上,部署完成后运行所述新版本执行脚本文件。
本发明的一个或多个实施例的细节在下面的附图和描述中提出。本发明的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。
【附图说明】
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为一个实施例中数据库集成测试方法的应用环境图;
图2为一个实施例中计算机设备的内部结构示意图;
图3为一个实施例中数据库集成测试方法的流程图;
图4为另一个实施例中数据库集成测试方法的流程图;
图5为又一个实施例中数据库集成测试方法的流程图;
图6为一个实施例中数据库集成测试装置的结构示意图;
图7为另一个实施例中数据库集成测试装置的结构示意图;
图8为又一个实施例中数据库集成测试装置的结构示意图;
图9为再一个实施例中数据库集成测试装置的结构示意图。
【具体实施方式】
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明实施例所提供的数据库集成测试方法,可应用于如图1所示的应用环境中。参考图1,服务器102通过相应的网络与生产服务器104连接。服务器102可以接收生产服务器104发送的新版本数据库文件。生产服务器104用于开发生产数据库,或对老版本的数据库进行版本升级更新,生产服务器104将开发后的新版本数据库的相关文件发送给服务器102进行测试。新版本数据库文件中包括数据库基础数据、对象数据和执行脚本文件等构建数据库所必须的数据和文件。服务器102获取新版本数据库文件对应的基线数据库信息,根据基线数据库信息查找新版本数据库文件对应的数据库基线数据,将当前数据库中的数据替换为数据库基线数据,从所述新版本数据库文件中抽取执行脚本文件,将执行脚本文件中的执行脚本部署在经过数据替换后的所述当前数据库上,部署完成后运行所述执行脚本,以实现数据库快速集成测试。
图2为一个实施例中服务器的内部结构示意图。该服务器包括通过系统总线连接的处理器、存储器和网络接口。其中,该处理器用于提供计算和控制能力,支撑整个服务器的运行。存储器用于存储数据、指令代码等,存储有所有版本基线数据库的基线数据库信息,以及每个基线数据库的数据库基线数据。网络接口用于外部的生产服务器以及服务器等通过网络连接通信。
该存储器上存储至少一个计算机可执行指令,该计算机可执行指令可被处理器执行,以实现本申请各实施例中提供的数据库集成测试方法。存储器可包括磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random-Access-Memory,RAM)等。在一个实施例中,存储器包括非易失性存储介质及内存储器。服务器的非易失性存储介质存储有操作系统、数据库和计算机可执行指令。该数据库中存储有用于实现下述各个实施例所提供的一种数据库集成测试方法相关的数据。该计算机可执行指令可被处理器所执行,以用于实现下述各个实施例所提供的一种数据库集成测试方法。终端中的内存储器为非易失性存储介质中的操作系统、数据库和计算机可执行指令提供高速缓存的运行环境。
本领域技术人员可以理解,图2中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的服务器的限定,具体的服务器可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,如图3所示,提供了一种数据库集成测试方法,。本实施例以该方法应用于图1所示的环境中,并应用于如图2所示的服务器来举例说明。参照图3,该数据库集成测试方法包括以下步骤:
步骤310,接收新版本数据库文件。
服务器接收从数据库生产环境提交的新版本数据库文件。新版本数据库文件中包括数据库基础数据、对象数据和执行脚本文件等等构建数据库所必须的数据和文件。
需要说明的是,本实施例中的不同版本的新版本数据库都是基于同一个基础版本数据库进行开发生产的,如新版本数据库可以为V1.1版本、V1.2版本及V1.3版本等,它们都是基于V1.0基础版本数据库进行开发的。
在本实施例中,新版本数据库是指需要进行测试的数据库,新版本数据库文件可以为首次开发出来的需要进行测试的数据库文件,也可以是经过测试脚本出现异常,由开发人员进行修正并重新提交的数据库文件。
步骤320,获取新版本数据库文件对应的基线数据库信息,根据基线数据库信息查找新版本数据库文件对应的数据库基线数据。
服务器中存储了所有的基础版本数据库的数据库文件。服务器根据新版本数据库信息可以查找到新版本数据库所基于的基础版本数据库信息,数据库信息可以为数据库名称或数据库版本号等,从而根据基础版本数据库信息可以查找到存储的基础版本数据库文件,从基础版本数据库文件中提取到基础版本数据库的数据库基线数据。数据库基线数据包括数据库的结构数据和其他基础数据、基础脚本,但不包括具体的数据库对象内容数据和新版数据库的执行脚本文件。
步骤330,将当前数据库中的数据替换为数据库基线数据。
当前数据库是指服务器的测试环境中正在进行测试或者正在等待测试的数据库,且当前数据库与新版本数据库是基于同一基础数据库进行开发的。服务器通过数据库命令停止当前数据库运行,当数据库停止运行后,服务器将当前数据库汇总的数据替换为基础数据库的数据库基线数据,以实现使当前测试环境中的数据回滚到基线数据。当数据替换完成后,服务器通过数据库命令重新启动数据库。
步骤340,从新版本数据库文件中抽取执行脚本文件,将执行脚本文件中的执行脚本部署在经过数据替换后的当前数据库上,部署完成后运行执行脚本。
服务器从获取的新版本数据库文件中抽取执行脚本文件,执行脚本文件中包含多个执行脚本,多个执行脚本为新版本数据库中所有待部署和执行的脚本。一般的,执行脚本是数据库SQL脚本,执行脚本也可以为其他格式的脚本。
服务器根据预设规则从执行脚本文件中逐一提取脚本文件,并将提取出的脚本文件依次部署在已回滚到基线状态的当前数据库上,当所有的执行脚本部署完成后,服务器在测试环境中构建出完整的新版本数据库,数据库构建好后,服务器开始运行执行脚本并实时监控运行结果。
在本实施例中,服务器在接收到生产环境提交的需要进行测试的新版本数据库文件时,获取新版本数据库文件对应的基线数据库信息,并查找与其对应的已进行存储的数据库基线数据,将当前完成测试的数据库中的数据替换为查找到的数据库基线数据,以实现将当前数据库中的数据回滚到基线状态,无需从头构建数据库,并根据预设规则从新版本数据库文件中抽取并自动部署新版本的执行脚本文件,所需部署的脚本量少,从而提高新版本数据库构建工作以及数据库执行脚本部署工作的效率,并且因脚本量少能够减少脚本的执行时间,提高测试效率。
在一个实施例中,如图4所示,数据库集成测试方法还包括以下步骤:
步骤350,根据当前数据库中的数据库结构数据生成基线结构库。
执行脚本在运行完成后,若脚本执行过程中没有出现执行异常的情况,则新版本数据库通过测试可以上线。在新版本数据库通过测试之后,若服务器接收到基线数据库构建指令,则表明需要新版本数据库需要作为基础数据库,以便后续开发的数据库以此库为基础进行设计开发生产。
服务器获取基线数据库构建指令后,构建一个空数据库,并将当前数据库中的数据库结构数据复制到构建的空数据库中生成基线结构库。
步骤360,获取基线数据列表,根据基线数据列表从当前数据库中抽取基本数据并对基本数据进行备份,将备份后的基本数据导入基线结构库,生成基线数据库。
服务器获取新版本数据库的基线数据列表,基线数据列表可以是开发人员提交的,也可以是预先存储在服务器上的。服务器将基线数据列表中所列的数据名称与当前数据库中的数据进行匹配,并将匹配成功的数据从当前数据库中抽取出来。对抽取出来的基本数据进行备份,并以新版数据库的名称或版本号等进行命名,以便作为以后开发的多个新版本的数据库基线数据。服务器将备份好的基本数据导入制作好的基线结构库中生成基线数据库,新版本数据库可以在此基线数据库上部署待执行的脚本文件,进行新版本数据库的构建。在一个实施例中,在生成基线数据库之后,由开发人员对基线数据库进行检查验证,在验证无误后可以投入使用或进行发布。
在一个实施例中,服务器对抽取到的基本数据进行压缩处理,在压缩处理后再进行备份工作。可以通过缩小表空间、删除不必要的数据等方式进行压缩处理。可以减少数据备份以及拷贝的时间,提高数据库构建工作的效率。
在本实施例中,当经过数据替换的当前数据库通过测试后,服务器可以根据基线数据库构建指令从当前数据库中提取结构数据和基本数据构建基线结构库,以使当前结构库可以作为以后新开发版本数据库的基础。由此,当开发人员根据生产工作的需要想要构建基线数据库时,服务器可以通过本实施例中的方法方便快捷地构建基线数据库并对基本数据进行备份存储,操作简单。并且由于构建的基线数据库的部署脚本较少,也方便后期多版本数据库的维护工作,节省人力。
在一个实施例中,步骤140中新版本执行脚本文件中的执行脚本部署在经过数据替换后的当前数据库上的步骤具体包括:
当查找到第一配置表时,从第一配置表中读取脚本名称,将读取到的脚本名称与执行脚本进行名称匹配,将匹配成功的执行脚本部署在当前数据库中;当查找不到第一配置表时,对执行脚本进行归类,将归类后的执行脚本进行排序,将排序后的执行脚本部署在当前数据库中。
第一配置表可以预先存储在服务器本地,也可以保存在新版本数据库文件中,服务器获取第一配置表。第一配置表为脚本执行顺序配置表,第一配置表中列出了所有执行脚本的名称并规定了所有执行脚本的部署顺序。数据库的所有执行脚本都是按照规范命名标准进行统一命名的,执行脚本的名称中包含脚本的类型信息、执行功能信息以及序列编码等。
服务器从第一配置表中按照排列顺序依次读取执行脚本名称,并将读取到的脚本名称与执行脚本文件中的脚本名称进行匹配,当匹配成功时,从执行脚本文件中抽取匹配成功的执行脚本,并将匹配成功的执行脚本按照脚本名称读取的顺序部署在经过数据替换的当前数据库中,直至所有的执行脚本部署完毕。当从第一配置表中读取到的执行脚本名称在执行脚本文件中匹配不到相应的执行脚本时,跳过该条执行脚本名称并继续执行下一条执行脚本名称的匹配。
当服务器从本地或者从新版本数据库文件中查找不到第一配置表时,服务器获取预设的脚本分类排序表。终端根据执行脚本名称中的脚本类型信息对执行脚本进行归类,例如,不同分类的脚本的名称的首两位字母不同,如SR开头的为一类,SQ开头的为一类,SD开头的为另一类等。终端对执行脚本归类完成后,根据执行脚本的序列编号,对每一类别中的执行脚本进行按照编号从大到小、或者从小到大的顺序进行排序。当所有类别中的执行脚本排序完成后,服务器获取脚本分类排序表中脚本类别的排序顺序,如SR开头的脚本先于SQ开头的脚本,SQ开头的脚本先于SD开头的脚本等。服务器根据脚本分类排序表的排序顺序对不同类别间的执行脚本进行排序,并最终将排序完成的执行脚本部署在当前数据库中。
在一个实施例中,执行脚本的脚本名称中包含执行用户信息,在部署执行脚本之前,服务器从执行脚本的名称中提取执行用户信息,并从获取本地执行用户的用户信息,将两者进行比较,判断用户信息是否一致,当用户信息一致时,继续进行下面的部署操作,当用户信息不一致时,进行无操作权限的提醒,并中断当前的操作。由此,可以对执行用户的操作权限进行设置,避免无权限人员进行恶意操作。
在本实施例中,通过预先设置第一配置表,服务器根据配置表中脚本名称与执行脚本文件中的脚本进行名称匹配,并将匹配成功的脚本按照表中排列顺序自动部署在当前数据库中,当服务器查找不到第一配置表时,可以通过获取脚本分类排序表的方式对执行脚本进行排序,从而实现新版本数据库中执行脚本的全自动部署,无需人工进行手动部署,提高了部署工作的工作效率并且节省了人力。
在一个实施例中,如图5所示,在步骤140之后还包括以下步骤:
步骤370,获取第二配置表,第二配置表中包括异常关键字。
服务器获取预先存储的第二配置表,第二配置表中包括所有异常执行结果中可能出现的所有异常关键字,如“SP2-”、“CPY-”、“ORA-”以及“Warning”等关键字,从异常关键字可以判断出执行脚本运行出现异常的具体原因。当出现这些执行脚本的运行脚本中出现这些关键字时,表明执行脚本的运行出现异常。
步骤380,监测执行脚本的运行结果,判断运行结果中是否包含异常关键字。
执行脚本的部署工作完成后,新版本数据库构建完成,服务器开始运行部署的执行脚本并对执行脚本的运行结果进行实时监控。每条执行脚本运行结束后,服务器获取运行结果,逐一读取第二配置表中的异常关键字并与获取的运行结果进行匹配,判断运行结果中是否包含异常关键字。
步骤390,获取运行结果对应的执行脚本的脚本名称,根据异常关键字和脚本名称生成运行异常警报,将异常警报发送至监控终端。
当服务器判断出运行结果中包含第二配置表中的任一异常关键字时,表明执行脚本运行出现异常,服务器获取运行异常的执行脚本的脚本名称,并根据运行结果中所包含的异常关键字和脚本名称生成运行异常警报,服务器获取监控终端的联系信息,联系信息可以为终端地址,邮箱信息等,服务器通过联系信息将运行异常警报发送至监控终端,使得监控人员能够获取运行出现异常的执行脚本的信息以及运行异常的原因。当运行结果中不包含异常关键字时,不进行处理。
在一个实施例中,服务器可以进行实时地运行异常警报通知,即在执行脚本的运行过程中,只要监控到有一条执行脚本运行异常,就将根据该条执行脚本和运行结果单独生成一个异常警报,并及时发送给监控终端。在另一个实施例中,在运行过程中,服务器监测到有异常运行结果时,对出现异常的执行脚本及相应的运行结果进行记录,待所有脚本执行完成后,将记录的所有异常结果进行汇总并生成运行异常警报,将汇总的运行异常警报发送至监控终端。
在本实施例中,通过预先存储配置异常关键字,服务器可以通过在监测到的运行结果中自动进行异常关键字的匹配并判断执行脚本的执行结果是否出现异常,无需人工核查,并将根据运行异常的结果生成运行异常警报发送给监控终端,从而使得监控终端根据运行异常警报清楚地了解到出现异常的执行脚本有哪些,便于开发人员根据运行异常警报对数据库脚本进行修正。
在一个实施例中,数据库集成测试方法还包括以下步骤:监测执行脚本的单脚本运行时间;判断单脚本运行时间是否超过预设单脚本运行时间阈值;若是,则将执行脚本的脚本名称和运行时间进行记录并添加至异常警报中;检测执行脚本的总运行时间,判断总运行时间是否超过预设脚本总运行时间阈值;若是,则中断执行脚本的运行并向监控终端发送运行超时警报。
服务器获取预设的单脚本运行时间阈值和预设的脚本总运行时间阈值。服务器对每条执行脚本的单脚本运行时间进行监测,并对每条脚本的运行时间都进行记录。当一条执行脚本运行完成后,终端获得该脚本的运行时间,并将该脚本的运行时间与预设单脚本运行时间阈值进行比较,当该脚本的运行时间超过预设单脚本运行时间阈值时,服务器获取该脚本的脚本名称,并将该脚本的脚本名称和运行时间记录添加至异常警报中,使得监控人员还能及时了解单脚本的运行时间情况。
此外,服务器还进行执行脚本总运行时间的监测,当每一条执行脚本运行完成后,服务器将该条执行脚本的运行时间与运行过的执行脚本的运行时间进行迭加,并判断迭加的总运行时间是否超过预设脚本总运行时间阈值,当总运行时间没有超过预设脚本总运行时间阈值时,继续运行下一条执行脚本,当总运行时间超过预设脚本总运行时间阈值时,服务器中断执行脚本的运行,生成运行超时警报,并将运行超时警报发送至监控终端。
在本实施例中,服务器通过对单脚本的运行时间进行监控,并将单脚本的运行时间记录在异常警报中,可以使进行监控的开发人员获取每条脚本的运行时间情况,方便开发人员查找到运行时间过长的执行脚本并进行优化。服务器通过监测部署脚本的总运行时间,可以在运行时间超过阈值时及时中断脚本的运行,避免了脚本发生死循环等异常情况还会继续执行造成的测试资源的浪费。
在一个实施例中,在服务器上搭建虚拟机,当前数据库安装在虚拟机上,在虚拟机上进行数据库环境的搭建,执行脚本的部署和执行脚本的运行等工作。而在服务器的主机上可以继续进行数据库的开发、生产工作。从而实现开发工作与测试工作的同机并发执行。当新版本数据库在主机上开发完成后,将新版本数据库文件从主机提交至虚拟机,虚拟机接收到从主机提交的版本数据库文件时,即触发数据库集成测试工作流程的开始。具体的,可以在虚拟机上构建触发器,并设置触发器的触发方式为当有新的数据库文件提交时,触发数据库集成测试工作流程。
在另一个实施例中,可以在服务器上搭建多个虚拟机,当需要将开发出的多个版本的数据库同时进行测试工作时,可以将多个版本的数据库分别安装在不同的虚拟机上进行同步测试,在每个虚拟机上单独进行数据库环境的搭建,从而实现多版本数据库的并发测试,提高测试工作的效率。
在一个实施例中,如图6所示,提供了一种数据库集成测试装置,该装置可运行于服务器上,包括:文件接收模块610,基线数据查找模块620,数据替换模块630,和脚本部署运行模块640。其中:
文件接收模块610,用于接收新版本数据库文件。
基线数据查找模块620,用于获取新版本数据库文件对应的基线数据库信息,根据基线数据库信息查找新版本数据库文件对应的数据库基线数据。
数据替换模块630,用于将当前数据库中的数据替换为数据库基线数据。
脚本部署运行模块640,用于从新版本数据库文件中抽取执行脚本文件,将执行脚本文件中的执行脚本部署在经过数据替换后的当前数据库上,部署完成后运行执行脚本。
在一个实施例中,如图7所示,装置还包括:
结构库生成模块650,用于根据当前数据库中的数据库结构数据生成基线结构库。
基线库生成模块660,用于获取基线数据列表,根据基线数据列表从当前数据库中抽取基本数据并对基本数据进行备份,将备份后的基本数据导入基线结构库,生成基线数据库。
在一个实施例中,脚本部署运行模块640包括:
匹配部署模块,用于当查找到第一配置表时,从第一配置表中读取脚本名称,将读取到的脚本名称与执行脚本进行名称匹配,将匹配成功的执行脚本部署在当前数据库中。
排序部署模块,用于当查找不到第一配置表时,对执行脚本进行归类,将归类后的执行脚本进行排序,将排序后的执行脚本部署在当前数据库中。
在一个实施例中,如图8所示,装置还包括:
配置表获取模块670,用于获取第二配置表,所述第二配置表中包括异常关键字。
结果检测模块680,用于监测所述执行脚本的运行结果,判断所述运行结果中是否包含异常关键字。
异常警报发送模块690,用于获取所述运行结果对应的执行脚本的脚本名称,根据所述异常关键字和所述脚本名称生成运行异常警报,将所述异常警报发送至监控终端。
在一个实施例中,如图9所示,装置还包括:
单脚本时间监测模块691,用于监测所述执行脚本的单脚本运行时间;
单脚本时间判断模块693,用于判断所述单脚本运行时间是否超过预设单脚本运行时间阈值;
时间记录模块695,用于将所述执行脚本的脚本名称和运行时间进行记录并添加至所述异常警报中;
总时间检测模块697,用于检测所述执行脚本的总运行时间,判断所述总运行时间是否超过预设脚本总运行时间阈值;
超时警报发送模块699,用于中断所述执行脚本的运行并向所述监控终端发送运行超时警报。
上述数据库集成测试装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。其中,网络接口可以是以太网卡或无线网卡等。上述各模块可以硬件形式内嵌于或独立于终端中的处理器中,也可以以软件形式存储于终端中的存储器中,以便于处理器调用执行以上各个模块对应的操作。该处理器可以为中央处理单元(CPU)、微处理器、单片机等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种数据库集成测试方法,包括:
    接收新版本数据库文件;
    获取所述新版本数据库文件对应的基线数据库信息,根据所述基线数据库信息查找所述新版本数据库文件对应的数据库基线数据;
    将当前数据库中的数据替换为所述数据库基线数据;及
    从所述新版本数据库文件中抽取执行脚本文件,将所述执行脚本文件中的执行脚本部署在经过数据替换后的所述当前数据库上,部署完成后运行所述执行脚本。
  2. 根据权利要求1所述的方法,其特征在于,在所述部署完成后运行所述执行脚本之后,所述方法还包括:
    根据所述当前数据库中的数据库结构数据生成基线结构库;及
    获取基线数据列表,根据所述基线数据列表从所述当前数据库中抽取基本数据并对所述基本数据进行备份,将备份后的基本数据导入所述基线结构库,生成基线数据库。
  3. 根据权利要求1所述的方法,其特征在于,所述将所述新版本执行脚本文件中的执行脚本部署在经过数据替换后的所述当前数据库上,包括:
    当查找到第一配置表时,从所述第一配置表中读取脚本名称,将读取到的脚本名称与所述执行脚本进行名称匹配,将匹配成功的执行脚本部署在所述当前数据库中;及
    当查找不到第一配置表时,对所述执行脚本进行归类,将归类后的执行脚本进行排序,将排序后的执行脚本部署在所述当前数据库中。
  4. 根据权利要求1所述的方法,其特征在于,所述部署完成后运行所述执行脚本之后,所述方法还包括:
    获取第二配置表,所述第二配置表中包括异常关键字;
    监测所述执行脚本的运行结果,判断所述运行结果中是否包含异常关键字;
    若是,则获取所述运行结果对应的执行脚本的脚本名称,根据所述异常关键字和所述脚本名称生成运行异常警报,将所述异常警报发送至监控终端。
  5. 根据权利要求4所述的数据库集成测试方法,其特征在于,所述部署完成后运行所述执行脚本之后,所述方法还包括:
    监测所述执行脚本的单脚本运行时间;
    判断所述单脚本运行时间是否超过预设单脚本运行时间阈值;
    若是,则将所述执行脚本的脚本名称和运行时间进行记录并添加至所述异常警报中;及
    检测所述执行脚本的总运行时间,判断所述总运行时间是否超过预设脚本总运行时间阈值;
    若是,则中断所述执行脚本的运行并向所述监控终端发送运行超时警报。
  6. 一种数据库集成测试装置,包括:
    文件接收模块,用于接收新版本数据库文件;
    基线数据查找模块,用于获取所述新版本数据库文件对应的基线数据库信息,根据所述基线数据库信息查找所述新版本数据库文件对应的数据库基线数据;
    数据替换模块,用于将当前数据库中的数据替换为所述数据库基线数据;及
    脚本部署运行模块,用于从所述新版本数据库文件中抽取执行脚本文件,将所述执行脚本文件中的执行脚本部署在经过数据替换后的所述当前数据库上,部署完成后运行所述执行脚本。
  7. 根据权利要求6所述的装置,其特征在于,所述装置还包括:
    结构库生成模块,用于根据所述当前数据库中的数据库结构数据生成基线结构库;
    基线库生成模块,用于获取基线数据列表,根据所述基线数据列表从所述当前数据库中抽取基本数据并对所述基本数据进行备份,将备份后的基本数据导入所述基线结构库,生成基线数据库。
  8. 根据权利要求6所述的装置,其特征在于,所述脚本部署运行模块还包括:
    匹配部署模块,用于当查找到第一配置表时,从所述第一配置表中读取脚本名称,将读取到的脚本名称与所述执行脚本进行名称匹配,将匹配成功的执行脚本部署在所述当前数据库中;
    排序部署模块,用于当查找不到第一配置表时,对所述执行脚本进行归类,将归类后的执行脚本进行排序,将排序后的执行脚本部署在所述当前数据库中。
  9. 根据权利要求6所述的装置,其特征在于,所述装置还包括:
    配置表获取模块,用于获取第二配置表,所述第二配置表中包括异常关键字;
    运行监测模块,用于监测所述执行脚本的运行结果,判断所述运行结果中是否包含异常关键字;
    警报生成模块,用于获取所述运行结果对应的执行脚本的脚本名称,根据所述异常关键字和所述脚本名称生成运行异常警报,将所述异常警报发送至监控终端。
  10. 根据权利要求9所述的装置,其特征在于,所述装置还包括:
    时间监测模块,用于监测所述执行脚本的单脚本运行时间;
    时间阈值判断模块,用于判断所述单脚本运行时间是否超过预设单脚本运行时间阈值;
    时间记录模块,用于将所述执行脚本的脚本名称和运行时间进行记录并添加至所述异常警报中;及
    总时间监测模块,用于检测所述执行脚本的总运行时间,判断所述总运行时间是否超过预设脚本总运行时间阈值;
    警报发送模块,用于中断所述执行脚本的运行并向所述监控终端发送运行超时警报。
  11. 一种服务器,包括存储器和处理器,所述存储器中存储有指令,所述指令被所述处理器执行时,使得所述处理器执行以下步骤:
    接收新版本数据库文件;
    获取所述新版本数据库文件对应的基线数据库信息,根据所述基线数据库信息查找所述新版本数据库文件对应的数据库基线数据;
    将当前数据库中的数据替换为所述数据库基线数据;
    从所述新版本数据库文件中抽取新版本执行脚本文件,将所述新版本执行脚本文件根据预设规则部署在所述当前数据库上,部署完成后运行所述新版本执行脚本文件。
  12. 根据权利要求11所述的服务器,其特征在于,在所述部署完成后运行所述执行脚本之后,还包括执行以下步骤:
    根据所述当前数据库中的数据库结构数据生成基线结构库;及
    获取基线数据列表,根据所述基线数据列表从所述当前数据库中抽取基本数据并对所述基本数据进行备份,将备份后的基本数据导入所述基线结构库,生成基线数据库。
  13. 根据权利要求11所述的服务器,其特征在于,所述将所述新版本执行脚本文件中的执行脚本部署在经过数据替换后的所述当前数据库上,还包括执行以下步骤:
    当查找到第一配置表时,从所述第一配置表中读取脚本名称,将读取到的脚本名称与所述执行脚本进行名称匹配,将匹配成功的执行脚本部署在所述当前数据库中;及
    当查找不到第一配置表时,对所述执行脚本进行归类,将归类后的执行脚本进行排序,将排序后的执行脚本部署在所述当前数据库中。
  14. 根据权利要求11所述的服务器,其特征在于,所述部署完成后运行所述执行脚本之后,还包括执行以下步骤:
    获取第二配置表,所述第二配置表中包括异常关键字;
    监测所述执行脚本的运行结果,判断所述运行结果中是否包含异常关键字;
    若是,则获取所述运行结果对应的执行脚本的脚本名称,根据所述异常关键字和所述脚本名称生成运行异常警报,将所述异常警报发送至监控终端。
  15. 根据权利要求14所述的服务器,其特征在于,所述部署完成后运行所述执行脚本之后,还包括执行以下步骤:
    监测所述执行脚本的单脚本运行时间;
    判断所述单脚本运行时间是否超过预设单脚本运行时间阈值;
    若是,则将所述执行脚本的脚本名称和运行时间进行记录并添加至所述异常警报中;及
    检测所述执行脚本的总运行时间,判断所述总运行时间是否超过预设脚本总运行时间阈值;
    若是,则中断所述执行脚本的运行并向所述监控终端发送运行超时警报。
  16. 一个或多个存储有计算机可执行指令的非易失性可读存储介质,所述计算机可执行指令被一个或多个处理器执行,使得所述一个或多个处理器执行以下步骤:
    接收新版本数据库文件;
    获取所述新版本数据库文件对应的基线数据库信息,根据所述基线数据库信息查找所述新版本数据库文件对应的数据库基线数据;
    将当前数据库中的数据替换为所述数据库基线数据;
    从所述新版本数据库文件中抽取新版本执行脚本文件,将所述新版本执行脚本文件根据预设规则部署在所述当前数据库上,部署完成后运行所述新版本执行脚本文件。
  17. 根据权利要求16所述的存储介质,其特征在于,在所述部署完成后运行所述执行脚本之后,还包括执行以下步骤:
    根据所述当前数据库中的数据库结构数据生成基线结构库;及
    获取基线数据列表,根据所述基线数据列表从所述当前数据库中抽取基本数据并对所述基本数据进行备份,将备份后的基本数据导入所述基线结构库,生成基线数据库。
  18. 根据权利要求16所述的存储介质,其特征在于,所述将所述新版本执行脚本文件中的执行脚本部署在经过数据替换后的所述当前数据库上,还包括执行以下步骤:
    当查找到第一配置表时,从所述第一配置表中读取脚本名称,将读取到的脚本名称与所述执行脚本进行名称匹配,将匹配成功的执行脚本部署在所述当前数据库中;及
    当查找不到第一配置表时,对所述执行脚本进行归类,将归类后的执行脚本进行排序,将排序后的执行脚本部署在所述当前数据库中。
  19. 根据权利要求16所述的存储介质,其特征在于,所述部署完成后运行所述执行脚本之后,还包括执行以下步骤:
    获取第二配置表,所述第二配置表中包括异常关键字;
    监测所述执行脚本的运行结果,判断所述运行结果中是否包含异常关键字;
    若是,则获取所述运行结果对应的执行脚本的脚本名称,根据所述异常关键字和所述脚本名称生成运行异常警报,将所述异常警报发送至监控终端。
  20. 根据权利要求19所述的存储介质,其特征在于,所述部署完成后运行所述执行脚本之后,还包括执行以下步骤:
    监测所述执行脚本的单脚本运行时间;
    判断所述单脚本运行时间是否超过预设单脚本运行时间阈值;
    若是,则将所述执行脚本的脚本名称和运行时间进行记录并添加至所述异常警报中;及
    检测所述执行脚本的总运行时间,判断所述总运行时间是否超过预设脚本总运行时间阈值;
    若是,则中断所述执行脚本的运行并向所述监控终端发送运行超时警报。
PCT/CN2017/099736 2017-06-20 2017-08-30 数据库集成测试方法、装置、服务器及存储介质 WO2018233037A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019563048A JP6799695B2 (ja) 2017-06-20 2017-08-30 データベースの統合テスト方法、装置、サーバ、および記録媒体

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710470644.0 2017-06-20
CN201710470644.0A CN107688531B (zh) 2017-06-20 2017-06-20 数据库集成测试方法、装置、计算机设备及存储介质

Publications (1)

Publication Number Publication Date
WO2018233037A1 true WO2018233037A1 (zh) 2018-12-27

Family

ID=61152694

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/099736 WO2018233037A1 (zh) 2017-06-20 2017-08-30 数据库集成测试方法、装置、服务器及存储介质

Country Status (3)

Country Link
JP (1) JP6799695B2 (zh)
CN (1) CN107688531B (zh)
WO (1) WO2018233037A1 (zh)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457300A (zh) * 2019-07-15 2019-11-15 中国平安人寿保险股份有限公司 一种公共测试库的清理方法及装置、电子设备
CN111522719A (zh) * 2020-04-27 2020-08-11 中国银行股份有限公司 大数据任务状态的监控方法及装置
CN111651364A (zh) * 2020-07-01 2020-09-11 中国银行股份有限公司 并行开发下的sql检查方法及装置
CN111857752A (zh) * 2020-07-22 2020-10-30 浪潮商用机器有限公司 一种PostgreSQL数据库安装方法、装置及设备
JP2021047806A (ja) * 2019-09-20 2021-03-25 富士通株式会社 情報処理システム、情報処理装置および情報処理プログラム
CN113138974A (zh) * 2021-04-23 2021-07-20 建信金融科技有限责任公司 数据库合规检测的方法和装置
CN113297028A (zh) * 2021-03-18 2021-08-24 中国平安人寿保险股份有限公司 一种脚本执行方法、装置、计算机设备及存储介质
CN114625630A (zh) * 2020-12-14 2022-06-14 福建天泉教育科技有限公司 一种多环境多角色版本发布系统的测试方法及其测试系统
CN115757055A (zh) * 2022-10-19 2023-03-07 北京新数科技有限公司 一种基于Spring Cloud的数据库统一运维及综合性能评分系统

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804327A (zh) * 2018-06-12 2018-11-13 北京京东金融科技控股有限公司 一种自动生成测试数据的方法和装置
CN108984408B (zh) * 2018-07-13 2021-11-30 中国银行股份有限公司 一种应用系统中sql代码的检测方法和装置
CN109508356B (zh) * 2018-11-14 2024-05-03 平安科技(深圳)有限公司 数据异常预警方法、装置、计算机设备及存储介质
CN109766124B (zh) * 2018-12-26 2022-05-03 深圳左邻永佳科技有限公司 业务开发方法、装置、计算机设备和存储介质
CN111858352B (zh) * 2020-07-22 2024-04-05 中国平安财产保险股份有限公司 自动化测试监控的方法、装置、设备及存储介质
CN112965905B (zh) * 2021-03-11 2024-06-18 京东科技信息技术有限公司 数据测试方法、装置、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289460A (zh) * 2011-07-13 2011-12-21 中国工商银行股份有限公司 一种向测试环境进行报表元数据同步的方法及系统
CN103020149A (zh) * 2012-11-22 2013-04-03 用友软件股份有限公司 共享数据更新装置和共享数据更新方法
CN104572644A (zh) * 2013-10-10 2015-04-29 北京大学 数据库更新装置和数据库更新方法
WO2016015220A1 (en) * 2014-07-29 2016-02-04 Hewlett-Packard Development Company, L.P. Executable code abnormality detection
CN105512017A (zh) * 2014-09-22 2016-04-20 阿里巴巴集团控股有限公司 一种数据库兼容性检测方法及设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8078655B2 (en) * 2008-06-04 2011-12-13 Microsoft Corporation Generation of database deltas and restoration
CN202121621U (zh) * 2011-07-13 2012-01-18 中国工商银行股份有限公司 一种向测试环境进行报表元数据同步的系统
CN102722436B (zh) * 2012-05-29 2016-03-02 百度在线网络技术(北京)有限公司 一种增量覆盖信息的统计方法和装置
US9659040B1 (en) * 2013-09-23 2017-05-23 Amazon Technologies, Inc. Database fleet schema maintenance
CN105302710B (zh) * 2014-07-03 2019-06-07 腾讯科技(深圳)有限公司 一种确定需要回归测试的测试用例的方法和装置
US9811444B2 (en) * 2015-08-04 2017-11-07 Salesforce.Com, Inc. Testing software enhancements in database applications
CN106445795B (zh) * 2016-09-26 2019-03-22 中国工商银行股份有限公司 一种数据库sql效率检测方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289460A (zh) * 2011-07-13 2011-12-21 中国工商银行股份有限公司 一种向测试环境进行报表元数据同步的方法及系统
CN103020149A (zh) * 2012-11-22 2013-04-03 用友软件股份有限公司 共享数据更新装置和共享数据更新方法
CN104572644A (zh) * 2013-10-10 2015-04-29 北京大学 数据库更新装置和数据库更新方法
WO2016015220A1 (en) * 2014-07-29 2016-02-04 Hewlett-Packard Development Company, L.P. Executable code abnormality detection
CN105512017A (zh) * 2014-09-22 2016-04-20 阿里巴巴集团控股有限公司 一种数据库兼容性检测方法及设备

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457300A (zh) * 2019-07-15 2019-11-15 中国平安人寿保险股份有限公司 一种公共测试库的清理方法及装置、电子设备
CN110457300B (zh) * 2019-07-15 2024-02-02 中国平安人寿保险股份有限公司 一种公共测试库的清理方法及装置、电子设备
JP2021047806A (ja) * 2019-09-20 2021-03-25 富士通株式会社 情報処理システム、情報処理装置および情報処理プログラム
CN111522719A (zh) * 2020-04-27 2020-08-11 中国银行股份有限公司 大数据任务状态的监控方法及装置
CN111522719B (zh) * 2020-04-27 2023-12-01 中国银行股份有限公司 大数据任务状态的监控方法及装置
CN111651364B (zh) * 2020-07-01 2023-04-28 中国银行股份有限公司 并行开发下的sql检查方法及装置
CN111651364A (zh) * 2020-07-01 2020-09-11 中国银行股份有限公司 并行开发下的sql检查方法及装置
CN111857752A (zh) * 2020-07-22 2020-10-30 浪潮商用机器有限公司 一种PostgreSQL数据库安装方法、装置及设备
CN111857752B (zh) * 2020-07-22 2023-08-08 浪潮商用机器有限公司 一种PostgreSQL数据库安装方法、装置及设备
CN114625630A (zh) * 2020-12-14 2022-06-14 福建天泉教育科技有限公司 一种多环境多角色版本发布系统的测试方法及其测试系统
CN113297028A (zh) * 2021-03-18 2021-08-24 中国平安人寿保险股份有限公司 一种脚本执行方法、装置、计算机设备及存储介质
CN113138974B (zh) * 2021-04-23 2023-08-22 建信金融科技有限责任公司 数据库合规检测的方法和装置
CN113138974A (zh) * 2021-04-23 2021-07-20 建信金融科技有限责任公司 数据库合规检测的方法和装置
CN115757055A (zh) * 2022-10-19 2023-03-07 北京新数科技有限公司 一种基于Spring Cloud的数据库统一运维及综合性能评分系统
CN115757055B (zh) * 2022-10-19 2023-10-27 北京新数科技有限公司 一种基于Spring Cloud的数据库统一运维及综合性能评分系统

Also Published As

Publication number Publication date
JP2020520515A (ja) 2020-07-09
CN107688531B (zh) 2019-02-22
CN107688531A (zh) 2018-02-13
JP6799695B2 (ja) 2020-12-16

Similar Documents

Publication Publication Date Title
WO2018233037A1 (zh) 数据库集成测试方法、装置、服务器及存储介质
WO2018014582A1 (zh) 保单数据处理方法、装置、服务器和存储介质
TWI608419B (zh) 軟體相容性預先檢測方法與其系統
US8140907B2 (en) Accelerated virtual environments deployment troubleshooting based on two level file system signature
US8140905B2 (en) Incremental problem determination and resolution in cloud environments
WO2018014580A1 (zh) 数据接口测试方法、装置、服务器和存储介质
WO2017177769A1 (zh) Ogg 版本部署方法、系统、服务器和存储介质
WO2022151776A1 (zh) 一种云平台虚拟机回收方法及计算机设备
JPH0325629A (ja) プログラムのエラー検出方法及びシステム
US20060235907A1 (en) Pausable backups of file system items
JP2001508894A (ja) 広域コンピュータネットワークにおいてコンピュータファイルをバックアップするシステム及び方法
JPH07105064A (ja) ファイル名検出方式
US20150142813A1 (en) Language tag management on international data storage
WO2014029111A1 (zh) 一种用户行为处理系统及方法
WO2018036168A1 (zh) 数据处理任务执行方法、装置、执行服务器和存储介质
CN114116322B (zh) 数据恢复方法、装置、设备及存储介质
CN104123197B (zh) 未持有iOS设备情况下的离线取证方法
US8290992B2 (en) File management method, file management device, and program
US20210173750A1 (en) Methods to automatically correct and improve system recovery and replication processes
CN113704790A (zh) 一种异常日志信息汇总方法及计算机设备
CN114238255A (zh) 同步文件的方法、装置、电子设备及计算机可读存储介质
CN113268206B (zh) 一种网络靶场资源热插拔实现方法与系统
JP4511047B2 (ja) 移動通信システムの並列プロセッサを同期化するためのプロトコル
Yoshida et al. Finding similar defects using synonymous identifier retrieval
WO2018014581A1 (zh) 数值转移记录的核对方法、装置、服务器和存储介质

Legal Events

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

Ref document number: 17914853

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019563048

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

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

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

122 Ep: pct application non-entry in european phase

Ref document number: 17914853

Country of ref document: EP

Kind code of ref document: A1