Sql Server Database Restore

Hi all

I created a backup of an exixting database in sql server i then created a new seperate database, because i wanted to restore the backup onto the new database so i could compare a few things.

When i try to restore i get an error message saying

TITLE: Microsoft SQL Server Management Studio
------------------------------

Restore failed for Server 'Sharepoint'.  (Microsoft.SqlServer.SmoExtended)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: The file 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\DB_Opera_Copy_Data.mdf' cannot be overwritten.  It is being used by database 'DB_Opera_Copy'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------
can anybody assist me with this.

Thanks
pepps11976Asked:
Who is Participating?
 
EvilPostItConnect With a Mentor Commented:
If your doing this in management studio, go to the options tab and change the filename of the DB_Opera_Copy_Data.mdf file.

If you doing this using a RESTORE command use WITH MOVE to change the file location.
0
 
EvilPostItCommented:
System.Data.SqlClient.SqlError: The file 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\DB_Opera_Copy_Data.mdf' cannot be overwritten.  It is being used by database 'DB_Opera_Copy'.

Your trying to use a datafile with the same physical name as a database that already exists.
0
 
pepps11976Author Commented:
Ok i can see that now so what would be the easiest way to acheive what i am trying to do?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.