WO2013123703A1 - Data backup method and device, and data recovery method and device of network management system - Google Patents

Data backup method and device, and data recovery method and device of network management system Download PDF

Info

Publication number
WO2013123703A1
WO2013123703A1 PCT/CN2012/074018 CN2012074018W WO2013123703A1 WO 2013123703 A1 WO2013123703 A1 WO 2013123703A1 CN 2012074018 W CN2012074018 W CN 2012074018W WO 2013123703 A1 WO2013123703 A1 WO 2013123703A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
database
backup
data table
file
Prior art date
Application number
PCT/CN2012/074018
Other languages
French (fr)
Chinese (zh)
Inventor
吴雁峰
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2013123703A1 publication Critical patent/WO2013123703A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/085Retrieval of network configuration; Tracking network configuration history
    • H04L41/0853Retrieval of network configuration; Tracking network configuration history by actively collecting configuration information or by backing up configuration information
    • H04L41/0856Retrieval of network configuration; Tracking network configuration history by actively collecting configuration information or by backing up configuration information by backing up or archiving configuration information

Definitions

  • the present invention relates to the field of communications, and in particular to a data backup method, apparatus, and recovery method and apparatus for a network management system.
  • a method for backing up and restoring important data is provided.
  • the database structure is first accessed during backup.
  • the database structure writes a Structured Query Language (SQL) statement, and uses the SQL statement to generate an executable sequence file that is first emptied and then inserted one by one.
  • SQL Structured Query Language
  • the database engine can be used to directly run the executable sequence file to recover all the backed up data.
  • This backup recovery method conforms to the programmer's programming habits. At the same time, it also realizes online backup and recovery.
  • the backup and recovery schemes of the related technologies have the following disadvantages: With the improvement of the network management capability of the network management system, the number of base stations that can be managed by one network management system can reach 1500. As the number of management base stations increases, backup and recovery are required. The data is also increased in geometry, and data is backed up and restored in the past. A large LAN data backup takes 10 minutes and data recovery takes 50 minutes. Such a slow backup and recovery speed obviously does not meet the user's requirements.
  • the backup and recovery mode of the network management system uses the SQL script sequence. The SQL script sequence can be used to intuitively understand the data configured in the current system, but the user can modify the data in the script sequence.
  • the present invention provides a data backup method, apparatus, and recovery method and apparatus for a network management system to at least solve the problem that data backup and recovery in a related art takes a long time.
  • a data backup method of a network management system including: reading a data table in a database that needs to be backed up; and writing data in the data table into a pre-designated text file in a binary format.
  • reading the data table that needs to be backed up in the database comprises: obtaining a list of table names of the data tables that need to be backed up in the database; and reading the data table corresponding to each data table name in the table name list in the database.
  • reading the data table corresponding to each data table name in the table name list in the database comprises: reading the data table corresponding to each data table name in the order of the table name list.
  • writing the data in the data table in a binary format to the pre-designated text file comprises: writing the data in each data table in a binary format to a separate text file specified in advance.
  • the method further comprises: encrypting the text file.
  • the method further includes: compressing the encrypted text file; and storing the compressed text file in the designated area.
  • a data recovery method of a network management system comprising: reading a backup file stored in a binary format in advance from a specified area; and importing the backup file into a database.
  • reading the backup file stored in the binary format in advance from the specified area comprises: reading the table name from the table name list of the data table pre-generated by the system; reading each data in the specified area and the table name list
  • importing the backup file into the database comprises: respectively importing the backup file stored in the binary format in advance into the data table corresponding to the table name in the database.
  • the method before reading the table name from the list of table names of the data table pre-generated by the system, the method further includes: checking whether the data of the binary text is modified; in the case that the data is not modified, the table name from the system Read the table name in the list.
  • a data backup device for a network management system comprising: a reading module configured to read a data table in a database that needs to be backed up; and a writing module configured to binary the data in the data table The format is written to a pre-specified text file.
  • a data recovery device for a network management system comprising: a reading module configured to read a backup file stored in a binary format in advance from a designated area; importing a module, setting the backup to be performed The file is imported into the database.
  • FIG. 2 is a flowchart of a data backup method of a network management system according to a preferred embodiment of the present invention
  • FIG. 4 is a flowchart of a data recovery method in a network management system according to a preferred embodiment of the present invention
  • FIG. 5 is a data backup device of a network management system according to an embodiment of the present invention
  • Figure 6 is a block diagram showing the structure of a data backup device of a network management system according to a preferred embodiment of the present invention
  • Figure 7 is a block diagram showing the structure of a data backup device of a network management system according to a preferred embodiment of the present invention
  • FIG. 9 is a structural block diagram of a data recovery device of a network management system according to an embodiment of the present invention
  • FIG. 9 is a structural block diagram of a data recovery device of a network management system according to an embodiment of the present invention
  • FIG. 10 is a block diagram of a data recovery device of a network management system according to an embodiment of the present invention
  • FIG. 11 is a block diagram of a data recovery device of a network management system according to a preferred embodiment of the present invention
  • FIG. Two block diagram is a block diagram showing recovery means third data network management system according to a preferred embodiment of the present invention.
  • a list of table names for storing all the data tables in the database that need to be backed up and restored is obtained from the system.
  • the corresponding data table name is retrieved from the table name list file in order, and according to the data table name, the packaged Bulk Copy (BCP) tool is used to find the specified database.
  • BCP packaged Bulk Copy
  • This data table, and all the data in this data table is written in a binary format to a pre-designated text file, and then a data table name is removed from the list file, and the above operation is repeated, and all the tables in the database are All are converted into binary text files, and then the binary text file is encrypted by Cyclic Redundancy Check (CRC). Finally, the encrypted text file is compressed and stored in the specified directory of the system. .
  • CRC Cyclic Redundancy Check
  • Step S102 reading a data table in the database that needs to be backed up.
  • Step S104 the data in the data table is written in a binary format into a pre-designated text file.
  • an executable sequence file generated according to the data table to be backed up is directly backed up, and the backup process takes a long time.
  • the data in the data table to be backed up is backed up in a binary format. Reduces the time it takes to back up and improves the user experience.
  • the table name list of the data table to be backed up in the database may be obtained first, and then each data table name in the database and the table name list is read.
  • Corresponding data table. First generate a list and then back up one by one, you can avoid missing the data table to be backed up.
  • the backup process is interrupted, you can know which data has been backed up and which data tables have not been backed up by the list, so that it is backed up. Continue to complete the remaining backups, improving the efficiency of the backup.
  • each data table name may be read in the order of the table name list.
  • the data Table Compared with reading the first letter of the table name, reading according to the file size of the data table, or reading according to the modification time of the data table, it is more convenient to read the data table directly in the order of the list, and at the same time.
  • the step of storing the correspondence between the table name and the data table saves backup time and storage space.
  • the data in each data table can be separately written into a pre-designated independent text file in a binary format.
  • the backup to be backed up is performed.
  • the data table is all loaded into the memory for processing. Since the file is large, it occupies a large amount of memory and CPU resources. With this embodiment, the system only needs to load data of one data table at a time, which greatly reduces the memory and CPU usage, and makes the system Run a more process.
  • the text file can also be encrypted in order to prevent the backup data from being modified. In order to save the storage space, the encrypted text file can also be compressed, and then the compressed text file is stored in the designated area.
  • FIG. 2 is a flowchart of a data backup method of a network management system according to a preferred embodiment of the present invention.
  • data backup is to be specified in a database that needs to be backed up in advance.
  • the data table or the view name list is processed in a single table by the batch command in the BCP tool, and the data in the table is stored in a binary format and stored in a binary file, and the following steps S202 to S216 are included.
  • Step S202 starting a backup operation.
  • Step S204 reading the library table sequence from the file or the database.
  • step S206 the data table name or the view name is read in the order of indicating the list, so that all fields in the table or view to be backed up are read.
  • Step S208 sequentially extracting a table name from the container 1 into the variable "dbtablename", and then using this variable
  • the "dbtablename” executes the encapsulated BCP tool for the input parameters.
  • a command that the database engine can recognize is automatically constructed.
  • the format of the command in this embodiment is as follows: Bcp ⁇ dbtablename ⁇ ⁇ out ⁇ filename -c -k -t & -a65535 -S database IP, port number -U username -P password This command can take various parameters,
  • “-c” means that the data in the exported table is stored in character type
  • "-k” means that the record in the exported table will automatically retain the null value if the value of a field is empty
  • “-t” means to The terminator of the field is used as the termination of each field value.
  • "&” is used as the termination.
  • "-a” indicates the maximum packet size of the text file that can be exported.
  • 65536 is used to make it large enough to support large data volume.
  • “-S” indicates the name or IP of the database server to be exported
  • "-U” indicates the user name of this database
  • “-P” indicates the database password corresponding to this database.
  • the system After calling the database engine to execute this command, the system will store all the data in the data table in the database with the variable "dbtablename" as the table name in binary format to the file under the specified file path, where the file name convention is:
  • the fixed file name prefix "_dbtablename.txt” ensures that each data table generates a unique binary text file. Since the data is read in this embodiment, it is not necessary to distinguish the type of each field in each table, nor the information of each field in the table is stored, and the file is written in a compact binary byte stream sequence. Into the text, so it is very efficient to back up the database data in this way, and the data in the binary format file is 01 data, the compression efficiency is the highest.
  • Step S210 determining whether the data table in the table name list has been read, if yes, executing step S212; if not, reading the next table name in the container 1, repeating the operation of step S208 until the container 1 is All the data tables have done the above.
  • Step S212 performing encryption processing on the data stored in the file in the binary file format in the specified file path, and generating a string of encrypted characters stored in the specified text file CRC.txt, the encrypted characters being used for verifying data recovery Whether the backed up data has been modified.
  • Step S214 compressing and packaging all the generated binary files and the CRC.txt file, storing the files in a customized .dat format, and placing them in a user-specified directory.
  • FIG. 3 is a flowchart of a data recovery method of a network management system according to an embodiment of the present invention, which includes the following steps S302 to S304.
  • Step S302 reading a backup file stored in a binary format in advance from the designated area.
  • Step S304 importing the backup file into the database.
  • a pre-generated executable sequence file is directly restored when data is restored, and the recovery process takes a long time.
  • the data table backed up in a binary format is restored, which shortens the time used for recovery.
  • the table name may be read from the table name list of the data table pre-generated by the system, and then the backup stored in the binary format corresponding to each data table name in the table name list in the specified area is read.
  • the files are restored one by one according to the table name list of the data table, and the data table to be restored can be avoided.
  • the list can know which data has been recovered, which data tables have not been recovered, and thus On the basis of recovery, the remaining recovery is continued, which improves the efficiency of recovery.
  • the backup file stored in the binary format in advance may be separately imported into the data table corresponding to the table name in the database.
  • the CRC check is performed first, and the restored data is checked whether the data has not been modified, and only the data that has not been tampered with can be resumed.
  • the data existing in the database is cleared first.
  • the data to be restored is decompressed, decompressed into text files, and the table name is taken out from the list of table names in order according to the list of table names obtained from the system, and then the BCP tool encapsulated in this embodiment is used.
  • the data in the binary text is all imported into the corresponding table of the database, the table name in the table name list file is sequentially manipulated, until all the data of the text file has been imported into the database table, and the recovery is completed.
  • FIG. 4 is a flowchart of a data recovery method in a network management system according to a preferred embodiment of the present invention.
  • data backup and recovery occur in the same database management software.
  • the list of table names to be backed up specified in the data backup process is also one-to-one corresponding to the data recovery process.
  • the recovery data is an inverse process of the backup data, and the specific steps include the following steps S402 to S414.
  • step S402 a recovery operation is started.
  • Step S404 performing a decompression algorithm process on the file specified by the user in the .dat format.
  • Step S406 performing decryption processing on the decompressed binary file, and also generating a string of encrypted character strings, and comparing the string encrypted string with the encrypted string stored in the CRC.txt file, if the two strings are not Similarly, if the backed up data has been modified, it is not allowed to be restored to the system. If the two strings are the same, it means that the data has not been modified since the backup, then the operation of step S408 is performed; if two strings are If not, proceed to step S414.
  • Step S408 reading the table name or the view name in the database table name list file specified in advance, storing all the read table or view name information into a container 2, and comparing whether the number of table names in the container is It is equal to the number of binary files, and data recovery is performed when they are equal.
  • Step S410 sequentially extracting a table name "dbtablename" from the container 2, and then executing the packaged BCP tool, the program automatically constructs a command of the BCP tool that the database engine can recognize: bcp ⁇ dbtablename ⁇ ⁇ in ⁇ filename-c -k -t & -a65535 -S Database IP, Port Number - U Username -P Password
  • this embodiment divides all the table data in the database into a single text file, which reduces the system memory consumption during recovery and reduces the risk of memory overflow of the system running.
  • the entire recovery file needs to be loaded into the memory for processing. Since the file is large, the memory and CPU resources are very consumed.
  • the system only loads data in one file at a time, which greatly reduces the memory and CPU consumption makes the system run more smoothly.
  • Step S412 determining whether there is still a binary file to be imported, if yes, taking the next table name in the container 2, repeating the operation of step S408 until the above operations are performed on all the data tables in the container 2, and the recovery is completed; If no, the process proceeds to step S414.
  • step S414 the recovery operation is completed, and the recovery ends.
  • FIG. 5 is a structural block diagram of a data backup device of a network management system according to an embodiment of the present invention. As shown in FIG. 5, a read module 52 and a write module 54 are included. The structure is described in detail below.
  • the reading module 52 is configured to read a data table in the database that needs to be backed up; the writing module 54, connected to the reading module 52, is configured to write the data in the data table into a pre-designated text file in a binary format.
  • 6 is a structural block diagram of a data backup device of a network management system according to a preferred embodiment of the present invention. As shown in FIG. 6, the reading module 52 includes: an obtaining submodule 522, configured to acquire a table of data tables in the database that need to be backed up. Name list.
  • the read sub-module 524 is connected to the acquisition sub-module 522 and configured to read the data table corresponding to each data table name in the table name list in the database.
  • FIG. 7 is a block diagram showing the structure of a data backup device of a network management system according to a preferred embodiment of the present invention.
  • the write module 54 includes: a write submodule 542 configured to set data in each data table. The binary format is written to a separate text file specified in advance.
  • FIG. 8 is a structural block diagram 3 of a data backup apparatus of a network management system according to a preferred embodiment of the present invention. As shown in FIG. 8, the apparatus further includes: an encryption apparatus 56 configured to encrypt a text file.
  • the compression module 58 coupled to the encryption device 56, is configured to compress the encrypted text file.
  • the storage module 510 is coupled to the compression module 58 and configured to store the compressed text file to a designated area.
  • the embodiment of the invention provides a data recovery device of the network management system, and the device can be configured to implement a data recovery method of the network management system.
  • FIG. 9 is a structural block diagram of a data recovery device of a network management system according to an embodiment of the present invention. As shown in FIG. 5, a read module 92 and an import module 94 are included. The structure is described in detail below.
  • the reading module 92 is configured to read a backup file previously stored in a binary format from the designated area.
  • the import module 94 connected to the read module 92, is arranged to import the backup file into the database.
  • the reading module 92 includes: a first reading submodule 922, which is set as a data table pre-generated from the system. The table name is read in the table name list; the second reading sub-module 924 is connected to the first reading sub-module 922, and is set to read the binary format in the specified area corresponding to each data table name in the table name list. Stored backup files.
  • 11 is a block diagram showing the structure of a data recovery device of a network management system according to a preferred embodiment of the present invention, as shown in FIG.
  • the import module 94 includes: an import submodule 942, which is configured to respectively import a backup file stored in a binary format in advance into a data table corresponding to the table name in the database.
  • 12 is a structural block diagram 3 of a data recovery apparatus of a network management system according to a preferred embodiment of the present invention. As shown in FIG. 12, the apparatus further includes: a verification module 96, configured to check whether data of the binary text is modified. It should be noted that the data backup device of the network management system and the data recovery device of the network management system described in the device embodiment correspond to the foregoing method embodiments, and the specific implementation process has been described in detail in the method embodiment. No longer.
  • the present invention uses a binary format to back up and restore data, shortens the time taken for backup, and has industrial applicability.
  • modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices.
  • they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device, or they may be separately fabricated into individual integrated circuit modules, or they may be Multiple modules or steps are made into a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Provided are a data backup method and device, and a data recovery method and device of a network management system. The data backup method of the network management system comprises: reading a data table needing to be backed up from a database (S102); and writing, in a binary format, data in the data table into a pre-assigned text file (S104). The methods and devices solve the problem of time-consuming data backup and recovery, thereby achieving the effect of rapid data backup and recovery.

