Databases not accessible by default on auto-unlocked BitLocker drive
Take the following BitLocker set up:
C:\ OS Drive (encrypted) - Windows and SQL Server installed here
D:\ Database Drive (encryped + auto-unlock)
When Windows boots, it seems that the MS SQL Server service starts before BitLocker auto-unlocks the drives. Therefore, when SSMS is started, the databases are inaccessible (labelled as Recovery Pending). Also, any attempt to access the database data in SSMS results in strange read/write error dialogs:
Msg 823, Level 24, State 2, Line 1
The operating system returned error 21(The device is not ready.) to SQL Server during a read at offset 0x000000005f4000 in file 'D:\Databases\MyDb_Data.mdf'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
If we restart the MS SQL Server service, then it works fine.
Therefore, the MS SQL Server should only start once BitLocker has finished auto-unlocking drives.
I am facing same issue please help in resolving the issue.
Burak Günüşen commented
Apparently drive is unlocked after user logs in. I've created a batch file that restarts mssql service and placed it under shell:startup.
Tried to delay the SQL Server service starting up, but this did not work.