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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore with name change 1

Status
Not open for further replies.

sheila11

Programmer
Dec 27, 2000
251
US
Hi All,

I am new to Database admin work. I have a database by name [TestDB] on my development machine, and am trying to move it to Staging machine. I took its backup, copied it to Staging machine, and ran this command.

RESTORE DATABASE [AcmeDB]
FROM DISK = 'C:\TestDB_4_14.bak'

I notice that the Database gets created by name AcmeDB, but the files in Data folder (C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data) are named TestDB.mdf and TestDB.ldf

Is there a way to get these files named by the new name?

TIA,
Sheila
 
Try
Code:
RESTORE DATABASE  [AcmeDB]
   FROM DISK = 'C:\TestDB_4_14.bak' 
   WITH MOVE 'TestDB_Data' TO C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AcmeDB.mdf',
   MOVE 'TestDB_Log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AcmeDB.ldf';
GO

Though this is based on the Data file and log file logical name being TESTDB_DATA and TESTDB_Log


Have a look at MS site for more help

"I'm living so far beyond my income that we may almost be said to be living apart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top