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, 2009 at 12:52 PM in Default

avatar image

OraLearner
1.3k 82 88 92

(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, 2009 at 01:01 PM

avatar image

Andrew Mobbs
1.6k 3 5

Excellent..its working for me. Thank you for your quick reply.

Dec 22, 2009 at 01:09 PM OraLearner

"show recyclebin;" yields "SHOW is not supported." How does one enable support for SHOW?

Jan 22, 2010 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, 2010 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, 2009 at 01:10 PM

avatar image

OraLearner
1.3k 82 88 92

(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, 2012 at 06:36 AM

avatar 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.

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:

x425
x424
x273
x27

asked: Dec 22, 2009 at 12:52 PM

Seen: 2794 times

Last Updated: Jun 19, 2012 at 06:37 AM

Copyright 2016 Redgate Software. Privacy Policy