CN110333970B - Data recovery method and device - Google Patents

Data recovery method and device Download PDF

Info

Publication number
CN110333970B
CN110333970B CN201910620122.3A CN201910620122A CN110333970B CN 110333970 B CN110333970 B CN 110333970B CN 201910620122 A CN201910620122 A CN 201910620122A CN 110333970 B CN110333970 B CN 110333970B
Authority
CN
China
Prior art keywords
data block
data
recovered
transfer table
restored
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.)
Active
Application number
CN201910620122.3A
Other languages
Chinese (zh)
Other versions
CN110333970A (en
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.)
China Travelsky Holding Co
Original Assignee
China Travelsky Holding Co
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 China Travelsky Holding Co filed Critical China Travelsky Holding Co
Priority to CN201910620122.3A priority Critical patent/CN110333970B/en
Publication of CN110333970A publication Critical patent/CN110333970A/en
Application granted granted Critical
Publication of CN110333970B publication Critical patent/CN110333970B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/1458Management of the backup or restore process
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof

Landscapes

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

Abstract

The application discloses a data recovery method and a data recovery device, wherein a transfer table and a final table which have the same table structure with a data table to be recovered are established; inserting a preset data block into the transfer table; copying the target data block to be recovered to a position of a transfer table for storing a preset data block; and reading the target data block to be recovered copied into the transfer table from the transfer table into a final table according to the data block attribute value of the target data block to be recovered copied into the transfer table in the transfer table. The data recovery method includes the steps that a data block to be recovered is copied into a transfer table, the data block attribute value of the data block to be recovered in the transfer table is determined, the data block to be recovered copied into the transfer table is read from the transfer table into a final table according to the data block attribute value, and the data block to be recovered in the data table which is subjected to the truncate operation is the data block which is subjected to the truncate operation.

Description

