Categories
Sql Server

How to Take Backup of SQL Server Database on Linux

How to Take Backup of SQL Server Database on Linux

This tutorial explains How to Take Backup of SQL Server Database on Linux. Recently Microsoft team did a tremendous job and released SQL Server vNext CTP 1.4 on Linux with the same tools as other platforms. Earlier we had discussed about Install SQL Server on LinuxHow to Restore SQL Server database from Windows to SQL Server on Linux and Install SQL Server on Ubuntu.

Taking a backup in SQL Server on Linux is as easy as it is in Windows OS. First of all we have to login our SQL Server through SQLCMD, and then pass backup command to take backup of desired database.

Command to login SQL Server:

sqlcmd -s localhost -U SA

It will prompt for SA password, once input. Use below mention command to take backup.

Backup Command:

backup database TestDB to Disk='/var/opt/mssql/data/testdb.bak' with NOREWIND,NOINIT, 
NOUNLOAD, NOFORMAT, SKIP, Name='TESTDB-FULL', STATS=10;

After passing command the shell will return the results of the backup progress.

How to Take Backup of SQL Server Database on Linux

Video Tutorial: