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

Announcing backup and restore improvements for large datasets near the size limit

Enhanced refresh with the Power BI REST API is now generally available

What’s New in SQL Server 2014 since SQL Server 2008 R2