Description

网管系统的数据备份方法、 装置和恢复方法、 装置 技术领域 本发明涉及通信领域, 具体而言, 涉及一种网管系统的数据备份方法、 装置和恢 复方法、 装置。 背景技术 在相关技术的码分多址 (Code Division Multiple Access, 简称为 CDMA) 网管系 统中, 提供了一种备份与恢复重要数据的方法, 该方法中, 在备份的时候首先访问数 据库结构,按数据库结构编写结构查询语言(Structured Query Language,简称为 SQL) 语句,使用该 SQL语句将数据库中所有需备份的数据表生成一个先清空再逐个插入的 可执行序列文件。 在恢复的时候, 再利用数据库引擎直接运行这个可执行序列文件, 即可恢复所有已备份的数据。 此种备份恢复方式符合程序员的编程习惯, 同时也实现 了在线的备份、 恢复, 不需要重启服务器, 便于用户实时地对整个网络进行监控、 维 护。 但是, 相关技术的备份与恢复的方案存在以下弊端: 随着目前网管系统网管能力的提升, 一个网管系统可管理的基站数目已经可以达 到 1500个, 随着管理基站数目的增加, 需要备份与恢复的数据也成几何量增大, 用以 往的方式备份和恢复数据, 一个大的局域网的数据备份需要 10 分钟, 数据恢复需要 50分钟。 如此缓慢的备份和恢复速度, 显然无法满足用户的要求。 目前网管系统的备份恢复方式中使用的是 SQL脚本序列, 从 SQL脚本序列中可 以比较直观的了解目前系统中配置的数据, 但是用户可以修改该脚本序列中的数据, 对于商用系统而言, 使用 SQL脚本序列进行备份和恢复存在很大的安全隐患。 由于在备份恢复过程中, 用户无法进行其他操作, 对于数据量大的局域网, 如果 网管系统长时间不能对系统进行维护, 会导致用户满意度差。 在实际的使用过程中, 用户也经常反映传统的备份与恢复方式由于时间过长, 导致客户端与服务端通信断链 或者其他的问题。 针对相关技术中进行数据备份和恢复耗时较长的问题, 目前尚未提出有效的解决 方案。 发明内容 本发明提供了一种网管系统的数据备份方法、 装置和恢复方法、 装置, 以至少解 决相关技术中进行数据备份和恢复耗时较长的问题。 根据本发明的一个方面, 提供了一种网管系统的数据备份方法, 包括: 读取数据 库中需要备份的数据表;将数据表中数据以二进制的格式写入预先指定的文本文件中。 优选地, 读取数据库中需要备份的数据表包括: 获取数据库中需要备份的数据表 的表名列表; 读取数据库中与表名列表中的各个数据表名对应的数据表。 优选地, 读取数据库中与表名列表中的各个数据表名对应的数据表包括: 按表名 列表的顺序读取各个数据表名对应的数据表。 优选地, 将数据表中数据以二进制的格式写入到预先指定的文本文件中包括: 将 每个数据表中的数据以二进制的格式分别写入到预先指定的一个独立的文本文件中。 优选地, 在将数据表中数据以二进制的格式写入到预先指定的文本文件中之后, 还包括: 对文本文件加密。 优选地, 在对文本文件加密之后, 还包括: 对加密后的文本文件进行压缩; 将压 缩后的文本文件存储到指定区域。 根据本发明的另一个方面, 提供了一种网管系统的数据恢复方法, 包括: 从指定 区域中读取预先以二进制的格式存储的备份文件; 将备份文件导入数据库。 优选地, 从指定区域中读取预先以二进制的格式存储的备份文件包括: 从系统预 先生成的数据表的表名列表中读取表名; 读取指定区域中与表名列表中的各个数据表 名对应的以二进制格式存储的备份文件。 优选地, 将备份文件导入数据库, 包括: 分别将预先以二进制格式存储的备份文 件导入数据库中与表名对应的数据表中。 优选地, 在从系统预先生成的数据表的表名列表中读取表名之前, 还包括: 校验 二进制文本的数据是否被修改; 在数据未被修改的情况下, 从系统中的表名列表中读 取表名。 根据本发明的又一个方面, 提供了一种网管系统的数据备份装置, 包括: 读取模 块, 设置为读取数据库中需要备份的数据表; 写入模块, 设置为将数据表中数据以二 进制的格式写入预先指定的文本文件中。 根据本发明的再一个方面, 提供了一种网管系统的数据恢复装置, 包括: 读取模 块, 设置为从指定区域中读取预先以二进制的格式存储的备份文件; 导入模块, 设置 为将备份文件导入数据库。 通过本发明, 采用二进制的格式对数据进行备份和恢复, 至少解决了相关技术中 进行数据备份和恢复耗时较长的问题,进而达到了快速对数据进行备份和恢复的效果。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部分, 本发 明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图 中: 图 1是根据本发明实施例的网管系统的数据备份方法的流程图; 图 2是根据本发明优选实施例的网管系统的数据备份方法的流程图; 图 3是根据本发明实施例的网管系统中的数据恢复方法的流程图; 图 4是根据本发明优选实施例的网管系统中的数据恢复方法的流程图; 图 5是根据本发明实施例的网管系统的数据备份装置的结构框图; 图 6是根据本发明优选实施例的网管系统的数据备份装置的结构框图一; 图 7是根据本发明优选实施例的网管系统的数据备份装置的结构框图二; 图 8是根据本发明优选实施例的网管系统的数据备份装置的结构框图三; 图 9是根据本发明实施例的网管系统的数据恢复装置的结构框图; 图 10是根据本发明优选实施例的网管系统的数据恢复装置的结构框图一; 图 11是根据本发明优选实施例的网管系统的数据恢复装置的结构框图二; 图 12是根据本发明优选实施例的网管系统的数据恢复装置的结构框图三。 具体实施方式 需要说明的是, 在不冲突的情况下, 本申请中的实施例及实施例中的特征可以相 互组合。 下面将参考附图并结合实施例来详细说明本发明。 为了解决相关技术中进行数据备份和恢复耗时较长的问题, 本发明实施例采用以 下技术方案, 首先从系统中获取一份存储所有需要备份、 恢复的数据库中数据表的表 名列表, 当用户执行备份操作时, 则按顺序从表名列表文件中取出对应的数据表名, 根据这个数据表名, 采用封装好的大量复制(Bulk Copy, 简称为 BCP)工具, 到指定 的数据库中找到此数据表, 并将此数据表中的全部数据以二进制的格式写入到预先指 定的文本文件中, 再依次从列表文件中取下一个数据表名, 重复上述操作, 将数据库 中所有的表都导成一个个的二进制文本文件,再通过循环冗余校验(Cyclic Redundancy Check, 简称为 CRC) 对上述二进制文本文件进行加密处理, 最后对加密的文本文档 进行压缩, 存放到系统的指定目录。 需要说明的是, 通过使用 BCP工具, 可以向数据 表中导入和读取数据, 在本发明实施例中, 通过预先在系统中封装入 BCP工具, 实现 数据的写入和读取。 基于上述内容, 本发明实施例提供了一种网管系统的数据备份方法, 图 1是根据 本发明实施例的网管系统的数据备份方法的流程图, 包括如下的步骤 S102 至步骤 S104。 步骤 S102, 读取数据库中需要备份的数据表。 步骤 S104, 将数据表中数据以二进制的格式写入预先指定的文本文件中。 相关技术中, 在备份数据时直接备份一个根据待备份数据表生成的可执行序列文 件, 备份过程耗时较长, 通过本发明实施例, 将待备份数据表中的数据以二进制格式 进行备份, 缩短了备份所用的时间, 提高了用户体验。 步骤 S102中读取需要备份的数据表有多种实现方式,较为优选的,可以先获取数 据库中需要备份的数据表的表名列表, 然后读取数据库中与表名列表中的各个数据表 名对应的数据表。 先生成列表再逐个备份, 可以避免遗漏需备份的数据表, 同时, 在 备份过程被中断时,可以通过列表知晓哪些数据已经被备份, 哪些数据表还未被备份, 从而在已备份的基础上继续完成剩余备份, 提高了备份的效率。 由于表名列表中的表名与所述数据表之间存在一一对应的关系, 为了不额外存储 一份表名和数据表的对应关系, 可以按表名列表的顺序读取各个数据表名对应的数据 表。 相比于按表名首字母的先后读取、 按数据表的文件大小读取或者按数据表的修改 时间先后读取等方式, 直接按列表顺序读取个数据表的方式更加简便, 同时省略了存 储表名和数据表之间对应关系这一步骤, 节省了备份时间和存储空间。 在本发明实施例的步骤 S104中,可以将每个数据表中的数据以二进制的格式分别 写入到预先指定的一个独立的文本文件中, 相关技术中, 在进行备份时, 把待备份的 数据表全部加载到内存中处理, 由于文件大, 非常占用内存和 CPU资源, 通过本实施 例, 系统每次仅需加载一个数据表的数据, 极大地减小了内存和 CPU的占用, 使系统 运行更加流程。 在将数据表中数据以二进制的格式写入到预先指定的文本文件中之后, 为了防止 备份数据被修改, 还可以对文本文件加密。 为了节省存储空间, 还可以对加密后的文本文件进行压缩, 然后将压缩后的文本 文件存储到指定区域, 在本实施例中, 由于备份数据的格式是二进制, 数据的存储空 间得到了很大的压缩, 原来一份大容量数据需要几十 M的存储空间, 现在的数据只需 要 1M空间, 从而节省了存储空间。 下面将结合实例对本发明实施例的实现过程进行详细描述。 图 2是根据本发明优选实施例的网管系统的数据备份方法的流程图,如图 2所示, 在本发明优选实施例中的网管软件系统中, 数据备份就是将事先指定需要备份的数据 库中的数据表或视图名列表通过 BCP 工具中的批处理命令, 以单个表为单位进行处 理, 将表中的数据以二进制的格式存储到文本文件中打包存储, 具体包括如下步骤 S202至步骤 S216。 步骤 S202, 开始备份操作。 步骤 S204, 从文件或数据库读取库表序列。 步骤 S206, 按表明列表的顺序读取数据表名或视图名, 保证待备份的表或视图中 所有的字段都会被读取。 将读入的所有数据表或视图名信息存入到容器 1。 步骤 S208, 从容器 1中顺序取出一个表名存入变量" dbtablename", 然后以此变量The present invention relates to the field of communications, and in particular to a data backup method, apparatus, and recovery method and apparatus for a network management system. BACKGROUND OF THE INVENTION In the related art code division multiple access (CDMA) network management system, a method for backing up and restoring important data is provided. In the method, the database structure is first accessed during backup. The database structure writes a Structured Query Language (SQL) statement, and uses the SQL statement to generate an executable sequence file that is first emptied and then inserted one by one. At the time of recovery, the database engine can be used to directly run the executable sequence file to recover all the backed up data. This backup recovery method conforms to the programmer's programming habits. At the same time, it also realizes online backup and recovery. It does not need to restart the server, so that users can monitor and maintain the entire network in real time. However, the backup and recovery schemes of the related technologies have the following disadvantages: With the improvement of the network management capability of the network management system, the number of base stations that can be managed by one network management system can reach 1500. As the number of management base stations increases, backup and recovery are required. The data is also increased in geometry, and data is backed up and restored in the past. A large LAN data backup takes 10 minutes and data recovery takes 50 minutes. Such a slow backup and recovery speed obviously does not meet the user's requirements. Currently, the backup and recovery mode of the network management system uses the SQL script sequence. The SQL script sequence can be used to intuitively understand the data configured in the current system, but the user can modify the data in the script sequence. For commercial systems, use SQL script sequences for backup and recovery have great security risks. Because the user cannot perform other operations during the backup and recovery process, for a LAN with a large amount of data, if the network management system cannot maintain the system for a long time, the user satisfaction will be poor. In the actual use process, users often reflect the traditional backup and recovery methods due to the long time, resulting in communication disconnection between the client and the server or other problems. In view of the problem that the data backup and recovery in the related art takes a long time, an effective solution has not been proposed yet. SUMMARY OF THE INVENTION The present invention provides a data backup method, apparatus, and recovery method and apparatus for a network management system to at least solve the problem that data backup and recovery in a related art takes a long time. According to an aspect of the present invention, a data backup method of a network management system is provided, including: reading a data table in a database that needs to be backed up; and writing data in the data table into a pre-designated text file in a binary format. Preferably, reading the data table that needs to be backed up in the database comprises: obtaining a list of table names of the data tables that need to be backed up in the database; and reading the data table corresponding to each data table name in the table name list in the database. Preferably, reading the data table corresponding to each data table name in the table name list in the database comprises: reading the data table corresponding to each data table name in the order of the table name list. Preferably, writing the data in the data table in a binary format to the pre-designated text file comprises: writing the data in each data table in a binary format to a separate text file specified in advance. Preferably, after the data in the data table is written into the pre-designated text file in a binary format, the method further comprises: encrypting the text file. Preferably, after encrypting the text file, the method further includes: compressing the encrypted text file; and storing the compressed text file in the designated area. According to another aspect of the present invention, a data recovery method of a network management system is provided, comprising: reading a backup file stored in a binary format in advance from a specified area; and importing the backup file into a database. Preferably, reading the backup file stored in the binary format in advance from the specified area comprises: reading the table name from the table name list of the data table pre-generated by the system; reading each data in the specified area and the table name list The backup file corresponding to the table name stored in binary format. Preferably, importing the backup file into the database comprises: respectively importing the backup file stored in the binary format in advance into the data table corresponding to the table name in the database. Preferably, before reading the table name from the list of table names of the data table pre-generated by the system, the method further includes: checking whether the data of the binary text is modified; in the case that the data is not modified, the table name from the system Read the table name in the list. According to still another aspect of the present invention, a data backup device for a network management system is provided, comprising: a reading module configured to read a data table in a database that needs to be backed up; and a writing module configured to binary the data in the data table The format is written to a pre-specified text file. According to still another aspect of the present invention, a data recovery device for a network management system is provided, comprising: a reading module configured to read a backup file stored in a binary format in advance from a designated area; importing a module, setting the backup to be performed The file is imported into the database. Through the invention, the data is backed up and restored in a binary format, which at least solves the problem that the data backup and recovery in the related technology takes a long time, thereby achieving the effect of quickly backing up and restoring the data. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are set to illustrate,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 1 is a flowchart of a data backup method of a network management system according to an embodiment of the present invention; FIG. 2 is a flowchart of a data backup method of a network management system according to a preferred embodiment of the present invention; FIG. 4 is a flowchart of a data recovery method in a network management system according to a preferred embodiment of the present invention; FIG. 5 is a data backup device of a network management system according to an embodiment of the present invention; Figure 6 is a block diagram showing the structure of a data backup device of a network management system according to a preferred embodiment of the present invention; Figure 7 is a block diagram showing the structure of a data backup device of a network management system according to a preferred embodiment of the present invention; FIG. 9 is a structural block diagram of a data recovery device of a network management system according to an embodiment of the present invention; FIG. 10 is a block diagram of a data recovery device of a network management system according to an embodiment of the present invention; FIG. 11 is a block diagram of a data recovery device of a network management system according to a preferred embodiment of the present invention; FIG. Two block diagram; FIG. 12 is a block diagram showing recovery means third data network management system according to a preferred embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. The invention will be described in detail below with reference to the drawings in conjunction with the embodiments. In order to solve the problem that the data backup and recovery in the related art takes a long time, the following technical solutions are adopted in the embodiment of the present invention. First, a list of table names for storing all the data tables in the database that need to be backed up and restored is obtained from the system. When the user performs the backup operation, the corresponding data table name is retrieved from the table name list file in order, and according to the data table name, the packaged Bulk Copy (BCP) tool is used to find the specified database. This data table, and all the data in this data table is written in a binary format to a pre-designated text file, and then a data table name is removed from the list file, and the above operation is repeated, and all the tables in the database are All are converted into binary text files, and then the binary text file is encrypted by Cyclic Redundancy Check (CRC). Finally, the encrypted text file is compressed and stored in the specified directory of the system. . It should be noted that, by using the BCP tool, data can be imported and read into the data table. In the embodiment of the present invention, data is written and read by pre-packaging the BCP tool in the system. Based on the above, the embodiment of the present invention provides a data backup method of the network management system. FIG. 1 is a flowchart of a data backup method of the network management system according to an embodiment of the present invention, which includes the following steps S102 to S104. Step S102, reading a data table in the database that needs to be backed up. Step S104, the data in the data table is written in a binary format into a pre-designated text file. In the related art, when the data is backed up, an executable sequence file generated according to the data table to be backed up is directly backed up, and the backup process takes a long time. In the embodiment of the present invention, the data in the data table to be backed up is backed up in a binary format. Reduces the time it takes to back up and improves the user experience. There are multiple implementation manners for reading the data table that needs to be backed up in step S102. Preferably, the table name list of the data table to be backed up in the database may be obtained first, and then each data table name in the database and the table name list is read. Corresponding data table. First generate a list and then back up one by one, you can avoid missing the data table to be backed up. At the same time, when the backup process is interrupted, you can know which data has been backed up and which data tables have not been backed up by the list, so that it is backed up. Continue to complete the remaining backups, improving the efficiency of the backup. Since there is a one-to-one correspondence between the table name in the table name list and the data table, in order not to additionally store a correspondence between the table name and the data table, each data table name may be read in the order of the table name list. The data Table. Compared with reading the first letter of the table name, reading according to the file size of the data table, or reading according to the modification time of the data table, it is more convenient to read the data table directly in the order of the list, and at the same time The step of storing the correspondence between the table name and the data table saves backup time and storage space. In the step S104 of the embodiment of the present invention, the data in each data table can be separately written into a pre-designated independent text file in a binary format. In the related art, when the backup is performed, the backup to be backed up is performed. The data table is all loaded into the memory for processing. Since the file is large, it occupies a large amount of memory and CPU resources. With this embodiment, the system only needs to load data of one data table at a time, which greatly reduces the memory and CPU usage, and makes the system Run a more process. After the data in the data table is written in a binary format to a pre-designated text file, the text file can also be encrypted in order to prevent the backup data from being modified. In order to save the storage space, the encrypted text file can also be compressed, and then the compressed text file is stored in the designated area. In this embodiment, since the format of the backup data is binary, the storage space of the data is greatly The compression, the original large-capacity data requires tens of M of storage space, the current data only needs 1M space, thus saving storage space. The implementation process of the embodiment of the present invention will be described in detail below with reference to examples. 2 is a flowchart of a data backup method of a network management system according to a preferred embodiment of the present invention. As shown in FIG. 2, in the network management software system in the preferred embodiment of the present invention, data backup is to be specified in a database that needs to be backed up in advance. The data table or the view name list is processed in a single table by the batch command in the BCP tool, and the data in the table is stored in a binary format and stored in a binary file, and the following steps S202 to S216 are included. Step S202, starting a backup operation. Step S204, reading the library table sequence from the file or the database. In step S206, the data table name or the view name is read in the order of indicating the list, so that all fields in the table or view to be backed up are read. Store all data table or view name information read into container 1. Step S208, sequentially extracting a table name from the container 1 into the variable "dbtablename", and then using this variable
"dbtablename"为输入参数执行封装好的 BCP工具,本实施例会自动构造一条数据库引 擎可以识别的命令, 本实施例中命令的格式如下: bcp {dbtablename} { out } 文件名 -c -k -t & -a65535 -S 数据库 IP,端口号 -U用 户名 -P 密码 此命令中可以带上各种参数, 其中, The "dbtablename" executes the encapsulated BCP tool for the input parameters. In this embodiment, a command that the database engine can recognize is automatically constructed. The format of the command in this embodiment is as follows: Bcp {dbtablename} { out } filename -c -k -t & -a65535 -S database IP, port number -U username -P password This command can take various parameters,
"-c"表示导出来的表中数据采用字符类型存储, "-k"表示导出来的表中记录如果某 个字段的值为空, 则会自动保留空值, "-t"表示以某个字段终止符来作为每个字段值的 终止,这里以" &"作为终止, "-a"表示可以导出的文本文件的最大包大小,这里取 65536, 使之足够大, 支持大数据量, "-S"表示需要导出的数据库服务器的名称或 IP, "-U"表 示此数据库的用户名, "-P"表示此数据库对应的数据库密码。 调用数据库引擎执行此命令后, 系统会将数据库中的以变量 "dbtablename"为表名 的数据表中的所有数据, 以二进制格式存储到指定的文件路径下的文件中, 其中文件 名约定为: 固定的文件名前缀" _dbtablename.txt", 保证每个数据表生成一个唯一的二 进制文本文件。 由于本实施例读取数据的时候不需要区分每个表中的每个字段的类型, 也不需要 存储表中各个字段的信息, 而且写入文件的时候是按照紧凑的二进制字节流顺序写入 到文本中, 因此用这种方式备份数据库数据效率很高, 而且, 二进制格式的文件中的 数据都是 01数据, 压缩效率最高。 步骤 S210, 判断表名列表中的数据表是否已读取完, 如果是, 执行步骤 S212; 如果否, 读取容器 1中的下一个表名, 重复步骤 S208的操作, 直到将容器 1中的所有 数据表都进行了上述操作。 步骤 S212,对以二进制格式存储到指定的文件路径下的文件中的数据进行加密处 理, 生成一串加密字符串存入指定文本文件 CRC.txt中, 该加密字符用于在数据恢复 时校验备份的数据是否被修改。 步骤 S214, 对所有生成的二进制文件以及 CRC.txt文件进行压缩打包处理, 以自 定义的 .dat格式的文件存储, 放到用户指定目录。 步骤 S216, 完成备份操作, 备份结束。 本发明实施例还提供了一种网管系统的数据恢复方法, 该方法可以与上述的数据 备份方法配合使用。 图 3是根据本发明实施例的网管系统的数据恢复方法的流程图, 包括如下的步骤 S302至步骤 S304。 步骤 S302, 从指定区域中读取预先以二进制的格式存储的备份文件。 步骤 S304, 将备份文件导入数据库。 相关技术中, 在恢复数据时直接恢复一个预先生成的可执行序列文件, 恢复过程 耗时较长, 通过本发明实施例, 恢复预先以二进制的格式备份的数据表, 缩短了恢复 所用的时间, 提高了用户体验。 在读取备份文件时, 可以先从系统预先生成的数据表的表名列表中读取表名, 然 后读取指定区域中与表名列表中的各个数据表名对应的以二进制格式存储的备份文件 根据数据表的表名列表逐个恢复, 可以避免遗漏需恢复的数据表, 同时, 在恢复过程 被中断时, 可以通过列表知晓哪些数据已经被恢复, 哪些数据表还未被恢复, 从而在 已恢复的基础上继续完成剩余恢复, 提高了恢复的效率。 在本发明实施例的步骤 S304中,可以分别将预先以二进制格式存储的备份文件导 入数据库中与表名对应的数据表中。 相关技术中, 在进行恢复时, 把待备份的数据表 全部加载到内存中处理, 由于文件大, 非常占用内存和 CPU资源, 通过本实施例, 系 统每次仅需加载一个数据表的数据, 极大地减小了内存和 CPU的占用, 使系统运行更 加流程。 为了防止备份数据被修改, 在从系统预先生成的数据表的表名列表中读取表名之 前可以先校验二进制文本的数据是否被修改, 在数据未被修改的情况下, 才从系统中 的表名列表中读取表名。例如, 在本实施例中增加了 CRC校验, 防止用户更改任何数 据, 避免给运营商造成不可估量的损失。 从以上实施例可以发现, 当用户执行恢复操作时, 先进行 CRC校验, 检查恢复的 数据有没有被修改, 只有未被篡改的数据才能继续执行恢复, 此时, 先清空数据库中 存在的数据, 然后对准备恢复的数据进行解压, 解压成一个个的文本文件, 根据从系 统中获取的表名列表, 按顺序从表名列表中取出表名, 然后通过本实施例中封装好的 BCP工具, 将二进制文本中的数据全部导入的数据库的相应表中, 顺序操作表名列表 文件中的表名, 直至所有的文本文件的数据都已导入到数据库表中, 至此恢复完成。 下面将结合实例对本发明实施例的实现过程进行详细描述。 图 4是根据本发明优选实施例的网管系统中的数据恢复方法的流程图, 如图 4所 示,在实际的应用过程中,数据的备份与恢复都是发生在同一个数据库管理软件中的, 数据备份过程中事先指定的待备份的表名列表也同时一一对应数据恢复过程中需要待 恢复的表名列表。 恢复数据是备份数据的一个逆过程, 具体步骤包括如下步骤 S402 至步骤 S414。 步骤 S402, 开始恢复操作。 步骤 S404, 对用户指定的 .dat格式的文件进行解压缩算法处理。 步骤 S406, 对解压出的二进制文件进行解密处理, 同样会生成一串加密字符串, 将该串加密字符串与 CRC.txt文件中存储的加密字符串做字符串比较, 如果两个字符 串不一样, 则表明备份的数据已经被修改, 则不允许被恢复到系统中, 如果两个字符 串一样, 则表示该数据自备份后没有经过修改, 则进行步骤 S408的操作; 如果两个字 符串不一样, 则进行步骤 S414。 步骤 S408, 按顺序读取事先指定的数据库表名列表文件中的表名或视图名, 将读 入的所有表或视图名信息存入一容器 2中, 并比较容器中表名的个数是否与二进制文 件的个数相等, 在相等时进行数据恢复。 步骤 S410, 从容器 2中顺序取出一个表名 "dbtablename", 然后执行封装好的 BCP 工具, 程序会自动构造一条数据库引擎可以识别的 BCP工具的命令: bcp {dbtablename} { in } 文件名 -c -k -t & -a65535 -S 数据库 IP,端口号 -U用 户名 -P 密码 这里需要指出的是, 备份时指定的参数是如何定义的, 则恢复时也需要指定同样 的参数定义, 避免数据库引擎解析时, 错误的将二进制文件分割, 导致数据错位。 调 用数据库引擎执行此命令后, 数据库引擎会读取指定的文件路径下文件, 以二进制格 式进行读取, 并把数据依次写入数据库表 "dbtablename"中, 形成一条条的数据库记录。 由于本实施例是将文本文件中的数据按指定的间隔符批量的往数据库的表导入数据, 以纯二进制流的形式写入, 因此本实施例恢复数据库数据效率很高, 恢复的时间仅是 相关技术的十分之一。 另外与以前的技术相比, 本实施例将数据库中的所有表数据分 割成了一个个的文本文件, 这样在恢复时减少了系统内存的消耗, 降低了系统运行的 内存溢出风险, 相关技术在恢复数据时, 需要把整个恢复文件加载到内存中处理, 由 于文件大, 非常消耗内存与 CPU资源, 而采用本实施例, 系统每次仅加载一个文件中 的数据, 极大的减少了内存与 CPU的消耗, 使系统运行更顺畅。 步骤 S412, 判断是否还有待导入二进制文件, 如果是, 则取容器 2中的下一个表 名, 重复步骤 S408的操作, 直到对容器 2中的所有数据表都进行了上述操作, 至此恢 复完成; 如果否, 则进入步骤 S414。 步骤 S414, 完成恢复操作, 恢复结束。 从上述实例可以看出, 本发明实施例提供的备份与恢复重要数据的解决方案, 继 承了相关技术中灵活性高、 操作简单、 能在线备份与恢复的优点, 同时克服了相关技 术中对大容量数据执行效率低, 安全性差、 存储空间大等缺点。 更好的满足了通讯及 相关行业, 对重要配置数据的安全、 快速、 灵活、 方便地进行备份与恢复操作的要求, 取得了非常满意的效果, 并移植到了公司其他产品上使用。 需要说明的是, 在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的 计算机系统中执行, 并且, 虽然在流程图中示出了逻辑顺序, 但是在某些情况下, 可 以以不同于此处的顺序执行所示出或描述的步骤。 本发明实施例提供了一种网管系统的数据备份装置, 该装置可以设置为实现上述 网管系统的数据备份方法。 图 5是根据本发明实施例的网管系统的数据备份装置的结 构框图, 如图 5所示, 包括读取模块 52和写入模块 54。 下面对其结构进行详细描述。 读取模块 52, 设置为读取数据库中需要备份的数据表; 写入模块 54, 连接至读取 模块 52, 设置为将数据表中数据以二进制的格式写入预先指定的文本文件中。 图 6是根据本发明优选实施例的网管系统的数据备份装置的结构框图一, 如图 6 所示, 读取模块 52包括: 获取子模块 522, 设置为获取数据库中需要备份的数据表的 表名列表。读取子模块 524, 连接至获取子模块 522, 设置为读取数据库中与表名列表 中的各个数据表名对应的数据表。 优选地, 读取子模块 524按表名列表的顺序读取各个数据表名对应的数据表。 图 7是根据本发明优选实施例的网管系统的数据备份装置的结构框图二, 如图 7 所示, 写入模块 54包括: 写入子模块 542, 设置为将每个数据表中的数据以二进制的 格式分别写入到预先指定的一个独立的文本文件中。 图 8是根据本发明优选实施例的网管系统的数据备份装置的结构框图三, 如图 8 所示, 上述装置还包括: 加密装置 56, 设置为对文本文件加密。 压缩模块 58, 连接至 加密装置 56, 设置为对加密后的文本文件进行压缩。 存储模块 510, 连接至压缩模块 58, 设置为将压缩后的文本文件存储到指定区域。 本发明实施例提供了一种网管系统的数据恢复装置, 该装置可以设置为实现上述 网管系统的数据恢复方法。 图 9是根据本发明实施例的网管系统的数据恢复装置的结 构框图, 如图 5所示, 包括读取模块 92和导入模块 94。 下面对其结构进行详细描述。 读取模块 92, 设置为从指定区域中读取预先以二进制的格式存储的备份文件。 导 入模块 94, 连接至读取模块 92, 设置为将备份文件导入数据库。 图 10 是根据本发明优选实施例的网管系统的数据恢复装置的结构框图一, 如图 10所示, 读取模块 92包括: 第一读取子模块 922, 设置为从系统预先生成的数据表的 表名列表中读取表名; 第二读取子模块 924, 连接至第一读取子模块 922, 设置为读取 指定区域中与表名列表中的各个数据表名对应的以二进制格式存储的备份文件。 图 11 是根据本发明优选实施例的网管系统的数据恢复装置的结构框图二, 如图"-c" means that the data in the exported table is stored in character type, "-k" means that the record in the exported table will automatically retain the null value if the value of a field is empty, "-t" means to The terminator of the field is used as the termination of each field value. Here, "&" is used as the termination. "-a" indicates the maximum packet size of the text file that can be exported. Here, 65536 is used to make it large enough to support large data volume. "-S" indicates the name or IP of the database server to be exported, "-U" indicates the user name of this database, and "-P" indicates the database password corresponding to this database. After calling the database engine to execute this command, the system will store all the data in the data table in the database with the variable "dbtablename" as the table name in binary format to the file under the specified file path, where the file name convention is: The fixed file name prefix "_dbtablename.txt" ensures that each data table generates a unique binary text file. Since the data is read in this embodiment, it is not necessary to distinguish the type of each field in each table, nor the information of each field in the table is stored, and the file is written in a compact binary byte stream sequence. Into the text, so it is very efficient to back up the database data in this way, and the data in the binary format file is 01 data, the compression efficiency is the highest. Step S210, determining whether the data table in the table name list has been read, if yes, executing step S212; if not, reading the next table name in the container 1, repeating the operation of step S208 until the container 1 is All the data tables have done the above. Step S212, performing encryption processing on the data stored in the file in the binary file format in the specified file path, and generating a string of encrypted characters stored in the specified text file CRC.txt, the encrypted characters being used for verifying data recovery Whether the backed up data has been modified. Step S214, compressing and packaging all the generated binary files and the CRC.txt file, storing the files in a customized .dat format, and placing them in a user-specified directory. In step S216, the backup operation is completed, and the backup ends. The embodiment of the invention further provides a data recovery method of the network management system, which can be used in conjunction with the data backup method described above. FIG. 3 is a flowchart of a data recovery method of a network management system according to an embodiment of the present invention, which includes the following steps S302 to S304. Step S302, reading a backup file stored in a binary format in advance from the designated area. Step S304, importing the backup file into the database. In the related art, a pre-generated executable sequence file is directly restored when data is restored, and the recovery process takes a long time. By using the embodiment of the present invention, the data table backed up in a binary format is restored, which shortens the time used for recovery. Improve the user experience. When reading the backup file, the table name may be read from the table name list of the data table pre-generated by the system, and then the backup stored in the binary format corresponding to each data table name in the table name list in the specified area is read. The files are restored one by one according to the table name list of the data table, and the data table to be restored can be avoided. At the same time, when the recovery process is interrupted, the list can know which data has been recovered, which data tables have not been recovered, and thus On the basis of recovery, the remaining recovery is continued, which improves the efficiency of recovery. In step S304 of the embodiment of the present invention, the backup file stored in the binary format in advance may be separately imported into the data table corresponding to the table name in the database. In the related art, when the recovery is performed, all the data tables to be backed up are loaded into the memory for processing. Since the file is large, the memory and the CPU resources are occupied very much. In this embodiment, the system only needs to load data of one data table at a time. Greatly reduce the memory and CPU usage, and make the system run more smoothly. In order to prevent the backup data from being modified, it is possible to check whether the data of the binary text is modified before reading the table name from the list of table names of the data table pre-generated by the system, and the data is not modified from the system. The table name is read in the list of table names. For example, a CRC check is added in this embodiment to prevent the user from changing any data and avoiding an incalculable loss to the operator. It can be found from the above embodiment that when the user performs the recovery operation, the CRC check is performed first, and the restored data is checked whether the data has not been modified, and only the data that has not been tampered with can be resumed. In this case, the data existing in the database is cleared first. Then, the data to be restored is decompressed, decompressed into text files, and the table name is taken out from the list of table names in order according to the list of table names obtained from the system, and then the BCP tool encapsulated in this embodiment is used. , the data in the binary text is all imported into the corresponding table of the database, the table name in the table name list file is sequentially manipulated, until all the data of the text file has been imported into the database table, and the recovery is completed. The implementation process of the embodiment of the present invention will be described in detail below with reference to examples. 4 is a flowchart of a data recovery method in a network management system according to a preferred embodiment of the present invention. As shown in FIG. 4, in the actual application process, data backup and recovery occur in the same database management software. The list of table names to be backed up specified in the data backup process is also one-to-one corresponding to the data recovery process. A list of recovered table names. The recovery data is an inverse process of the backup data, and the specific steps include the following steps S402 to S414. In step S402, a recovery operation is started. Step S404, performing a decompression algorithm process on the file specified by the user in the .dat format. Step S406, performing decryption processing on the decompressed binary file, and also generating a string of encrypted character strings, and comparing the string encrypted string with the encrypted string stored in the CRC.txt file, if the two strings are not Similarly, if the backed up data has been modified, it is not allowed to be restored to the system. If the two strings are the same, it means that the data has not been modified since the backup, then the operation of step S408 is performed; if two strings are If not, proceed to step S414. Step S408, reading the table name or the view name in the database table name list file specified in advance, storing all the read table or view name information into a container 2, and comparing whether the number of table names in the container is It is equal to the number of binary files, and data recovery is performed when they are equal. Step S410, sequentially extracting a table name "dbtablename" from the container 2, and then executing the packaged BCP tool, the program automatically constructs a command of the BCP tool that the database engine can recognize: bcp {dbtablename} { in } filename-c -k -t & -a65535 -S Database IP, Port Number - U Username -P Password Here, it is necessary to specify how the parameters specified during backup are defined. In the case of recovery, you also need to specify the same parameter definition to avoid the database. When the engine parses, the binary file is incorrectly split, resulting in data misalignment. After calling the database engine to execute this command, the database engine will read the file under the specified file path, read it in binary format, and write the data into the database table "dbtablename" in turn to form a database record. In this embodiment, the data in the text file is imported into the database table in a batch format by a specified interval, and is written in the form of a pure binary stream. Therefore, the recovery of the database data in this embodiment is very efficient, and the recovery time is only relevant. One tenth of technology. In addition, compared with the prior art, this embodiment divides all the table data in the database into a single text file, which reduces the system memory consumption during recovery and reduces the risk of memory overflow of the system running. When restoring data, the entire recovery file needs to be loaded into the memory for processing. Since the file is large, the memory and CPU resources are very consumed. With this embodiment, the system only loads data in one file at a time, which greatly reduces the memory and CPU consumption makes the system run more smoothly. Step S412, determining whether there is still a binary file to be imported, if yes, taking the next table name in the container 2, repeating the operation of step S408 until the above operations are performed on all the data tables in the container 2, and the recovery is completed; If no, the process proceeds to step S414. In step S414, the recovery operation is completed, and the recovery ends. It can be seen from the above examples that the solution for backing up and restoring important data provided by the embodiments of the present invention inherits the advantages of high flexibility, simple operation, online backup and recovery, and overcomes the related art. Capacity data execution is inefficient, poor security, and large storage space. It better satisfies the requirements of communication and related industries, and provides safe, fast, flexible and convenient backup and recovery operations for important configuration data. It has achieved very satisfactory results and has been transplanted to other products of the company. It should be noted that the steps shown in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer executable instructions, and, although the logical order is shown in the flowchart, in some cases, The steps shown or described may be performed in an order different than that herein. The embodiment of the invention provides a data backup device of the network management system, and the device can be configured to implement the data backup method of the network management system. FIG. 5 is a structural block diagram of a data backup device of a network management system according to an embodiment of the present invention. As shown in FIG. 5, a read module 52 and a write module 54 are included. The structure is described in detail below. The reading module 52 is configured to read a data table in the database that needs to be backed up; the writing module 54, connected to the reading module 52, is configured to write the data in the data table into a pre-designated text file in a binary format. 6 is a structural block diagram of a data backup device of a network management system according to a preferred embodiment of the present invention. As shown in FIG. 6, the reading module 52 includes: an obtaining submodule 522, configured to acquire a table of data tables in the database that need to be backed up. Name list. The read sub-module 524 is connected to the acquisition sub-module 522 and configured to read the data table corresponding to each data table name in the table name list in the database. Preferably, the reading sub-module 524 reads the data tables corresponding to the respective data table names in the order of the table name list. FIG. 7 is a block diagram showing the structure of a data backup device of a network management system according to a preferred embodiment of the present invention. As shown in FIG. 7, the write module 54 includes: a write submodule 542 configured to set data in each data table. The binary format is written to a separate text file specified in advance. FIG. 8 is a structural block diagram 3 of a data backup apparatus of a network management system according to a preferred embodiment of the present invention. As shown in FIG. 8, the apparatus further includes: an encryption apparatus 56 configured to encrypt a text file. The compression module 58, coupled to the encryption device 56, is configured to compress the encrypted text file. The storage module 510 is coupled to the compression module 58 and configured to store the compressed text file to a designated area. The embodiment of the invention provides a data recovery device of the network management system, and the device can be configured to implement a data recovery method of the network management system. FIG. 9 is a structural block diagram of a data recovery device of a network management system according to an embodiment of the present invention. As shown in FIG. 5, a read module 92 and an import module 94 are included. The structure is described in detail below. The reading module 92 is configured to read a backup file previously stored in a binary format from the designated area. The import module 94, connected to the read module 92, is arranged to import the backup file into the database. FIG. 10 is a structural block diagram of a data recovery apparatus of a network management system according to a preferred embodiment of the present invention. As shown in FIG. 10, the reading module 92 includes: a first reading submodule 922, which is set as a data table pre-generated from the system. The table name is read in the table name list; the second reading sub-module 924 is connected to the first reading sub-module 922, and is set to read the binary format in the specified area corresponding to each data table name in the table name list. Stored backup files. 11 is a block diagram showing the structure of a data recovery device of a network management system according to a preferred embodiment of the present invention, as shown in FIG.
11所示, 导入模块 94包括: 导入子模块 942, 设置为分别将预先以二进制格式存储的 备份文件导入数据库中与表名对应的数据表中。 图 12 是根据本发明优选实施例的网管系统的数据恢复装置的结构框图三, 如图 12所示, 上述装置还包括: 校验模块 96, 设置为校验二进制文本的数据是否被修改。 需要说明的是, 装置实施例中描述的网管系统的数据备份装置和网管系统的数据 恢复装置对应于上述的方法实施例, 其具体的实现过程在方法实施例中已经进行过详 细说明, 在此不再赘述。 工业实用性 本发明采用二进制的格式对数据进行备份和恢复, 缩短了备份所用的时间, 具有 工业适用性。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可以用通用 的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算装置所 组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以 将它们存储在存储装置中由计算装置来执行, 或者将它们分别制作成各个集成电路模 块, 或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本发明 不限制于任何特定的硬件和软件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。 As shown in Fig. 11, the import module 94 includes: an import submodule 942, which is configured to respectively import a backup file stored in a binary format in advance into a data table corresponding to the table name in the database. 12 is a structural block diagram 3 of a data recovery apparatus of a network management system according to a preferred embodiment of the present invention. As shown in FIG. 12, the apparatus further includes: a verification module 96, configured to check whether data of the binary text is modified. It should be noted that the data backup device of the network management system and the data recovery device of the network management system described in the device embodiment correspond to the foregoing method embodiments, and the specific implementation process has been described in detail in the method embodiment. No longer. Industrial Applicability The present invention uses a binary format to back up and restore data, shortens the time taken for backup, and has industrial applicability. Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general-purpose computing device, which can be concentrated on a single computing device or distributed over a network composed of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device, or they may be separately fabricated into individual integrated circuit modules, or they may be Multiple modules or steps are made into a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software. The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.

