Professional Documents
Culture Documents
EN GB CNTNT Ebook DBMC SQL Server On Linux A Guide To Re Platforming1
EN GB CNTNT Ebook DBMC SQL Server On Linux A Guide To Re Platforming1
01 / 02 / 03 /
An overview of SQL Server Getting the most out of Tools and management
on Linux SQL Server on Linux
04 / 05 /
Tools and services for Conclusion
migrations and upgrades
3
SQL Server 2017 continues the evolution source applications. In this eBook, you’ll get
of SQL Server on the platform of your an operational view of this RDBMS, with a
choice, improving and enhancing data focus on leveraging SQL Server capabilities
management and data-driven applications to deliver powerful insights in ways that
through new capabilities and support for open-source developers and IT specialists
more Linux distributions, including Red Hat need and expect. In addition to now-
Enterprise Linux (RHEL), Ubuntu and SUSE standard features like advanced analytics
Enterprise Linux (SLES), as well as container and end-to-end business intelligence,
platforms like Docker and Kubernetes. SQL Server 2017 provides in-memory
performance across workloads, mission-
Companies can deploy on the platform –
critical high availability and unparalleled
or combination of platforms – that makes
security features and compliance with
the most sense for their business. The same
privacy regulations such as GDPR, PCI and
is true for programming languages, too.
HIPAA to protect your data at rest and in
Companies using Oracle, PostgreSQL, DB2,
motion – all on your choice of language
Sybase and other systems running on Linux
and platform.
can now migrate to the SQL Server 2017,
an industry-leading Relational Database Choice across platforms
Management System (RDBMS), and use the
SQL Server on Windows and Linux share a
operating system of their choice without
common code base. That is, the SQL Server
the requirement to install Windows Server
core engine hasn’t been changed to allow
operating system. Engineers who are most
it to run on Linux. SQL Server introduced
comfortable with C#, Java, Ruby or another
a Platform Abstraction Layer (SQLPAL)
coding language can build apps using
that’s responsible for abstraction of calls
the best language and platform for the
and communication between SQL Server
job, and then host the apps on any cloud
and the underlying operating system. The
provider or on-premises server that suits
host extension is simply a native Linux
their needs using SQL Server 2017.
application. Low-level operating systems
SQL Server 2017 is engineered to handle functions are native calls to optimise the
relational and non-relational data, graph input/output (I/O), memory and CPU
data coming from diverse data sources and usage. When the host extension starts, it
run any type of application including open- loads and initialises SQLPAL, which then
An overview of SQL Server on Linux 6
SQL Server.
Linux host extension
The response to this data platform Linux OS calls
1
TPC. “TPC-H Result Highlights HPE Proliant DL380 Gen9.” March, 2017.
http://www.tpc.org/3327
An overview of SQL Server on Linux 9
Open-source pricing
Customer story:
Of course, your databases and the data
Ajilius, an Australian start-
that’s within them are priceless. But that
doesn’t mean that you should be required up, migrated its PostgreSQL
to break the bank to work with your data.
With SQL Server 2017 on Linux, it’s possible
system to SQL Server on the
to realise a lower total cost of ownership Linux data platform, resulting
(TCO) and a quicker return on investment
(ROI) than if you choose a competing
in accelerated development
vendor. Required capabilities and features and cost savings. This
are built into SQL Server on Linux,
including in-memory capabilities, security, new platform is easier to
data warehousing and high availability/ administer and hosting
disaster recovery (HADR) at no extra cost.
expenses are down by 30%.
Avoiding extra licences, training time and
hardware costs will ensure your initial Plus, they can use SQL Server
investment in SQL Server pays off.
built-in capabilities to help
boost query performance,
improve security and increase
availability.
An overview of SQL Server on Linux 10
Use Master;
For guidance on installing SQL Server GO
on Ubuntu and SUSE Linux Enterprise ALTER DATABASE tempdb MODIFY FILE (NAME =
tempdev, FILENAME = ‘/var/opt/mssq1/data/
Server, see the Quick-Start guides: Install
tempdb01/tempdb01.mdf’, SIZE =- 1024,
SQL Server and create a database on FILEGROWTH = 8192 KB) ;
Ubuntu, Install SQL Server and create a GO
database on SUSE Linux Enterprise Server. ALTER DATABASE tempdb MODIFY FILE (NAME
To run the SQL Server 2017 container = templog, FILENAME — ‘/var/opt/mssqIl/
datalog/tempdbOI/tempIog.ldf’, SIZE =
image with Docker, you need to pull and
1024KB , FILEGROWTH = 8192KB );
run the mssql-server-linux container image. GO
For details on how to do this, see the
Quick-Start guide to Run the SQL Server
2017 container image with Docker.
Getting the most out of SQL Server on Linux 13
Here are some other best practices and Check the compatibility level of your
post-installation options that can help database using the following T-SQL
you maximise performance for database command:
applications that connect to SQL Server
on Linux: ALTER DATABASE YourDBName
SET COMPATIBILITY_LEVEL = 140;
ff To maintain efficient Linux and GO
SQL Scheduling behaviour, it’s
recommended to use the ALTER Memory configuration settings
SERVER CONFIGURATION command
ff Use mssql-conf to configure the
to set PROCESS AFFINITY for all the
memory limit and ensure there’s
NUMANODEs and/or CPUs.
enough free physical memory
ff To reduce the risk of tempdb for the Linux operating system.
concurrency slowdowns in high-
Linux OS configuration settings
performance environments,
configure multiple tempdb files ff On multi-node Non-Uniform
according to guidelines found Memory Access (NUMA) installations,
through Microsoft Support. The auto NUMA balancing needs to
automatic tempdb configuration be disabled to allow SQL Server
feature introduced in SQL Server to operate at maximum efficiency
2016 doesn’t offer an option to on a NUMA system.
configure multiple tempdb files
when installing SQL Server on Linux. sysctl -w kernel.numa_balancing=0
Shared storage. All FCIs on Linux or Configure settings for SQL Server
Windows Server require some form of Availability Group on Linux. To create
shared storage. The options available for an availability group on Linux servers, you
shared storage on Linux are iSCSI and need to enable availability groups on each
Network File System (NFS), and Server Linux node with endpoints and certificates.
Message Block (SMB) on Windows Server. Use T-SQL (or the New Availability Group
In a configuration that spans multiple Wizard in SSMS on Windows) to create an
locations, data stored in one datacentre availability group with the desired cluster
must be synchronised across locations. For type. After an availability group is created
default user data and log file locations, the on SQL Server, you’ll also need to create
system databases must always exist at /var/ the corresponding resources in Pacemaker.
opt/mssql/data for all instances. To get started with Availability Groups
in SQL Server 2017 on Linux, see Create
FCI resource group. The FCI on Linux
and configure an availability group for
nodes must be created in a resource group.
SQL Server on Linux.
You can create the FCI resource using the
pcs resource command. After ensuring that Cluster type. For an availability group
the FCI is online, you can issue the normal on Linux, set the cluster type to External
SQL statements using SSMS or sqlcmd. or None. An External type means using
Pacemaker with the availability group while
sudo pcs resource create FCIResourceName None means that there’s no requirement
ocf:mssql:fci op defaults timeout=60s
to use Pacemaker. An External cluster
--group RGName
type with Pacemaker helps you query the
instances of SQL Server in the availability
For further guidance on how to create
group and orchestrate failover to maintain
a SQL Server FCI on Linux, see Microsoft
high availability. A cluster type of None
documentation.
only supports manual failover from a
High availability with Always On primary to a secondary replica and is
Availability Groups primarily targeted for the read-scale out
scenario. For listener connectivity in this
For Always On Availability Groups under
context, you can use an IP address resource
Linux-based SQL Server installations,
created in Pacemaker that can run on any
you’ll want to consider characteristics and
of the nodes. Read more about listener
configuration settings such as:
functionality under Linux.
Getting the most out of SQL Server on Linux 16
Visual Studio Code and SQL Server many modern features such as auto-
extensions completion and syntax highlighting. Based
on Python, mssql-cli uses a preferred
Visual Studio (VS) Code is a code editor
installer program (pip) to install it. Once
redefined and optimised for building
it’s installed, you can launch the tool
and debugging modern web and cloud
from the command line using mssql-cli
applications. VS Code is free and available
--help. As an open-source tool that works
on your favourite platform – Linux, macOS
across platforms, you can install mssql-cli
and Windows. It has a rich ecosystem of
on Windows, macOS or Linux. For more
extensions found in the VS Code Extension
information on how to install mssql-cli and
Marketplace.
usage, see documentation on the mssql-cli
The mssql extension for VS Code enables GitHub repository.
you to connect to SQL Server, query with
SQL Server Management Studio (SSMS)
T-SQL statements and view the results. You
can save results as a JSON or CSV file to Even though SQL Server Management
use the data in your applications with just Studio isn’t made to run on Linux, it can be
a few clicks. While typing T-SQL code, you used – from a Windows server – to manage
get rich T-SQL language features like T-SQL SQL Server instances on Linux OS remotely.
IntelliSense (code completion), syntax SSMS is a powerful database administration
highlighting, linting, code navigation and tool that can help you back up, restore,
code snippets. view and edit databases, plus create and
edit T-SQL queries, scripts and database
You can also use VS Code to establish a
objects. See specific instructions on how to
connection to the SQL Server Integration
use SSMS to connect remotely to your SQL
Services (SSIS) Catalogue using an SSIS
Server instance on Linux.
extension and then use T-SQL statements
to deploy an SSIS project to the SSIS System Centre Management Pack
Catalogue. (Management Pack)
Data Migration Assistant (DMA) presented through the guided process are
easy to understand and implement.
DMA detects compatibility issues that
can affect database functionality on Database Experimentation Assistant
your new version of SQL Server before (DEA)
you migrate. If issues are detected, DMA
DEA helps in evaluating a targeted
can offer suggestions on how to address
version of SQL for upgrade. It’s another
them before proceeding. It recommends
important tool for customers upgrading
performance and reliability improvements
from previous SQL Server versions (starting
for your target environment, including
2005 and above) to any newer version of
newer features that are available through
SQL Server. DEA provides analysis reports
a version upgrade. The migration workflow
such as queries metrics for compatibility
helps you migrate database schemas, data
errors, degraded queries and query plans
and users, server roles and SQL Server
and other workload comparison reports
logins. While the migration of Active
to help you upgrade successfully. This tool
Directory (AD) logins is officially supported
helps you set up automated workload
by SQL Server 2017 on Linux, this requires
capture and replay of production database,
additional configuration for setting up
perform statistical analysis on traces
AD logins on SQL Server 2017 on Linux.
collected using both old and new instances
(For more information, see Configuration
and visualise the collected data through
steps.) Standard SQL Authentication works
analysis report. You can install DEA through
as expected without any additional set-up.
the Microsoft Download Centre.
Additionally, Data Migration Services
Availability groups as a migration path
(DMS) simplify the migration of existing
on-premises SQL Server, Oracle and MySQL For migrating from one datacentre or
databases to Microsoft Azure, whether ecosystem to another, availability group
your target database is SQL Database, SQL replicas offer a way to move quickly
Database Managed Instance or SQL Server without shuffling around backups and with
on an Azure virtual machine. The minimal downtime. You can use the cross-
automated workflow guides you through platform Always On Availability Group
the changes you need to make before configuration, where part of the replica
performing the migration. The options is on a Windows server and the other
Tools and services for migrations and upgrades 23