Solved

restore db in sql server

Posted on 2015-02-07
6
171 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
6 Comments
 
LVL 33

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 45

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In this article I will describe the Backup & Restore 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.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now