HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Cannot systemctl start/stop mssql. mssql-server stuck in script upgrade mode. Cannot login either

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
cannotscriptstuckmodeloginmssqlstopeithersystemctlstart

Problem

I'm having trouble getting my mssql-server back online. Apparently it got stuck between an upgrade and a bad database restore, and now it is stuck, and I nothing I've tried has helped to unstuck it.

Basically I was doing a

RESTORE DATABASE ···· FROM DISK = '/path/to/backup/·······.bak'
WITH replace, move '········' TO
'/path/to/data/········.mdf', move '······' TO
'/path/to/data/······.ldf'
GO


that got stuck (The database '····' is marked RESTORING and is in a state that does not allow recovery to be run), and by some idiotic timing, minutes later a yum update took place, including an mssql-server upgrade. After that, I got locked out of the server and now I cant do anything to get in.

If I type

systemctl start/stop mssql-server


the command never finishes, and when I ctrl-C it,

systemctl status mssql-server


returns

● mssql-server.service - Microsoft SQL Server Database Engine
   Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
   Active: deactivating (stop-sigterm) since sat 2019-05-18 20:49:33 MST; 4min 0s ago
     Docs: https://learn.microsoft.com/en-us/sql/linux
 Main PID: 5864 (sqlservr)
   CGroup: /system.slice/mssql-server.service
       ├─5864 /opt/mssql/bin/sqlservr
       └─5866 /opt/mssql/bin/sqlservr


Apparently, it never finishes deactivating, and after a short while, systemctl status sends

● mssql-server.service - Microsoft SQL Server Database Engine
   Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
   Active: active (running) since sáb 2019-05-18 20:27:35 MST; 17min ago
     Docs: https://learn.microsoft.com/en-us/sql/linux
 Main PID: 5864 (sqlservr)
   CGroup: /system.slice/mssql-server.service
       ├─5864 /opt/mssql/bin/sqlservr
       └─5866 /opt/mssql/bin/sqlservr


when I try to login as admin I get

```
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: E

Solution

I was having similar issue to a point where I could not even connect. Turns out there are two different version streams (https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-change-repo?view=sql-server-2017&pivots=ld2-ubuntu#cuversusgdr):

-
Cumulative Updates (CU): The Cumulative Update (CU) repository contains packages for the base SQL Server release and any bug fixes or improvements since that release. Cumulative updates are specific to a release version, such as SQL Server 2017. They are released on a regular cadence.

-
GDR: The GDR repository contains packages for the base SQL Server release and only critical fixes and security updates since that release. These updates are also added to the next CU release.

Looks like it is more stable to use GDR in prod. "Downgrading" at least solved all my issues.

Context

StackExchange Database Administrators Q#238508, answer score: 3

Revisions (0)

No revisions yet.