Last post Sep 23, 2009 01:32 PM by ps2goat
Sep 23, 2009 12:59 PM|AppDevForMe|LINK
I have a database named Elsie which exists on my production server and on my development server.
On my production server I backed up Elsie and named it Josie (Right click then --> Task|Backup)
I then transfered Josie to my development server where I would like to restore it
with a entirely new database named Josie. (Even though Elsie still exists on that SQL server)
When I tried to restore Josie as a new database, on the secondary server I get the following error message:
Restore failed for Server 'ServerName'
System.Data.SqlClient.SqlError: The file 'F:\Data\Elsie_Data.MDF' cannot be overwritten. It is being used
by database 'Elsie'
Did I do my backup properly? How come Elsie_Data.MDF was not renamed to Josie_Data.MDF ?
Sep 23, 2009 01:32 PM|watana72|LINK
When restoring, go to Options change the restore as paths for the mdf and ldf files tp Josie_Data.MDF and Josie_Log.LDF respectively
Sep 23, 2009 01:32 PM|ps2goat|LINK
When restoring, select your backup file. Next, click 'Options' in the left pane (SQL Server 2005's management studio). In the right side, you will now see 'Restore options' (Check "Overwrite the existing database") and "Restore the database as:". The
latter is the important part.
There are two columns in the "Restore the database as:" section. The left side is the original name of the files, and the right side is what you want to change the names of the files to.
Changing the name of the backup file does NOT change the name of the original .mdf and .ldf files.
In the right column, scroll all the way to the right to see the file name, and change it to your new preferred name: Josie.mdf for the primary file and Josie.ldf for the log file.
The actual names you give to the files do not have to have anything to do with the database name, but should so that you can easily reference them if backing up or physically moving/copying files.