Claims

权 利 要 求 书 Claim
1. 一种网管系统的数据备份方法, 包括: A data backup method for a network management system, comprising:
读取数据库中需要备份的数据表;  Read the data table in the database that needs to be backed up;
将所述数据表中数据以二进制的格式写入预先指定的文本文件中。  The data in the data table is written in a binary format into a pre-designated text file.
2. 根据权利要求 1所述的方法, 其中, 读取数据库中需要备份的数据表包括: 获取所述数据库中需要备份的数据表的表名列表; 2. The method according to claim 1, wherein the reading the data table in the database that needs to be backed up comprises: obtaining a list of table names of the data tables in the database that need to be backed up;
读取所述数据库中与所述表名列表中的各个数据表名对应的所述数据表。  The data table corresponding to each data table name in the table name list in the database is read.
3. 根据权利要求 2所述的方法, 其中, 读取所述数据库中与所述表名列表中的各 个数据表名对应的所述数据表包括: 按所述表名列表的顺序读取各个所述数据 表名对应的数据表。 3. The method according to claim 2, wherein reading the data table corresponding to each data table name in the table name list in the database comprises: reading each in the order of the table name list The data table corresponding to the data table name.
4. 根据权利要求 1所述的方法, 其中, 将所述数据表中数据以二进制的格式写入 到预先指定的文本文件中包括: 将每个数据表中的数据以二进制的格式分别写 入到预先指定的一个独立的文本文件中。 4. The method according to claim 1, wherein writing data in the data table in a binary format to a pre-designated text file comprises: writing data in each data table in a binary format Go to a separate text file specified in advance.
5. 根据权利要求 1所述的方法, 其中, 在将所述数据表中数据以二进制的格式写 入到预先指定的文本文件中之后, 还包括: 对所述文本文件加密。 5. The method according to claim 1, wherein, after the data in the data table is written in a binary format into a pre-designated text file, the method further comprises: encrypting the text file.
6. 根据权利要求 5所述的方法, 其中, 在对所述文本文件加密之后, 还包括: 对加密后的所述文本文件进行压缩; The method according to claim 5, after the encrypting the text file, further comprising: compressing the encrypted text file;
将压缩后的所述文本文件存储到指定区域。  The compressed text file is stored in a specified area.
7. 一种网管系统的数据恢复方法, 包括: 7. A data recovery method for a network management system, comprising:
从指定区域中读取预先以二进制的格式存储的备份文件;  Reading a backup file previously stored in binary format from the specified area;
将所述备份文件导入数据库。  Import the backup file into the database.
8. 根据权利要求 7所述的方法, 其中, 从指定区域中读取预先以二进制的格式存 储的备份文件包括: 8. The method according to claim 7, wherein reading the backup file previously stored in a binary format from the specified area comprises:
从系统预先生成的数据表的表名列表中读取表名; 读取所述指定区域中与所述表名列表中的各个数据表名对应的以二进制格 式存储的备份文件。 Reading the table name from the list of table names of the data table pre-generated by the system; A backup file stored in a binary format corresponding to each data table name in the table name list in the specified area is read.
9. 根据权利要求 8所述的方法, 其中, 将所述备份文件导入数据库, 包括: 分别 将预先以二进制格式存储的备份文件导入数据库中与表名对应的数据表中。 9. The method according to claim 8, wherein the importing the backup file into the database comprises: respectively importing a backup file stored in a binary format in advance into a data table corresponding to the table name in the database.
10. 根据权利要求 8所述的方法, 其中, 在从系统预先生成的数据表的表名列表中 读取表名之前, 还包括: 10. The method according to claim 8, wherein before the table name is read from the list of table names of the data table pre-generated by the system, the method further includes:
校验所述二进制文本的数据是否被修改;  Verifying whether the data of the binary text is modified;
在所述数据未被修改的情况下, 从系统中的所述表名列表中读取表名。  In the case where the data has not been modified, the table name is read from the list of table names in the system.
11. 一种网管系统的数据备份装置, 包括: 11. A data backup device for a network management system, comprising:
读取模块, 设置为读取数据库中需要备份的数据表;  Reading module, set to read the data table in the database that needs to be backed up;
写入模块, 设置为将所述数据表中数据以二进制的格式写入预先指定的文 本文件中。  A write module, configured to write data in the data table into a pre-specified text file in a binary format.
12. 一种网管系统的数据恢复装置, 包括: 12. A data recovery device for a network management system, comprising:
读取模块,设置为从指定区域中读取预先以二进制的格式存储的备份文件; 导入模块, 设置为将所述备份文件导入数据库。  The reading module is configured to read a backup file stored in a binary format in advance from the specified area; the import module is configured to import the backup file into the database.
PCT/CN2012/074018 2012-02-22 2012-04-13 Data backup method and device, and data recovery method and device of network management system WO2013123703A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2012100406957A CN102624545A (en) 2012-02-22 2012-02-22 Data backup method, data backup device, data recovery method and data recovery device of network management system
CN201210040695.7 2012-02-22