Data recovery method and device
Technical Field
The invention relates to the technical field of database processing, in particular to a data recovery method and device.
Background
The Oracle database is a relational database management system which is most popular and has the widest application range at present, has the characteristics of good portability, convenient use and strong function, and can be suitable for various large, medium, small and microcomputer environments.
The truncate operation in the Oracle database is an operation for deleting data, the truncate operation can delete all data in the data table at one time, and the Oracle database engine mainly does the following three things when doing a truncate operation on a data table: firstly, the method comprises the following steps: clearing the area address set extension map in the segment header where the data table is located; secondly, the method comprises the following steps: the HWM (High Water Mark) in the segment header of the data table is reduced; thirdly, the method comprises the following steps: the physical storage location identification data object id corresponding to the data table is incremented. After the three steps, the data in the data table cannot be read through the area address set extend map, HWM and dataobject id after the truncate command is executed.
However, in practice, after the Oracle database engine does the above three things, the Oracle database engine does not delete the data in the data table, and the data is still stored in the data table, but the data cannot be read. Since the Oracle database engine does not delete data in the data table, the time spent by the truncate operation is always fixed no matter how large the data amount of the data table is, so that the deletion of data by using the truncate operation has the characteristics of high deletion speed and constant deletion time, and thus the truncate operation is widely used for deleting and cleaning data in the Oracle database.
At present, after a truncate operation is performed on a certain data table, data in the data table cannot be recovered, and therefore, how to provide an effective data recovery method for the data table after the truncate operation is performed becomes a technical problem to be solved urgently at present.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data recovery method and apparatus, which can recover data in a data table after performing an incorrect truncate operation.
A method for data recovery, comprising:
establishing a transfer table and a final table which have the same table structure with the data table to be recovered;
inserting a preset data block into the transfer table, wherein the block structure of the preset data block is the same as the structure of the data block to be recovered in the data table to be recovered;
acquiring the data block to be recovered contained in the data table to be recovered;
according to the storage sequence in the data table to be restored, selecting an uncopyed data block to be restored from the data table to be restored as a target data block to be restored;
copying the target data block to be recovered to a position of the transfer table where a preset data block is stored, wherein the target data block to be recovered copied to the transfer table needs to replace the data block stored at the position of the transfer table where the preset data block is stored;
setting the data block attribute value of the target data block to be recovered, which is copied to the transfer table, in the transfer table;
reading the target data block to be recovered copied to the transfer table from the transfer table to the final table according to the data block attribute value of the target data block to be recovered copied to the transfer table in the transfer table;
judging whether the data table to be restored has the data block to be restored which is not copied, if so, returning to execute the step of selecting one data block to be restored which is not copied from the data table to be restored as the target data block to be restored according to the storage sequence in the data table to be restored; if not, the process ends.
Preferably, the process of acquiring the data block to be restored included in the data table to be restored includes:
according to history information recorded in a data dictionary corresponding to the data table to be restored, acquiring a corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with truncate operation from the history information;
acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with the truncate operation;
or;
acquiring a corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with truncate operation from a next data block of the segment header block corresponding to the data table to be restored;
and acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage position identifier in the data table to be restored before the data block to be restored is executed with the truncate operation.
Preferably, the process of setting the data block attribute value in the transfer table of the target data block to be restored, which is copied to the transfer table, includes:
and setting a block address, a physical storage position identifier and a reference data check value of the target data block to be recovered, which is copied to the transfer table, in the transfer table.
Preferably, the reading, from the transfer table to the final table, the target data block to be restored copied to the transfer table according to the data block attribute value of the target data block to be restored copied to the transfer table in the transfer table includes:
acquiring the target data block to be recovered copied to the transfer table according to the block address of the target data block to be recovered copied to the transfer table in the transfer table and the physical storage position identification;
calculating the current data check value of the target data block to be recovered, which is copied to the transfer table, in the transfer table according to the data content contained in the target data block to be recovered;
and reading the target data block to be recovered copied to the transfer table from the transfer table to the final table under the condition that the current data check value is consistent with the reference data check value.
Preferably, when the current data check value is consistent with the reference data check value, the reading the target data block to be recovered copied to the transfer table from the transfer table to the final table includes:
under the condition that the current data check value is consistent with the reference data check value, reading the data content in the target data block to be recovered copied to the transfer table line by line;
judging whether the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table;
and if the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table, inserting the read data content of the current row into the final table from the transfer table.
A data recovery apparatus comprising:
the table establishing module is used for establishing a transfer table and a final table which have the same table structure with the data table to be recovered;
a preset data block insertion module, configured to insert a preset data block into the transfer table, where a block structure of the preset data block is the same as a structure of a data block to be recovered in the data table to be recovered;
a to-be-recovered data block obtaining module, configured to obtain the to-be-recovered data block included in the to-be-recovered data table;
a target data block to be restored determining module, configured to select, according to a storage sequence in the data table to be restored, one data block to be restored that is not copied from the data table to be restored, as a target data block to be restored;
the copying module is used for copying the target data block to be recovered to the position of the transfer table where the preset data block is stored, wherein the target data block to be recovered copied to the transfer table needs to replace the data block stored at the position of the transfer table where the preset data block is stored;
the data block attribute value setting module is used for setting the data block attribute value of the target data block to be recovered, which is copied to the transfer table, in the transfer table;
the reading module is used for reading the target data block to be recovered copied into the transfer table from the transfer table into the final table according to the data block attribute value of the target data block to be recovered copied into the transfer table in the transfer table;
the judging module is used for judging whether the data table to be recovered has the data block to be recovered which is not copied, and if the judging module judges that the data table to be recovered has the data block to be recovered which is not copied, returning to the step executed by the target data block to be recovered determining module; and if the judging module judges that the data block to be recovered which is not copied does not exist in the data table to be recovered, ending the operation.
Preferably, the module for acquiring the data block to be recovered includes:
the first to-be-recovered data block acquisition submodule is used for acquiring a corresponding physical storage position identifier in the to-be-recovered data table before the to-be-recovered data block is subjected to truncate operation from the history information according to the history information recorded in the data dictionary corresponding to the to-be-recovered data table; acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with the truncate operation;
or;
a second to-be-recovered data block obtaining submodule, configured to obtain, from a data block next to a segment header block corresponding to the to-be-recovered data table, a physical storage location identifier in the to-be-recovered data table corresponding to the to-be-recovered data block before the to-be-recovered data block is subjected to truncate operation; and acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage position identifier in the data table to be restored before the data block to be restored is executed with the truncate operation.
Preferably, the data block attribute value setting module includes:
and the data block attribute value setting submodule is used for setting the block address, the physical storage position identification and the reference data check value of the target data block to be recovered, which is copied to the transfer table, in the transfer table.
Preferably, the reading module includes:
the target data block to be recovered acquiring module is used for acquiring the target data block to be recovered copied to the transfer table according to the block address of the target data block to be recovered copied to the transfer table in the transfer table and the physical storage position identification;
a current data check value calculation module, configured to calculate, according to data content included in the target data block to be recovered, a current data check value in the transfer table of the target data block to be recovered, where the current data check value is copied to the transfer table;
and the reading submodule is used for reading the target data block to be recovered which is copied to the transfer table from the transfer table to the final table under the condition that the current data check value is consistent with the reference data check value.
Preferably, the reading submodule is specifically configured to:
under the condition that the current data check value is consistent with the reference data check value, reading the data content in the target data block to be recovered copied to the transfer table line by line; judging whether the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table; and if the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table, inserting the read data content of the current row into the final table from the transfer table.
Based on the technical scheme, the embodiment of the invention discloses a data recovery method and a device, wherein a transfer table and a final table which have the same table structure with a data table to be recovered are established; inserting a preset data block into a transfer table, wherein the block structure of the preset data block is the same as the structure of a data block to be recovered in the data table to be recovered; acquiring a data block to be recovered contained in a data table to be recovered; according to the storage sequence in the data table to be recovered, selecting an uncopyed data block to be recovered from the data table to be recovered as a target data block to be recovered; copying a target data block to be recovered to a position, in a transfer table, where a preset data block is stored, wherein the target data block to be recovered copied to the transfer table needs to replace the data block stored in the position, in the transfer table, where the preset data block is stored; setting the data block attribute value of the target data block to be recovered, which is copied to the transfer table, in the transfer table; reading the target data block to be recovered copied to the transfer table from the transfer table to the final table according to the data block attribute value of the target data block to be recovered copied to the transfer table in the transfer table; judging whether the data table to be restored has the data block to be restored which is not copied, if so, returning to execute the step of selecting one data block to be restored which is not copied from the data table to be restored as the target data block to be restored according to the storage sequence in the data table to be restored; if not, the process ends. The data recovery method comprises the steps of copying a data block to be recovered to a transfer table, determining a data block attribute value of the data block to be recovered in the transfer table, reading the data block to be recovered copied to the transfer table from the transfer table to a final table according to the data block attribute value of the data block to be recovered in the transfer table, wherein the data block to be recovered is the data block which executes a truncate operation.
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 described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a data recovery method according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for reading a target data block to be recovered copied into the transfer table from the transfer table into the final table according to a data block attribute value of the target data block to be recovered copied into the transfer table in the transfer table according to an embodiment of the present invention;
FIG. 3 is a table structure diagram according to an embodiment of the present invention;
fig. 4 is a block diagram of a data recovery apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
First, technical terms in terms of databases used in the embodiments of the present invention are described as follows:
DDL: data Definition Language, database schema Definition Language.
Tablespace: tablespaces, which are logical concepts in an Oracle database, an Oracle database can have one or more tablespaces, and a tablespace corresponds to one or more physical data files.
Segment: the segment is a collection of spaces used by an Oracle database object, is also a logic concept in the Oracle database, and can be a table segment, an index segment, a rollback segment, a temporary segment and the like.
Extension: a zone, any contiguous block called zone in an Oracle database that is assigned to an object (e.g., a table), is also a logical concept in an Oracle database, and once a zone is assigned to an object (table, index, and cluster), the zone cannot be reassigned to other objects.
Block: the block is the smallest logical unit for storing data in the Oracle database, and the block is also a logical concept in the Oracle database.
RDBA: block address, which is the physical storage address of a block in the Oracle database.
Extension Map: area address set, extend Map is the set of RDBA of the first Block of each of a set of extensions in an Oracle database.
Segment Header: the segment header is a special Block in an Oracle database, in which some meta information (e.g. extend Map) belonging to this segment is recorded, and when reading data of a certain table, Oracle accesses the segment header of the table first, then reads out the extend Map of this segment from the segment header, and finally accesses the data in the Block corresponding to the extend according to the extend Map.
HWM: high Water Mark, High Water line is a block address, it records the block address corresponding to the upper limit of the data stored in the corresponding segment, High Water line is stored in the segment head;
object id: the object id is a unique flag used by the Oracle database to identify the database object, and the object id indicates the logical id of the database object.
data object id: the physical storage location identifies the actual physical storage location of the database object, and if some objects have no physical attributes, there is no dataobject id, such as procedure, function, package, datatype, db link, mv definition, view definition, temporary table, partition table definition, etc., these objects are not corresponding to a segment, and thus their dataobject ids are all empty. The object id and data object id of a table are equal when it is just created, but if the table is committed, its object id does not change, but its data object id changes (its value is incremented).
And (2) rowid: and a data line number and rowid are physical storage addresses of data lines in the Oracle database, and the data line number and rowid can be used for rapidly positioning and accessing a certain row of data by the Oracle.
And each data block in the Oracle database records a Checksum value, and when the data in the data block is modified, the Oracle recalculates the Checksum value according to the data in the data block and writes the new Checksum value into the Oracle database. When reading the data block, the Oracle recalculates a checksum value according to the data in the read data block, compares the calculated checksum value with the checksum value originally recorded in the data block, and if the calculated checksum value is not equal to the checksum value originally recorded in the data block, the Oracle considers that the current data block is damaged.
The truncate operation in the Oracle database is an operation for deleting data, the truncate operation can delete all data in the data table at one time, and the Oracle database engine mainly does the following three things when doing a truncate operation on a data table: firstly, the method comprises the following steps: clearing the area address set extension map in the segment header where the data table is located; secondly, the method comprises the following steps: HWM in segment header where the data table is located is reduced; thirdly, the method comprises the following steps: the physical storage location identification data object id corresponding to the data table is incremented. After the three steps, the data in all the data blocks of the table is not deleted, so the time spent by the truncate operation is always fixed regardless of the data size of the table. Meanwhile, the Oracle database engine does not delete the data in all the data blocks of the table after the three things are done, which also means that all the data blocks in the table are still intact and remain on the disk, and only because the Oracle database engine clears the extent map of the table, lowers the high-water line thereof, and increases the data object id of the table, the data which are all intact and not intact in the table cannot be read by the Oracle database engine after the truncate.
Since the truncate operation is a DDL operation, the truncate operation cannot be rolled back; meanwhile, the Oracle database does not provide undo operation for the truncate operation, so that once the truncate command is executed, data in the data table cannot be recovered.
In order to solve the above technical problem, an embodiment of the present invention discloses a data recovery method, in which a data block to be recovered is copied to a transfer table, so as to determine a data block attribute value of the data block to be recovered in the transfer table, and then the data block to be recovered copied to the transfer table is read from the transfer table to the final table according to the data block attribute value of the data block to be recovered in the transfer table, where the data block to be recovered in the present application is a data block for performing a truncate operation, and thus data recovery in the data table for performing the truncate operation is achieved by the above method.
Fig. 1 shows a flow chart of a data recovery method, which, with reference to fig. 1, may comprise:
s100, establishing a transfer table and a final table which have the same table structure with a data table to be recovered;
the data table to be restored is a data table which needs to be restored after the truncate operation is performed.
A table structure is data that can identify the specific structure of a table, for example: the fields, field names of the fields, field types, widths, and numbers of rows and columns of the table are included, and the embodiment of the present invention is not limited in particular.
It should be noted that, since the extensions in the cleared extension map in the segment header are reused by the Oracle database engine at any time once the table performs the truncate operation, once the extensions are reused, the extensions are reformatted by the Oracle database engine for storing new data, which means that some of the data blocks in the table to be restored that have been cleared are partially covered, and once covered, the data in the covered data blocks are not restored.
Therefore, in the embodiment of the present invention, before data in the to-be-restored data table is restored, the access process of the to-be-restored data table may be stopped first or the to-be-restored data in the to-be-restored data table may be copied in advance, so as to avoid a situation that the to-be-restored data is covered due to a subsequent operation on the to-be-restored data table.
Step S110, inserting a preset data block into the transfer table;
the block structure of the preset data block is the same as the structure of the data block to be restored in the data table to be restored, and the data in the preset data block may be set by a person skilled in the art.
After inserting a preset data block into the transfer table, the Oracle database sets the extend map and HWM of the transfer table according to the inserted preset data block.
Step S120, acquiring the data block to be recovered contained in the data table to be recovered;
the data block to be restored in the embodiment of the invention is the data block which needs to be restored after the truncate operation is executed.
In the embodiment of the present invention, the data block to be recovered included in the data table to be recovered may be obtained in the following manner:
the first mode is as follows: according to history information recorded in a data dictionary corresponding to the data table to be restored, acquiring a corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with truncate operation from the history information; and acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage position identifier in the data table to be restored before the data block to be restored is executed with the truncate operation.
After the data table performs the truncate operation, the physical storage location identifier corresponding to the data table is incremented, and the data block to be restored cannot be accurately found according to the incremented physical storage location identifier, so that the data block to be restored can be accurately found according to the corresponding physical storage location identifier in the data table to be restored before the data block to be restored is performed the truncate operation, which is corresponding to the data block to be restored before the data block to be restored is performed the truncate operation.
The second way is: acquiring a corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with truncate operation from a next data block of the segment header block corresponding to the data table to be restored; and acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage position identifier in the data table to be restored before the data block to be restored is executed with the truncate operation.
And according to the storage sequence of the data blocks in the data table to be restored, finding a next data block of a segment head block corresponding to the data table to be restored in the database, wherein a physical storage position identifier in the data table to be restored, which corresponds to the data block to be restored before the truncate operation is executed, is stored in the next data block of the segment head block.
Step S130, selecting an uncopied data block to be recovered from the data table to be recovered as a target data block to be recovered according to the storage sequence in the data table to be recovered;
step S140, copying the target data block to be recovered to the position of a preset data block stored in the transfer table;
and the target data block to be recovered copied to the transfer table needs to replace the data block stored at the position of the preset data block stored in the transfer table.
Specifically, the first target data block to be restored copied to the transfer table needs to replace the preset data block at the position where the preset data block is stored in the transfer table, after the first target data block to be restored is read from the transfer table to the final table through the following steps, the second target data block to be restored is obtained from the data table to be restored, the second target data block to be restored is copied to the position where the preset data block is stored in the transfer table, the first target data block to be restored is replaced, and so on until no uncopied data block to be restored exists in the data table to be restored.
S150, setting a data block attribute value of the target data block to be recovered, which is copied to the transfer table, in the transfer table;
the data block attribute value of the target data block to be restored in the transfer table in the embodiment of the present invention is specifically: the block address, the physical storage position identification and the data check value of the target data block to be recovered in the transfer table; therefore, the setting of the data block attribute value of the target data block to be recovered copied to the transfer table in the transfer table is to set the block address, the physical storage location identifier and the reference data check value of the target data block to be recovered copied to the transfer table in the transfer table.
The block address and the physical storage location identifier of the target data block to be recovered in the transfer table may be set according to the storage location of the target data block to be recovered in the transfer table, the data check value of the target data block to be recovered in the transfer table may be set according to the data value of the target data block to be recovered, the data check value of the target data block to be recovered in the transfer table is used to check the integrity of the data, and check whether the data changes, a specific Checksum manner may be a manner of calculating an exclusive or value by taking every two bytes as a unit and by cyclic superposition, for example, the first byte and the second byte are subjected to exclusive or operation with the third byte and the fourth byte respectively (the first byte and the third byte are subjected to exclusive or operation to obtain a first exclusive or value, and the second byte and the fourth byte are subjected to exclusive or operation to obtain a second exclusive or value), the first exclusive or value and the second exclusive or value are obtained respectively, and then subjected to exclusive or operation with the fifth byte and the sixth byte respectively, and circulating to the next time until the last byte, wherein the obtained value is a Checksum value, namely the current data check value.
Step S160, reading the target data block to be recovered copied into the transfer table from the transfer table into the final table according to the data block attribute value of the target data block to be recovered copied into the transfer table in the transfer table;
in the embodiment of the invention, a rowed SQL statement mode can be adopted, and the target data block to be recovered which is copied into the transfer table is read into the final table from the transfer table according to the data block attribute value of the target data block to be recovered which is copied into the transfer table in the transfer table.
And reading the target data block to be recovered copied into the transfer table from the transfer table into the final table, namely reading the target data block to be recovered from the transfer table, and then inserting the read target data block to be recovered into the final table.
Step S170, judging whether the data table to be restored has the data block to be restored which is not copied, if so, returning to execute the step S130; and if the data to be restored which is not copied does not exist in the data table to be restored, ending the execution.
After the execution is finished, the data block stored in the final table is the data of the data table to be restored, on which the truncate operation is executed.
In the embodiment of the invention, the data block attribute value of the data block to be recovered in the transfer table is determined by copying the data block to be recovered into the transfer table, so that the Oracle engine can read the data block to be recovered copied into the transfer table from the transfer table into the final table according to the data block attribute value of the data block to be recovered in the transfer table.
In addition, the method disclosed by the embodiment of the invention can be implemented on line without stopping the operation of the database to be recovered corresponding to the data table to be recovered. In the embodiment of the invention, the SQL statement mode can be adopted, and the target data block to be recovered which is copied into the transfer table is read into the final table from the transfer table according to the data block attribute value of the target data block to be recovered which is copied into the transfer table, so that the Oracle database with any version and the Oracle data column with any type can be compatible.
In the embodiment of the present invention, a rowed SQL statement mode may be adopted, and the target data block to be recovered copied to the transfer table is read from the transfer table to the final table according to the data block attribute value of the target data block to be recovered copied to the transfer table in the transfer table, and a specific process of reading the target data block to be recovered copied to the transfer table from the transfer table to the final table according to the data block attribute value of the target data block to be recovered copied to the transfer table in the transfer table is described in detail with a specific embodiment below: fig. 2 is a flowchart illustrating a method for reading a target data block to be restored copied into the transfer table from the transfer table into the final table according to a data block attribute value of the target data block to be restored copied into the transfer table, where with reference to fig. 2, the method may include:
step S200, acquiring the target data block to be recovered copied to the transfer table according to the block address of the target data block to be recovered copied to the transfer table in the transfer table and the physical storage position identification;
it should be noted that, in the embodiment of the present invention, the target data block to be recovered copied to the transfer table is obtained in a manner of extract _ rows _ from _ single _ block, where the manner of extract _ rows _ from _ single _ block is specifically to perform loop reading on data in the target data block to be recovered row by row, each loop calls dbms _ row. The number of reading cycles per line can be configured by those skilled in the art according to the database, and alternatively, the number of reading cycles can be 10000.
Step S210, calculating the current data check value of the target data block to be recovered, which is copied to the transfer table, in the transfer table according to the data content contained in the target data block to be recovered;
and the current data check value of the target data block to be recovered in the transfer table is used for checking the integrity of the data and checking whether the data in the target data block to be recovered is changed or damaged.
According to the data values contained in the target data block to be recovered, calculating the current data check value of the target data block to be recovered copied to the transfer table in a manner of circularly overlapping and calculating an exclusive or value by taking every two bytes as a unit, specifically calculating the current data check value of the target data block to be recovered copied to the transfer table in the transfer table, namely performing exclusive or operation on the first byte and the second byte respectively with the third byte and the fourth byte to obtain a first exclusive or value, performing exclusive or operation on the second byte and the fourth byte to obtain a second exclusive or value, performing exclusive or operation on the first exclusive or value and the second exclusive or value respectively with the fifth byte and the sixth byte, and circularly performing exclusive or operation until the last byte to obtain a value as the current data check value.
Step S220, reading the target to-be-recovered data block copied to the transfer table from the transfer table to the final table under the condition that the current data check value is consistent with the reference data check value.
And under the condition that the current data check value is consistent with the reference data check value, the current data in the target data block to be recovered is not changed and is not damaged, so that the current data in the target data block to be recovered, which is copied into the transfer table, can be read from the transfer table to the final table.
And the reference data check value is the data check value of the current data in the target data block to be recovered in the data table to be recovered.
It should be noted that, since there are usually row migration and row linking in the database:
specifically, when a record is updated, the Oracle database engine first tries to find enough free space in the data block where the record is located to store the updated record, and if not enough free space is available, the record is split into two parts, the first part includes a rowid pointing to the second part, the rowid pointing to the second part is still kept in the original data block, the second part includes all the specific data of the row record, and the part is stored in another new data block, which is called row migration.
The line link is that when a record is too large to be stored in a data block, the Oracle database engine will split the line record into 2 or more parts, and then store the split parts in a plurality of different data blocks, and simultaneously construct a link between the data blocks by using rowid, so that when the Oracle database engine reads the first part of the line record, the Oracle database engine can use the link to access the rest data stored in other data blocks in turn.
In order to avoid the situation that the data reading process fails due to the occurrence of the conditions of row migration and row linking, the embodiment of the present invention discloses a specific process for reading a target data block to be recovered, which is copied into a transfer table, from the transfer table to a final table under the condition that the current data check value is consistent with the reference data check value:
under the condition that the current data check value is consistent with the reference data check value, reading the data content in the target data block to be recovered copied to the transfer table line by line; judging whether the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table; if the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered, which is copied to the transfer table, in the transfer table, the read data content of the current row is inserted into the final table from the transfer table; otherwise, the data content of the read current line is not inserted into the final table from the transfer table.
In the process of reading the data content in the target data block to be recovered copied to the transfer table line by line, the embodiment of the present invention determines whether the physical storage location identifier corresponding to the read data content of the current line is the same as the preset physical storage location identifier of the target data block to be recovered copied to the transfer table, and because line migration occurs and the physical storage location identifier corresponding to the data content of the current line linked to the line changes, the physical storage location identifier corresponding to the data content of the current line is different from the preset physical storage location identifier of the target data block to be recovered copied to the transfer table In this case, it is possible to avoid a case where the data reading process fails due to occurrence of the line migration and the data of the line link.
According to the data block attribute value of the target data block to be recovered in the transfer table, the target data block to be recovered in the transfer table can be read from the transfer table to the final table, and the condition that the data reading process fails due to row migration and row link data can be avoided.
The following describes the specific process of the data recovery method disclosed in the present application in detail by using a specific embodiment:
referring to the table structure diagram shown in fig. 3, the following data Recovery operation performed in the embodiment of the present invention is an outstanding operation, and it is assumed that an incorrect locate operation is performed on an Original target table t1_ Original, the Original target table t1_ Original is a to-be-recovered data table, a table space where t1_ Original is located is Tablespace1, all data blocks mapped in the Original target table are stored in Tablespace1, t1_ Temp is a transition table, t1_ Recovery is a final table, a final table space is Tablespace2, a transition Segment _ Temp and a Recovery Segment _ Recovery are stored in Tablespace2, and the transition Segment _ Temp is a storage location in the transition table during migration of the to-be-recovered data block; the Recovery Segment _ Recovery is a storage location of all data blocks to be recovered, which are formed by reading from the intermediate table and inserting into the final table by using an SQL statement.
1. And keeping the site, stopping the access process of the application to t1_ Original or copying the data to be recovered in tablespace1 corresponding to t1_ Original in advance.
2. Table space tablespace2 is newly created in the database where t1_ Original exists, and two tables, table 1_ Temp and final table t1_ Recovery, are newly created in tablespace 2.
the table structure of t1_ Temp and t1_ Recovery is the same as t1_ Original, where t1_ Temp is used to store data in a single data block recovered from t1_ Original and t1_ Recovery is used to store all data recovered from t1_ Original.
3. A record is inserted into the transit table t1_ Temp in order for the Oracle database engine to format a preset data block in the transit table t1_ Temp.
4. Preparing two configuration files, which correspond to the untrustage operation, untrustage _ control.txt and untrustage _ control.txt.
Txt will contain all data file paths corresponding to the tablespace where the data table to be restored is located, and may be new storage paths of all data files copied from step 1.
Txt will contain the following configuration information:
(1) the user name, the password and the database instance name of the database where the data table to be recovered is located;
(2) the owner of the data table to be recovered and the table name are obtained, wherein the owner of the data table to be recovered is a user name which is correspondingly connected with an Oracle database when the data table to be recovered is created;
(3) the owner and the table name of the transfer table t1_ Temp, wherein the owner of the transfer table t1_ Temp is the user name connected with the Oracle database corresponding to the creation of the transfer table t1_ Temp;
(4) the owner and the table name of the final table t1_ Recovery, and the owner of the final table t1_ Recovery is the user name connected with the Oracle database corresponding to the creation of the final table t1_ Recovery;
(5) the data object id of the data block to be restored contained in the data table to be restored needs to be acquired according to the method disclosed by the embodiment of the invention; or, the untruncate may connect to the original target table database, read the data dictionary information, and use the object id of the to-be-recovered data block included in the read to-be-recovered data table as the data object id of the to-be-recovered data block.
5. Executing the untruncate, the untruncate first reads the configuration files untruncate _ control.txt and untruncate _ control.txt, and then reads the following metadata information from the database where t1_ origin is located:
(1) the size of the data block of the database where t1_ Original is denoted as t1_ blocksize, and optionally, the size of the data block is 8192, which is not specifically limited in the embodiment of the present invention;
(2) the object id of the data block to be restored contained in t1_ Original is denoted as object _ id _ t 1. Recording the data object id before t1_ Original untrustworthy as data _ object _ id _ t1, and if the data object id before t1_ Original untrustworthy is not configured in untrustworthy _ config.txt, then the data _ object _ id _ t1 is assigned as object _ id _ t 1; txt, if the data object id before t1_ Original is not located is configured in the outstanding _ config.T, then the data _ object _ id _ t1 will be assigned as the configured value;
(3) and the data object id of the target data block to be recovered, which is copied to the transit table t1_ Temp, in the transit table t1_ Temp is recorded as data _ object _ id _ t1_ Temp.
(4) Determining the rowid of the data in the preset data block in the t1_ Temp, wherein the untruncate calculates the RDBA of the preset data block according to the rowid, and the RDBA is marked as RDBA _ t1_ Temp.
6. The untruncate cyclically reads the data blocks corresponding to tablespace1 where t1_ Original is located in units of t1_ blocksize until all data blocks corresponding to tablespace1 are traversed. Each time a data block of size t1_ blocksize is read, the untrunate determines the data object id of the data block, and if the data object id is found not equal to the data _ object _ id _ t1, the data block is skipped and the next data block is read. If the data object id of a data block is found to be equal to the data _ object _ id _ t1, determining the data block as a target data block to be restored;
7. copying a target data block to be recovered to a position, where a preset data block is stored, in the transit table t1_ Temp, wherein the target data block to be recovered copied to the transit table t1_ Temp needs to replace the data block stored at the position, where the preset data block is stored, in the transit table, then changing the RDBA of the target data block to be recovered copied to the transit table t1_ Temp to RDBA _ t1_ Temp, then changing the data object id of the target data block to be recovered copied to the transit table t1_ Temp to data _ object _ id _ t1_ Temp, and finally recalculating and modifying the checksum value of the target data block to be recovered;
8. executing a storage process extract _ rows _ from _ single _ block, reading the target data block to be recovered copied into the transfer table t1_ Temp from the transfer table t1_ Temp into the final table t1_ Recovery according to the data block attribute value of the target data block to be recovered copied into the transfer table in the transfer table until the data block to be recovered which is not copied does not exist in the data table to be recovered, wherein the data in the data block in the final table t1_ Recovery is the data in the data block in the table t1_ Original which is recovered and is dropped by truncate.
Specifically, when the data in the target data block to be recovered in t1_ Temp is read by using a rowid SQL statement one by one, if the data is data of row migration or row link, the error of the Oracle database engine will be reported when the data is read, and at this time, the system automatically ignores the error reported by the Oracle database engine, and directly circularly reads the next data, so that the purpose of skipping row migration and row link recording is achieved.
The following describes a data recovery apparatus according to an embodiment of the present invention, and the data recovery apparatus described below may be referred to in correspondence with the data recovery method described above.
Fig. 4 is a block diagram of a data recovery apparatus according to an embodiment of the present invention, and referring to fig. 4, the data recovery apparatus may include:
the table establishing module 100 is configured to establish a transfer table and a final table having the same table structure as the data table to be restored;
a preset data block inserting module 110, configured to insert a preset data block into the transfer table, where a block structure of the preset data block is the same as a structure of a data block to be recovered in the data table to be recovered;
a to-be-recovered data block obtaining module 120, configured to obtain the to-be-recovered data block included in the to-be-recovered data table;
a target data block to be restored determining module 130, configured to select, according to the storage sequence in the data table to be restored, one data block to be restored that is not copied from the data table to be restored, as a target data block to be restored;
the copying module 140 is configured to copy the target to-be-recovered data block to a location in the transfer table where a preset data block is stored, where the target to-be-recovered data block copied to the transfer table needs to replace a data block stored in the location in the transfer table where the preset data block is stored;
a data block attribute value setting module 150, configured to set a data block attribute value of a target data block to be recovered, copied to the transfer table, in the transfer table;
a reading module 160, configured to read the target data block to be recovered copied to the transfer table from the transfer table to the final table according to the data block attribute value of the target data block to be recovered copied to the transfer table in the transfer table;
the judging module 170 is configured to judge whether an uncopied data block to be recovered exists in the data table to be recovered, and if the judging module judges that the uncopied data block to be recovered exists in the data table to be recovered, return to the step executed by the execution target data block to be recovered determining module; and if the judging module judges that the data block to be recovered which is not copied does not exist in the data table to be recovered, ending the operation.
The module for acquiring the data block to be recovered comprises:
the first to-be-recovered data block acquisition submodule is used for acquiring a corresponding physical storage position identifier in the to-be-recovered data table before the to-be-recovered data block is subjected to truncate operation from the history information according to the history information recorded in the data dictionary corresponding to the to-be-recovered data table; acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with the truncate operation;
or;
a second to-be-recovered data block obtaining submodule, configured to obtain, from a data block next to a segment header block corresponding to the to-be-recovered data table, a physical storage location identifier in the to-be-recovered data table corresponding to the to-be-recovered data block before the to-be-recovered data block is subjected to truncate operation; and acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage position identifier in the data table to be restored before the data block to be restored is executed with the truncate operation.
The data block attribute value setting module comprises:
and the data block attribute value setting submodule is used for setting the block address, the physical storage position identification and the reference data check value of the target data block to be recovered, which is copied to the transfer table, in the transfer table.
The reading module includes:
the target data block to be recovered acquiring module is used for acquiring the target data block to be recovered copied to the transfer table according to the block address of the target data block to be recovered copied to the transfer table in the transfer table and the physical storage position identification;
a current data check value calculation module, configured to calculate, according to data content included in the target data block to be recovered, a current data check value in the transfer table of the target data block to be recovered, where the current data check value is copied to the transfer table;
and the reading submodule is used for reading the target data block to be recovered which is copied to the transfer table from the transfer table to the final table under the condition that the current data check value is consistent with the reference data check value.
The reading submodule is specifically configured to:
under the condition that the current data check value is consistent with the reference data check value, reading the data content in the target data block to be recovered copied to the transfer table line by line; judging whether the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table; and if the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table, inserting the read data content of the current row into the final table from the transfer table.
In summary, the following steps:
the embodiment of the invention discloses a data recovery method and a data recovery device, wherein a transfer table and a final table which have the same table structure with a data table to be recovered are established; inserting a preset data block into a transfer table, wherein the block structure of the preset data block is the same as the structure of a data block to be recovered in the data table to be recovered; acquiring a data block to be recovered contained in a data table to be recovered; according to the storage sequence in the data table to be recovered, selecting an uncopyed data block to be recovered from the data table to be recovered as a target data block to be recovered; copying a target data block to be recovered to a position, in a transfer table, where a preset data block is stored, wherein the target data block to be recovered copied to the transfer table needs to replace the data block stored in the position, in the transfer table, where the preset data block is stored; setting the data block attribute value of the target data block to be recovered, which is copied to the transfer table, in the transfer table; reading the target data block to be recovered copied to the transfer table from the transfer table to the final table according to the data block attribute value of the target data block to be recovered copied to the transfer table in the transfer table; judging whether the data table to be restored has the data block to be restored which is not copied, if so, returning to execute the step of selecting one data block to be restored which is not copied from the data table to be restored as the target data block to be restored according to the storage sequence in the data table to be restored; if not, the process ends. The data recovery method comprises the steps of copying a data block to be recovered to a transfer table, determining a data block attribute value of the data block to be recovered in the transfer table, reading the data block to be recovered copied to the transfer table from the transfer table to a final table according to the data block attribute value of the data block to be recovered in the transfer table, wherein the data block to be recovered is the data block which executes a truncate operation.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for data recovery, comprising:
establishing a transfer table and a final table which have the same table structure with the data table to be recovered;
inserting a preset data block into the transfer table, wherein the block structure of the preset data block is the same as the structure of the data block to be recovered in the data table to be recovered;
acquiring the data block to be recovered contained in the data table to be recovered;
according to the storage sequence in the data table to be restored, selecting an uncopyed data block to be restored from the data table to be restored as a target data block to be restored;
copying the target data block to be recovered to a position of the transfer table where a preset data block is stored, wherein the target data block to be recovered copied to the transfer table needs to replace the data block stored at the position of the transfer table where the preset data block is stored;
setting the data block attribute value of the target data block to be recovered, which is copied to the transfer table, in the transfer table;
reading the target data block to be recovered copied to the transfer table from the transfer table to the final table according to the data block attribute value of the target data block to be recovered copied to the transfer table in the transfer table;
judging whether the data table to be restored has the data block to be restored which is not copied, if so, returning to execute the step of selecting one data block to be restored which is not copied from the data table to be restored as the target data block to be restored according to the storage sequence in the data table to be restored; if not, the process ends.
2. The method according to claim 1, wherein the step of obtaining the data block to be restored contained in the data table to be restored comprises:
according to history information recorded in a data dictionary corresponding to the data table to be restored, acquiring a corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with truncate operation from the history information;
acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with the truncate operation;
or;
acquiring a corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with truncate operation from a next data block of the segment header block corresponding to the data table to be restored;
and acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage position identifier in the data table to be restored before the data block to be restored is executed with the truncate operation.
3. The method according to claim 1, wherein the process of setting the data block attribute value in the transfer table of the target data block to be restored copied to the transfer table comprises:
and setting a block address, a physical storage position identifier and a reference data check value of the target data block to be recovered, which is copied to the transfer table, in the transfer table.
4. The method according to claim 1, wherein the reading the target data block to be restored copied into the transfer table from the transfer table into the final table according to the data block attribute value of the target data block to be restored copied into the transfer table in the transfer table comprises:
acquiring the target data block to be recovered copied to the transfer table according to the block address of the target data block to be recovered copied to the transfer table in the transfer table and the physical storage position identification;
calculating the current data check value of the target data block to be recovered, which is copied to the transfer table, in the transfer table according to the data content contained in the target data block to be recovered;
and reading the target data block to be recovered copied to the transfer table from the transfer table to the final table under the condition that the current data check value is consistent with the reference data check value.
5. The method according to claim 4, wherein the reading the target data block to be restored copied to the transfer table from the transfer table to the final table in the case that the current data check value is consistent with the reference data check value comprises:
under the condition that the current data check value is consistent with the reference data check value, reading the data content in the target data block to be recovered copied to the transfer table line by line;
judging whether the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table;
and if the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table, inserting the read data content of the current row into the final table from the transfer table.
6. A data recovery apparatus, comprising:
the table establishing module is used for establishing a transfer table and a final table which have the same table structure with the data table to be recovered;
a preset data block insertion module, configured to insert a preset data block into the transfer table, where a block structure of the preset data block is the same as a structure of a data block to be recovered in the data table to be recovered;
a to-be-recovered data block obtaining module, configured to obtain the to-be-recovered data block included in the to-be-recovered data table;
a target data block to be restored determining module, configured to select, according to a storage sequence in the data table to be restored, one data block to be restored that is not copied from the data table to be restored, as a target data block to be restored;
the copying module is used for copying the target data block to be recovered to the position of the transfer table where the preset data block is stored, wherein the target data block to be recovered copied to the transfer table needs to replace the data block stored at the position of the transfer table where the preset data block is stored;
the data block attribute value setting module is used for setting the data block attribute value of the target data block to be recovered, which is copied to the transfer table, in the transfer table;
the reading module is used for reading the target data block to be recovered copied into the transfer table from the transfer table into the final table according to the data block attribute value of the target data block to be recovered copied into the transfer table in the transfer table;
the judging module is used for judging whether the data table to be recovered has the data block to be recovered which is not copied, and if the judging module judges that the data table to be recovered has the data block to be recovered which is not copied, returning to the step executed by the target data block to be recovered determining module; and if the judging module judges that the data block to be recovered which is not copied does not exist in the data table to be recovered, ending the operation.
7. The apparatus of claim 6, wherein the to-be-recovered data block obtaining module comprises:
the first to-be-recovered data block acquisition submodule is used for acquiring a corresponding physical storage position identifier in the to-be-recovered data table before the to-be-recovered data block is subjected to truncate operation from the history information according to the history information recorded in the data dictionary corresponding to the to-be-recovered data table; acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage location identifier in the data table to be restored before the data block to be restored is executed with the truncate operation;
or;
a second to-be-recovered data block obtaining submodule, configured to obtain, from a data block next to a segment header block corresponding to the to-be-recovered data table, a physical storage location identifier in the to-be-recovered data table corresponding to the to-be-recovered data block before the to-be-recovered data block is subjected to truncate operation; and acquiring the data block to be restored from the data table to be restored according to the corresponding physical storage position identifier in the data table to be restored before the data block to be restored is executed with the truncate operation.
8. The apparatus of claim 6, wherein the data block attribute value setting module comprises:
and the data block attribute value setting submodule is used for setting the block address, the physical storage position identification and the reference data check value of the target data block to be recovered, which is copied to the transfer table, in the transfer table.
9. The apparatus of claim 6, wherein the reading module comprises:
the target data block to be recovered acquiring module is used for acquiring the target data block to be recovered copied to the transfer table according to the block address of the target data block to be recovered copied to the transfer table in the transfer table and the physical storage position identification;
a current data check value calculation module, configured to calculate, according to data content included in the target data block to be recovered, a current data check value in the transfer table of the target data block to be recovered, where the current data check value is copied to the transfer table;
and the reading submodule is used for reading the target data block to be recovered which is copied to the transfer table from the transfer table to the final table under the condition that the current data check value is consistent with the reference data check value.
10. The apparatus of claim 9, wherein the read submodule is specifically configured to:
under the condition that the current data check value is consistent with the reference data check value, reading the data content in the target data block to be recovered copied to the transfer table line by line; judging whether the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table; and if the physical storage position identification corresponding to the read data content of the current row is the same as the preset physical storage position identification of the target data block to be recovered copied into the transfer table in the transfer table, inserting the read data content of the current row into the final table from the transfer table.
CN201910620122.3A 2019-07-10 2019-07-10 Data recovery method and device Active CN110333970B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910620122.3A CN110333970B (en) 2019-07-10 2019-07-10 Data recovery method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910620122.3A CN110333970B (en) 2019-07-10 2019-07-10 Data recovery method and device

