Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running MSSQL Server 2012 RC 0.

I am using the management studio to create a backup of a database, and then restore it on the SAME server, but with a different database name.

I can create the backup fine, but when I go to restore the backup, I enter the new name of the database that I want it to create (which doesnt exist).

I then get an error saying:

"Restore of database 'newdatabasename' failed....... Exclusive access could not be obtained because the database is in use.

I know there is plenty on the internet about this, but it is more geared towards restoring over the SAME database.

Which database is it referring to? The old one? I can't see why it would refer to the old database as I am restoring from a full backup file. The new database isn't even created yet so I also can't see why it would be referring to that one.

Any help appreciated!

share|improve this question
    
When running an experimental release, which is what an RC is, you really need to contact the vendor when you have problems. –  John Gardeniers Apr 26 '12 at 2:37
    
But this is not necessarily a problem with the software- I have a very small amount of knowledge with SQL Server and this is probably a question that would relate to any version –  Lock Apr 26 '12 at 3:43
add comment

closed as too localized by John Gardeniers, mdpc, Scott Pack, Ward, Michael Hampton Dec 8 '12 at 22:15

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

Please execute the following query in SSMS and compare the value of "DatabaseName" column in the output with the database name that you are trying to restore.

RESTORE HEADERONLY FROM DISK = 'path of your backup file"

I doubt that the backup file contains the database backup of some other database which already exists.

share|improve this answer
    
DatabaseName in the output has the same name as the database that I made a copy of. This is NOT the name of the destination database- the destination database does not yet exist. Is this correct? –  Lock Apr 26 '12 at 3:16
add comment

Use T/SQL to restore the database. The GUI for doing restores is annoying at best.

use master
go
RESTORE DATABASE NewDatabaseNAme from disk='D:\Path\To\Backup\File.bak'
with move 'OldDatabaseFile' to 'e:\Path\To\New\NewDatbaseName.mdf',
move 'OldDatabaseLog' to 'e:\Path\To\New\NewDatabaseName_Log.ldf'
GO
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.