Database upgrading method and device, equipment, storage medium and program product
Through an automated database upgrade method, pre-detection scripts and upgrade process definition files are used to solve the problems of complex and inefficient existing database upgrade processes, and simplified upgrade processes and efficient database upgrades are achieved.
Patent Information
- Application Number
- CN202510037534.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2045-01-10
AI Technical Summary
The existing database upgrade process is complex and requires strict sequential operation, resulting in large workload, low efficiency and error-prone, increasing the risk of upgrade failure.
By obtaining the target database installation package, the relevant upgrade process definition files are called, including pre-detection scripts, installation scripts, database startup scripts and uninstall scripts, to automate the entire upgrade process.
It simplifies the installation process of the new version of the database, reduces operational complexity, improves upgrade efficiency and success rate, and adapts to different upgrade scenarios.
Smart Images

Figure CN119440590A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a database upgrading method, device, equipment, storage medium and program product. Background Art
[0002] Database software installation and upgrade based on the Red Hat Package Manager (RPM) generally requires multiple software packages. In addition to the required main program package, there are also dependent library packages, tool packages, plug-in packages, etc. These packages constitute a complete set of database software. Due to the dependencies between the packages, installation and upgrade need to be performed one by one in order to ensure that the dependencies between the software packages can be well resolved. In the existing upgrade process, there are strict order requirements for installing multiple software packages, which increases the workload and difficulty of upgrading the database. Secondly, the upgrade process of different modes is different and involves multiple steps. If each step is manually operated, it will not only reduce efficiency but also be prone to errors, thereby increasing the failure rate of the entire upgrade. Summary of the invention
[0003] In view of the above problems, the present invention provides a database upgrading method, apparatus, device, storage medium and program product.
[0004] According to a first aspect of the present invention, there is provided a database upgrade method, comprising: obtaining a target database installation package, wherein the target database installation package comprises a main program file, a function library file, and an auxiliary tool file; calling an upgrade process definition file related to the target database installation package, wherein the upgrade process definition file comprises a pre-detection script, an installation script, a database startup script, and an uninstallation script; calling the pre-detection script to detect the version numbers of the old version database and the new version database to obtain an operation result; based on the operation result and the target database installation package, calling the installation script to install the new version database; calling the database startup script to start the new version database based on the operation result; calling the uninstallation script to uninstall the old version database.
[0005] Optionally, a pre-detection script is called to detect the version numbers of the old version database and the new version database, and the operation results obtained include: calling the pre-detection script to determine the first upgrade mode when the version numbers of the old version database and the new version database are different; based on the first upgrade mode, a logical backup operation is performed on the old version database to obtain a logical backup result; when the logical backup result includes a backup success result, a deactivation operation is performed on the old version database to obtain a deactivation result; when a deactivation result indicating a successful deactivation is obtained, a configuration information backup operation is performed on the old version database to obtain a configuration information backup result; when the configuration information backup result includes a backup success result, a transfer operation is performed on the data directory information in the old version database to obtain a transfer result, wherein the operation results include a logical backup result, a configuration information backup result, a transfer result, and a deactivation result.
[0006] Optionally, the logical backup result also includes a data logical backup file, the configuration information backup result also includes a configuration parameter file, and the transfer result includes a data directory information status result; wherein, calling the database startup script and starting the new version of the database based on the operation result includes: calling the database startup script, and when the data directory information status result is empty, performing an initialization operation on the new version of the database to obtain an initialization result; when an initialization result indicating successful initialization is obtained, starting the new version of the database based on the configuration parameter file, and importing the data logical backup file.
[0007] Optionally, calling a pre-detection script to detect the version numbers of the old version database and the new version database, and obtaining the operation result also includes: calling the pre-detection script to determine the second upgrade mode when the version numbers of the old version database and the new version database are the same; based on the second upgrade mode, deactivating the old version database to obtain a deactivation result, wherein the operation result includes the deactivation result; calling the database startup script to start the new version database based on the operation result includes: calling the database startup script to detect the status of the data directory information in the old version database based on the operation result to obtain a data detection result; when a data detection result representing a non-empty state is obtained, starting the new version database based on the data directory information.
[0008] Optionally, the upgrade process definition file also includes a data cleanup script; the database upgrade method also includes: calling the data cleanup script to clean up automatic startup function configuration information and environment variable information related to the old version of the database.
[0009] Optionally, the target database installation package is obtained based on the following operations: parsing the list file to determine the target file name; copying the function library file and auxiliary tool file corresponding to the target file name to the installation folder, where the installation folder includes the main program file; packaging the installation folder to obtain the target database installation package.
[0010] The second aspect of the present invention provides a database upgrade device, including: an acquisition module, used to acquire a target database installation package, wherein the target database installation package includes a main program file, a function library file, and an auxiliary tool file; a calling module, used to call an upgrade process definition file related to the target database installation package, wherein the upgrade process definition file includes a pre-detection script, an installation script, a database startup script, and an uninstallation script; a pre-detection module, used to call the pre-detection script, detect the version numbers of the old version database and the new version database, and obtain an operation result; an installation module, used to call the installation script based on the operation result and the target database installation package to install the new version database; a startup module, used to call the database startup script, and start the new version database based on the operation result; an uninstallation module, used to call the uninstallation script to uninstall the old version database.
[0011] The third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above-mentioned database upgrade method.
[0012] The fourth aspect of the present invention further provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the above-mentioned database upgrade method.
[0013] The fifth aspect of the present invention also provides a computer program product, including a computer program, which implements the above-mentioned database upgrade method when executed by a processor.
[0014] According to the database upgrade method, device, equipment, storage medium and program product provided by the present invention, the version numbers of the old version database and the new version database are detected by calling the pre-detection script to obtain the operation result; based on the operation result and the target database installation package, the installation script is called to install the new version database; the database startup script is called to start the new version database based on the operation result; the uninstall script is called to uninstall the old version database. Since the function library files, auxiliary tool files and main program files are uniformly packaged into a target database installation package, and there is no order requirement between the files, the installation process and upgrade process of the new version database can be simplified, and the complexity of the operation can be reduced; in addition, custom scripts are injected into each stage of the upgrade process definition file, and then the entire upgrade process is flexibly adapted to different upgrade scenarios based on the version numbers of the old version database and the new version database. The one-click automation of the upgrade process greatly improves the execution efficiency and success rate, and solves the technical problems of complex operation and low efficiency in installing and upgrading the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0016] Figure 1 The application scenario of the database upgrade method and device according to the embodiment of the present invention is shown.
[0017] Figure 2 A flowchart of a database upgrading method according to an embodiment of the present invention is shown.
[0018] Figure 3A A flow chart of calling a pre-detection script according to an embodiment of the present invention is shown.
[0019] Figure 3B A flowchart of calling a database startup script according to an embodiment of the present invention is shown.
[0020] Figure 3C A flowchart of database upgrade according to an embodiment of the present invention is shown.
[0021] Figure 4 A structural block diagram of a database upgrading device according to an embodiment of the present invention is shown.
[0022] Figure 5 A block diagram of an electronic device suitable for implementing a database upgrading method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0023] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.
[0024] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0025] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0026] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0027] In the process of implementing the present invention, it is found that the installation and upgrade of database software based on the software package manager (Red Hat Package Manager, RPM) generally requires multiple software packages, in addition to the necessary main program package, there are also dependent library packages, tool packages, plug-in packages, etc., which completely constitute a set of database software. Due to the dependency relationship between the various packages, it is necessary to operate one by one in order during installation and upgrade to ensure that the dependencies between the software packages can be well resolved. In the existing upgrade process, there are strict order requirements for installing multiple software packages, which increases the workload and difficulty of upgrading the database. Secondly, the upgrade process of different modes is different, and multiple steps will be involved. If each step is manually operated, it will not only reduce efficiency but also be prone to errors, thereby increasing the failure rate of the entire upgrade.
[0028] In view of this, an embodiment of the present invention provides a database upgrade method, device, equipment, storage medium and program product. The method includes: obtaining a target database installation package, wherein the target database installation package includes a main program file, a function library file, and an auxiliary tool file; calling an upgrade process definition file related to the target database installation package, wherein the upgrade process definition file includes a pre-detection script, an installation script, a database startup script, and an uninstallation script; calling the pre-detection script to detect the version numbers of the old version database and the new version database to obtain an operation result; based on the operation result and the target database installation package, calling the installation script to install the new version database; calling the database startup script to start the new version database based on the operation result; calling the uninstallation script to uninstall the old version database.
[0029] In the technical solution of the present invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0030] Figure 1 The application scenario of the database upgrade method and device according to the embodiment of the present invention is shown.
[0031] like Figure 1 As shown, the business system architecture 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a cluster server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the cluster server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0032] The user may use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0033] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0034] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The cluster distributed database is deployed on the server 105, and the server 105 includes multiple server nodes that can analyze and process the received user request and other data, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device.
[0035] It should be noted that the database upgrade method provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the database upgrade device provided in the embodiment of the present invention can generally be set in the server 105. The database upgrade method provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the database upgrade device provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0036] Alternatively, the database upgrade method provided in the embodiment of the present invention may also be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103, or may also be executed by other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the database upgrade apparatus provided in the embodiment of the present invention may also be provided in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or may be provided in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.
[0037] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0038] It should be noted that the sequence numbers of the operations in the following method are only used as representations of the operations for the purpose of description, and should not be regarded as representing the execution order of the operations. Unless explicitly stated, the method does not need to be executed completely in the order shown.
[0039] Figure 2 A flowchart of a database upgrading method according to an embodiment of the present invention is shown.
[0040] like Figure 2 As shown, the method 200 includes operations S210 to S260.
[0041] In operation S210, a target database installation package is obtained.
[0042] Optionally, the target database installation package includes main program files, function library files, and auxiliary tool files.
[0043] Optionally, the target database installation package can be generated based on a software package manager (Red Hat Package Manager, RPM), and the main program files, function library files, and auxiliary tool files in the target database installation package are used to install the new version of the database.
[0044] Optionally, the main program file supports the operation of the new version of the database; the function library file is a third-party dependent library, and the function library file supports the functions of the new version of the database; the auxiliary tool file can be a plug-in tool, etc., and the auxiliary tool file also supports the functions of the new version of the database. Package the main program file, function library file, and auxiliary tool file into a target database installation package.
[0045] In operation S220, an upgrade process definition file related to the target database installation package is called.
[0046] Optionally, the upgrade process definition file may be a specification file (Specification, SPEC), and the functions of each upgrade stage in the upgrade process definition file are implemented by calling a script.
[0047] Optionally, the upgrade process definition file is a configuration specification file of the target database installation package, which includes information such as the name, version, dependencies, source code, and publisher of the target database installation package.
[0048] Optionally, operation commands are added to the scripts of each upgrade phase of the upgrade process definition file to obtain a pre-detection script, an installation script, a database startup script, and an uninstallation script.
[0049] Optionally, the pre-detection script is used to detect the database version number and perform pre-operations before installing the new version of the database. The installation script is used to install the new version of the database, and the database startup script is used to start the installed new version of the database. After startup, the uninstallation script is executed to uninstall the old version of the database.
[0050] In operation S230, a pre-detection script is called to detect the version numbers of the old version database and the new version database to obtain an operation result.
[0051] Optionally, execute the upgrade command first, such as rpm -Uvh ***.rpm, to start the database upgrade in RPM mode.
[0052] Optionally, the old version database is an existing database in the system, and the new version database is a database to be upgraded based on the old version database.
[0053] Optionally, the pre-detection script in the upgrade process definition file is executed to detect the version numbers of the old version database and the new version database, and the old version database is operated according to the detection results of the two version numbers to obtain the operation result. For example, the operation result can be a deactivation result or a backup result.
[0054] In operation S240, based on the operation result and the target database installation package, an installation script is called to install the new version database.
[0055] Optionally, based on the operation results, the main program files, function library files, and auxiliary tool files in the target database installation package, the installation script in the upgrade process definition file is executed to install the new version of the database.
[0056] In operation S250, a database startup script is called to start a new version of the database based on the operation result.
[0057] Optionally, after installing the new version of the database, execute the database startup script in the upgrade process definition file and start the new version of the database according to the operation results.
[0058] For example, when the operation result only includes the deactivation result, the new version database is directly started; when the operation result also includes the backup result, the new version database is initialized first, and then the new version database is started based on the operation result.
[0059] In operation S260, an uninstall script is called to uninstall the old version database.
[0060] Optionally, after starting the new version of the database, execute the uninstall script in the upgrade process definition file to uninstall the old version of the database, and clean up the main program files, function library files, auxiliary tool files, etc. related to the old version of the database.
[0061] Optionally, by packaging the function library files, auxiliary tool files, and main program files into a target database installation package without any order requirements between the files, the installation process and upgrade process of the new version database are simplified, and the complexity of the operation is reduced. In addition, custom scripts are injected into each stage of the upgrade process definition file, and the entire upgrade process is flexibly adapted to different upgrade scenarios based on the version numbers of the old version database and the new version database. The one-click automation of the upgrade process greatly improves the execution efficiency and success rate, and solves the technical problems of complex operation and low efficiency in installing and upgrading the database.
[0062] Optionally, a pre-detection script is called to detect the version numbers of the old version database and the new version database, and the operation results obtained include: calling the pre-detection script to determine the first upgrade mode when the version numbers of the old version database and the new version database are different; based on the first upgrade mode, a logical backup operation is performed on the old version database to obtain a logical backup result; when the logical backup result includes a backup success result, a deactivation operation is performed on the old version database to obtain a deactivation result; when a deactivation result indicating a successful deactivation is obtained, a configuration information backup operation is performed on the old version database to obtain a configuration information backup result; when the configuration information backup result includes a backup success result, a transfer operation is performed on the data directory information in the old version database to obtain a transfer result, wherein the operation results include a logical backup result, a configuration information backup result, a transfer result, and a deactivation result.
[0063] Optionally, a pre-detection script in the upgrade process definition file is executed to detect the version numbers of the old version database and the new version database, and if the version numbers of the old version database and the new version database are different, a first upgrade mode is determined. The first upgrade mode may be a major upgrade mode.
[0064] Optionally, the different version numbers of the old version database and the new version database indicate that the main program of the new version database is incompatible with the main program of the old version database, and the new version database cannot use the data directory of the old version database. Therefore, it is necessary to perform a logical backup operation on the old version database first.
[0065] Optionally, the logical backup operation is to dump the data in the old version database to a data file in a storage manner. The data file format is a Structured Query Language (SQL) file. The logical backup result includes the data file. The content in the data file is the creation statements of all objects and data in the old version database at the time of backup.
[0066] Optionally, the logical backup result also includes a backup success result or a backup failure result. In the case of a backup failure result, the upgrade process is directly exited; in the case of a backup success result, the old version database is stopped to obtain a deactivation result indicating successful deactivation.
[0067] Optionally, when the transfer result includes a transfer success result, a configuration information backup operation is performed on the old version database to obtain a configuration information backup result.
[0068] Optionally, the configuration information backup result may also include backup results of configuration operation parameters, environment, port, etc. of the old version database.
[0069] Optionally, when the configuration information backup result includes a successful backup result, a transfer operation is performed on the data directory information in the old version database to obtain a transfer result. The data directory information in the old version database is copied to another path file, and the data directory information in the old version database is cleared so that the main program of the new version database can be reinitialized in the original path.
[0070] Optionally, the logical backup result also includes a data logical backup file, the configuration information backup result also includes a configuration parameter file, and the transfer result includes a data directory information status result; wherein, calling the database startup script and starting the new version of the database based on the operation result includes: calling the database startup script, and when the data directory information status result is empty, performing an initialization operation on the new version of the database to obtain an initialization result; when an initialization result indicating successful initialization is obtained, starting the new version of the database based on the configuration parameter file, and importing the data logical backup file.
[0071] Optionally, the content of the data logic backup file is the creation statements of all objects and data in the old version database at the time of backup; the configuration parameter file includes the configuration operation parameters, environment, port and other information of the old version database.
[0072] Optionally, when a successful transfer result is obtained, the data directory information status result may be in an empty state; when a failed transfer result is obtained, the data directory information status result may be in a non-empty state.
[0073] Optionally, after installing the new version of the database, execute the database startup script in the upgrade process definition file to check the data directory information status of the old version of the database. If the data directory information status result is empty, initialize the new version of the database based on the default information of the data directory to obtain an initialization result indicating successful initialization.
[0074] Optionally, when an initialization result indicating successful initialization is obtained, a new version database is started based on the configuration parameter file, and then the data logic backup file is imported into the new version database to ensure consistency between the data in the new version database and the data in the old version database.
[0075] Optionally, calling a pre-detection script to detect the version numbers of the old version database and the new version database, and obtaining the operation result also includes: calling the pre-detection script to determine a second upgrade mode when the version numbers of the old version database and the new version database are the same; based on the second upgrade mode, deactivating the old version database to obtain a deactivation result, wherein the operation result includes the deactivation result.
[0076] Calling a database startup script and starting a new version of the database based on the operation result includes: calling a database startup script, detecting the status of the data directory information in the old version of the database based on the operation result, and obtaining a data detection result; when a data detection result representing a non-empty state is obtained, starting the new version of the database based on the data directory information.
[0077] Optionally, the pre-detection script in the upgrade process definition file is executed to detect the version numbers of the old version database and the new version database, and when the version numbers of the old version database and the new version database are the same, the second upgrade mode is determined. The second upgrade mode can be a minor upgrade mode.
[0078] Optionally, the same version number of the old version database and the new version database indicates that the main program of the new version database is compatible with the main program of the old version database, and the new version database can be started based on the data directory of the old version database, so the old version database can be directly deactivated. The operation result includes the deactivation result.
[0079] Optionally, when a successful deactivation result is obtained, install the new version database, and then execute the database startup script in the upgrade process definition file to check the data directory information status of the old version database. When the data directory information status result is not empty, directly start the new version database based on the data directory information of the old version database, and the data in the new version database is consistent with the data in the old version database.
[0080] Optionally, a custom script can be injected into the pre-detection stage of the upgrade process definition file to detect the version numbers of the old version database and the new version database, so as to flexibly determine different upgrade modes. This allows the entire upgrade process to adapt to different upgrade scenarios and achieve one-click upgrade, greatly improving execution efficiency and success rate.
[0081] Figure 3AA flow chart of calling a pre-detection script according to an embodiment of the present invention is shown.
[0082] like Figure 3A As shown, calling the pre-detection script includes steps S311 to S319.
[0083] In step S311, it is determined whether it is the first upgrade mode. Specifically, if it is the first upgrade mode, jump to step S312; otherwise, jump to step S315.
[0084] In step S312, a logical backup operation is performed on the old version database.
[0085] In step S313, it is determined whether the backup result is successful. Specifically, if the backup result fails, the process jumps to step S314; otherwise, the process jumps to step S315.
[0086] In step S314, exit the upgrade process.
[0087] In step S315, the old version database is deactivated.
[0088] In step S316, it is determined again whether it is the first upgrade mode. Specifically, if it is the first upgrade mode, jump to step S317; otherwise, jump to step S319.
[0089] In step S317, a configuration information backup operation is performed on the old version database.
[0090] In step S318, the data directory information in the old version database is transferred.
[0091] In step S319, the new version database is installed.
[0092] Figure 3B A flowchart of calling a database startup script according to an embodiment of the present invention is shown.
[0093] like Figure 3B As shown, calling the database startup script includes steps S321 to S327.
[0094] In step S321, it is determined whether it is the first upgrade mode. Specifically, if it is the first upgrade mode, jump to step S322; otherwise, jump to step S324.
[0095] In step S322, the new version database is initialized.
[0096] In step S323, the configuration parameter file is copied.
[0097] In step S324, the new version database is started.
[0098] In step S325, it is determined whether it is the first upgrade mode. Specifically, if it is the first upgrade mode, jump to step S326; otherwise, jump to step S327.
[0099] In step S326, the data logic backup file is imported into the new version database.
[0100] In step S327, execution of the database startup script ends.
[0101] Optionally, the upgrade process definition file also includes a data cleanup script; the database upgrade method also includes:
[0102] Call the data cleanup script to clean up the automatic startup function configuration information and environment variable information related to the old version of the database.
[0103] Optionally, the upgrade process definition file also includes a pre-uninstall detection script. After executing the database startup script in the upgrade process definition file, the pre-uninstall detection script is executed. The pre-uninstall detection script has no additional operations for the upgrade process and will stop the database for a simple uninstall operation.
[0104] Optionally, after executing the pre-uninstallation detection script, execute the uninstallation script to uninstall the old version database and clean up the main program files, function library files, auxiliary tool files, etc. related to the old version database.
[0105] Optionally, after executing the uninstallation script, execute a data cleanup script to clean up the automatic startup function configuration information and environment variable information related to the old version database.
[0106] Optionally, the automatic startup function configuration information represents information for configuring the automatic startup function of the old version database.
[0107] Figure 3C A flowchart of database upgrade according to an embodiment of the present invention is shown.
[0108] like Figure 3C As shown, the database upgrade includes steps S331 to S336.
[0109] In step S331, the pre-detection script is called.
[0110] In step S332, the installation script is called.
[0111] In step S333, the database startup script is called.
[0112] In step S334, the pre-uninstall detection script is called.
[0113] In step S335, the uninstall script is called.
[0114] In step S336, the data cleansing script is called.
[0115] Optionally, the target database installation package is obtained based on the following operations:
[0116] Parse the list file to determine the target file name; copy the function library file and auxiliary tool file corresponding to the target file name to the installation folder, wherein the installation folder includes the main program file; package the installation folder to obtain the target database installation package.
[0117] Optionally, the list file is used to record files related to the database. Function library files and auxiliary tool files are recorded in the list file.
[0118] Optionally, parse the list file to determine the target file name.
[0119] Optionally, the main program file, function library file, and auxiliary tool file are copied to the installation folder according to the target file name, and then packaged into a target database installation package.
[0120] Optionally, by copying the function library files and auxiliary tool files in the list file to the installation folder, and then packaging them together with the main program files and upgrade process definition files into a target database installation package, the installation and subsequent upgrade processes are simplified, the database upgrade process is optimized, and the complexity of the operation is reduced.
[0121] Based on the above database upgrade method, the present invention also provides a database upgrade device. Figure 4 The device is described in detail.
[0122] Figure 4 A structural block diagram of a database upgrading device according to an embodiment of the present invention is shown.
[0123] like Figure 4 As shown, the database upgrade device 400 of this embodiment includes an acquisition module 410 , a calling module 420 , a pre-detection module 430 , an installation module 440 , a startup module 450 and an uninstallation module 460 .
[0124] The acquisition module 410 is used to acquire the target database installation package, wherein the target database installation package includes a main program file, a function library file, and an auxiliary tool file. In one embodiment, the acquisition module 410 can be used to perform the operation S210 described above, which will not be described in detail here.
[0125] The calling module 420 is used to call the upgrade process definition file related to the target database installation package, wherein the upgrade process definition file includes a pre-detection script, an installation script, a database startup script, and an uninstallation script. In one embodiment, the calling module 420 can be used to perform the operation S220 described above, which will not be repeated here.
[0126] The pre-detection module 430 is used to call the pre-detection script to detect the version numbers of the old version database and the new version database to obtain the operation result. In one embodiment, the pre-detection module 430 can be used to perform the operation S230 described above, which will not be repeated here.
[0127] The installation module 440 is used to call the installation script based on the operation result and the target database installation package to install the new version of the database. In one embodiment, the installation module 440 can be used to perform the operation S240 described above, which will not be repeated here.
[0128] The startup module 450 is used to call the database startup script and start the new version of the database based on the operation result. In one embodiment, the startup module 450 can be used to perform the operation S250 described above, which will not be repeated here.
[0129] The uninstallation module 460 is used to call the uninstallation script to uninstall the old version database. In one embodiment, the uninstallation module 460 can be used to perform the operation S260 described above, which will not be described in detail here.
[0130] Optionally, the pre-detection module 430 includes a first detection submodule, a second detection submodule, a third detection submodule, a fourth detection submodule and a fifth detection submodule.
[0131] The first detection submodule is used to call a pre-detection script and determine a first upgrade mode when the version numbers of the old version database and the new version database are different.
[0132] The second detection submodule is used to perform a logical backup operation on the old version database based on the first upgrade mode to obtain a logical backup result.
[0133] The third detection submodule is used to, when the logical backup result includes a backup success result, perform a deactivation operation on the old version database to obtain a deactivation result.
[0134] The fourth detection submodule is used to perform a configuration information backup operation on the old version database to obtain a configuration information backup result when a deactivation result indicating successful deactivation is obtained.
[0135] The fifth detection submodule is used to transfer the data directory information in the old version database to obtain the transfer result when the configuration information backup result includes the backup success result, wherein the operation result includes the logic backup result, the configuration information backup result, the transfer result, and the deactivation result.
[0136] Optionally, the start-up module 450 includes a first start-up module and a second start-up module.
[0137] The first startup submodule is used to call the database startup script, and when the data directory information status result is an empty state, perform an initialization operation on the new version database to obtain an initialization result.
[0138] The second startup submodule is used to start the new version database based on the configuration parameter file and import the data logic backup file when an initialization result indicating successful initialization is obtained.
[0139] Optionally, the pre-detection module 430 includes a sixth detection submodule and a seventh detection submodule.
[0140] The sixth detection submodule is used to call the pre-detection script and determine the second upgrade mode when the version numbers of the old version database and the new version database are the same.
[0141] The seventh detection submodule is used to perform a deactivation operation on the old version database based on the second upgrade mode to obtain a deactivation result, wherein the operation result includes the deactivation result.
[0142] Optionally, the database upgrading device 400 includes a cleaning module.
[0143] The cleanup module is used to call the data cleanup script to clean up the automatic startup function configuration information and environment variable information related to the old version database.
[0144] Optionally, any multiple modules among the acquisition module 410, the call module 420, the pre-detection module 430, the installation module 440, the startup module 450 and the uninstallation module 460 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. Optionally, at least one of the acquisition module 410, the call module 420, the pre-detection module 430, the installation module 440, the startup module 450 and the uninstallation module 460 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in an appropriate combination of any of them. Alternatively, at least one of the acquisition module 410, the calling module 420, the pre-detection module 430, the installation module 440, the startup module 450 and the uninstallation module 460 may be at least partially implemented as a computer program module, which may perform a corresponding function when executed.
[0145] Figure 5 A block diagram of an electronic device suitable for implementing a database upgrading method according to an embodiment of the present invention is shown.
[0146] Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0147] like Figure 5 As shown, the computer electronic device 500 according to an embodiment of the present invention includes a processor 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 to the random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an on-board memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0148] In RAM 503, various programs and data required for the operation of electronic device 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present invention by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present invention by executing the program stored in one or more memories.
[0149] Optionally, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The electronic device 500 may further include one or more of the following components connected to the input / output (I / O) interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage portion 508 as needed.
[0150] Optionally, the method flow according to the embodiment of the present invention can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above-mentioned functions defined in the system of the embodiment of the present invention are executed. Optionally, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0151] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the database upgrade method according to the embodiment of the present invention is implemented.
[0152] Optionally, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0153] For example, optionally, the computer-readable storage medium may include the ROM 502 and / or the RAM 503 described above and / or one or more memories other than the ROM 502 and the RAM 503 .
[0154] An embodiment of the present invention also includes a computer program product, which includes a computer program, which contains program code for executing the method provided by the embodiment of the present invention. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the database upgrade method provided by the embodiment of the present invention.
[0155] When the computer program is executed by the processor 501, the above functions defined in the system / device of the embodiment of the present invention are performed. Optionally, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0156] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 509, and / or installed from the removable medium 511. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0157] Optionally, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages, specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, such as Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0158] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments of the present invention can be combined and / or combined in various ways, even if such a combination or combination is not explicitly recorded in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features recorded in the various embodiments of the present invention can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present invention.
[0159] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination advantageously. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.
Claims
1. A database upgrade method, characterized in that: The method comprises: Obtain a target database installation package, wherein the target database installation package includes a main program file, a function library file, and an auxiliary tool file; Calling an upgrade process definition file related to the target database installation package, wherein the upgrade process definition file includes a pre-detection script, an installation script, a database startup script, and an uninstallation script; Call the pre-detection script to detect the version numbers of the old version database and the new version database, respectively, to obtain the operation result; Based on the operation result and the target database installation package, calling the installation script to install the new version database; Calling the database startup script to start the new version database based on the operation result; The uninstall script is called to uninstall the old version database.
2. The method according to claim 1, characterized in that: The calling of the pre-detection script detects the version numbers of the old version database and the new version database, and obtains the operation results including: Calling the pre-detection script, and determining a first upgrade mode when the version numbers of the old version database and the new version database are different; Based on the first upgrade mode, a logical backup operation is performed on the old version database to obtain a logical backup result; In the case where the logical backup result includes a backup success result, performing a deactivation operation on the old version database to obtain a deactivation result; When the deactivation result indicating successful deactivation is obtained, a configuration information backup operation is performed on the old version database to obtain a configuration information backup result; In the case where the configuration information backup result includes a successful backup result, a transfer operation is performed on the data directory information in the old version database to obtain a transfer result, wherein the operation result includes the logical backup result, the configuration information backup result, the transfer result, and the deactivation result.
3. The method according to claim 2, characterized in that The logical backup result also includes a data logical backup file, the configuration information backup result also includes a configuration parameter file, and the transfer result includes a data directory information status result; The calling of the database startup script and starting the new version database based on the operation result includes: Calling the database startup script, and when the data directory information status result is in an empty state, performing an initialization operation on the new version database to obtain an initialization result; When the initialization result indicating successful initialization is obtained, the new version database is started based on the configuration parameter file, and the data logic backup file is imported.
4. The method according to claim 1, characterized in that: The calling of the pre-detection script to detect the version numbers of the old version database and the new version database to obtain the operation result also includes: Calling the pre-detection script, and determining a second upgrade mode when the version numbers of the old version database and the new version database are the same; Based on the second upgrade mode, a deactivation operation is performed on the old version database to obtain a deactivation result, wherein the operation result includes the deactivation result; The calling of the database startup script and starting the new version database based on the operation result includes: Calling the database startup script, and detecting the status of the data directory information in the old version database based on the operation result to obtain a data detection result; When the data detection result indicating a non-empty state is obtained, the new version database is started based on the data directory information.
5. The method according to claim 1, characterized in that The upgrade process definition file also includes a data cleaning script; the method also includes: The data cleaning script is called to clean up the automatic startup function configuration information and environment variable information related to the old version database.
6. The method according to claim 1, characterized in that The target database installation package is obtained based on the following operations: Parse the list file to determine the target file name; Copying the function library file and the auxiliary tool file corresponding to the target file name to an installation folder, wherein the installation folder includes the main program file; The installation folder is packaged to obtain the target database installation package.
7. A database upgrade device, characterized in that: The device comprises: An acquisition module, used to acquire a target database installation package, wherein the target database installation package includes a main program file, a function library file, and an auxiliary tool file; A calling module, used to call an upgrade process definition file related to the target database installation package, wherein the upgrade process definition file includes a pre-detection script, an installation script, a database startup script, and an uninstallation script; A pre-detection module is used to call the pre-detection script to detect the version numbers of the old version database and the new version database to obtain the operation result; An installation module, configured to call the installation script based on the operation result and the target database installation package to install the new version database; A startup module, used to call the database startup script and start the new version database based on the operation result; The uninstallation module is used to call the uninstallation script to uninstall the old version database.
8. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more instructions, Wherein, when the one or more instructions are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: Executable instructions are stored thereon, and when the instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Database management method and device, equipment and storage medium
CN113901025A
System upgrading method and device, electronic equipment and storage medium
CN114356370A
Data version management method and device, storage medium and electronic equipment
CN115344585A
Database script upgrading method and device
CN118567676A
Version upgrading method and device, equipment and storage medium
CN119088410A