Zip/Unzip SQL Server Database Backup File on Linux Machine

After the fantastic announcement of SQL Server on Linux – Public Preview, I started exploring a couple of things on SQL Server on Linux. During the exploration of SSOL, I realized that If you are a new Linux System user, you might find difficulties to zip and unzip a SQL database backup file on a Linux system. In this tutorial, we will see how we can achieve this using command line.

  • Connect to your Linux machine

01

  • Check, if the Zip software is already installed

Syntax: dpkg -s zip

02-iszip-installated

  • If It is not installed, let’s switch to root user to install it

Syntax: sudo -i

03-switchtorootuser

  • Now, let’s install the Zip software

Syntax: apt-get install zip

04-installzip

  • Locate the SQL Server database backup zipped file on your Linux machine

Syntax: ls -l

05locate-the-backupfilev1

  • Unzip the SQL database backup file

∗At Same location

Syntax: unzip ‘ThezippedSQLBackupfileName’ ‘ExtractedFileName’

06-unzipthefilev4

∗At different location

Syntax: unzip ‘ThezippedSQLBackupfileName’ -d ‘NewLocationwithExtractedFileName’

Note: “-d” parameter is used to  extract files into exdir

07-verifytheunzippedfile-part2v1

  • Verify the unzipped backup file

Syntax: ls -l

07-verifytheunzippedfile

  • Now, Zip a SQL Server Database backup file and verify it

Syntax: zip ‘ThezippedSQLBackupfileName.zip’ ‘BackupFileName’

08-zipping

I hope this tutorial was helpful and also saved your a lot of time on searching how to zip and unzip SQL Server database backup file or others files on Linux machine.

Leave a comment

Your email address will not be published. Required fields are marked *