Get the App
SLTechnology News&Howtos  ›  Database  › 

How to recover oracle data based on internal SCN number DML erroneously deleted data

Shulou Source: shulou.com Published: 2022-05-31 15:15:12 11月15日 Update

This article mainly shows you "oracle how to restore DML mistakenly deleted data according to the internal SCN number", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "oracle how to restore DML mistakenly deleted data according to the internal SCN number" this article.

The following example is tested by yourself:

1. Create a temporary table:

SQL > create table t as select * from dba_tables

Table created.

SQL > select count (1) from t

COUNT (1)

-

2734

2. Check the current SCN number.

SQL > select dbms_flashback.get_system_change_number fscn from dual

FSCN

-

1730685

You can also view historical scn numbers by time:

Select name,FIRST_CHANGE# fscn,NEXT_CHANGE# nscn,FIRST_TIME from v$archived_log

13641588409883

3. Delete data from the table:

SQL > delete from t

2734 rows deleted.

SQL > commit

Commit complete.

SQL > select count (1) from t

COUNT (1)

-

0

4. Query the data of historical SCN number

SQL > select count (*) from t as of scn 1730685

COUNT (*)

-

2734

You can query under the historical SCN number, and the number of t table is 2734.

5. Restore the data of T table:

SQL > insert into t select * from t as of scn 1730685

2734 rows created.

SQL > commit

Commit complete.

SQL > select count (1) from t

COUNT (1)

-

2734

OK, through the above simple example, we can find a relatively simple way to recover data.

And this method does not need to be run in flashback mode. But you can only use DML operation. If a truncate operation occurs in the table, it cannot be recovered.

In addition, this method is similar to flashback.

The above is all the contents of the article "how to recover DML erased data according to the internal SCN number of oracle". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Data content history methods articles numbers examples learning help query available through quantity way time easy to understand by more organization knowledge editing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Redmi Shulou Tech Info Shulou Technology MariaDB