Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I restore from .BAK file without any other
Message
General information
Forum:
Microsoft SQL Server
Category:
Backups
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01436834
Message ID:
01436857
Views:
33
>I think I understand where the error is coming from. SSMS is trying to restore the database from the .BAK file into the file "C:\Program Files\Microsoft SQL Server\MSSQL\Data\NameofDatabase.mdf". But file "C:\Program Files\Microsoft SQL Server\MSSQL\Data\NameofDatabase.mdf" does not exist; hence the error that "The System cannot find the path specified". So I will have to go to your 1st suggestion and create the database first. But the idea of doing it on-the-fly was interesting.
>
>Update: I tried to create an empty database in the SQL Server with the same name as the database in the .BAK file. Then tried to restore from the .BAK into this database but still I get error. The error now says
>
>The backup set holds a backup of a database other than the existing 
>'NameofDatabase' database.
>
>
>I think this error means that the existing database that I just created is not matching to the database in the .BAK file. I know that but don't know how to get around it.



That is normal. Nobody could know what is the real file name of the database (the author is excluded).
if you just use:
CREATE DATABASE SomeName
SQL Server could created whatever file name it wants (starting with SomeName) and I am not sure from file naming depends (and don't care). If you want to have a a file name of DB to be the same as DB you should use FILE NAME hint in create database command.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform