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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Restoring a .BAK file onto a different server

Author  Topic 

kbmccarthy
Starting Member

6 Posts

Posted - 2007-10-24 : 18:11:02
Hello all,

I have a .BAK file that is a full backup of our production database named variable_prod, from server X. I want to restore it onto a different server, server Y, as database variable_test.

I've copied the .BAK file onto the D:\ of server Y.

When I try to run the following query

RESTORE DATABASE variable_test
FROM DISK = 'D:\database backups\variable_prod*******.BAK'
WITH REPLACE, MOVE 'variable_test_data' TO
'D:\variable_test_data.MDF',
MOVE 'variable_test_log' TO 'D:\variable_test_log.LDF'

It doesn't work. I then ran RESTORE FILELISTONLY
FROM DISK = 'D:\database backups\variable_prod*******.BAK'

And the following was returned (it actually uses Adbase which is not the name of the previous or new database):

Adbase_data | E:\SQLDATA\variable_prod_data.MDF
Adbase_log | F:\SQLLOGS\variable_prod_data.LDF

Unfortunately, server X where variable_prod is, has the E: and F: drives where these files are. However, server Y does not have F: and E: setup this way. Eventually I want the .MDF and .LDF files for server Y to be in the following directory D:\SQLDATA and D:\SQLLOGS



Any help or insights would be greatly appreciated.

Thanks
Adbase_log

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-24 : 18:15:10
MOVE 'Adbase_data' TO 'D:\SQLDATA\Adbase_data.MDF',
MOVE 'Adbase_log' TO 'D:\SQLLOGS\Adbase_log.LDF'


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

kbmccarthy
Starting Member

6 Posts

Posted - 2007-10-24 : 18:29:56
Excellent.

Thanks, that seems so obvious. One more question, do the adbase_data.mdf and adbase_log.ldf files need to exist before running the query?

Thanks again
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-24 : 18:36:13
No. The restore will create them.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-26 : 05:54:43
See also: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=RESTORE%20syntax%20/%20example

Kristen
Go to Top of Page
   

- Advertisement -