When I was tried to restore the database but the restore of database is failed and showing the following error message.
ERROR MESSAGE:
TITLE: Microsoft SQL Server Management StudioAfter Clicking the show details button It shows the bellow message,
------------------------------
Restore of database 'ShoppingZone' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)
------------------------------
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: File "ShoppingZone" cannot be restored over the existing "C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\DATA\ShoppingZone.mdf". Reissue the RESTORE statement using WITH REPLACE to overwrite pre-existing files, or WITH MOVE to identify an alternate location. (Microsoft.SqlServer.SmoExtended)
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=16.100.46437.65+(SMO-master-A)&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
Restore of database 'ShoppingZone' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)SOLUTION:
------------------------------
Program Location:
at Microsoft.SqlServer.Management.RelationalEngineTasks.RestoreDatabaseTaskFormComponent.PerformTask(ITaskExecutionContext context)
at Microsoft.SqlServer.Management.RelationalEngineTasks.RestoreDatabaseTaskFormComponent.Perform(ITaskExecutionContext context)
at Microsoft.SqlServer.Management.TaskForms.TaskExecutionManager.ExecuteTaskSequence(ISfcScriptCollector collector)
===================================
System.Data.SqlClient.SqlError: File "ShoppingZone" cannot be restored over the existing "C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\DATA\ShoppingZone.mdf". Reissue the RESTORE statement using WITH REPLACE to overwrite pre-existing files, or WITH MOVE to identify an alternate location. (Microsoft.SqlServer.SmoExtended)
------------------------------
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=16.100.46437.65+(SMO-master-A)&LinkId=20476
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Smo.RestorePlan.Execute()
at Microsoft.SqlServer.Management.RelationalEngineTasks.RestoreDatabaseTaskFormComponent.PerformTask(ITaskExecutionContext context)
Go to the following location:
"C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\DATA\"
Search for the database.mdf file and change the database name.
Right-click on the "Databases" node in the Object Explorer and select "Restore Database..."
In the "General" section, select the source file. You can choose to restore from a disk.
Click the "OK" button to start the restore process.