CN114443371A - Timing backup method and system based on domestic distributed database - Google Patents

Timing backup method and system based on domestic distributed database Download PDF

Info

Publication number
CN114443371A
CN114443371A CN202210120373.7A CN202210120373A CN114443371A CN 114443371 A CN114443371 A CN 114443371A CN 202210120373 A CN202210120373 A CN 202210120373A CN 114443371 A CN114443371 A CN 114443371A
Authority
CN
China
Prior art keywords
backup
timing
task
database
system table
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210120373.7A
Other languages
Chinese (zh)
Inventor
徐扬
鲍之骁
田祥雨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Yunxi Technology Co ltd
Original Assignee
Shandong Inspur Scientific Research Institute Co Ltd
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 Shandong Inspur Scientific Research Institute Co Ltd filed Critical Shandong Inspur Scientific Research Institute Co Ltd
Priority to CN202210120373.7A priority Critical patent/CN114443371A/en
Publication of CN114443371A publication Critical patent/CN114443371A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The invention particularly relates to a timing backup method and a timing backup system based on a domestic distributed database. According to the timed backup method and system based on the domestic distributed database, a user creates an SQL statement of a timed backup task, the database analyzes the SQL statement, backup information is written into a system table, and a timed backup task executed by a background is created at the same time; the database scans the system table at regular time, screens out backup tasks to be executed and executes the backup tasks; if the backup task is not executed successfully, the timing backup task is stopped, a database user is prompted, and meanwhile, problem information is written into a log. According to the timing backup method and system based on the domestic distributed database, the timing backup task is set by inputting the SQL statements in the database, so that the timing backup becomes more flexible, the backup is easier, the data can be protected, the large-scale loss of the data is avoided, the safety of the data is ensured, meanwhile, the related online services of the database are not influenced, and the application scene is wide.

Description

