Sql-server – Database Restoration Issue Msg 3156, Level 16, State 6

restoresql serversql-server-2016

Recently while restoring a database with memory optimized filegroup I start facing an issue with below error message:-

Msg 3156, Level 16, State 3, Line 2 File 'XYZ' cannot be restored to
'D:\FolderPath\Memory_Optimized_FolderName'. Use WITH MOVE to identify
a valid location for the file.

First I thought it might be syntax error but syntax was correct and I even checked the permission to filepath which was also fine. So what is the reason for this error?

Best Answer

I found the solution of my problem which was folder location. The folder gets created itself. So once I removed the last folder name which was in some format

"TableName_Memory_Optimized"

And using only below path in my restoration script it starts working fine.

'D:\FolderPath'