Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to roll back data after commit in oracle

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to roll back the data after commit in oracle. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

After commit

The first kind:

Remember the approximate time and get the data of the previous approximate time.

Select * from Test as of timestamp to_timestamp ('2021-12-08 09mm Murray hh34:mi:ss')

The above code can check the record of the point in time you want to recover to see if there is a record of the DML you just submitted.

As you can see, the rest is simple. You can back up the data in the current table to a temporary table, and then insert the records into the original table.

Don't delete it with truncate, or you won't be able to go back, and then you'll cry again.

Delete from Test;insert into Test select * from Test as of timestamp to_timestamp ('2021-12-08 09mm Murray dd hh34:mi:ss') commit

The second kind:

Oracle introduced flashback technology in version 9i, and flashback function has been fully provided in Oracle 10g, which mainly provides a fast and simple way to recover data misoperated in the database without having to recover from logical backup or physical backup.

If the commit data is repeated, can it be flashed back? I don't think so. Flashbacks can only temporarily store the most recent data operation.

Flashback steps:

1. Query the data before the most recent update (to determine if it is pre-Commit data)

Select * from Test as of timestamp to_timestamp ('2021-12-08 08 yyyy-mm-dd hh34:mi:ss')

Where Test is the table that was misoperated, and '2021-12-08 08-08-08-08-08-08-08-00-00 indicates the time before the data was last updated.

two。 Enable line movement before flashback operation (do not flashback if not enabled)

Alter table Test enable row movement

Where Test represents the table that has been misoperated

3. Execute the flashback statement:

Flashback table Test to timestamp TO_TIMESTAMP ('20211208 15lv 10lv 00mm HH24:MI:SS')

In this way, the mismanipulated data can be "found". Haha ~

Note: the method comes from network finishing, please operate carefully! Form a good habit before modifying the data and back up the data manually!

This is about how to roll back the data after commit in oracle. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report