Timing backup method and system based on domestic distributed database
Technical Field
The invention relates to the technical field of distributed databases, in particular to a timing backup method and a timing backup system based on a domestic distributed database.
Background
In a large distributed database, data protection is particularly important, and data backup is a reasonable means for protecting data. If the database data is backed up at a designated point in time, the constantly updated data can be protected. When the database fails, the database can be restored to the time point of the last backup in time, so that large-scale loss of data is avoided. Currently, the backup method for the database by those skilled in the art mainly adopts the following two strategies:
1) and compiling a script by using a timing system of the operating system, and copying the physical storage data of the database at regular time.
According to the scheme, the script is compiled by utilizing a timing system of the operating system, so that timing operation can be performed at the period time specified by the script, and the data physically stored in the database is copied and stored in other safe physical storage equipment.
2) And writing a script by using a timing system of the operating system, and executing the SQL backup statement at a fixed time.
The scheme combines the timing system of the operating system with the backup function of the database to execute the SQL backup statement at fixed time, so that the database data backup can be carried out in the fixed time period specified by the script.
The two schemes both depend on an operating system strongly, have high limitation, need to be familiar with personnel compiling scripts of the corresponding operating system to compile the scripts, and related information backed up in a timing mode in the above way is not intuitive enough and is not easy to store. Meanwhile, the scheme 1) is physical backup, the database can be copied only by stopping, and many service scenes are not applicable. Scheme 2) gets rid of the limitation, can be applied to online services, but is still limited in aspects such as operating systems and scripts.
Based on the problems existing in the current database backup, the invention provides a timing backup method and a timing backup system based on a domestic distributed database.
Disclosure of Invention
In order to make up for the defects of the prior art, the invention provides a simple and efficient timed backup method and system based on a domestic distributed database.
The invention is realized by the following technical scheme:
a timing backup method based on a domestic distributed database is characterized in that: the method comprises the following steps:
step S1, the user executes SQL statements for creating the timing backup task;
step S2, the database analyzes the SQL sentence, writes the backup information into the system table of the timing backup in the database, and creates the timing backup task executed by the background;
step S3, the database scans the system table at regular time according to the preset time interval, screens out the backup task to be executed and executes the backup task;
step S4, executing the backup task which is screened in the step S3 and meets the condition, and if the backup task is successfully executed, continuing to execute the step S3; if the failure is not successful, the timed backup task is stopped, the database user is prompted, and meanwhile, the problem information is written into the log.
In step S1, the backup information recorded in the SQL statement includes a backup target, a backup cycle, and backup location information;
the backup location information is used for backing up the specified database (mode, table) to the specified node, partition and disk drop location.
In step S2, the database service parses the SQL statement to generate a syntax tree, and then generates an execution plan through the syntax tree, and writes the backup information into the system table for timed backup in the database.
The specific implementation steps of step S2 are as follows:
s2.1, after the user inputs SQL sentences for creating the timing backup task, a parser is used for lexical analysis, syntactic analysis and semantic analysis, and the SQL sentences are generated into a syntax tree;
s2.2, the optimizer generates a logic plan according to the syntax tree and then generates a physical plan during specific execution according to the logic plan;
and S2.3, writing the backup information into a system table of the timing backup in the database based on the executed physical plan, and creating a timing backup process in the background for scanning the system table at regular time.
In step S3, the database scans the system table once at regular intervals according to a preset time interval in the database, and screens out and executes the backup task to be executed; the method comprises the following concrete steps:
s3.1, regularly scanning a backup system table according to a preset time interval, and inquiring whether the backup task should be executed;
and 3.2, if the execution condition is met, executing the backup task and updating the timing information of the backup task in a system table of the timing backup task, and if the execution condition is not met, not executing the backup task and updating and waiting for next scanning.
A timing backup system based on domestic distributed database is characterized in that: the system comprises an SQL statement creating module, an analysis module, a backup task creating module, a timing scanning module, a backup task execution module, a system table management module and a log management module;
the backup task creating module is responsible for creating SQL statements of the timing backup task;
the analysis module is responsible for analyzing the SQL statement and acquiring backup information, wherein the backup information comprises a backup target, a backup period and backup position information;
the backup task creating module is responsible for creating a timing backup task executed by a background;
the timing scanning module is responsible for carrying out timing scanning on the system table according to a preset time interval and screening out backup tasks to be executed;
the backup task execution module is responsible for executing the backup tasks which are screened out by the timing scanning module and meet the conditions;
the system table management module is responsible for writing the backup information analyzed by the analysis module into the system table and updating the backup information recorded in the system table in real time;
and the log management module is responsible for writing the problem information into the log when the backup task execution module fails to execute the backup task.
The analysis module comprises an analyzer and an optimizer, wherein the analyzer is used for performing lexical analysis, syntactic analysis and semantic analysis on the SQL sentences and generating a syntax tree for the SQL sentences; the optimizer is responsible for generating a logic plan according to the syntax tree, the backup task creating module generates a specifically executed backup task according to the logic plan, and the system table management module writes backup information into a system table which is regularly backed up in the database based on an executed physical plan.
The timing scanning module regularly scans the backup system table according to a preset time interval and inquires whether the backup task should be executed; if the execution condition is met, the backup task execution module executes the backup task, the system table management module updates the timing information of the backup task in the system table, if the execution condition is not met, the backup task execution module does not execute the backup task, and the system table management module does not update the timing information of the backup task in the system table and waits for next scanning.
The invention has the beneficial effects that: according to the timing backup method and system based on the domestic distributed database, the timing backup task is set by inputting the SQL statements into the database, so that the timing backup becomes more flexible, the backup is easier to pass, the data can be protected, the large-scale loss of the data is avoided, the safety of the data is guaranteed, meanwhile, the related online services of the database are not influenced, and the application scene is wide.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic diagram of a method for creating a timed backup task according to the present invention.
FIG. 2 is a schematic diagram of a method for performing a backup operation according to the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the embodiment of the present invention. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
SQL (Structured Query Language), a special programming Language, is used to access data and Query, update, and manage relational database systems.
The timed backup method based on the domestic distributed database comprises the following steps:
step S1, the user executes SQL statements for creating timing backup tasks;
step S2, the database analyzes SQL sentences, the backup information is written into a system table of the timing backup in the database, and a timing backup task executed by the background is created at the same time;
step S3, the database scans the system table at regular time according to the preset time interval, screens out the backup task to be executed and executes the backup task;
step S4, executing the backup task which is screened in the step S3 and meets the condition, and if the backup task is successfully executed, continuing to execute the step S3; if the failure is not successful, the timed backup task is stopped, the database user is prompted, and meanwhile, the problem information is written into the log.
In step S1, the backup information recorded in the SQL statement includes a backup target, a backup cycle, and backup location information;
the backup location information is used for backing up the specified database (mode, table) to the specified node, partition and disk drop location.
In step S2, the database service parses the SQL statement to generate a syntax tree, and then generates an execution plan through the syntax tree, and writes the backup information into the system table for timed backup in the database.
The specific implementation steps of step S2 are as follows:
s2.1, after the user inputs SQL sentences for creating the timing backup task, a parser is used for lexical analysis, syntactic analysis and semantic analysis, and the SQL sentences are generated into a syntax tree;
s2.2, the optimizer generates a logic plan according to the syntax tree and then generates a physical plan during specific execution according to the logic plan;
and S2.3, writing the backup information into a system table of the timing backup in the database based on the executed physical plan, and creating a timing backup process in the background for scanning the system table at regular time.
The specific information in the system table for the timed backup in the database is as follows:
{
unique identification of schedule _ id timing backup task
schedule _ name timed backup task name
created timed backup task creation time
owner user for owner timing backup task
schedule _ expr timed backup period expression
Next _ run the time to next backup execution
target timed backup task object
}
In step S3, the database scans the system table once at regular intervals according to a preset time interval in the database, and screens out and executes the backup task to be executed; the method comprises the following concrete steps:
s3.1, regularly scanning a backup system table according to a preset time interval, and inquiring whether the backup task should be executed;
and 3.2, if the execution condition is met, executing the backup task and updating the timing information of the backup task in a system table of the timing backup task, and if the execution condition is not met, not executing the backup task and updating and waiting for next scanning.
And comparing and judging the current time with the next _ run corresponding to the backup in the system table, if the current time is more than or equal to the next _ run, executing the backup task, and if the current time is less than the next _ run, not executing the backup task.
And executing backup, namely updating the timing information of the backup, namely updating the next _ run value of the corresponding backup in the system table, wherein the next _ run value is the time period converted by adding schedule _ expr to the current next _ run value.
The timed backup system based on the domestic distributed database comprises an SQL (structured query language) statement creating module, an analysis module, a backup task creating module, a timed scanning module, a backup task executing module, a system table management module and a log management module;
the backup task creating module is responsible for creating SQL statements of the timing backup task;
the analysis module is responsible for analyzing the SQL statement and acquiring backup information, wherein the backup information comprises a backup target, a backup period and backup position information;
the backup task creating module is responsible for creating a timing backup task executed by a background;
the timing scanning module is responsible for carrying out timing scanning on the system table according to a preset time interval and screening out backup tasks to be executed;
the backup task execution module is responsible for executing the backup tasks which are screened out by the timing scanning module and meet the conditions;
the system table management module is responsible for writing the backup information analyzed by the analysis module into the system table and updating the backup information recorded in the system table in real time;
and the log management module is responsible for writing the problem information into the log when the backup task execution module fails to execute the backup task.
The analysis module comprises an analyzer and an optimizer, wherein the analyzer is used for performing lexical analysis, syntactic analysis and semantic analysis on the SQL sentences and generating a syntax tree for the SQL sentences; the optimizer is responsible for generating a logic plan according to the syntax tree, the backup task creating module generates a specifically executed backup task according to the logic plan, and the system table management module writes backup information into a system table which is regularly backed up in the database based on an executed physical plan.
The timing scanning module regularly scans the backup system table according to a preset time interval and inquires whether the backup task should be executed; if the execution condition is met, the backup task execution module executes the backup task, the system table management module updates the timing information of the backup task in the system table, if the execution condition is not met, the backup task execution module does not execute the backup task, and the system table management module does not update the timing information of the backup task in the system table and waits for the next scanning.
According to the timing backup method and system based on the domestic distributed database, the database data is backed up at regular time through the database, large-scale loss of the data can be avoided, the safety of the data is guaranteed, meanwhile, compared with other similar technologies, the problem that a timing backup task is strongly dependent on an operating system and a script is solved, the timing backup is more flexible and easy to achieve, operation and use of database management personnel are facilitated, the backup mode uses a logic backup mode of the database, the method belongs to logic backup rather than physical backup, the problem that database business needs to be stopped during backup can be solved, the business scene is widened, and meanwhile, the safety and reliability of the data are guaranteed.
The above-described embodiment is only one specific embodiment of the present invention, and general changes and substitutions by those skilled in the art within the technical scope of the present invention are included in the protection scope of the present invention.

