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

Can I restore a *.MDF file under a different database? 1

Status
Not open for further replies.

kschut

Technical User
Jun 11, 2002
24
US
I have received a "database.MDF" file which I have to restore on my system. However, there already is a database with that name. Is there any way of restoring this under a different (new) database-name?

KS
 
When you go to attach the database, it gives you the option to "Attach As". Just name it whatever you want it to be and that's what the new name of the database will be. Likewise, if you're doing a restore instead of an attach, you have the option to "Restore As".



Hope This Helps!

Ecobb
- I hate computers!
 
Today I learned that it is actually a 'backup' and not just an mdf-file.

So: I have a backup-file, called oadb.
This belongs to a database which has files like: d:\programme\Microsoft SQL Server\SQL\data\oadb_Data.MDF
And I want to resore it as database my_oadb
such that it has files as:
d:\program files\Microsoft SQL Server\SQL\data\my_oadb_Data.MDF

If I do a restore as "my_database" I get an error stating that the pathname "d:\programme\....\oadb_Data.MDF" may be incorrect.

Yes, it is since that is not where I want to restore it, and that is not the name under which I try to restore.

The database-backup is created on a German-Windows, and I am restoring on an English-Windows ... which has very different path-names. However, apparantely the restore does still depend on the original name and location of the database?
 
You might try checking out the Books OnLine, use the Index tab and enter RESTORE DATABASE, click on the Transact-SQL option and look for the MOVE command. I've never used it, but I think that's what you need.

-SQLBill
 
As it turns out is was very simple: when doing a restore-as or attatch-as, one also can indicate where the physical files will be created: that needs to be in an existing directory. When doing restores under a different-language operating-system, this can be very different-indeed.

Solved, and thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top