Publications (1)

Publication Number Publication Date
WO2013123703A1 true WO2013123703A1 (en) 2013-08-29

Family

ID=46564236

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/074018 WO2013123703A1 (en) 2012-02-22 2012-04-13 Data backup method and device, and data recovery method and device of network management system

Country Status (2)

Country Link
CN (1) CN102624545A (en)
WO (1) WO2013123703A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108804463B (en) * 2017-05-03 2021-07-09 杭州海康威视数字技术股份有限公司 Data synchronization method and device of MySQL database and electronic equipment
CN108255938A (en) * 2017-12-07 2018-07-06 中国航空工业集团公司西安航空计算技术研究所 A kind of airborne Embedded Main Memory Database image generation and loading method
CN109213635B (en) * 2018-09-11 2020-10-30 许继集团有限公司 Damaged data table repairing method and system of wave recording device
CN111580838A (en) * 2019-02-18 2020-08-25 深圳市致趣科技有限公司 Zigbee network recovery and backup method and system
CN110851171B (en) * 2019-11-09 2023-08-11 许继集团有限公司 Function configuration method, tool and system for embedded platform
CN114491652A (en) * 2022-04-19 2022-05-13 广州市保伦电子有限公司 Method for encrypting, backing up and decrypting and restoring database data and processing terminal

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1517918A (en) * 2003-01-17 2004-08-04 深圳市中兴通讯股分有限公司 Method for back-up and restoring important data
CN1549128A (en) * 2003-05-15 2004-11-24 深圳市中兴通讯股份有限公司南京分公 Databank back-up method
CN101202644A (en) * 2006-12-15 2008-06-18 中兴通讯股份有限公司 Data backup and recovery method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7523098B2 (en) * 2004-09-15 2009-04-21 International Business Machines Corporation Systems and methods for efficient data searching, storage and reduction

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1517918A (en) * 2003-01-17 2004-08-04 深圳市中兴通讯股分有限公司 Method for back-up and restoring important data
CN1549128A (en) * 2003-05-15 2004-11-24 深圳市中兴通讯股份有限公司南京分公 Databank back-up method
CN101202644A (en) * 2006-12-15 2008-06-18 中兴通讯股份有限公司 Data backup and recovery method

