Restore failed for Server 'Server_Name'

TITLE: Microsoft SQL Server Management Studio
------------------------------
Restore failed for Server 'Server_Name'.  (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: File "DataBase_Name" cannot be restored over the existing "D:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DataBase_Name.mdf". Reissue the RESTORE statement using WITH REPLACE to overwrite pre-existing files, or WITH MOVE to identify an alternate location. (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
------------------------------

Solution:

RESTORE DATABASE [DataBase_Name] FROM  DISK = N'D:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\Backup\DataBase_Name.bak'
WITH  FILE = 1,  MOVE N'DataBase_Name' TO N'D:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DataBase_Name.mdf', 
MOVE N'DataBase_Name_log' TO N'D:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DataBase_Name_1.ldf', 
NOUNLOAD,  REPLACE,  STATS = 5
GO

or
1. Go to bellow path
D:\MSSQL\MSSQL10_50.MSSQLSERVER\MSSQL\DATA
2. Delete existing database
3. Restore once again

Comments

Post a Comment

Popular posts from this blog

Failed to execute the package or element. Build errors were encountered

Restore of database 'DataBase_Name' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)

On-premises data gateway December release