This article brings you relevant knowledge about Oracle. When using oracle data, the data in the table was accidentally deleted and submitted. The following is about the oracle delete error. I hope this information is helpful to everyone on how to restore table data after deleting it.
## Recommended tutorial: "Oracle Video Tutorial"
Restore based on time
This method requires us to roughly know the time when the delete statement is executed. Query the current system time:select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
delete from demo was executed;
select * from DEMO as of timestamp to_timestamp(‘2022-04-02 16:26:11',‘yyyy-mm-dd hh24:mi:ss');
You can see that although there is no data in the current demo table, you can query the data from the demo table one minute ago. Recovery 1: At this time, you can export the sql file through the export query result function of the plsql tool, and then re-execute the insert statement in the sql file for data recovery. Recovery 2: Execute the following sql for data recovery:
flashback table DEMO to timestamp to_timestamp(‘2022-04-02 16:26:11',‘yyyy-mm-dd hh24:mi:ss');
alter table DEMO enable row movement;
create table DEMO1 as select * from DEMO as of timestamp to_timestamp(‘2022-04-02 16:30:11',‘yyyy-mm-dd hh24:mi:ss');
insert into DEMO select * from DEMO1 where not exists (select * from DEMO where DEMO.id=DEMO1.id);
select current_scn from v$database;
select * from DEMO as of scn 166937913;
flashback table DEMO to scn 166937913;
Oracle Video Tutorial"
The above is the detailed content of How to recover after accidentally deleting table data in oracle instance parsing delete. For more information, please follow other related articles on the PHP Chinese website!