다음을 통해 공유


SQL Server on Linux: Troubleshooting

                                                               https://msdnshared.blob.core.windows.net/media/2016/05/0640_NinjaAwardTinyGold.png won Gold award in Jan 2019

1. MSSQL is inactive dead state

problem: when starting MSSQL services or checking status, active -inactive (dead)  will shown in MSSQL

 

Solution:

You need configure 

sudo /opt/mssql/bin/mssql-conf setup
sudo /opt/mssql/bin/mssql-conf setup
    The license terms for  this product can be downloaded from
     http://go.microsoft.com/fwlink/?LinkId=746388 Jump
    and found in  /usr/share/doc/mssql-server/LICENSE.TXT.
    Do you accept the license terms? [Yes/No]:yes
      Setting up Microsoft SQL Server
    Enter the new SQL Server system administrator password:  --Enter strong password
    Confirm the new SQL Server system administrator password: --Enter strong password
     starting Microsoft SQL Server...
     Enabling Microsoft SQL Server to  run at  boot...
    Setup completed successfully.

after completion configuration we are able to see services are running state.

2. sqlcmd: command not found

Problem: After mssql installation we trying access suing sqlcmd we getting following error.

-bash :sqlcmd command not found

Solution:

you need check ODBC drive installed and create a symlink for sqldcmd.

curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo sudo yum remove mssql-tools unixODBC-utf16-devel 
--modify your PATH in the ~/.bash_profile file 
sudo yum install mssql-tools unixODBC-devel
sudo yum check-update
sudo yum update mssql-tools
--modify your PATH in the ~/.bash_profile file 
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
---modify the PATH in the ~/.bashrc file 

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

source ~/.bashrc
sudo ls /opt/mssql-tools/bin/sqlcmd*

After you get the name of the tool you can create a symlink:

sudo ln -sfn /opt/mssql-tools/bin/sqlcmd /usr/bin/sqlcmd

3. Unable status SQL services with normal user

Problem : Authentication is required to start 'mssql-server.service'

We have created new user 

adduser sqlreader

We have to  set a password by following command

passwd sqlreader

Solution:

we have to log using the root user and to check the status of the SQL services.
** su - root**

We have check SQL services status by the root user.

systemctl status mssql-server

4. mssql is not starting below 2 GB ram

For this, we are testing set 1 GB ram to server.

After increasing memory 3 Gb .We have started mssql services and sql services is started.

Note

MSSQL require minimum 2 GB ram.

 

Suggested reading:

Mssql installation on Centos (Linux)
SQL Server on Linux: How to Change SA password