views:

655

answers:

5

Is there any way to undelete a SQL server database and stored procedures?

Edit:

No I don't have a backup. That is the reason I need help

+8  A: 

Restore from backup.

You do have a backup, right?

Edit: I'm assuming you probably did a right-click, "Delete" from SQL Management Studio? If so, that actually does a "drop" of the database, which literally removes the files from the hard drive. If this is the case, you'll have to restore from your latest backup (if you have one).

If you just did a "detach", then the MDF and LDF files are still on the hard drive, and you can simply attach them.

BradC
Nothing like that sinking feeling when you drop a production database.Anyway, if you had a backup, in SSMS, right click on the server, and hit restore. Find the bak file, name the database, and away you go.
Eric
You could get SUPER lucky and have a Shadow copy, ( right click on folder, and chooser previous versions ). But the UI is a bit hockey in XP/2003, ( can only see it through a network share ), and I know I tend to shut shadow copy off on SQL to cut back on the IO.
Russ
A: 

Ctrl-Z fixes everything.

If that doesn't work, try Alt-F4 or Ctrl-Alt-Delete.

TheSoftwareJedi
Don't forget your <sarcasm> tag for the humor impaired.
BradC
@BradC nah, I don't mind the downvotes. Glad you giggled.
TheSoftwareJedi
don't you know? downvotes are a badge of honor! :)
BradC
+2  A: 

How exactly have you deleted it.

If you haven't made any changes to you disks file system since then (and not defraged) then its possible the file will still be sitting on the disk as windows doesn't delete the file completely, just the File Handle.

Have a look at something like this and you may be able to recover the .mdf/.ldf files from your HD.

http://www.undelete.com/file-recovery.aspx

If not, you'll have to restore from your last back.

And if you don't have a backup... you're screwed.

Eoin Campbell
A: 

Did you drop the database or detach it ? If you've detached it then just reattach it again from the mdf and ldf files.

Vixen
+1  A: 

On of the best file recovery tools is ZAR. Last week, I could recover 95% of a damaged HD.

fbinder