Symptoms
Process of restoring the site from the backup failed with the error:
PLESK_ERROR: Msg 5133, Level 16, State 1, Line 94
Directory lookup for the file “C:Program Files (x86)ParallelsPleskDatabasesMSSQLMSSQL10_50.MSSQLSERVERMSSQLDATAexample.mdf” failed with the operating system error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 94
File ‘exfile’ cannot be restored to ‘C:Program Files (x86)ParallelsPleskDatabasesMSSQLMSSQL10_50.MSSQLSERVERMSSQLDATAexample.mdf’. Use WITH MOVE to identify a valid location for the file.
Msg 5133, Level 16, State 1, Line 94
Directory lookup for the file “C:Program Files (x86)ParallelsPleskDatabasesMSSQLMSSQL10_50.MSSQLSERVERMSSQLDATAexample.ldf” failed with the operating system error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 94
File ‘exfile_log’ cannot be restored to ‘C:Program Files (x86)ParallelsPleskDatabasesMSSQLMSSQL10_50.MSSQLSERVERMSSQLDATAexample.ldf’. Use WITH MOVE to identify a valid location for the file.
Cause
MS SQL data directory inside *.bak files is different from actual MS SQL server settings.
Resolution
-
Connect to the server via RDP
-
Restore configuration files from the dumps which placed in the directory C:Program Files (x86)ParallelsPleskDatabasesMSSQLMSSQL10_50.MSSQLSERVERMSSQLDATA
-
Navigate to C:Program Files (x86)ParallelsPleskDatabasesMSSQLMSSQL10_50.MSSQLSERVERMSSQLDATA
-
Copy all files to the correct destination folder with new SQL installation (for example E:MSSQLMSSQL10_50.MSSQLSERVERMSSQLDATA)
-
-
Assign full permissions on destination folder to account SQLServerMSSQLUser$ComputerName$InstanceName as below:
Â
Additional information
Stack Overflow: Restore Database and change the location for MDF File
RESTORE DATABASE [My_Database]
FROM DISK = 'C:Content.bak'
WITH MOVE 'MyDatabase_Data' TO 'C:DataMyDatabase_Data.mdf',
MOVE 'MyDatabase_Log' TO 'C:DataMyDatabase_Log.ldf',
REPLACE,
STATS=10
Â