Trusted DCS upper computer real-time database incremental backup recovery method and related device
By implementing incremental backup and recovery methods of real-time databases in DCS host computers, the automation and accuracy problems of database backup and recovery in the prior art are solved, and the rapid recovery of the database and high system reliability are achieved.
Patent Information
- Application Number
- CN202510069863.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-05-23
AI Technical Summary
In the prior art, DCS host computer databases require manual backup and recovery, which are prone to lack of some modified configurations and cannot meet the needs of timed backup and specified date recovery.
Provides a real-time incremental backup and recovery method for real-time databases of trusted DCS host computers. By starting the backup program in the historical station, setting a specified cycle time to start the database backup, encrypting the backup database files and calculating the characteristic values, and saving them to the local area. When it is necessary to restore the database, locate the database file to be restored from locally, calculate its characteristic value and compare it with the locally saved characteristic value. If it is consistent, decrypt and restore the database file.
It realizes rapid and accurate database recovery, reduces system downtime and potential economic losses, enhances system reliability and stability, and reduces manual operation burden through automated management.
Smart Images

Figure CN120029822A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of DCS systems, and relates to a method for incremental backup and recovery of a real-time database of a trusted DCS host computer and a related device. Background Art
[0002] The DCS (Distributed Control System) host computer is the core management and monitoring interface of the entire control system, and undertakes important tasks such as data collection, processing, display and remote control. Its node configuration, system settings, monitoring screens and all information related to operation and management are stored in an efficient and reliable real-time database to ensure that the host computer background program can run stably and efficiently, providing strong support and guarantee for the entire DCS system. Among them, node configuration is a crucial part of the DCS host computer. It records in detail the key information such as the physical location, network address, communication protocol, hardware configuration, etc. of each control node in the system (such as PLC, remote I / O station, etc.). This information is accurately stored in the real-time database, allowing the host computer to identify and manage each control node in real time, ensuring that data flow is unimpeded and control instructions are accurately transmitted to each execution unit. System settings cover various basic configurations of the DCS host computer, including user authority management, security policy settings, data backup and recovery strategies, system log records, etc. These settings ensure the security, stability and maintainability of the system. Through the management of real-time database, any changes in system settings can be recorded and take effect immediately, providing great convenience and flexibility for system administrators.
[0003] During the operation of the host computer, the real-time database is usually loaded into the memory. When an erroneous operation occurs or the configuration is modified incorrectly, the normal operation of the host computer may be affected. At this time, if the business needs to be restored quickly, it is necessary to quickly import the previously backed up database. Usually, the power plant operators will manually back up the database regularly. If the backup time interval is too long, the restored business may lack some of the modified configuration.
[0004] In summary, it is urgent to develop a method that can realize the incremental backup and recovery of the real-time database of a trusted DCS host computer to meet the needs of the host computer for scheduled backup and restoration on a specified date, so as to better ensure the operation of the business. Summary of the invention
[0005] The present invention provides a trusted DCS host computer real-time database incremental backup and recovery method and related devices to solve the technical problem in the prior art that the DCS host computer database needs to be manually backed up and restored, and is prone to missing part of the modified configuration.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a method for incremental backup and recovery of a real-time database of a trusted DCS host computer, comprising the following steps:
[0008] Start the backup program at the history station and set the specified periodic time to start backing up the database;
[0009] Encrypt the backed-up database file and calculate the eigenvalue; save the encrypted database file and eigenvalue locally to complete the database backup;
[0010] When the database needs to be restored, the database file to be restored is located locally, and the characteristic value of the database file to be restored is calculated;
[0011] Compare the calculated eigenvalues with the locally saved eigenvalues. If they are consistent, decrypt the database file to be recovered, restore the original database file and publish it to the real-time database to complete the database recovery.
[0012] Furthermore, the steps of encrypting the backed-up database file and calculating the characteristic value; and saving the encrypted database file and the characteristic value locally to complete the database backup specifically include:
[0013] Select the database file of the first day of the system's official operation as the baseline file, and store the baseline file in the first specified path;
[0014] When the backup task is started, the database file is copied from the path where the system is running to the second specified path;
[0015] Perform a bitwise XOR operation on the copied database file and the baseline file to generate the first file;
[0016] compressing the first file to generate a second file;
[0017] encrypting the second file to generate a third file;
[0018] The characteristic value of the third file is calculated, the characteristic value and the third file are saved in the first designated path, and the database file copied in the second designated path is deleted.
[0019] Furthermore, the file name of the third file includes a backup date.
[0020] Furthermore, in the step of compressing the first file, the lzo algorithm is used for compression; in the step of encrypting the second file, the sm1 algorithm is used for encryption; in the step of calculating the characteristic value of the third file, the sm3 algorithm is used for calculation.
[0021] Furthermore, when the database needs to be restored, the step of locating the database file to be restored locally and calculating the characteristic value of the database file to be restored specifically includes: when the database needs to be restored, according to the date required to be restored, locating the database file to be restored from the first specified path; calculating the sm3 characteristic value of the database file to be restored.
[0022] Furthermore, the calculated eigenvalues are compared with the locally stored eigenvalues. If they are consistent, the database file to be recovered is decrypted, the original database file is restored and published to the real-time database, and the step of recovering the database is completed, specifically including: comparing the calculated eigenvalues with the locally stored eigenvalues. If they are inconsistent, the database file is discarded; if they are consistent, the database file to be recovered is decrypted to generate a first file; the first file is bitwise XORed with the baseline file, the original database file is restored and published to the real-time database, and the recovery of the database is completed.
[0023] Furthermore, in the step of decrypting the database file to be restored, the sm1 algorithm is used for decryption.
[0024] In a second aspect, the present invention provides a trusted DCS host computer real-time database incremental backup and recovery system, comprising:
[0025] The setting module is used to start the backup program in the history station and set the specified cycle time to start backing up the database;
[0026] The backup module is used to encrypt the backed-up database file and calculate the characteristic value; the encrypted database file and the characteristic value are saved locally to complete the database backup;
[0027] A positioning module is used to locate the database file to be restored from the local when the database needs to be restored, and calculate the characteristic value of the database file to be restored;
[0028] The recovery module is used to compare the calculated eigenvalues with the locally saved eigenvalues. If they are consistent, the database file to be recovered is decrypted, the original database file is restored and published to the real-time database to complete the database recovery.
[0029] In a third aspect, the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0030] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] The present invention discloses a method and related device for incremental backup and recovery of a real-time database of a trusted DCS host computer; first, a backup program is started at a historical station, and a backup cycle and time are set according to requirements for backup; the backed-up data file is encrypted and a characteristic value is calculated for local storage; when the database needs to be restored, the previously stored database file is found locally, and the characteristic value is calculated and compared with the pre-saved characteristic value, and if they are consistent, the database file is restored to restore the database. The incremental backup and recovery method provided by the present invention can quickly and accurately restore the database to the most recent valid state when a system failure or data loss occurs, thereby reducing system downtime and potential economic losses, and enhancing the reliability and stability of the entire system. And by setting a specified cycle time to automatically start the backup program, the automatic management of database backup is realized. This not only reduces the burden of manual operation, but also avoids backup omissions or delays caused by human negligence, and ensures the timeliness and continuity of data backup. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0034] Figure 1 is a flow chart of the method of the present invention;
[0035] Figure 2 is a schematic diagram of the system of the present invention;
[0036] Figure 3 It is a schematic diagram of the computer device structure of the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0038] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0039] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0040] In the description of the embodiments of the present invention, it should be noted that if the terms "upper", "lower", "horizontal", "inner", etc. indicate an orientation or positional relationship based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship in which the product of the invention is usually placed when in use, it is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0041] In addition, if the term "horizontal" appears, it does not mean that the component must be absolutely horizontal, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", which does not mean that the structure must be completely horizontal, but can be slightly tilted.
[0042] In the description of the embodiments of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal connection of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0043] The present invention is further described in detail below in conjunction with the accompanying drawings:
[0044] See also Figure 1 The embodiment of the present invention discloses a method for incremental backup and recovery of a real-time database of a trusted DCS host computer, comprising the following steps:
[0045] S1, start the backup program at the history station and set the specified cycle time to start backing up the database;
[0046] When installing the history station, you need to allocate a partition for the backup path to store backup files. Start the backup program on the history station, set the backup cycle and time according to your needs, and start backing up the database at a fixed time every day.
[0047] S2, encrypt the backed-up database file and calculate the eigenvalue; save the encrypted database file and the eigenvalue locally to complete the database backup;
[0048] S201, selecting a database file on the first day of the system's official operation as a baseline file, and storing the baseline file in a first designated path;
[0049] S202, when the backup task is started, copy the database file from the path where the system is running to the second specified path;
[0050] S203, performing a bitwise XOR operation on the copied database file and the baseline file to generate a first file;
[0051] S204, compressing the first file using the lzo algorithm to generate a second file;
[0052] S205, encrypt the second file using the sm1 algorithm to generate a third file; the file name of the third file includes the backup date to facilitate searching during later recovery.
[0053] S206, using the sm3 algorithm to calculate the characteristic value of the third file, saving the characteristic value and the third file in the first designated path, and deleting the database file copied in the second designated path.
[0054] S3: when the database needs to be restored, the database file to be restored is located locally and the characteristic value of the database file to be restored is calculated;
[0055] In this step, a recovery date can be selected, and the database file to be restored can be located from the first specified path according to the date in the file name when the database file was previously backed up; and the characteristic value of the database file to be restored can be calculated using the sm3 algorithm.
[0056] S4, compare the calculated eigenvalue with the locally saved eigenvalue. If they are consistent, decrypt the database file to be recovered, restore the original database file and publish it to the real-time database, and complete the database recovery.
[0057] In this step, the calculated eigenvalues are compared with the locally saved eigenvalues. If they are inconsistent, the database file is discarded; if they are consistent, the sm1 algorithm is used to decrypt the database file to be restored to obtain the first file; the first file is bitwise XORed with the baseline file to restore the original database file and publish it to the real-time database to complete the database recovery.
[0058] See also Figure 2 The embodiment of the present invention discloses a trusted DCS host computer real-time database incremental backup and recovery system, including a setting module, a backup module, a positioning module and a recovery module; wherein the setting module is used to start the backup program at the historical station, set the specified cycle time to start backing up the database; the backup module is used to encrypt the backed-up database file and calculate the characteristic value; the encrypted database file and the characteristic value are saved locally to complete the database backup; the positioning module is used to locate the database file to be restored from the local when the database needs to be restored, and calculate the characteristic value of the database file to be restored; the recovery module is used to compare the calculated characteristic value with the characteristic value saved locally, if they are consistent, the database file to be restored is decrypted, the original database file is restored and published to the real-time database, and the database recovery is completed. The present invention effectively prevents the data from being illegally accessed or tampered with during storage and transmission by encrypting the backup database file and calculating the characteristic value for verification, thereby greatly enhancing the security of the data. This dual protection mechanism ensures the integrity and credibility of the backup data, and provides a solid data guarantee for the stable operation of the DCS (distributed control system) host computer. This method is not only suitable for the database backup and recovery needs of the current DCS host computer system, but also has good flexibility and scalability. As the system scale expands or the amount of data increases, the backup cycle, encryption algorithm and other parameters can be adjusted to adapt to new needs to ensure the effectiveness and efficiency of the backup and recovery strategy.
[0059] Example:
[0060] The embodiment of the present invention discloses a method for incremental backup and recovery of a real-time database of a trusted DCS host computer, comprising the following steps:
[0061] 1. Backup;
[0062] 1. When installing the history station, you need to allocate a separate partition for the backup path to store backup files.
[0063] 2. Start the backup program on the history station and start backing up the database at 1:00 a.m. every day.
[0064] 3. The path to back up the database is as follows:
[0065] a) Select the database file on the first day of the system's official operation as the baseline file and store it in the specified path / users / backup / data.
[0066] b) After the scheduled task is started, copy the database file from the system running path to the / users / backup / data / tmp path.
[0067] c) Perform a bitwise XOR operation on the copied database file and the baseline file to generate a new file xor.dat.
[0068] d) Use the lzo algorithm to compress xor.dat and generate com_xor.dat file.
[0069] e) Use the sm1 algorithm to encrypt com_xor.dat and generate en_com_xor_20240101.dat file (3).
[0070] f) Use the sm3 algorithm to calculate the eigenvalue of the en_com_xor_20240101.dat file.
[0071] g) Save the feature value and file name locally, save the en_com_xor_20240101.dat file in the / users / backup / data / path, and delete the files in / users / backup / data / tmp.
[0072] 2. Recovery;
[0073] When an abnormal scenario occurs and real-time database recovery is required, open the recovery software restart_data.
[0074] Select the date to restore and start restoring the database. The steps are as follows:
[0075] 1. Open the backup file of the selected date, select the file of 20240101, and open the file en_com_xor_20240101.dat from the / users / backup / data path.
[0076] 2. Calculate the sm3 feature value of en_com_xor_20240101.dat and compare it with the locally saved feature value. If they are inconsistent, discard the file.
[0077] 3. Use the sm1 algorithm to decrypt the en_com_xor_20240101.dat file to generate the xor.dat file.
[0078] 4. Perform a bitwise XOR operation on the xor.dat file and the baseline file to restore the original database file.
[0079] 5. Publish the original database file into the database.
[0080] In one embodiment of the present invention, see Figure 3 , a computer device is provided, the computer device includes a processor and a memory, the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used for the operation of the incremental backup and recovery method of the real-time database of a trusted DCS host computer.
[0081] The present invention also provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both the built-in storage medium in the computer device and the extended storage medium supported by the computer device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the incremental backup and recovery method of the real-time database of the trusted DCS host computer in the above embodiment.
[0082] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0083] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0084] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0085] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for incremental backup and recovery of a real-time database of a trusted DCS host computer, characterized in that: The following steps are involved: Start the backup program at the history station and set the specified periodic time to start backing up the database; Encrypt the backed-up database file and calculate the eigenvalue; save the encrypted database file and eigenvalue locally to complete the database backup; When the database needs to be restored, the database file to be restored is located locally, and the characteristic value of the database file to be restored is calculated; Compare the calculated eigenvalues with the locally saved eigenvalues. If they are consistent, decrypt the database file to be recovered, restore the original database file and publish it to the real-time database to complete the database recovery.
2. A method for incremental backup and recovery of a real-time database of a trusted DCS host computer according to claim 1, characterized in that: The backed-up database file is encrypted and the characteristic value is calculated; The encrypted database file and feature value are saved locally to complete the steps of database backup, including: Select the database file of the first day of the system's official operation as the baseline file, and store the baseline file in the first specified path; When the backup task is started, the database file is copied from the path where the system is running to the second specified path; Perform a bitwise XOR operation on the copied database file and the baseline file to generate the first file; compressing the first file to generate a second file; encrypting the second file to generate a third file; The characteristic value of the third file is calculated, the characteristic value and the third file are saved in the first designated path, and the database file copied in the second designated path is deleted.
3. A method for incremental backup and recovery of a real-time database of a trusted DCS host computer according to claim 2, characterized in that: The file name of the third file includes a backup date.
4. A method for incremental backup and recovery of a real-time database of a trusted DCS host computer according to claim 2, characterized in that: In the step of compressing the first file, the lzo algorithm is used for compression; in the step of encrypting the second file, the sm1 algorithm is used for encryption; in the step of calculating the characteristic value of the third file, the sm3 algorithm is used for calculation.
5. A method for incremental backup and recovery of a real-time database of a trusted DCS host computer according to claim 2, characterized in that: The step of locating the database file to be restored locally and calculating the characteristic value of the database file to be restored when the database needs to be restored specifically includes: locating the database file to be restored from the first specified path according to the date required to be restored when the database needs to be restored; and calculating the sm3 characteristic value of the database file to be restored.
6. A method for incremental backup and recovery of a real-time database of a trusted DCS host computer according to claim 2, characterized in that: The step of comparing the calculated characteristic value with the locally stored characteristic value, if they are consistent, decrypting the database file to be recovered, restoring the original database file and publishing it to the real-time database, and completing the database recovery step specifically includes: comparing the calculated characteristic value with the locally stored characteristic value, if they are inconsistent, discarding the database file; if they are consistent, decrypting the database file to be recovered and generating a first file; performing a bitwise XOR operation on the first file and the baseline file, restoring the original database file and publishing it to the real-time database, and completing the database recovery.
7. A method for incremental backup and recovery of a real-time database of a trusted DCS host computer according to claim 6, characterized in that: In the step of decrypting the database file to be restored, the sm1 algorithm is used for decryption.
8. A trusted DCS host computer real-time database incremental backup and recovery system, characterized in that: include: The setting module is used to start the backup program in the history station and set the specified cycle time to start backing up the database; The backup module is used to encrypt the backed-up database file and calculate the characteristic value; Save the encrypted database file and feature value locally to complete the database backup; A positioning module is used to locate the database file to be restored from the local when the database needs to be restored, and calculate the characteristic value of the database file to be restored; The recovery module is used to compare the calculated eigenvalues with the locally saved eigenvalues. If they are consistent, the database file to be recovered is decrypted, the original database file is restored and published to the real-time database to complete the database recovery.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing 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 7 are implemented.