I tried running the following query to restore a database:
restore database myDatabase
from disk=
'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\MSSQL\Backup\myDatabase_backup_2012_06_20.bak'
with replace,
move 'myDatabase' to
'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\MSSQL\DATA\myDatabase',
move 'Analytics_log' to
'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\DATA\myDatabase_log.ldf'
And am getting the following error:
Msg 5133, Level 16, State 1, Line 1 Directory lookup for the file
“C:\Program Files\Microsoft SQL
Server\MSSQL11.SQLSERVER2012\DATA\myDatabase_log.ldf” failed with the
operating system error 2(The system cannot find the file specified.).Msg 3156, Level 16, State 3, Line 1 File ‘myDatabase_log’ cannot be
restored to ‘C:\Program Files\Microsoft SQL
Server\MSSQL11.SQLSERVER2012\DATA\myDatabase_log.ldf’.
Use WITH MOVE
to identify a valid location for the file.
For the first error, it seems like SQL Server cannot find the .ldf file. However, it is in that location and was listed in the results when I ran restore filelistonly on the .bak file.
Are you sure your LDF file wasn’t suppose to be copied to : C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\MSSQL\DATA\myDatabase_log.ldf ? …Notice you’re missing the MSSQL subfolder. What am saying is that LDF file path may be invalid.