You can retrieve Oracle's deleted rows only if the data still exists somewhere after the delete. The key condition is whether the transaction that removed the rows was committed and, if so, which recovery mechanism is available: Oracle Flashback Query, Flashback Versions Query, Flashback Transaction Query, Flashback Table, Flashback Drop, archived redo log mining, or a database backup. If the delete was committed and the undo data has been overwritten or the table was purged with no backup, the rows are generally unrecoverable. The safest sequence is: stop making unnecessary changes, identify when and how the delete happened, preserve what remains, then try the least invasive recovery method before moving to more disruptive ones.
The word "retrieve" can mean three different things in Oracle. You might want to read the rows without restoring them, restore them into a copy for verification, or put them back in place. Each has different prerequisites and different blast radius. I'll separate those, because choosing the wrong first step — especially on a production table — can turn a small mistake into an outage or make a later recovery impossible.
First, Establish What Actually Happened
Before you run a recovery query, answer four questions. Skip this and you'll likely waste time on mechanisms that can't work for your situation.
Was the delete committed? An uncommitted delete can often be undone by the session that did it, or simply rolled back if that transaction is still open. If the transaction is still open in another session, recovery is mostly about coordinating with that session, not running flashback. Check for pending transactions with V$TRANSACTION and V$SESSION before assuming the data is permanently gone from the live table.
When did it happen, and roughly how long ago? Undo and flashback data are time-limited. The relevant parameters are UNDO_RETENTION (the target retention period, not a guarantee) and the actual undo tablespace usage. If something consumed undo aggressively, your usable window may be much shorter than the parameter suggests.
Was the table changed structurally? A TRUNCATE is not a DELETE. TRUNCATE removes all rows and is a DDL operation; it bypasses row-level undo in the ordinary sense and can't be reversed with Flashback Query or Flashback Table in the usual way. Similarly, a DROP TABLE needs Flashback Drop (recycle bin) or backup-based recovery, not row-level undo. Many "deleted rows" calls are actually truncate calls, and the two need different paths.
Do you have a backup and archived redo logs? If you have a recent backup plus archived and current redo logs, almost any committed delete can be recovered in principle by restoring a copy and applying logs to a chosen point in time. That's slower and more operationally involved, but it is the fallback that doesn't depend on undo retention.
Write these answers down with a timestamp. Time zone matters: Oracle time queries in this area typically interpret values in the database time zone, and a mismatch between your local clock, the database server, and the session time zone is one of the most common reasons a recovery query returns nothing. Use SYSTIMESTAMP and CURRENT_TIMESTAMP to see what the database considers "now," and prefer timestamps over relative guesses.
Flashback Query: The First and Least Invasive Try
Flashback Query is the fastest, least disruptive way to see deleted rows. It uses undo data to reconstruct the table as it appeared at a past time or SCN, and it runs as a normal query with no restore step, no downtime, and no DDL.
Prerequisite: You need FLASHBACK privilege on the table (or SELECT for as-of queries in some versions) and enough undo to cover the point in time. It works for committed deletes only if the undo is still present.
Actions in order:
1: Confirm "now" in database terms with SELECT CURRENT_TIMESTAMP, SYSTIMESTAMP FROM dual;. 2: Pick a timestamp just before the delete. When in doubt, aim slightly earlier, because rows deleted at that time should still be visible. 3: Run a verification count against the past image, e.g. SELECT COUNT(*) FROM sales AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '30' MINUTE);. 4: Compare that count to the current table count. This tells you whether the undo window covers the delete at all. 5: Inspect a specific row you know disappeared, e.g. SELECT * FROM sales AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '30' MINUTE) WHERE id = 4172;. 6: If the rows appear, copy them out rather than updating the live table immediately. Use CREATE TABLE recovery_copy AS SELECT * FROM sales AS OF TIMESTAMP (...); so you have a materialized snapshot you can verify. 7: Only after verification, plan how to reinsert the missing rows. A scoped INSERT ... SELECT ... FROM recovery_copy joined against the current table on the primary key, filtered to rows that no longer exist, is usually safer than a bulk truncate-and-reload.
Success check: The row count in the as-of query should match what you expect, and the specific rows should reappear. If you get ORA-01555: snapshot too old, that's not a permissions problem. It means the undo for that time has been overwritten, and smaller numbers of "minutes ago" may still work — but you may have already passed the practical window. Try earlier-shifted times only if you suspect undo pressure was recent; otherwise move to the next mechanism.
Flashback Query does not restore anything. It shows you the past. That distinction matters, because people sometimes assume a successful query means the "retrieval" is complete; in fact you still have to move data back.
Flashback Versions Query: What Changed and When
Flashback Versions Query (VERSIONS BETWEEN syntax) is a related but different tool. Instead of asking "what did the table look like at time T," it asks "what versions of these rows existed across a time range, and what operation changed each one." That's useful when you know specific rows were deleted but don't know exactly when, and when you want to distinguish an insert-and-delete from an update.
Use it like this:
1: Identify the key values of the rows you think are missing. 2: Run SELECT versions_starttime, versions_endtime, versions_operation, * FROM sales VERSIONS BETWEEN TIMESTAMP (SYSTIMESTAMP - INTERVAL '2' HOUR) AND SYSTIMESTAMP WHERE id = 4172;. 3: Read versions_operation: D indicates a delete version, and you can see versions_starttime around when the delete was committed. 4: Use the discovered timestamp as input to Flashback Query to pull the full row image.
This is often the best tool for producing an audit-style answer to "when were these rows removed," which is useful before filing a recovery request or briefing teammates. Note the same undo-retention limits apply; if the versions range falls outside available undo you'll get ORA-01555 again.
Flashback Transaction Query and Undo-Based Transaction Reconstruction
Flashback Transaction Query can show the operations associated with a transaction and, with the right privileges and setup, help undo a specific transaction. In practice this is closer to a DBA tool than a developer's routine, and it has prerequisites: supplemental logging and a license/version caveat depending on your edition and version. If your organization has Oracle Flashback Data Archive in use, it can retain row history for much longer than ordinary undo and is a much more reliable route than guessing at undo retention.
I'd treat this as a step to raise with your DBA. If you're the DBA, verify the version, confirm supplemental logging state, and test the undo path against a non-production clone before touching production. The failure mode here isn't usually "it doesn't work" — it's "it works and undoes more or less than you intended," which is why a clone test is the right precaution.
Flashback Table: Restore In Place, With Risks
Flashback Table (FLASHBACK TABLE ... TO TIMESTAMP ...) restores a table's contents to a prior point in place. It's powerful, and it's the wrong first move for most people.
Prerequisites and trade-offs:
Row movement must be enabled (ALTER TABLE ... ENABLE ROW MOVEMENT;), which is itself a schema change. The operation does more than restore deleted rows: it reverts the table to its state as of that point in time. Rows inserted after that point will disappear too, and updates made after that point get reverted. If other work has continued on the table, you can erase valid changes along with the mistake. Foreign keys referencing the table, grants that depend on data, and downstream tables that received rows based on the deleted data are not automatically fixed. You can end up with referential inconsistency. It isn't a backup restore, and it doesn't fix views, synonyms, triggers, or dependent logic.
For those reasons, I recommend using Flashback Table only when the table is effectively isolated, or when you have verified across the dependency tree that no later legitimate changes exist. Otherwise, use Flashback Query to extract rows into a recovery table and reinsert narrowly, or restore a copy from backup into a separate schema.
Flashback Drop and the Recycle Bin
If the original event wasn't a row delete but a DROP TABLE, the recycle bin is the usual first stop. FLASHBACK TABLE original_name TO BEFORE DROP; can recover a dropped table, subject to space and purge behavior. Two limitations matter for your question specifically: a table recovered from the recycle bin returns with its rows as of the drop, which may or may not include rows deleted before the drop, and the recycle bin can be commanded to purge on various eviction policies, so there's no guaranteed window.
If the table was dropped and then the bin purged, or if this is a TRUNCATE, the recycle bin doesn't help. Those go to backup-based recovery, which I'll cover next. This is where distinguishing "deleted rows" from "dropped or truncated table" up front saves hours.
Backup and Archived Redo Log Recovery
When undo is gone, backups are the dependable path. The principle: restore a copy of the relevant tablespace or database to a separate location, apply archived redo logs to the point just before the delete, and extract the rows.
The exact tooling depends on your environment. RMAN can perform point-in-time recovery (RECOVER DATABASE UNTIL TIME ... or UNTIL SCN), typically using a duplicate or clone rather than overwriting production. If you're using a managed platform or a version that supports a clone-based workflow, that's the least risky route: clone to a non-production namespace, run the Flashback Query there if undo permits, and export the rows.
Steps in order:
1: Preserve the current archived redo logs; don't let them age out before you've confirmed recovery scope. 2: Note the exact timestamp of the delete from Flashback Versions Query or application logs, and the matching SCN if you have it. 3: Restore a copy, or clone, to a separate database or schema. 4: Recover to the chosen time or SCN, stopping before the delete commit. 5: Use a normal SELECT or Data Pump export to pull the missing rows. 6: Move them into production via controlled inserts, with a joined filter so you only restore rows the production table is actually missing. Re-inserting duplicates or clobbering legitimate updates is a common error at this step.
Success check: count comparison between the recovered snapshot's target rows and the current production table's list of expected missing rows. Do the diff, don't just do the insert.
The costs and limits are real: log retention determines how far back you can go, a very large database takes time to clone, and the process may need a recovery catalog or the right up-to-date control file information. It is, however, the mechanism that doesn't depend on undo being young.
Other Tools You Might Encounter
A few adjacent options show up in real organizations. Oracle Flashback Data Archive (also called Total Recall in some versions) retains historical data on a retention schedule you configure, and can answer "what did this table look like three months ago" without depending on undo — but only if it was enabled before the delete, and it may have edition/licensing implications.
LogMiner reads the archived redo logs to reconstruct row changes. It's a valid route when you need the relationship of the delete to surrounding changes, but it's a DBA-level operation and the output is detailed rather than a neat restore.
If you happen to be in a non-production sandbox, some teams deliberately set UNDO_RETENTION high and use a recoverable tablespace. That doesn't help you after the fact, but it tells you what to check about your environment before the next incident.
What Breaks Most Often
The most frequent failure isn't the query syntax. It's ORA-01555, which simply means the undo you need has been reused. If that's the case, don't increase UNDO_RETENTION live in a panic; if undo usage is tight, an increase can fill the undo tablespace and take the instance down. The correct move is to escalate, preserve archived logs, and plan backup-based recovery.
The second most common failure is a time-zone or clock mismatch. As-of queries interpret timestamps relative to the database environment, and if you were mentally converting local time while the server was in UTC, you can look hours off. Get the server's SYSTIMESTAMP first and base the query on SYSTIMESTAMP - INTERVAL rather than a hard-coded string; it removes the conversion guesswork.
The third is that a later process re-inserted or re-used a related row, so the "missing rows" set isn't clean. Your recovery insert needs a deterministic exclusion join against the current table on the primary key. And before that, if you enabled row movement and let Flashback Table run without checking dependencies, you can lose downstream work even while the deleted rows come back.
Recover the Data You Can Prove Is Missing
A defensible recovery answer for Oracle deleted rows goes in this order: verify the delete was committed and when; test the as-of query and versions query while undo might still exist; extract to a materialized recovery table and validate; reinsert narrowly with a key-based exclusion filter; and only escalate to Flashback Table or backup-based clone-and-recover after the low-risk paths are exhausted. Enabling row movement, running a restore on production, or bulk-replacing table contents are all reversible-looking steps that aren't actually reversible once downstream jobs run, so keep them last and test on a clone.
If your undo window has closed, archived log and backup-based recovery is the realistic route, and it depends entirely on what your environment retained. The questions that decide whether retrieval works are the ones worth answering before you run anything: was this delete, truncate, or drop; when did it commit; how much undo and backup is actually available; and what else has changed since. Once you have those, the technical steps are short, and the recovery is usually more about careful validation than about exotic syntax.