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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 restoring backups to SSMS on my local machine

Author  Topic 

cseward
Starting Member

24 Posts

Posted - 2011-12-02 : 07:40:12
I figured out how to do this yesterday. I want to restore a new backup each day. What do I do with the database that is currently restored ? If I restore a different one today - will it just overwrite what is there ?

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-12-02 : 07:46:36
Yes - if you speciy replace in the restore. Otherwise you need to give a different dtabase name and specify a different file location.
Note - it will not restore if there are any connections to the database.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-02 : 07:49:32
yep.. if you restore it under same name, it will replace the existing db present in local server

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

cseward
Starting Member

24 Posts

Posted - 2011-12-02 : 08:43:49
Thanks for the reply - that worked.
I wonder if much of this could be automated with SQL server agent. I don't know much about the agent - just started to read about it.
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-12-02 : 08:57:49
Yes. You can just put tyhe restore command as a step in a scheduled job. I usually have an SP to which is passed the variables - but that's because I usually have to automate the backup transfer and restore and clearing up files and alerting.
Again it will fail if there are any connections to the database.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -