CN116991825A - Database flashback method, device, equipment and storage medium - Google Patents

Database flashback method, device, equipment and storage medium Download PDF

Info

Publication number
CN116991825A
CN116991825A CN202310962817.6A CN202310962817A CN116991825A CN 116991825 A CN116991825 A CN 116991825A CN 202310962817 A CN202310962817 A CN 202310962817A CN 116991825 A CN116991825 A CN 116991825A
Authority
CN
China
Prior art keywords
data table
flashback
database
data
instruction
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
CN202310962817.6A
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 Dameng Database Co Ltd
Original Assignee
Shanghai Dameng Database 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 Shanghai Dameng Database Co Ltd filed Critical Shanghai Dameng Database Co Ltd
Priority to CN202310962817.6A priority Critical patent/CN116991825A/en
Publication of CN116991825A publication Critical patent/CN116991825A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • 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

Landscapes

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

Abstract

The invention discloses a database flashback method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring a database flashback instruction, and generating a flashback data table list according to the database flashback instruction; the flashback data table list comprises at least one data table; determining a first data table needing reference constraint checking and a second data table needing no reference constraint checking in a flashback data table list according to the reference relation of each data table; after the reference constraint checking operation is performed on the first data table, determining a third data table passing the reference constraint checking, and performing a flashback operation on the second data table and the third data table according to a database flashback instruction. According to the database flashback method provided by the invention, whether each data table needs to be subjected to reference constraint check is determined by analyzing the reference relation of each data table corresponding to the database flashback instruction, so that the problem of error reporting caused by the sequence of execution of the data table flashback operation is avoided.

Description