Claims (8)

1. A timing backup method based on a domestic distributed database is characterized in that: the method comprises the following steps:
step S1, the user executes SQL statements for creating the timing backup task;
step S2, the database analyzes SQL sentences, the backup information is written into a system table of the timing backup in the database, and a timing backup task executed by the background is created at the same time;
step S3, the database scans the system table at regular time according to the preset time interval, screens out the backup task to be executed and executes the backup task;
step S4, executing the backup task which is screened in the step S3 and meets the condition, and if the backup task is successfully executed, continuing to execute the step S3; if the failure is not successful, the timed backup task is stopped, the database user is prompted, and meanwhile, the problem information is written into the log.
2. The timed backup method based on domestic distributed database according to claim 1, characterized in that: in step S1, the backup information recorded in the SQL statement includes a backup target, a backup period, and backup location information.
3. The domestic distributed database-based timed backup method according to claim 2, characterized in that: in step S2, the database service parses the SQL statement to generate a syntax tree, and then generates an execution plan through the syntax tree, and writes the backup information into the system table for timed backup in the database.
4. The timed backup method based on domestic distributed database according to claim 3, characterized in that: the specific implementation steps of step S2 are as follows:
s2.1, after the user inputs SQL sentences for creating the timing backup task, a parser is used for lexical analysis, syntactic analysis and semantic analysis, and the SQL sentences are generated into a syntax tree;
s2.2, the optimizer generates a logic plan according to the syntax tree and then generates a physical plan during specific execution according to the logic plan;
and S2.3, writing the backup information into a system table of the timing backup in the database based on the executed physical plan, and creating a timing backup process in the background for scanning the system table at regular time.
5. The timed backup method based on domestic distributed database according to claim 3, characterized in that: in step S3, the database scans the system table once at regular intervals according to a preset time interval in the database, and screens out and executes the backup task to be executed; the method comprises the following concrete steps:
s3.1, regularly scanning a backup system table according to a preset time interval, and inquiring whether the backup task should be executed;
and 3.2, if the execution condition is met, executing the backup task and updating the timing information of the backup task in a system table of the timing backup task, and if the execution condition is not met, not executing the backup task and updating and waiting for next scanning.
6. A timing backup system based on domestic distributed database is characterized in that: the system comprises an SQL statement creating module, an analysis module, a backup task creating module, a timing scanning module, a backup task execution module, a system table management module and a log management module;
the backup task creating module is responsible for creating SQL statements of the timing backup task;
the analysis module is responsible for analyzing the SQL statement and acquiring backup information, wherein the backup information comprises a backup target, a backup period and backup position information;
the backup task creating module is responsible for creating a timing backup task executed by a background;
the timing scanning module is responsible for carrying out timing scanning on the system table according to a preset time interval and screening out backup tasks to be executed;
the backup task execution module is responsible for executing the backup tasks which are screened by the timing scanning module and meet the conditions;
the system table management module is responsible for writing the backup information analyzed by the analysis module into the system table and updating the backup information recorded in the system table in real time;
and the log management module is responsible for writing the problem information into the log when the backup task execution module fails to execute the backup task.
7. The domestic distributed database-based timed backup system according to claim 6, characterized in that: the analysis module comprises an analyzer and an optimizer, wherein the analyzer is used for performing lexical analysis, syntactic analysis and semantic analysis on the SQL sentences and generating a syntax tree for the SQL sentences; the optimizer is responsible for generating a logic plan according to the syntax tree, the backup task creating module generates a specifically executed backup task according to the logic plan, and the system table management module writes backup information into a system table which is regularly backed up in the database based on an executed physical plan.
8. The domestic distributed database-based timed backup system according to claim 7, characterized in that: the timing scanning module is used for regularly scanning the backed-up system table according to a preset time interval and inquiring whether the backup task should be executed; if the execution condition is met, the backup task execution module executes the backup task, the system table management module updates the timing information of the backup task in the system table, if the execution condition is not met, the backup task execution module does not execute the backup task, and the system table management module does not update the timing information of the backup task in the system table and waits for the next scanning.
CN202210120373.7A 2022-02-08 2022-02-08 Timing backup method and system based on domestic distributed database Pending CN114443371A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210120373.7A CN114443371A (en) 2022-02-08 2022-02-08 Timing backup method and system based on domestic distributed database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210120373.7A CN114443371A (en) 2022-02-08 2022-02-08 Timing backup method and system based on domestic distributed database