Also Published As

Publication number Publication date
CN102624545A (en) 2012-08-01

Similar Documents

Publication Publication Date Title
US10102242B2 (en) Bulk initial download of mobile databases
CN107832406B (en) Method, device, equipment and storage medium for removing duplicate entries of mass log data
WO2013123703A1 (en) Data backup method and device, and data recovery method and device of network management system
KR102319657B1 (en) Managing operations on stored data units
CN112328435B (en) Method, device, equipment and storage medium for backing up and recovering target data
CN106874348B (en) File storage and index method and device and file reading method
CN103384884A (en) File compression method and device, file decompression method and device, and server
KR102275431B1 (en) Managing operations on stored data units
CN114556304B (en) Network accessible block level snapshot
US20110307471A1 (en) Accelerating Database Management System Operations
CN110166221B (en) Ciphertext data compression storage structure RCPE and data dynamic read-write method
WO2017045491A1 (en) Method and system for upgrading sqlite3 embedded database
CN112612576B (en) Virtual machine backup method and device, electronic equipment and storage medium
CN111966631A (en) Mirror image file generation method, system, equipment and medium capable of being rapidly distributed
WO2022082891A1 (en) Big data acquisition method and system, and computer device and storage medium thereof
CN110333876A (en) A kind of data clearing method and control equipment
CN105320577B (en) A kind of data backup and resume method, system and device
CN111078279A (en) Processing method, device and equipment of byte code file and storage medium
KR102275240B1 (en) Managing operations on stored data units
CN113961226B (en) Software development kit repairing method, terminal, server and equipment
US11762738B2 (en) Reducing bandwidth during synthetic restores from a deduplication file system
CN111427860A (en) Distributed storage system and data processing method thereof
CN113741954A (en) System software generation method and device, electronic equipment and storage medium
Liakos et al. Realizing memory-optimized distributed graph processing
US10311021B1 (en) Systems and methods for indexing backup file metadata

Legal Events

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

Ref document number: 12869051

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12869051

Country of ref document: EP

Kind code of ref document: A1