question

jctronicsshiva avatar image
jctronicsshiva asked

T-sql restore and transactions

i have seen a restore DB technique explained in this link. http://stackoverflow.com/questions/2510295/fully-automated-sql-server-restore/2510790#2510790 But the question is don't we need transactions here? is this a good practise? if we need transactions where do we put it? is it inside the stored proc or from the code where we are going to call this?
sql-server-2008t-sqldatabaserestoretransaction
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Grant Fritchey avatar image
Grant Fritchey answered
That is a way to automate a full database restore based only on the backup file. It doesn't cover transaction log restores at all. Further, based on this approach, you would have to substantially rewrite it in order to support log restores. Also, I'm not a fan of killing connections on a database in an automated fashion. Doing that you could easily run this against a production server by accident. I don't currently have an automated script for restoring logs. [Here's an article][1] that lays out one on SQL Server Central that looks pretty good. It includes log restores and point in time recovery. [1]: http://www.sqlservercentral.com/articles/Restore+database/95839/
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.