How To Recover a Dropped Table?
SQL tutorial | Interview questions | Oracle :: Interview questions :: Oracle DBA Interview questions
Page 1 of 1
How To Recover a Dropped Table?
If you accidentally dropped a table, can you recover it back? The answer is yes, if you have the
recycle bin feature turned on. You can use the FLASHBACK TABLE ... TO BEFORE DROP
statement to recover a dropped table from the recycle bin as shown in the following SQL script:
SQL> CREATE TABLE emp_dept_90
2 AS SELECT * FROM employees WHERE department_id=90;
Table created.
SQL> SELECT COUNT(*) FROM emp_dept_90;
COUNT(*)
----------
3
SQL> DROP TABLE emp_dept_90;
Table dropped.
SQL> FLASHBACK TABLE emp_dept_90 TO BEFORE DROP RENAME TO emp_dept_bck;
Flashback complete.
SQL> SELECT COUNT(*) FROM emp_dept_bck;
COUNT(*)
----------
3
The FLASHBASK statement in this script recovered the dropped table "emp_dept_90" to new
name "emp_dept_bck". All the data rows are recovered nicely.
recycle bin feature turned on. You can use the FLASHBACK TABLE ... TO BEFORE DROP
statement to recover a dropped table from the recycle bin as shown in the following SQL script:
SQL> CREATE TABLE emp_dept_90
2 AS SELECT * FROM employees WHERE department_id=90;
Table created.
SQL> SELECT COUNT(*) FROM emp_dept_90;
COUNT(*)
----------
3
SQL> DROP TABLE emp_dept_90;
Table dropped.
SQL> FLASHBACK TABLE emp_dept_90 TO BEFORE DROP RENAME TO emp_dept_bck;
Flashback complete.
SQL> SELECT COUNT(*) FROM emp_dept_bck;
COUNT(*)
----------
3
The FLASHBASK statement in this script recovered the dropped table "emp_dept_90" to new
name "emp_dept_bck". All the data rows are recovered nicely.
Similar topics
» How To Recover a Dropped Index?
» How To Create a New Table by Selecting Rows from Another Table?
» What Is a Table Index?
» How To View the Dropped Tables in Your Recycle Bin?
» What Is a Database Table?
» How To Create a New Table by Selecting Rows from Another Table?
» What Is a Table Index?
» How To View the Dropped Tables in Your Recycle Bin?
» What Is a Database Table?
SQL tutorial | Interview questions | Oracle :: Interview questions :: Oracle DBA Interview questions
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Sun Jan 31, 2010 12:35 am by Micheal
» Accessing tables of other users in SQL
Sun Jan 31, 2010 12:34 am by Micheal
» Grouping commands in SQL
Sun Jan 31, 2010 12:32 am by Micheal
» Operations on Result Sets in SQL
Sun Jan 31, 2010 12:31 am by Micheal
» Subqueries in SQL
Sun Jan 31, 2010 12:30 am by Micheal
» Joining Relations in SQL
Sun Jan 31, 2010 12:28 am by Micheal
» Delete comand in SQL
Sun Jan 31, 2010 12:27 am by Micheal
» Update command in SQL
Sun Jan 31, 2010 12:26 am by Micheal
» Insert command in SQL
Sun Jan 31, 2010 12:23 am by Micheal