Database flashback method, device, equipment and storage medium
Technical Field
The present invention relates to the field of database technologies, and in particular, to a database flashback method, device, equipment, and storage medium.
Background
In the database, flashback refers to rollback of data in a table to a certain point in time of history by rollback only changes made to a specified table and its related objects while the database is online, without performing a conventional point in time recovery operation. Such as rollback to a point in time before the user erroneously deletes the data, thereby restoring the erroneously deleted data. During this operation the database is still available and no additional space is required. In the process of database flashback, for a data table with foreign key reference relation, whether the data table is referred to or referred to, if the data in the table is modified from a certain time point, if only one table is subjected to the operation of flashback to the time point, errors which violate the reference constraint can easily occur.
In the prior art, to prevent this from happening, the system supports simultaneous flashback operations on multiple tables, and it is considered that flashback on multiple tables is an atomic operation, i.e., either all flashback succeeds or all flashback fails, and partial success and partial failure is not allowed. However, when performing multi-table simultaneous flashing, in the process of executing flashing by the system, since the flashing operation of the table always has a sequence when executing, there may be a case that the reference constraint is not violated but misreported.
Disclosure of Invention
The invention provides a database flashback method, device, equipment and storage medium, which are used for solving the problem of misinformation of reference constraint caused by execution sequence of flashback operation of a data table.
According to an aspect of the present invention, there is provided a database flashback method including:
acquiring a database flashback instruction, and generating a flashback data table list according to the database flashback instruction; the flashback data table list comprises at least one data table;
determining a first data table needing reference constraint checking and a second data table needing no reference constraint checking in the flashback data table list according to the reference relation of the data tables;
after the reference constraint checking operation is executed on the first data table, determining a third data table passing the reference constraint checking, and executing the flashback operation on the second data table and the third data table according to the database flashback instruction.
Further, generating a flashback data table list according to the database flashback instruction, including:
analyzing the grammar of the database flashback instruction, and extracting all data table objects contained in the database flashback instruction;
and establishing a blank data table list aiming at the database flashback instruction, and adding each data table object into the blank data table list to obtain the flashback data table list.
Further, determining a first data table needing to be subjected to reference constraint checking and a second data table needing not to be subjected to reference constraint checking in the flashback data table list according to the reference relation of each data table, wherein the method comprises the following steps:
determining a data table object which does not have a reference relationship in each data table as the first data table;
extracting fourth data tables with reference relations in the data tables, respectively determining associated data tables with reference relations with the fourth data tables, and determining the first data table and the second data table in the fourth data tables according to the associated data tables; wherein the first data table requires reference constraint checking and the second data table requires no reference constraint checking.
Further, the association data table includes a data table object referenced by the fourth data table and a data table object referencing the fourth data table.
Further, determining the first data table and the second data table in each fourth data table according to the associated data table comprises:
establishing a corresponding reference relation register array for each fourth data table respectively, and adding the associated data table of each fourth data table into the corresponding reference relation register array;
traversing each fourth data table, if the data table object which is not contained in the flashback data table list exists in the corresponding reference relation registration array, determining the corresponding fourth data table as the first data table, otherwise, determining the corresponding fourth data table as a fifth data table;
and traversing each fifth data table, determining the corresponding fifth data table as the first data table if the first data table exists in the corresponding reference relation registration array, and determining the corresponding fifth data table as the second data table if the first data table exists in the corresponding reference relation registration array.
Further, performing a flashback operation on the second data table and the third data table according to the database flashback instruction, including:
extracting flashback time point information in the database flashback instruction;
and backing the data in the second data table and the third data table to a state corresponding to the flashback time point information.
Further, after performing the reference constraint checking operation on the first data table, the method further includes:
and determining a sixth data table which does not pass the reference constraint check, and generating error prompt information according to the sixth data table.
According to another aspect of the present invention, there is provided a database flashback apparatus, including:
the flashback data list generation module is used for acquiring a database flashback instruction and generating a flashback data list according to the database flashback instruction; the flashback data table list comprises at least one data table;
the first data table and the second data table determining module are used for determining a first data table needing reference constraint checking and a second data table needing no reference constraint checking in the flashback data table list according to the reference relation of each data table;
and the flashback operation execution module is used for determining a third data table passing the reference constraint check after the reference constraint check operation is executed on the first data table, and executing flashback operation on the second data table and the third data table according to the database flashback instruction.
Optionally, the flashback data table list generating module is further configured to:
analyzing the grammar of the database flashback instruction, and extracting all data table objects contained in the database flashback instruction;
and establishing a blank data table list aiming at the database flashback instruction, and adding each data table object into the blank data table list to obtain the flashback data table list.
Optionally, the first data table and the second data table determining module are further configured to:
determining a data table object which does not have a reference relationship in each data table as the first data table;
extracting fourth data tables with reference relations in the data tables, respectively determining associated data tables with reference relations with the fourth data tables, and determining the first data table and the second data table in the fourth data tables according to the associated data tables; wherein the first data table requires reference constraint checking and the second data table requires no reference constraint checking.
Optionally, the association data table includes a data table object referenced by the fourth data table and a data table object referencing the fourth data table.
Optionally, the first data table and the second data table determining module are further configured to:
establishing a corresponding reference relation register array for each fourth data table respectively, and adding the associated data table of each fourth data table into the corresponding reference relation register array;
traversing each fourth data table, if the data table object which is not contained in the flashback data table list exists in the corresponding reference relation registration array, determining the corresponding fourth data table as the first data table, otherwise, determining the corresponding fourth data table as a fifth data table;
and traversing each fifth data table, determining the corresponding fifth data table as the first data table if the first data table exists in the corresponding reference relation registration array, and determining the corresponding fifth data table as the second data table if the first data table exists in the corresponding reference relation registration array.
Optionally, the flashback operation execution module is further configured to:
extracting flashback time point information in the database flashback instruction;
and backing the data in the second data table and the third data table to a state corresponding to the flashback time point information.
Optionally, the device further includes an error prompt information generating module, configured to determine a sixth data table that fails the reference constraint check, and generate error prompt information according to the sixth data table.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the database flashback method of any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement a database flashback method according to any embodiment of the present invention when executed.
The invention discloses a database flashback method, which comprises the steps of firstly, obtaining a database flashback instruction, and generating a flashback data list according to the database flashback instruction; the flashback data table list comprises at least one data table; then determining a first data table needing reference constraint check and a second data table needing no reference constraint check in a flashback data table list according to the reference relation of each data table; and finally, after the reference constraint checking operation is executed on the first data table, determining a third data table passing the reference constraint checking operation, and executing the flashback operation on the second data table and the third data table according to the database flashback instruction. According to the database flashback method provided by the invention, whether each data table needs to be subjected to reference constraint check is determined by analyzing the reference relation of each data table corresponding to the database flashback instruction, so that the problem of error reporting caused by the sequence of execution of the data table flashback operation is avoided.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a database flashback method provided in accordance with an embodiment of the present invention;
FIG. 2 is a flow chart of a database flashback method provided in accordance with a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a database flashback device according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device implementing a database flashback method according to the fourth embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a database flashback method according to an embodiment of the present invention, where the method may be performed by a database flashback device, and the device may be implemented in hardware and/or software, and the device may be configured in an electronic device. As shown in fig. 1, the method includes:
s110, acquiring a database flashback instruction, and generating a flashback data list according to the database flashback instruction.
Wherein the flashback data table list contains at least one data table.
In this embodiment, the database flashback instruction is an instruction that requires modification of a specified data table in the database, so that the data in the table is rolled back to a certain point in time of the history. Flashback data table list is a list of data tables required in a database flashback instruction to perform a flashback operation.
Optionally, after the database flashback instruction is acquired, a flashback data table list may be generated by performing syntax analysis on an instruction statement of the database flashback instruction, extracting each data table involved in the instruction statement, and then combining the data tables together to form the flashback data table list.
S120, determining a first data table needing reference constraint checking and a second data table needing no reference constraint checking in a flashback data table list according to the reference relation of each data table.
Wherein, the reference relationship may refer to whether the other data table is referenced or referred to by the other data table for each data table in the flashback data table list, and if so, the reference relationship exists for the data table.
In this embodiment, in order to avoid a false alarm condition caused by a sequence of a data table flashing operation, a first data table and a second data table may be divided for each data table in a flashing data table list, and for the first data table, a reference constraint check operation may be normally executed, and for the second data table, a reference constraint check may be omitted, so as to avoid a false alarm.
Optionally, for a certain data table a in the flashback data table list, the dividing principle of the first data table and the second data table may be: if the table A does not have a reference relationship, namely the table A does not reference other data tables or is not referenced by other data tables, dividing the table A into a first data table; if the table A has a reference relation, all data table objects with the reference relation with the table A are acquired, if all the data table objects belong to a flashback data table list, the table A is divided into a second data table, otherwise, the table A is divided into a first data table.
For example, if the reference relationship existing between the data tables t1 and t2 is t2 and references t1, for the database flashback instruction "flashback table t1, t2 to time table '2023-02-2008:55:30'", the instruction requires that the data of the data tables t1 and t2 be flashed, the generated flashback data table list contains the data tables t1 and t2, and since the data tables having the reference relationship with t1 and t2 are both in the flashback data table list, t1 and t2 are both the second data table; for the database flashback instruction "flashback table t1 to TIMESTAMP '2023-02-20:08:55:30'", the instruction requires data of the flashback data table t1, the generated flashback data table list only contains the data table t1, and the data table t2 having a reference relation with t1 is not in the flashback data table list, and then t1 is the first data table.
S130, after the reference constraint checking operation is carried out on the first data table, determining a third data table passing the reference constraint checking, and executing the flashback operation on the second data table and the third data table according to the database flashback instruction.
Among other things, reference constraint checking is a mechanism for ensuring the integrity and consistency of data in a database.
For example, the creation instruction of the data tables t1 and t2 is "Create table t1 (c 1 int primary key)" "Create table t2 (c 2 int, foreign key (c 2) REFERENCES t1 (c 1))", which indicates that the variable c1 in t1 is referenced by the data table t2, and then the instruction "Delete from t1 where c1=2" is executed on the data table t1, that is, the variable c1=2 in t1 is deleted. For the database flashback instruction "flashback table t2 to TIMESTAMP '2023-02-20:08:55:30'", the instruction requires flashback of the data of data table t2, but t2 references variable c1 of t1 and the variable c1=2 in time 2023-02-2008:55:30t1 has been deleted, so the result after the reference constraint check is performed on data table t2 is not passed and flashback is not possible.
In this embodiment, after determining the first data table needing to be checked for reference constraint and the second data table not needing to be checked for reference constraint, a reference constraint checking operation is performed on the first data table, and the data table passing through the reference constraint checking in the first data table is used as a third data table, so that the third data table may perform a flashback operation according to a database flashback instruction. In addition, for the second data table, the flashback operation may also be performed directly in accordance with the database flashback instruction.
Further, after performing the reference constraint checking operation on the first data table, it may further: and determining a sixth data table which does not pass the reference constraint check, and generating error prompt information according to the sixth data table.
The error prompt information may be information for prompting an error that violates the reference constraint.
In this embodiment, after the reference constraint checking operation is performed on the first data table, the data table that does not pass the reference constraint checking in the first data table may be used as the sixth data table, and error prompt information is reported to prompt the operator that each sixth data table cannot be flashed.
The database flashback method disclosed by the embodiment of the invention comprises the steps of firstly, acquiring a database flashback instruction, and generating a flashback data list according to the database flashback instruction; the flashback data table list comprises at least one data table; then determining a first data table needing reference constraint check and a second data table needing no reference constraint check in a flashback data table list according to the reference relation of each data table; and finally, after the reference constraint checking operation is executed on the first data table, determining a third data table passing the reference constraint checking operation, and executing the flashback operation on the second data table and the third data table according to the database flashback instruction. According to the database flashback method provided by the invention, whether each data table needs to be subjected to reference constraint check is determined by analyzing the reference relation of each data table corresponding to the database flashback instruction, so that the problem of error reporting caused by the sequence of execution of the data table flashback operation is avoided.
Example two
Fig. 2 is a flowchart of a database flashback method according to a second embodiment of the present invention, and this embodiment is a refinement of the foregoing embodiment. As shown in fig. 2, the method includes:
s210, acquiring a database flashback instruction, carrying out syntax analysis on the database flashback instruction, and extracting all data table objects contained in the database flashback instruction.
In this embodiment, after the database flashback instruction is obtained, the instruction statement of the database flashback instruction may be parsed, and each data table involved therein may be extracted.
Specifically, taking a database flashback instruction of an SQL statement as an example, the syntax analysis of the database flashback instruction "flashback table t, t2 to TIMESTAMP '2023-02-20:55:30'" can obtain the data tables t1 and t2 involved therein.
S220, a blank data table list aiming at the database flashback instruction is established, and each data table object is added into the blank data table list to obtain a flashback data table list.
Wherein the flashback data table list contains at least one data table.
In this embodiment, after all the data table objects included in the database flashback instruction are extracted, the data table objects may be added to a blank data table list corresponding to the database flashback instruction, so as to obtain a flashback data table list.
S230, determining the data table object without the reference relation in each data table as a first data table.
In this embodiment, after obtaining the flashback data table list, each data table in the flashback data table list may be judged one by one, so as to determine whether each data table has a reference relationship. For a data table in which there is no reference relationship, a first data table that requires a reference constraint check may be determined; further judgment is needed for the data table in which the reference relation exists.
Specifically, from the flashback data table list (table_list), the reference relationship of each data table therein can be identified by semantic parsing. Preferably, a corresponding constraint checking FLAG (CONS_FLAG) may be set for each data table, where CONS_FLAG is initially set to be empty, and if the data table is determined to be the first data table, CONS_FLAG=1 of the data table is set to indicate that the data table needs to be subjected to reference constraint checking.
S240, extracting fourth data tables with reference relations in the data tables, respectively determining associated data tables with reference relations with the fourth data tables, and determining a first data table and a second data table in the fourth data tables according to the associated data tables.
Wherein the first data table is required to be checked for reference constraint, the second data table is not required to be checked for reference constraint, and the associated data table comprises a data table object referenced by the fourth data table and a data table object referencing the fourth data table.
In this embodiment, for the data table having the reference relationship in the flashback data table list, the data table may be used as a fourth data table, then the associated data tables corresponding to the fourth data tables are determined one by one, and then the first data table and the second data table in the fourth data table are determined according to the associated data tables.
Optionally, the manner of determining the first data table and the second data table in each fourth data table according to the associated data table may be:
establishing a corresponding reference relation registration array for each fourth data table respectively, and adding the associated data table of each fourth data table into the corresponding reference relation registration array; traversing each fourth data table, if the data table object which is not contained in the flashback data table list exists in the corresponding reference relation registration array, determining the corresponding fourth data table as a first data table, otherwise determining the corresponding fourth data table as a fifth data table; traversing each fifth data table, determining the corresponding fifth data table as the first data table if the first data table exists in the corresponding reference relation registration array, and determining the corresponding fifth data table as the second data table if the first data table exists in the corresponding reference relation registration array.
Specifically, a corresponding reference relation register array (ref_tab_arr) may be established for each fourth data table, and when the reference table is used, all the referenced tables referenced by the table are found and added to the ref_tab_arr. Similarly, when a table is referenced, all reference tables referencing the table are found and added to the REF_TAB_ARR. For each fourth data table, sequentially checking whether a data table object which is not contained in a flashback data table list exists in the corresponding REF_TAB_ARR, if so, determining the corresponding fourth data table as a first data table, and setting CONS_FLAG=1 of the data table; otherwise, further judgment is needed as a fifth data table.
For each fifth data table, checking whether a data table object determined as the first data table exists in the corresponding ref_tab_arr in sequence, namely checking whether a data table object of CONS_FLAG=1 exists in the ref_tab_arr, if so, determining the corresponding fifth data table as the first data table, and setting CONS_FLAG=1 of the data table; otherwise, determining the data table as the second data table, and setting the CONS_FLAG=0 of the data table.
S250, after the reference constraint checking operation is executed on the first data table, determining a third data table passing the reference constraint checking.
In this embodiment, through the above-described determination step, it may be determined whether each data table in the flashback data table list needs to perform the reference constraint checking operation. According to the value of the CONS_FLAG of each data table, reference constraint checking operation can be performed on all the data tables, namely the first data table, of CONS_FLAG=1. After the reference constraint checking operation is performed, a third data table passing the reference constraint checking in all the first data tables can be obtained.
S260, extracting the flashback time point information in the database flashback instruction, and returning the data in the second data table and the third data table to the state corresponding to the flashback time point information.
The flashback time point information may be a historical time point to which the database flashback instruction requires the data table to rollback.
In this embodiment, the instruction statement of the database flashback instruction may be parsed, and flashback time point information therein may be extracted. For example, for database flashback instruction "flashback table t, t2 to TIMESTAMP '2023-02-20:55:30'", the flashback time point information extracted after parsing is "2023-02-20:08:55:30". After the flashback time point information is obtained, according to the obtained second data table without reference constraint check and the obtained third data table with reference constraint check, the data in the second data table and the third data table can be rolled back to the state corresponding to the flashback time point information.
The database flashback method disclosed by the embodiment of the invention comprises the steps of firstly acquiring a database flashback instruction, carrying out grammar analysis on the database flashback instruction, extracting all data table objects contained in the database flashback instruction, then establishing a blank data table list aiming at the database flashback instruction, adding each data table object into the blank data table list to obtain a flashback data table list, determining the data table object which does not have a reference relation in each data table as a first data table, then extracting a fourth data table which has a reference relation in each data table, respectively determining associated data tables which have the reference relation with each fourth data table, determining a first data table and a second data table in each fourth data table according to the associated data table, then determining a third data table checked through reference constraint after carrying out reference constraint checking on the first data table, finally extracting flashback time point information in the database flashback instruction, and backing data in the second data table and the third data table to a state corresponding to the flashback time point information. According to the database flashback method provided by the invention, whether each data table needs to be subjected to reference constraint check is determined by analyzing the reference relation of each data table corresponding to the database flashback instruction, so that the problem of error reporting caused by the sequence of execution of the data table flashback operation is avoided.
Example III
Fig. 3 is a schematic structural diagram of a database flashback device according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes: a flashback data table list generation module 310, a first and second data table determination module 320, and a flashback operation execution module 330.
The flashback data table list generating module 310 is configured to obtain a database flashback instruction, and generate a flashback data table list according to the database flashback instruction.
Wherein the flashback data table list contains at least one data table.
The first data table and second data table determining module 320 is configured to determine, according to the reference relation of each data table, a first data table needing to be checked for reference constraint and a second data table not needing to be checked for reference constraint in the flashback data table list.
And the flashback operation execution module 330 is configured to determine a third data table passing the reference constraint check after performing the reference constraint check operation on the first data table, and perform a flashback operation on the second data table and the third data table according to the database flashback instruction.
Optionally, the flashback data table list generating module 310 is further configured to:
analyzing the grammar of the database flashback instruction, and extracting all data table objects contained in the database flashback instruction; and establishing a blank data table list aiming at the database flashback instruction, and adding each data table object into the blank data table list to obtain a flashback data table list.
Optionally, the first data table and the second data table determining module 320 is further configured to:
determining a data table object without a reference relation in each data table as a first data table; extracting fourth data tables with reference relations in the data tables, respectively determining associated data tables with reference relations with the fourth data tables, and determining a first data table and a second data table in the fourth data tables according to the associated data tables; wherein the first data table is required to be checked for reference constraint and the second data table is not required to be checked for reference constraint.
Optionally, the associated data table includes a data table object referenced by the fourth data table and a data table object referencing the fourth data table.
Optionally, the first data table and the second data table determining module 320 is further configured to:
establishing a corresponding reference relation registration array for each fourth data table respectively, and adding the associated data table of each fourth data table into the corresponding reference relation registration array; traversing each fourth data table, if the data table object which is not contained in the flashback data table list exists in the corresponding reference relation registration array, determining the corresponding fourth data table as a first data table, otherwise determining the corresponding fourth data table as a fifth data table; traversing each fifth data table, determining the corresponding fifth data table as the first data table if the first data table exists in the corresponding reference relation registration array, and determining the corresponding fifth data table as the second data table if the first data table exists in the corresponding reference relation registration array.
Optionally, the flashback operation execution module 330 is further configured to:
extracting flashback time point information in a database flashback instruction; and backing the data in the second data table and the third data table to a state corresponding to the flashback time point information.
Optionally, the apparatus further includes an error prompt generation module 340, configured to determine a sixth data table that fails the reference constraint check, and generate an error prompt according to the sixth data table.
The database flashback device provided by the embodiment of the invention can execute the database flashback method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 4 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the database flashback method.
In some embodiments, the database flashback method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more of the steps of database flashback described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the database flashback method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A database flashback method, comprising:
acquiring a database flashback instruction, and generating a flashback data table list according to the database flashback instruction; the flashback data table list comprises at least one data table;
determining a first data table needing reference constraint checking and a second data table needing no reference constraint checking in the flashback data table list according to the reference relation of the data tables;
after the reference constraint checking operation is executed on the first data table, determining a third data table passing the reference constraint checking, and executing the flashback operation on the second data table and the third data table according to the database flashback instruction.
2. The method of claim 1, wherein generating a flashback data table list from the database flashback instruction comprises:
analyzing the grammar of the database flashback instruction, and extracting all data table objects contained in the database flashback instruction;
and establishing a blank data table list aiming at the database flashback instruction, and adding each data table object into the blank data table list to obtain the flashback data table list.
3. The method of claim 1, wherein determining a first data table of the flashback data table list requiring reference constraint checking and a second data table requiring no reference constraint checking based on a reference relationship of each data table comprises:
determining a data table object which does not have a reference relationship in each data table as the first data table;
extracting fourth data tables with reference relations in the data tables, respectively determining associated data tables with reference relations with the fourth data tables, and determining the first data table and the second data table in the fourth data tables according to the associated data tables; wherein the first data table requires reference constraint checking and the second data table requires no reference constraint checking.
4. A method according to claim 3, wherein the association data table comprises a data table object referenced by the fourth data table and a data table object referencing the fourth data table.
5. A method according to claim 3, wherein determining the first and second data tables in each of the fourth data tables from the associated data table comprises:
establishing a corresponding reference relation register array for each fourth data table respectively, and adding the associated data table of each fourth data table into the corresponding reference relation register array;
traversing each fourth data table, if the data table object which is not contained in the flashback data table list exists in the corresponding reference relation registration array, determining the corresponding fourth data table as the first data table, otherwise, determining the corresponding fourth data table as a fifth data table;
and traversing each fifth data table, determining the corresponding fifth data table as the first data table if the first data table exists in the corresponding reference relation registration array, and determining the corresponding fifth data table as the second data table if the first data table exists in the corresponding reference relation registration array.
6. The method of claim 1, wherein performing a flashback operation on the second data table and the third data table in accordance with the database flashback instruction comprises:
extracting flashback time point information in the database flashback instruction;
and backing the data in the second data table and the third data table to a state corresponding to the flashback time point information.
7. The method of claim 1, wherein after performing a reference constraint check operation on the first data table, further comprising:
and determining a sixth data table which does not pass the reference constraint check, and generating error prompt information according to the sixth data table.
8. A database flashback apparatus, comprising:
the flashback data list generation module is used for acquiring a database flashback instruction and generating a flashback data list according to the database flashback instruction; the flashback data table list comprises at least one data table;
the first data table and the second data table determining module are used for determining a first data table needing reference constraint checking and a second data table needing no reference constraint checking in the flashback data table list according to the reference relation of each data table;
and the flashback operation execution module is used for determining a third data table passing the reference constraint check after the reference constraint check operation is executed on the first data table, and executing flashback operation on the second data table and the third data table according to the database flashback instruction.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the database flashback method of any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to implement the database flashback method of any one of claims 1-7 when executed.
CN202310962817.6A 2023-08-01 2023-08-01 Database flashback method, device, equipment and storage medium Pending CN116991825A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310962817.6A CN116991825A (en) 2023-08-01 2023-08-01 Database flashback method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310962817.6A CN116991825A (en) 2023-08-01 2023-08-01 Database flashback method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116991825A true CN116991825A (en) 2023-11-03

