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?
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".
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.