Publications (2)

Publication Number Publication Date
CN110333970A CN110333970A (en) 2019-10-15
CN110333970B true CN110333970B (en) 2021-09-07

Family

ID=68145889

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910620122.3A Active CN110333970B (en) 2019-07-10 2019-07-10 Data recovery method and device

Country Status (1)

Country Link
CN (1) CN110333970B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110764943B (en) * 2019-10-21 2023-05-05 中国民航信息网络股份有限公司 Data processing method and device of Oracle database
CN112860686B (en) * 2019-11-28 2023-03-10 金篆信科有限责任公司 Data processing method, data processing device, computer equipment and computer readable medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567490A (en) * 2011-12-21 2012-07-11 华为技术有限公司 Method and apparatus for recovering description information and caching data in database
CN103593447A (en) * 2013-11-18 2014-02-19 北京国双科技有限公司 Data processing method and device applied to database table
CN104346454A (en) * 2014-10-30 2015-02-11 上海新炬网络技术有限公司 Data consistency verification method based on Oracle database
US9767177B1 (en) * 2005-03-28 2017-09-19 Federal Home Loan Mortgage Corporation System and method for optimizing data recovery in a parallel database
CN109241061A (en) * 2018-09-14 2019-01-18 上海新炬网络信息技术股份有限公司 Guard method for oracle database Truncate operation
CN109739936A (en) * 2019-01-23 2019-05-10 杭州数梦工场科技有限公司 Method of data synchronization, system, server and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10552057B2 (en) * 2016-05-27 2020-02-04 Netapp, Inc. Methods for improving journal performance in storage networks and devices thereof

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9767177B1 (en) * 2005-03-28 2017-09-19 Federal Home Loan Mortgage Corporation System and method for optimizing data recovery in a parallel database
CN102567490A (en) * 2011-12-21 2012-07-11 华为技术有限公司 Method and apparatus for recovering description information and caching data in database
CN103593447A (en) * 2013-11-18 2014-02-19 北京国双科技有限公司 Data processing method and device applied to database table
CN104346454A (en) * 2014-10-30 2015-02-11 上海新炬网络技术有限公司 Data consistency verification method based on Oracle database
CN109241061A (en) * 2018-09-14 2019-01-18 上海新炬网络信息技术股份有限公司 Guard method for oracle database Truncate operation
CN109739936A (en) * 2019-01-23 2019-05-10 杭州数梦工场科技有限公司 Method of data synchronization, system, server and computer readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Oracle 中Truncate 表的恢复方法;瞿金如;《福建电脑》;20170630(第6期);全文 *
Oracle 数据库误truncate table恢复过程;北亚数据安全救援;《北亚数据安全救援》;20181012;全文 *
深入解析:TRUNCATE TABLE 的内部原理解析与恢复思路;李翔宇;《数据和云》;20180802;全文 *

