Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore a SQL7 database on another server

Status
Not open for further replies.

cxb

Programmer
Jul 9, 2003
14
US
Could anyone tell me how to restore an SQL7 database on another SQL7 server? The backup contains files that need to be restored to drive D, but the destination server uses drive E to host data and log files. The example given in BOL only shows how to move files to a different drive on the same machine... Any advice will be appreciated!
 
Restore Database X
From Disk='C:\myDatabaseBackup.bak'
With Replace,
Move 'LocicalDataFileName' to 'D:\data\PhysicalDataFileName.mdf',
Move 'LocicalLogFileName' to 'D:\data\PhysicalLogFileName.ldf'
 
I copied the backup file to destination server and ran the following script:

Restore Database MAS
From Disk='e:\mssql7\backup\MAS_db_200307060200.BAK'
With Replace,
Move 'MAS_Data.MDF' to 'e:\mssql7\data\MAS_Data.MDF.mdf',
Move 'MAS_Log.LDF' to 'e:\mssql7\data\MAS_Log.LDF.ldf'

(e drive is the drive on destination server.)

I got the following error message:
"Server: Msg 3234, Level 16, State 2, Line 1
File 'MAS_Data.MDF' is not a database file for database 'MAS'.
Server: Msg 3013, Level 16, State 1, Line 1
Backup or restore operation terminating abnormally."

Should I copy the .mdf and .ldf files to the destination server first before I run the script? Thanks!
 
Your problem is highlighted in RED

Move [red]'MAS_Data.MDF'[/red] to 'e:\mssql7\data\MAS_Data.MDF.mdf',
Move [red]'MAS_Log.LDF'[/red] to 'e:\mssql7\data\MAS_Log.LDF.ldf'

What the program is expeciting is the logical name you gave to the data file when you set it up..

My guess is MAS_Data and MAS_Log should be substituted for the red values..

You can check this out for sure by running a query on the sysfiles1 table in the Local (original) database of the server you are transfering the database from..

The query could look something like
SELECT Name FROM MAS.dbo.sysfiles1

 
Thank you so much for your tip! It worked and the process was done in 9 seconds! Again, thanks a million!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top