Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

DataBase Restore Expand / Collapse
Author
Message
Posted Monday, December 5, 2005 1:10 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 9, 2014 4:22 PM
Points: 19, Visits: 22

Hi,

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:

Master: Full

Model: Full

MSDB: Simple

RSMS: Full

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?

Thanks,

Brian

Post #242039
Posted Monday, December 5, 2005 1:36 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, July 8, 2014 8:11 AM
Points: 3,244, Visits: 529
So you aren't doing the restore on the original system?

Did you copy the tape backup to the same drive location as on the original server (to N'D:\SQL Data Files\RSMS\Backups)? If not, you need to do so. Or use the MOVE option in your restore command. Refer to the BOL for how to use MOVE with RESTORE DATABASE.

-SQLBill



Post #242049
Posted Monday, December 5, 2005 1:40 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, May 30, 2012 8:02 AM
Points: 302, Visits: 294

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'




Post #242052
Posted Monday, December 5, 2005 1:55 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 9, 2014 4:22 PM
Points: 19, Visits: 22

sqlbill,

No I am trying to restore on a test system.  You referred to "BOL", what is "BOL"?

ramses2nd,

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?

Thanks,

Brian

Post #242058
Posted Monday, December 5, 2005 2:02 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 9, 2014 4:22 PM
Points: 19, Visits: 22

Hi,

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 1
File '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 1
RESTORE DATABASE is terminating abnormally.

Any Help?

Post #242061
Posted Monday, December 5, 2005 2:41 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 9, 2014 4:22 PM
Points: 19, Visits: 22
Never Mind.. I got it.. forgot the file name on the move...
Post #242077
Posted Tuesday, December 6, 2005 10:14 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 11:54 PM
Points: 3,198, Visits: 2,297

One point that was missed ... it concerns recovery ...

Databases are in Recovery mode:

  • Master: Full  ---> this should be simple
  • Model: Full----->  it is simple by default
  • MSDB: Simple
  • RSMS: Full

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.





Regards
Rudy Komacsar
Senior Database Administrator

"Ave Caesar! - Morituri te salutamus."
Post #242296
Posted Tuesday, December 6, 2005 11:19 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, October 2, 2013 2:46 PM
Points: 392, Visits: 82
I certaintly agree with Rudy.  Most of my user databases are in full recovery so I have model set to full however I would strongly recommend that you do not put master or msdb in full recovery.
Post #242321
Posted Tuesday, December 6, 2005 11:23 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, June 9, 2014 4:22 PM
Points: 19, Visits: 22

Can you explain to me why it is not recommended?  I hope to understand this, so if you have a few more minutes

Post #242323
Posted Tuesday, December 6, 2005 11:42 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 11:54 PM
Points: 3,198, Visits: 2,297
Modification of recovery modes for the system databases is not recommended nor supported.



Regards
Rudy Komacsar
Senior Database Administrator

"Ave Caesar! - Morituri te salutamus."
Post #242329
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse