Following are some commands to check the Location of MSSQL Files, Services, Ports, Error log in linux:
Start, restart, stop services:
To start service:
#systemctl start mssql-server.service
To restart service:
#systemctl restart mssql-server.service
To check the status of service
#systemctl status mssql-server.service
To check SQL Server port listening or not:
#netstat -ltnp | grep 1433
To check process of sqlserver, CPU & Memory :
#top
Detailed Error log message:
#cat /var/log/messages
or
#gedit /var/log/messages
MSSQL Files & Explaination:
Default locations:
Data, Log and Backup file arer stored in following location:
#cd /var/opt/data/
[root@localhost bin]# cd /var/opt/mssql/
[root@localhost mssql]# tree
.
├── data
│ ├── master.mdf
│ ├── mastlog.ldf
│ ├── modellog.ldf
│ ├── model.mdf
│ ├── msdbdata.mdf
│ ├── msdblog.ldf
│ ├── tempdb.mdf
│ └── templog.ldf
├── log
│ ├── errorlog
│ ├── errorlog.1
│ ├── errorlog.2
│ ├── errorlog.3
│ ├── HkEngineEventFile_0_131965325722020000.xel
│ ├── HkEngineEventFile_0_131965326649610000.xel
│ ├── HkEngineEventFile_0_131965326698640000.xel
│ ├── log_13.trc
│ ├── log_14.trc
│ ├── log_15.trc
│ ├── log_16.trc
│ ├── log_17.trc
│ ├── sqlagentstartup.log
│ ├── system_health_0_131965325738490000.xel
│ ├── system_health_0_131965326659670000.xel
│ └── system_health_0_131965326710160000.xel
├── mssql.conf
└── secrets
└── machine-key
3 directories, 26 files
Installing a SQL Server instance creates following hierarchy in /var/opt/mssql with the followings items:
- data folder = default folder for database data and transaction log files. By the way, system and tempdb database files are located here by default.
- log folder = log files are stored here. We may retrieve logs related to SQL Server engine (errorlog files), to the SQL Server agent here.
- mssql-conf utility= Stores the default location files for user database files and dump files.
- secret folder = contains the machine.key file used by the SQL Server engine or potential other files that come with high-availability architectures to store pacemaker credentials
Some important files:
[root@localhost ~]# tree /opt/mssql/
/opt/mssql/
├── bin
│ ├── compress-dump.sh
│ ├── crash-support-functions.sh
│ ├── generate-sql-dump.sh
│ ├── handle-crash.sh
│ ├── mssql-conf
│ ├── paldumper
│ └── sqlservr
└── lib
├── libc++abi.so.1
├── libc++.so.1
├── libsqlvdi.so
├── libunwind.so.8
├── loc
│ ├── de_DE
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ ├── en_US
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ ├── es_ES
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ ├── fr_FR
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ ├── it_IT
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ ├── ja_JP
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ ├── ko_KR
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ ├── pt_BR
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ ├── ru_RU
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ ├── zh_CN
│ │ └── LC_MESSAGES
│ │ └── sqlservr.mo
│ └── zh_TW
│ └── LC_MESSAGES
│ └── sqlservr.mo
├── mssql-conf
│ ├── checkinstall.sh
│ ├── checkrunninginstance.sh
│ ├── collations.txt
│ ├── invokesqlservr.sh
│ ├── loc
│ │ └── mo
│ │ ├── mssql-conf-de_DE.mo
│ │ ├── mssql-conf-en_US.mo
│ │ ├── mssql-conf-es_ES.mo
│ │ ├── mssql-conf-fr_FR.mo
│ │ ├── mssql-conf-it_IT.mo
│ │ ├── mssql-conf-ja_JP.mo
│ │ ├── mssql-conf-ko_KR.mo
│ │ ├── mssql-conf-pt_BR.mo
│ │ ├── mssql-conf-ru_RU.mo
│ │ ├── mssql-conf-zh_CN.mo
│ │ └── mssql-conf-zh_TW.mo
│ ├── mssqlconfhelper.py
│ ├── mssql-conf.py
│ ├── mssqlsettingsmanager.py
│ ├── mssqlsettings.py
│ └── set-collation.sh
├── secforwarderxplat.sfp
├── sqlagent.sfp
├── sqlservr.sfp
├── system.certificates.sfp
├── system.common.sfp
├── system.netfx.sfp
└── system.sfp
28 directories, 49 files
From the above output we may find out a bunch of files that are part of the proper functioning of SQL Server.
Most of these files are installed in the main hierarchy /opt/mssql/ with the following specific items
- /opt/mssql/bin/ (binary files and SQL Server crash dump generation scripts)
- /opt/mssql/lib (sqlserver libraries and sfp files)
- /opt/mssql/lib/mssql-conf (python and bash scripts)