I did a backup of a SQL2000 database (named Winstis) using the 2005 management studio. I then created a blank database on my 2005 instance (named Winstis). I then tried to do a database restore to the new 2005 database. I got an error:
System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'Winstis' database. (Microsoft.SqlServer.Smo)
I even tried the option to Overwrite Existing database and I got a different error:
System.Data.SqlClient.SqlError: The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'D:\Program Files\Microsoft SQL Server\MSSQL\Data\test.ldf'. (Microsoft.SqlServer.Smo)
Also the 2005 instance database is on C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Winstis_Data.mdf
and the 2000 instance is on
D:\Program Files\Microsoft SQL Server\MSSQL\Data\Winstis_Data.mdf
How can I accomplish getting the database from 2000 to 2005 with all tables, store procedures, and functions?you can restore from a 2000 backup to a 2005 server, but only if the db you are restoring to doesn't exist on the 2005 server at restore time.
so delete the winstis db on your 2005 instance then restore from the bak, should work ok then.|||Hi Jezemine,
I actually tried it that way as well. I finally got an answer from another forum. The key was using the move options on the RESTORE.
Thanks though.
Showing posts with label named. Show all posts
Showing posts with label named. Show all posts
Wednesday, March 7, 2012
Saturday, February 25, 2012
Restoring DB problem HELP!
Hello guys.
Here is my problem i had a DB on my SQL Server 2005 Named PROTE the DB got deleted by some developer i do not have the .BK file anymore and my MDF and LDF as moved to a new location eg: PROTE MDF & LDF where on the drive D: and now PROTE.MDF is in a folder like D:\DATA MDF and PROTE.LDF is in a folder like D:\DATA LDF.
How do i restore please help.you might be able to do a sp_attach_db.|||thanks that worked|||you might be able to do a sp_attach_db.
You are my hero|||why? because I can answer a simple admin question? Or are you already into your 5 o'clock happy hour?|||Or are you already into your 5 o'clock happy hour?
===========> eye
Lunch was good
Here is my problem i had a DB on my SQL Server 2005 Named PROTE the DB got deleted by some developer i do not have the .BK file anymore and my MDF and LDF as moved to a new location eg: PROTE MDF & LDF where on the drive D: and now PROTE.MDF is in a folder like D:\DATA MDF and PROTE.LDF is in a folder like D:\DATA LDF.
How do i restore please help.you might be able to do a sp_attach_db.|||thanks that worked|||you might be able to do a sp_attach_db.
You are my hero|||why? because I can answer a simple admin question? Or are you already into your 5 o'clock happy hour?|||Or are you already into your 5 o'clock happy hour?
===========> eye
Lunch was good
Tuesday, February 21, 2012
Restoring Database in TSQL
Hi. I want to restore a database named Employee Training but when I restore it, I want to name it Training. I know to to restore it in TSQL I type
"RESTORE DATABASE Employee Training To (name of device). How do I rename it to Training? I'd appreciate any help. Thanks.Have you looked in BOL (books online)? There is an example under RESTORE DATABASE - How to restore a database with a new name (Transact-SQL) that restores a copy of an existing database to another database with a new name.
I refer you here because you have to use the with move parameter to rename your physical mdf and ldf (and maybe ndf) files. If you have any more questions after you have read this, ask again.|||Restore the database first then rename it.|||I think then the question would have been "How do I rename a database?"|||Just give it the New name in the RESTORE command?
RESTORE myNewDBName ...|||Which is true and I referred to in post #2 with the BOL article and example cited, since they will have to move the physical filenames to a new file name for the restored database!
Lindalog, are you getting anything out of this?|||Which is true and I referred to in post #2 with the BOL article and example cited, since they will have to move the physical filenames to a new file name for the restored database!
Lindalog, are you getting anything out of this?
I'm getting it, you're right about having to move the physical filenames. Thanks for your help|||Thanks everybody. Tom53, I went to BOL and found exactly what I needed. Thanks alot. You saved me from hours of frustration. I'm sure that I'll be posting another question soon. Take care.
"RESTORE DATABASE Employee Training To (name of device). How do I rename it to Training? I'd appreciate any help. Thanks.Have you looked in BOL (books online)? There is an example under RESTORE DATABASE - How to restore a database with a new name (Transact-SQL) that restores a copy of an existing database to another database with a new name.
I refer you here because you have to use the with move parameter to rename your physical mdf and ldf (and maybe ndf) files. If you have any more questions after you have read this, ask again.|||Restore the database first then rename it.|||I think then the question would have been "How do I rename a database?"|||Just give it the New name in the RESTORE command?
RESTORE myNewDBName ...|||Which is true and I referred to in post #2 with the BOL article and example cited, since they will have to move the physical filenames to a new file name for the restored database!
Lindalog, are you getting anything out of this?|||Which is true and I referred to in post #2 with the BOL article and example cited, since they will have to move the physical filenames to a new file name for the restored database!
Lindalog, are you getting anything out of this?
I'm getting it, you're right about having to move the physical filenames. Thanks for your help|||Thanks everybody. Tom53, I went to BOL and found exactly what I needed. Thanks alot. You saved me from hours of frustration. I'm sure that I'll be posting another question soon. Take care.
Subscribe to:
Posts (Atom)