0

I have installed sql server 2017 on my centos 7 machine. I need to restore my database backups from windows machine to this machine. I could successfully run filelistonly. However, for restore, I'm using below statements:

     RESTORE DATABASE db_2  FROM DISK = '/backup2/mssql- 
backup/db_2_20190811.BAK' WITH  REPLACE, MOVE 'db_2' TO '/backup2/mssql- 
backup/db_2.mdf', MOVE 'db_2_log' TO '/backup2/mssql-backup/db_2_log.ldf' 
GO

and, I'm receiving below error:

    Msg 3634, Level 16, State 1, Server localhost, Line 9
 The operating system returned the error '2(The system cannot find the file 
specified.)' while attempting 'RestoreContainer::ValidateTargetForCreation' 
on '/backup2/mssql-backup/db_2.mdf'.
Msg 3156, Level 16, State 5, Server localhost, Line 9
File 'db_2' cannot be restored to '/backup2/mssql-backup/db_2.mdf'. Use WITH 
 MOVE to identify a valid location for the file.
Msg 3634, Level 16, State 1, Server localhost, Line 9
 The operating system returned the error '2(The system cannot find the file 
specified.)' while attempting 'RestoreContainer::ValidateTargetForCreation' 
on '/backup2/mssql-backup/db_2_log.ldf'.
 Msg 3156, Level 16, State 5, Server localhost, Line 9
File 'db_2_log' cannot be restored to '/backup2/mssql-backup/db_2_log.ldf'. 
Use WITH MOVE to identify a valid location for the file.
Msg 3119, Level 16, State 1, Server localhost, Line 9
 Problems were identified while planning for the RESTORE statement. Previous 
 messages provide details.
Msg 3013, Level 16, State 1, Server localhost, Line 9
 RESTORE DATABASE is terminating abnormally.

'REPLACE' clause is needed otherwise I was getting a different error. Any way to avoid this.

The error statement says to use 'WITH MOVE' which I'm already using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.