How to start SQL Server 2017 on Linux in single user mode/ masteronly recovery mode?

529 views Asked by At

How to start SQL Server 2017 on Linux in single user mode / masteronly recovery mode?

The scenario behind this question is we can move tempdb files to a new filesystem. What if I specify a wrong filesystem and restart SQL Server on linux. SQL Server will go down. In this case how to change tempdb location in system catalog?

2

There are 2 answers

0
Dylan On

Adding the -m flag when starting the process will enable single user mode.

0
John Hanley On

If SQL Server is running, stop SQL Server:

sudo systemctl stop mssql-server

Switch to the user mssql. No password is required.

sudo su mssql

Start the SQL Server binary in single-user mode:

/opt/mssql/bin/sqlservr -m 

Do whatever you need to do. When finished press CTRL-C

Start SQL Server:

sudo systemctl start mssql-server