Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
smithygreg
Starting Member
37 Posts |
Posted - 2007-06-28 : 17:45:54
|
Hi..I screwed up. I messed up a couple of stored procedures in my database..Luckily, we backed up the database a couple of days ago and I have the .bak files on my hard drive.Is there a way to recreate the database so I can go and grab the stored procedures from the good copy? Backing up and overwriting the thing will make me lose 3 days worth of work which is my last option...Thanks!-Greg |
|
smithygreg
Starting Member
37 Posts |
Posted - 2007-06-28 : 17:46:24
|
Oh Yeah..I am using SQLServer 2005. |
|
|
Haywood
Posting Yak Master
221 Posts |
Posted - 2007-06-28 : 18:09:11
|
Restore the backups to the server as a different database name. Then get your procedures out of the restored db and re-compile them in the 'regular' database. |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-06-29 : 04:27:55
|
As Haywood says, however if your database is in Full Recovery model you can NOW take a TLog backup and then restore the latest FULL backup plus (all) subsequent TLog backup(s) and use the STOP AT command to restore to a date/time just before the accident happened - which may save you some work if there were correct changes to the Sproc after the Full backup but before the Accident!"Luckily, we backed up the database a couple of days ago and I have the .bak files on my hard drive."I recommend that you put a more frequent scheduled backup in place. Taking a Full backup daily and [in your Recovery model is FULL] a TLog backup every 10-15 minutes. There really isn't any reason NOT to do this, and it will save the day for you at some time for sure!If you are doing development work I recommend that you use a Version Control system, rather than just changing the Stored Procedures directly in the database. We use Sub Version which is both Free and Excellent!See also: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=RESTORE+syntax+/+examplehttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=Version+ControlKristen |
|
|
|
|
|