Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL DB Restore

Posted on 2011-03-22
2
Medium Priority
?
532 Views
Last Modified: 2012-05-11
I have 2 databases (SERVICES and SERVICESTEST)

I need to restore the contents of SERVICESTEST into SERVICES.

I have made a backup of SERVICESTEST.BAK and I am trying to restore it over (with Overwrite box checked) and getting an error so I figure that I am doingit wrong.  

Before the restore, I changed the SERVICESTEST.BAK to SERVICES.BAK.

System.Data.SqlClient.SqlError: The file 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\SERVICESTEST.mdf' cannot be overwritten.  It is being used by database 'SERVICESTEST'. (Microsoft.SqlServer.Smo)


I am sure that there is a better way to resolve this.

This is version SQLServer 2008
0
Comment
Question by:yostnet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 2000 total points
ID: 35188062
When overwriting, ensure that the file names you are overwriting are the test database and not the live one. In the options where you tick Overwrite the database, you will see a "Restore As" section in the list. Ensure you're overwriting the correct file. Close all SQL Management Studio windows you have open on that db as well.
0
 

Author Closing Comment

by:yostnet
ID: 35188071
got it thx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Quality of Service (QoS) options are nearly endless when it comes to networks today. This article is merely one example of how it can be handled in a hub-n-spoke design using a 3-tier configuration.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question