Applies To
SQL Server 2017 Developer SQL Server 2017 Enterprise SQL Server 2017 Enterprise Core

Symptoms

Assume that you are trying to restore a database by using REPLACE option in SQL Server 2017. If the filepath contains redundant path separators in CREATE DATABASE, you may receive error messages that resemble the following:

Msg 3634, Level 16, State 1, Line LineNumber

The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'FilePath\FileName.mdf'.

Msg 3156, Level 16, State 8, Line LineNumber

File 'FileName' cannot be restored to 'FilePath\FileName.mdf'. Use WITH MOVE to identify a valid location for the file.

Msg 3634, Level 16, State 1, Line LineNumber

The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'FilePath\FileName.ldf'.

Msg 3156, Level 16, State 8, Line LineNumber

File 'FileName' cannot be restored to 'FilePath\FileName.ldf'. Use WITH MOVE to identify a valid location for the file.

Msg 3119, Level 16, State 1, Line LineNumber

Problems were identified while planning for the RESTORE statement. Previous messages provide details.

Msg 3013, Level 16, State 1, Line LineNumber

RESTORE DATABASE is terminating abnormally.

Workaround

You get this error when you are trying to do restore with REPLACE option. As a workaround, you can delete the existing database and do a restore.

Resolution

This issue is fixed in the following cumulative update for SQL Server:

       Cumulative Update 4 for SQL Server 2017

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

Latest cumulative update for SQL Server 2017

More information

About the path, it's not the path to the backup location, it’s the path of the file in the backup header which can be viewed with restore headers only. For more information, see RESTORE Statements - HEADERONLY (Transact-SQL). For example:

RESTORE HEADERONLY

FROM DISK = N'FilePath\FileName.bak'

WITH NOUNLOAD;

GO

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References

Learn about the terminologythat Microsoft uses to describe software updates.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.