Solved

SQL DB Restore

Posted on 2011-03-22
2
525 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
2 Comments
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In the hope of saving someone else's sanity... About a year ago we bought a Cisco 1921 router with two ADSL/VDSL EHWIC cards to load balance local network traffic over the two broadband lines we have, but we couldn't get the routing to work consi…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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…

839 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