# Thursday, July 13, 2006

So have you ever had the need to restore a SQL database because someone hit the delete button on a table or the whole Database? Well, my friend I have seen this happen several times. Here is some code to restore your database back to a certain point in time.

Start Server in single user mode :
sqlservr -m

RESTORE DATABASE YourDB

FROM YourBackUpDevice
  WITH NORECOVERY
GO
 
-- If you have diff backups here is where you can add, since we are using WITH NORECOVERY
-- Remeber to restore them in order :)

RESTORE LOG YourDB
   FROM YourBackUpDevice
   WITH RECOVERY, STOPAT = 'Jul 12, 2006 10:00 AM'   <------- what ever time before the mishap
GO
 
Of course you can do all this fun stuff via the GUI (and have the EM "not responding") but keep it real and use SQL statements in QA; if you really want to keep it real, use osql to run your statements:)
 
Ed K.
AKA
Eddie Kisinger
Edward Kisinger
CodeMonkey
 
posted on Thursday, July 13, 2006 12:20:48 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, July 10, 2006

So this is the other Ed.  Ed B.  The Toy Boy as I am lovingly called.  I suppose I get my nickname because I like new gadgets and gizmos.  I also get my name from the constant search and discovery of new tools and components that make my life (and the rest of our lives) as developers better.

My professional objective in life is to provide more productivity and efficiency to people, developers, and processes.  I won't get all philisophical but I think that is how mankind will prosper :)

Enough of that!  From time to time, I'll add new commentary about new tools that I have found and ones that I use from daily in my developer life and in school.  There are some that I absolutely love more than anything else and just can't live without... some people even think I work for these companies since I am such a proponent! (I don't)

So until later, be more productive and efficient in your development!

Ed B.

posted on Monday, July 10, 2006 11:30:20 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback