Home>

Unable to restore the database in the docker container using the script:

RESTORE DATABASE [DBName]
FROM
    DISK= N '/var /opt /mssql /data /DBName.bak'

When trying to restore it, it gives the following errors:

  1. Directory lookup for the file "C: \ DATA \ MSSQL15 \ MSSQL \ DATA \ DBName.mdf" failed with the operating system error 2 (The system cannot find the file specified.).
  2. File 'DBName' cannot be restored to 'C: \ DATA \ MSSQL15 \ MSSQL \ DATA \ DBName.mdf'. Use WITH MOVE to identify a valid location for the file.
  3. Directory lookup for the file "C: \ DATA \ MSSQL15 \ MSSQL \ DATA \ DBName_log.ldf" failed with the operating system error 2 (The system cannot find the file specified.).
  4. File 'DBName_log' cannot be restored to 'C: \ DATA \ MSSQL15 \ MSSQL \ DATA \ DBName.ldf'. Use WITH MOVE to identify a valid location for the file.
  5. Problems were identified while planning for the RESTORE statement. Previous messages provide details.
  6. RESTORE DATABASE is terminating abnormally.

It is not possible to restore the database through the interface, the problem is similar, I also tried to get the LogicalName PhysicalName:

RESTORE FILELISTONLY
    FROM DISK= N '/var /opt /mssql /data /DBName.bak'

and restore the trace as follows:

RESTORE DATABASE [DBName]
    FROM
        DISK= N '/var /opt /mssql /data /DBName.bak'
    WITH FILE= 1,
    MOVE N'DBName 'TO N'C: \ DATA \ MSSQL15 \ MSSQL \ DATA \ DBName.mdf',
    MOVE N'DBName_log 'TO N'C: \ DATA \ MSSQL15 \ MSSQL \ DATA \ DBName.ldf',
    NOUNLOAD, REPLACE, NOUNLOAD, STATS= 5

Nevertheless, it does not work, advise how to restore the database through a script?

There is a button to get a script through the interface. Take it as a basis.

PashaPash2022-01-13 15:36:15

I was wrong, there is a similar problem through the interface. Although it used to work, now even through the interface it is impossible to restore the backup. Errors are similar

Russo2022-01-12 17:09:13