Wael Awada
Wael Awada

Reputation: 1526

Restore a database using SQL Server 2005

I have backed up a database into a file using SQL Server from my old server.

Now i would like to restore that file into a new database on my new server.

I created a DB with the same name , I am getting an error saying :

"The Backup set holds a backup of the database other than the existing '*****' database"

Any thoughts?

Thanks

Upvotes: 1

Views: 214

Answers (4)

user2520280
user2520280

Reputation: 1

I was having the same issue, but even when putting WITH REPLACE, the error occurred. I had an empty database with the same name as the back up, but the problem was my .trn file I was using to backup from had two backup sets and I was choosing to restore from the full database AND the transaction log. I chose only the Full Database and it worked.

Upvotes: 0

Remus Rusanu
Remus Rusanu

Reputation: 294437

Add a WITH REPLACE option to your restore:

Specifies that SQL Server should create the specified database and its related files even if another database already exists with the same name

Upvotes: 4

Philip Kelley
Philip Kelley

Reputation: 40359

When you restore a database from backup, you are creating a new database on the SQL instance. If a database by that name is already present on that SQL instance, you will get an error--unless you select the option to overwrite any existing database, in which case the old database will be wiped out and replaced.

Upvotes: 0

Jason Williams
Jason Williams

Reputation: 57952

Drop the new database - it's sitting in the way of the one you want to restore.

THen when you try to restore your old database, select the file to restore from, and the name will magically appear in the "to database" destination field in SSMS.

Upvotes: 1

Related Questions