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

Restoring DB with a new name

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
 
Detach the database, rename the files and then attach the database.

If you do the attach via Enterprise Manager it's going to remember the old files names so you will have change them manually to whatever you renamed them to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top