Deleted data in the Oracle database can be recovered through the following steps: Check the Recycle Bin: Enter the Recycle Bin to view the deleted data and restore it if it is there. Use Flashback Query: Use the Flashback Query command to restore data when it is not in the Recycle Bin. Use LogMiner tool: Extract deleted data by parsing redo log files.
Deleted data recovery method in Oracle database
Steps to recover deleted data
Deleted data in the Oracle database can be recovered through the following steps:
1. Check the Recycle Bin
Execute the following query to view the deleted data available in the Recycle Bin:
<code class="sql">SELECT * FROM BIN$DATA_OBJECTS;</code>
If the data you want to recover is in the Recycle Bin, execute the following query :
<code class="sql">FLASHBACK TABLE table_name TO BEFORE DROP;</code>
where table_name is the name of the table to be restored.
2. Use Flashback Query
Use the following query syntax:
<code class="sql">SELECT * FROM table_name AS OF TIMESTAMP AS OF to_date('yyyy-mm-dd hh24:mi:ss', 'YYYY-MM-DD HH24:MI:SS');</code>
Where:
3. Use the LogMiner tool
To use LogMiner, follow these steps:
<code class="sql">ALTER SYSTEM SET log_archive_config = 'DG_CONFIG=(ASYNC,SYS.ARCHIVED_LOGS)';</code>
<code class="sql">EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILE => 'logfile_name'); EXECUTE DBMS_LOGMNR.START_LOGMNR(OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG);</code>
<code class="sql">SELECT * FROM V$LOGMNR_CONTENTS WHERE SEGMENT_NAME = 'table_name' AND SCN >=SCN_START AND SCN <=SCN_END;</code>
<code class="sql">INSERT INTO table_name SELECT * FROM V$LOGMNR_CONTENTS WHERE SEGMENT_NAME = 'table_name' AND SCN >=SCN_START AND SCN <=SCN_END;</code>
Note Matter
The above is the detailed content of How to recover deleted data in oracle database. For more information, please follow other related articles on the PHP Chinese website!