Solved

SQL DB Restore

Posted on 2011-03-22
2
526 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 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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…

740 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