I have a .bak
file, and I want to use this file to recreate the database in a fresh install of SQL Server 2008 Management Studio.
Can someone point me in the right direction on how this can be done?
I have tried:
right click on the Databases container within object explorer
from context menu select Restore database
Specify To Database as either a new or existing database
Specify Source for restore as from device
Select Backup media as File
Click the Add button and browse to the location of the BAK file
but I am getting error that
Restore failed for Server 'MyServer-PC'. (Microsoft.SqlServer.SmoExtended)
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'invent' database. (Microsoft.SqlServer.Smo)
read this link it show Step by step : Restore DataBase
1- Click Start, select All Programs, click Microsoft SQL Server 2008 and select SQL Server Management Studio. This will bring up the Connect to Server dialog box. Ensure that the Server name YourServerName and that Authentication is set to Windows Authentication. Click Connect.
2- On the right, right-click Databases and select Restore Database. This will bring up the Restore Database window.
3- On the Restore Database screen, select the From Device radio button and click the … box. This will bring up the Specify Backup screen.
4- On the Specify Backup screen, click Add. This will bring up the Locate Backup File.
5- Select the DBBackup folder and chose your BackUp File.
6- On the Restore Database screen, under Select the backup sets to restore: place a check in the Restore box, next to your data and in the drop-down next to To database: select DbName.
7- Ok your done.
Restoring a Database from Backup
I had the same error. What worked for me is when you go for the SMSS GUI option, look at General, Files in Options settings. After I did that (replace DB, set location) all went well.
To do this via TSQL (ssms query window or sqlcmd.exe) just run:
To do it via GUI - open SSMS, right click on Databases and follow the steps below
Using management studio the procedure can be done as follows
refer
You'll need to specify the WITH REPLACE option to overwrite the existing adventure_second database with a backup taken from a different database.
Click option menu and tick Overwrite the existing database(With replace)
Reference