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]
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:
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