FIX: FileTable database level directory is inaccessible after database startup in SQL Server 2016 and 2017

Applies to: SQL Server 2016 DeveloperSQL Server 2016 EnterpriseSQL Server 2016 Enterprise Core

Symptoms


During Microsoft SQL Server 2016 and 2017 startup, if a user triesto connect to a database before it is started, the user session may cause thedatabase to be auto-started. When this occurs, if the database contains aFileTable and has FILESTREAM non_transacted_access enabled, then the database-levelFileTable directory is inaccessible after database startup. If you try to access the folder through File Explorer, it may indicate that the folder isunavailable. When you run a "dir" command from Command prompt, it returns "The system cannot find the file specified."

Additionally, you may see the following errors in the error log that indicate a user session triggered the database to auto-start:

DateTime Logon       Error: 18456, Severity: 14, State: 38.

DateTime Logon       Login failed for user 'UserName'. Reason: Failed to open the explicitly specified database 'DatabaseName'. [CLIENT: IPNumber]

Status


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

Resolution


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

About cumulative updates for SQL Server:

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:

Workaround


The workaround for this issue is to disable and re-enable the FILESTREAM non_transacted_access of the database.

ALTER DATABASE [DatabaseName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE

ALTER DATABASE [DatabaseName] SET FILESTREAM ( NON_TRANSACTED_ACCESS = OFF )

ALTER DATABASE [DatabaseName] SET FILESTREAM ( NON_TRANSACTED_ACCESS = FULL )

ALTER DATABASE [DatabaseName] SET MULTI_USER WITH ROLLBACK IMMEDIATE

References


Learn about the terminology that Microsoft uses to describe software updates.