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 2008 Forums
 SQL Server Administration (2008)
 Copying database to another instance

Author  Topic 

Jerry444
Starting Member

5 Posts

Posted - 2012-03-28 : 14:06:50
I created a .BAK file for a database and tried to restore it to another instance on the same server.

When I do the restore it says that it is still connected to the .MDF file from the original database.

Can someone tell me how to resolve this?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-03-28 : 14:16:14
You would need to use the WITH MOVE option of the RESTORE command. If you aren't comfortable with the command, then you would do this on the Options page of the Restore GUI.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Jerry444
Starting Member

5 Posts

Posted - 2012-03-28 : 16:00:41
Tara,

Thanks for the reply.

On the options page of the Restore GUI I don't see anything referring to the "WITH MOVE" option.

No matter what I check on the options page I still get this error:

The process cannot access the file because it is being used by another process ... C:\ ... dbname.mdf

Also, I tried using the copy function but doesn't work because there is a database role on the database. The copy function works fine on other databases and I don't ususally have a problem with restoring databases from backups.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-03-28 : 16:12:04
The copy function is horrible. It doesn't give you an exact copy. Backup/Restore does and is best for this.

On the Options page, you need to modify the file names and/or path in the Restore As fields. You need to specify new names here as the restore is trying to reuse the names from the source database, which are already on your server.



Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Jerry444
Starting Member

5 Posts

Posted - 2012-03-28 : 16:40:49
OK, That worked! Thanks very much.

If you have time, could you enlighten me on things the copy function leaves out.

Thanks again.
Go to Top of Page
   

- Advertisement -