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 Development (2000)
 How to change the physical filename of .mdf

Author  Topic 

reddymade
Posting Yak Master

165 Posts

Posted - 2006-06-27 : 12:47:49
i have the following file: ccsnet_Data.MDF

which is same for qa server and also for dev server.

Now the problem is we want to put both the files on the same sql server.

Actual database name is ccsnet.

may be i can change the name of the database to ccsnetQA ,

How can i change the .mdf file from ccsnet_data.mdf to ccsnetQA_data.mdf

Please help.

Thank you very much for the information.

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-06-27 : 13:07:08
You can restore with move option. (see restore database in bol).
If you are attaching the database you can put the QA files in another folder as a workaround.

rockmoose
Go to Top of Page

reddymade
Posting Yak Master

165 Posts

Posted - 2006-06-27 : 13:18:28
Hello RockMoose,
I did that but its the physical file name which is same ccsnet_data.mdf, even though i renamed it to a different name but still it is picking up that name from somewhere. may be under master db, but i don't know, how to change a database physical filename after it is created with this name ccsnet_data.mdf

Thank you very much.
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-06-27 : 13:53:05
It should work, sample restore command:

restore database ccsnetQA from disk = 'D:\MSSQL\Backup\ccsnet.bak' -- restore backup of ccsnet as ccsnetQA
with
move 'ccsnet_data' to 'D:\MSSQL\Data\ccsnetQA.mdf' -- rename the data & logfiles as you restore
,move 'ccsnet_log' to 'D:\MSSQL\Data\ccsnetQA_log.ldf'



rockmoose
Go to Top of Page
   

- Advertisement -