Family

ID=88520991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310962817.6A Pending CN116991825A (en) 2023-08-01 2023-08-01 Database flashback method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116991825A (en)

Similar Documents

Publication Publication Date Title
CN116431505A (en) Regression testing method and device, electronic equipment, storage medium and product
CN116185389A (en) Code generation method and device, electronic equipment and medium
CN116991825A (en) Database flashback method, device, equipment and storage medium
CN116775171B (en) Architecture switching method and device, electronic equipment and storage medium
CN116955504B (en) Data processing method and device, electronic equipment and storage medium
CN117520396A (en) Method, device, equipment and storage medium for identifying abnormal association relation
CN116932033A (en) Component packaging method and device, electronic equipment and storage medium
CN115374010A (en) Function testing method, device, equipment and storage medium
CN116400956A (en) Code merging information determining method and device, electronic equipment and storage medium
CN117609064A (en) Unit test method and device, electronic equipment and storage medium
CN116226867A (en) Script processing method, device, equipment and medium
CN117453747A (en) Data quality detection method and device, electronic equipment and storage medium
CN117632734A (en) Performance test method of database, electronic equipment and storage medium
CN115757928A (en) Data query method and device, electronic equipment and storage medium
CN117251196A (en) Data maintenance method, device, equipment and storage medium
CN114443035A (en) Code generation method for application program, code generator, electronic device, and medium
CN115437955A (en) Project testing method, device, equipment and storage medium
CN118296076A (en) Data synchronization method, device, equipment and storage medium
CN117194471A (en) Data blood edge analysis method, device, medium, electronic equipment and product
CN117609237A (en) Data table field attribute determining method, device, equipment and storage medium
CN116414833A (en) Report data query method, device, equipment and medium
CN117873990A (en) DDL analysis method, device, equipment and storage medium based on WAL log
CN115858367A (en) Test case screening method, device, equipment and medium
CN117453252A (en) Application upgrading method, device, equipment and storage medium
CN115421665A (en) Data storage method, device, equipment and storage medium

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