Presentation is loading. Please wait.

Presentation is loading. Please wait.

Managing and monitoring SQL Server on Linux from the command line

Similar presentations


Presentation on theme: "Managing and monitoring SQL Server on Linux from the command line"— Presentation transcript:

1 Managing and monitoring SQL Server on Linux from the command line
Randolph West, Data Platform MVP

2 Please thank and support our sponsors
SQL Saturday is made possible with the generous support of these sponsors. Please support them by opting-in and visiting them in the sponsor area. Global Alliance Partner: Venue & Internet Sponsor: Silver Sponsor: Operations Support: Endless Support from: OGMA Consulting Corp. Bronze Sponsors: Please thank and support our sponsors

3 Attendee awareness You know what an operating system is
You know what Linux is You can navigate around the Linux command line You know what bash is You know what a relational database management system is

4 Agenda Installation Configuration with mssql-conf
Querying with mssql-cli Monitoring with dbfs Agenda

5 install -y mssql-server
Install your SQL Server instance

6 Supported Linux distros
Red Hat Enterprise Linux (RHEL) - v7.3+ SuSE Linux Enterprise Server (SLES) - v12 SP2+ Ubuntu Docker engine 1.8+

7 Supported Linux distros
Red Hat Enterprise Linux (RHEL) - v7.3+ SuSE Linux Enterprise Server (SLES) - v12 SP2+ Ubuntu Docker engine 1.8+ Examples and demos will be performed using Ubuntu

8 How did they get SQL Server on Linux?
arstechnica.com

9 A note on Docker Windows / Linux / macOS host
Stand-alone or orchestrated (OpenShift and Kubernetes) SQL Server 2019 Big Data Clusters Persisted storage layer

10 Minimum system requirements
2 GB RAM 6 GB storage on xfs or ext4 2-core x64 CPU at 2 GHz /var/opt/mssql can be located on NFS

11 mssql-conf Configure your SQL Server instance

12 What is mssql-conf? Replaces SQL Server Configuration Manager on Linux
Manages instance-level (server) configuration Written in Python Writes to a text file

13 How does mssql-cli work?
Takes two or more parameters Setting and value Requires super-user permission sudo

14 Where do I find mssql-conf?
/opt/mssql/bin/ mssql-conf /var/opt/mssql/ mssql-conf

15 Always remember to restart!
sudo systemctl restart mssql-server

16 mssql-conf examples

17 Enable the SQL Server Agent
sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true

18 Set physical memory allocation
sudo /opt/mssql/bin/mssql-conf set memory.memorylimitmb 3328

19 Set instance-level trace flags
sudo /opt/mssql/bin/mssql-conf traceflag on

20 Unset custom TCP port sudo /opt/mssql/bin/mssql-conf unset network.tcpport

21 View the mssql-conf settings
sudo cat /var/opt/mssql/mssql-conf cat means concatenate

22 More configuration options
sql-server-linux-configure-mssql-conf

23 Did you remember to restart?
sudo systemctl restart mssql-server Docker containers must be fully restarted using: sudo docker restart <container>

24 mssql-conf demo

25 mssql-cli Query your SQL Server instance

26 What is mssql-cli? Replaces sqlcmd and osql (almost)
Interactive command-line query tool Written in Python Full IntelliSense support

27 Configuration file support
mssql-cli features Autocomplete Syntax highlighting Query history Configuration file support Multi-line queries

28 Named queries in mssql-cli
Frequently-used queries can be saved as named queries Save the query: \sn [name] [query] Run the query: \n [name]

29 Subset of special commands
\? → list all special commands \d → describe objects (calls sp_help) \e → edit query in external editor

30 Subset of commands to list objects
\ld[+] [pattern] → list databases \lt[+] [pattern] → list tables \li[+] [pattern] → list indexes

31 mssql-cli demo

32 dbfs Monitor your SQL Server instance

33 Monitoring with dbfs DMVs FUSE bash

34 dbfs examples

35 List DMVs with matching pattern
ls | grep –i os | grep –i memory

36 View DMV results in JSON format
cat dm_os_sys_memory.json | python -m json.tool

37 Select and format a subset of a DMV
awk '{print $1,$5}' dm_os_sys_memory | column -t

38 Select, join and sort a DMV result set
join -j 1 -o 1.1,1.16,1.17,2.5,2.8 <(sort -k1 dm_exec_connections) <(sort -k1 dm_exec_connections) -t $'\t' | sort -n -k1 | column -t

39 dbfs demo

40 One more thing…

41 dbatools PowerShell module
500+ commands (admin, migration, best practice) Includes SQL Server Management Objects (SMO) in the box

42 dbatools continued Targets SQL Server 2000 to 2019
Supports .NET Core with high coverage Install-Module dbatools

43 dbachecks Pester framework Validate environment
Install-Module dbachecks

44 dbachecks continued Nearly 100 checks
Validate environment using checklists RTO / RPO / index monitoring / integrity checks / network latency / Agent job monitor Power BI dashboard built in

45 Summary It’s just SQL Server
Only dbfs is Linux-specific (including Docker!) Everything else works on all operating systems where SQL Server is supported (PowerShell has some limitations on Linux)

46 Contact me r@ndolph.ca bornsql.ca
SQL Server 2017 Administration Inside Out (Microsoft Press) SQL Server 2019 Administration Inside Out (coming soon)


Download ppt "Managing and monitoring SQL Server on Linux from the command line"

Similar presentations


Ads by Google