The database flashback operation restores the table in the drop case

Oracle Flashback Technology

 

1. Analysis of flashback drop flashback operation

It is easy to accidentally delete a table, and sometimes a table that should not be deleted is deleted because it is connected to the wrong schema or logged in to the wrong instance. How to successfully restore the deleted table? Here we will explain the flashback drop operation to restore the database table.

Usually, in order to avoid instances of login errors, we can add a sql*plus prompt here, for example, the settings are as follows

                            set sqlprompt "_user'@'_connect_identifier>"


 

2. Delete using flashback

First of all, I am here to say drop table <table_name> purge this sql statement. The purge keyword means that all references to the table are deleted and can never be recovered. In other words, if the above statement is used, the table user_recyclebin in our recycle bin will not be used. The structure records of the deleted table will be retained, and the table deleted by mistake cannot be recovered, so do not use the purge keyword unless the table can be completely deleted .

 

Well, we have listed the situations of complete deletion that may be encountered when deleting a table. There is no way to recover that situation, but we usually delete the operation table by mistake. The command applied is often drop table <table_name>, this type of operation As long as the user operation is not in the system tablespace, the table can often be restored, provided that the deleted table structure information can be found in the table user_recyclebin of the recycle bin, and the restoration can be carried out. For example

 , as shown in the figure, we delete the ocs_bank_info table from the system. If we delete the table by mistake, at this time, check the user_recyclebin table to see if there is any recycling record information of ocs_bank_info in it. pass through

flashback table names to before drop for recovery, and finally by querying select count(*) from ocs_bank_info, you can find out that we mistakenly deleted the table containing 45 entries.

 

 

 

 

 


 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326605379&siteId=291194637