Publications (1)

Publication Number Publication Date
CN114443371A true CN114443371A (en) 2022-05-06

Family

ID=81371963

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210120373.7A Pending CN114443371A (en) 2022-02-08 2022-02-08 Timing backup method and system based on domestic distributed database

Country Status (1)

Country Link
CN (1) CN114443371A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114756573A (en) * 2022-06-16 2022-07-15 恒生电子股份有限公司 Data processing method, device and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114756573A (en) * 2022-06-16 2022-07-15 恒生电子股份有限公司 Data processing method, device and system

Similar Documents

Publication Publication Date Title
US7634687B2 (en) Checkpoint restart system and method
US8010949B2 (en) Database breakpoint apparatus and method
US8010578B2 (en) Method of refactoring a running database system
US20080307011A1 (en) Failure recovery and error correction techniques for data loading in information warehouses
US20050177775A1 (en) Data race detection using sequential program analysis
US7418449B2 (en) System and method for efficient enrichment of business data
US8874519B1 (en) Method and apparatus for restoring a table in a database
US8924932B2 (en) Using stack data and source code to rank program changes
CN105528231A (en) Intermediate auxiliary function-based method and intermediate auxiliary function-based system for dynamically updating software
US9535687B2 (en) Audited builds based upon separate class dependency records
CN109885642B (en) Hierarchical storage method and device for full-text retrieval
US6665688B1 (en) Method and system for automatically regenerating data on-demand
JP4884480B2 (en) System and method for deploying SQL procedures
US7185322B2 (en) Method and apparatus for parallel action processing
CN114443371A (en) Timing backup method and system based on domestic distributed database
Engberts et al. Concept recognition-based program transformation
CN114238463A (en) Calculation engine control method and device for distributed index calculation
Chen et al. Analyzing performance-aware code changes in software development process
CN116821098A (en) Data warehouse management method, service system and storage medium
CN116483730A (en) Service system automatic test method based on domestic software and hardware and open source test tool
CN113885970A (en) Method, system and medium for generating report data based on script
CN112612647A (en) Log parallel replay method, device, equipment and storage medium
CN112394939A (en) Automatic user contract deployment method and device based on alliance chain and storage medium
CN112463447A (en) Optimization method for realizing physical backup based on distributed database
CN113190379B (en) Method, system and medium for reducing backup set of database backup

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20221128

Address after: Room 305-22, Building 2, No. 1158 Zhangdong Road and No. 1059 Dangui Road, China (Shanghai) Pilot Free Trade Zone, Pudong New Area, Shanghai, 200120

Applicant after: Shanghai Yunxi Technology Co.,Ltd.

Address before: Building S02, 1036 Gaoxin Langchao Road, Jinan, Shandong 250100

Applicant before: Shandong Inspur Scientific Research Institute Co.,Ltd.