I have a database that I backup each day as a scheduled job the syntax is as follows:
BACKUP DATABASE [master] TO DISK = N'D:\SQL Data Files\RSMS\Backups\Master.bak' WITH INIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
BACKUP DATABASE [msdb] TO DISK = N'D:\SQL Data Files\RSMS\Backups\msdb.bak' WITH INIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
BACKUP DATABASE [model] TO DISK = N'D:\SQL Data Files\RSMS\Backups\model.bak' WITH INIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
BACKUP DATABASE [rsms] TO DISK = N'D:\SQL Data Files\RSMS\Backups\RSMS.bak' WITH INIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT
BACKUP LOG [RSMS] TO DISK = N'D:\SQL Data Files\RSMS\Backups\RSMS.TRN' WITH INIT
Databases are in Recovery mode:
Then later on that night, the IS department does a online tape backup of the drives.
I created a test system and want to restore my databases. I keep coming up with errors. It says I need to "Move" the files, but then I try to attach and it gives me an invalid database file? What is the proper way to do this?
A with Move error usually means that the database restore is trying to put the data and log file in the same location as the server that it was backed up from. For example, on one server we store our data files on the root of E:\ on another server they are stored at d:\data\. If I try to restore a backup from the first server to the second it will try to put the files at E:\. If that location does not exist then I will get an error telling me to use the with move clause. The syntax I use is as follows:
RESTORE DATABASE [dbname] FROM DISK = 'path to backup file'
WITH FILE = 1, NOUNLOAD , STATS = 10, RECOVERY , REPLACE ,
MOVE 'nameofdatafile' TO 'new physical location of the data file',
MOVE 'nameoflogfile' TO 'new physical location of the log file'
No I am trying to restore on a test system. You referred to "BOL", what is "BOL"?
I will try that. And I should restore each file like that, with the exception of the log file "restore log". and I should do that last?
when I run this scrip I get the error that is included..
RESTORE DATABASE [RSMS] FROM DISK = 'C:\Temp\RS_Server Backups\rsms.bak' WITH FILE = 1, NOUNLOAD , STATS = 10, RECOVERY , REPLACE , MOVE 'RSC_DATA' TO 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\', MOVE 'RSC_LOG' TO 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\'
Server: Msg 3176, Level 16, State 1, Line 1File 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\' is claimed by 'Rsc_Log'(2) and 'Rsc_Data'(1). The WITH MOVE clause can be used to relocate one or more files.Server: Msg 3013, Level 16, State 1, Line 1RESTORE DATABASE is terminating abnormally.
One point that was missed ... it concerns recovery ...
Modification of recovery modes for the system databases is not recommended nor supported. The one exception is the model database. However changing the recovery mode of the master database is definitely a no-no.
Can you explain to me why it is not recommended? I hope to understand this, so if you have a few more minutes