x

Can we restore a dropped table after a new table with the same name has been created?

Anyone knows can we restore a database table which was deleted if we have a new table created with the same name. If possible how to do this ? is there any special syntax for this ? Thanks in advance.

more ▼

asked Dec 22 '09 at 12:52 PM in Default

OraLearner gravatar image

OraLearner
1.3k 69 85 88

(comments are locked)
10|1200 characters needed characters left

3 answers: sort voted first

If your database has the RECYCLEBIN option enabled, you can easily restore a dropped table. Try the following command in SQL*Plus:

show recyclebin;

If you have the recyclebin enabled, you will see the dropped tables with their original name and their recyclebin name (starts with BIN$).

You can then query the dropped table with normal SQL (but you may need to quote the name):

SELECT * FROM "BIN$<restofname>"

You can also restore it (and optionally rename it) with:

FLASHBACK TABLE <originalTableName> TO BEFORE DROP;

or

FLASHBACK TABLE <originalTableName> TO BEFORE DROP RENAME TO <newTableName>; 
more ▼

answered Dec 22 '09 at 01:01 PM

Andrew Mobbs gravatar image

Andrew Mobbs
1.5k 1 3

Excellent..its working for me. Thank you for your quick reply.
Dec 22 '09 at 01:09 PM OraLearner
"show recyclebin;" yields "SHOW is not supported." How does one enable support for SHOW?
Jan 22 '10 at 05:44 PM KillerDBA
@KillerDBA Are you using the command line SQL*Plus or another tool (e.g. iSQLPlus or SQL Developer)? As far as I know, "show" is a built-in command for SQL*Plus, so should just work.
Jan 26 '10 at 05:48 AM Andrew Mobbs
(comments are locked)
10|1200 characters needed characters left

Please refer the answer posted by 'Andrew Mobbs' which is working like gem.

more ▼

answered Dec 22 '09 at 01:10 PM

OraLearner gravatar image

OraLearner
1.3k 69 85 88

(comments are locked)
10|1200 characters needed characters left
is it working for SQL also? if it is not usefull for sql then tell me the solution for sql
more ▼

answered Jun 19 '12 at 06:36 AM

krishnaReddy gravatar image

krishnaReddy
0 1

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x375
x362
x235
x20

asked: Dec 22 '09 at 12:52 PM

Seen: 2160 times

Last Updated: Jun 19 '12 at 06:37 AM