Also Published As

Publication number Publication date
CN110333970A (en) 2019-10-15

Similar Documents

Publication Publication Date Title
US6772155B1 (en) Looking data in a database system
US4961134A (en) Method for minimizing locking and reading in a segmented storage space
CA2281287C (en) Method and system for efficiently searching for free space in a table of a relational database having a clustering index
US8560500B2 (en) Method and system for removing rows from directory tables
US6675180B2 (en) Data updating apparatus that performs quick restoration processing
EP1480132B1 (en) System and method for identifying and storing changes made to a table
CN110333970B (en) Data recovery method and device
JP4101410B2 (en) Time version data storage device
Taniar et al. A taxonomy of indexing schemes for parallel database systems
US7225206B2 (en) System and method for reorganizing stored data
US20190258618A1 (en) Immediately-consistent lock-free indexing for distributed applications
JP2018538596A (en) Method and apparatus for data processing
CN114968111A (en) Data deleting method, device, equipment and computer readable storage medium
US7269589B2 (en) Database managing method and system having data backup function and associated programs
US20040107198A1 (en) Method and arrangements for node recovery
US7650352B2 (en) System and method for increasing availability of an index
US20120317384A1 (en) Data storage method
US7051051B1 (en) Recovering from failed operations in a database system
CN109344163B (en) Data verification method and device and computer readable medium
CN110764943B (en) Data processing method and device of Oracle database
CN114968663A (en) Database content recovery method and system
JP3957464B2 (en) Data update device
CN110413617B (en) Method for dynamically adjusting hash table group according to size of data volume
CN114416741A (en) KV data writing and reading method and device based on multi-level index and storage medium
US7010552B2 (en) Optimizing command execution in database systems that provide support for updatable scrollable cursors

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
GR01 Patent grant
GR01 Patent grant