Skip navigation

SQLServer 2016

Right-click on the database you want to overwrite and choose tasks/restore/database:

 

In the “source” part of the “general” page, fetch your .dat file:

 

 

In order to see it, make sure you select “All files”:

 

 

You can see the contents of your .dat file by clicking on “Contents”:

Make sure the “Type” column says Database and the “Component” column says full.

 

Go to the options page: uncheck “Take tail-log backup…” and check "... WITH REPLACE" and "close existing connections...":

 

 

Back to the “General” page, click on Verify Backup Media.

You should get “Backup media verified successfully” at the top.

 

Go to the “Files” page, check “relocate files to folder” and enter the paths to the mdf and ldf files of your target database in Restore As:

 

 

Then click on OK at the bottom.  A green progress bar show the progress of the restoration:

Which should finish with:

Clicking on OK will close the restore wizard.

 

All of this can also be carried out with this T-SQL command:

RESTORE DATABASE gestiondossier

FROM disk = N'E:\temp\gestiondossier_201909080100_1.dat'

WITH replace,

MOVE 'gestiondossier' TO 'F:\MSSQL2016\MSSQL13.INSTP00\MSSQL\DATA\gestiondossier.mdf',

MOVE 'gestiondossier_log' TO 'G:\MSSQL2016\MSSQL13.INSTP00\MSSQL\LOG\gestiondossier.ldf',

   stats = 5

GO