Why do some SQL Server databases go into a "Recovery Pending" state after shutting down / restarting on Linux?
1
vote
0
answers
445
views
I built a secondary PC from old parts as a server for SQL Server databases and I went with Linux/Ubuntu 20.04 because it's free. I knew it would not be easy to set this up (I'm rather a Windows user) and I had quite some issues/challenges along the way but I got it working.
My only headache now is that basically every time I shutdown or reboot the PC, some of the databases are getting the "Recovery pending" state and then I have to run the usual script to fix that. (which for some of my big DBs are taking quite a long time to finish)
I thought I need to manually stop the SQL Server services every time I shutdown the PC so I tried this before that:
sudo systemctl stop mssql-server
Yet I still had one of the DBs in this pending state after booting. Now maybe the issue is that DB is on a different drive? The DBs not affected by this state are on the main SSD where Ubuntu is installed, if that makes any difference. I store the DBs on internal storage devices (1 SSD + 2 HDD).
Someone hinted on stackoverflow that maybe the HDDs were mounted AFTER the SQL Server services has been started? How could I fix that?
Thanks for any helpful feedback.
EDIT:
I checked the logs, the database files cannot be found:
This might prove that the SQL Server services start to early, I guess.

Asked by Ha'gel
(19 rep)
Dec 7, 2021, 07:36 PM
Last activity: Dec 8, 2021, 08:50 AM
Last activity: Dec 8, 2021, 08:50 AM