Solved

restore db in sql server

Posted on 2015-02-07
6
182 Views
Last Modified: 2015-05-19
I created a db and try to restore from the back up of another db.

i get the error
Restore of the db 'test2' failed. exclusive access could not be obtained.

please help thanks
0
Comment
Question by:TrialUser
[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
6 Comments
 
LVL 34

Accepted Solution

by:
Mike Eghtebas earned 167 total points
ID: 40596283
Are they the same version?
Are you logging as admin?
0
 

Author Comment

by:TrialUser
ID: 40596285
different version  -
yes i am logged in as administrator in sql management studio
0
 
LVL 22

Assisted Solution

by:Steve Wales
Steve Wales earned 167 total points
ID: 40596467
Before trying the restore, do this:

use master
go
alter database test2 set single_user with rollback immediate;

Open in new window

0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 166 total points
ID: 40597481
exclusive access could not be obtained.
It means that you or someone else is connected to the database on that server so you cannot overwrite.

different version  -
You cannot restore a backup from an a newer version pf SQL Server to a an older version of SQL Server.
0
 
LVL 49

Expert Comment

by:Vitor Montalvão
ID: 40598266
If you are trying to restore in the same stand-alone server then you'll see that error because you are trying to overwrite the database files. The solution is to Restore With Move option so you can set a new path for the data and log files. Example:
RESTORE DATABASE Test2 
FROM DISK = 'c:\mssql\backup\Test.bak'  --> replace with the real path and filename
WITH MOVE 'Test_Data' TO 'c:\mssql\data\Test2\Test2_Data.mdf', --> replace with the NEW real path and filename
MOVE 'Test_Log' TO 'c:\mssql\log\Test2\Test2_Log.ldf'  --> replace with the NEW real path and filename

Open in new window

0

Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

756 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