Backup a Microsoft SQL-Server with Ubuntu 14.04

I spent several  hours to figure out how to backup a mssql-server with linux. It wasn’t easy but I found a nice solution.

Yes Microsofts SQL-Server – I’m managing a page which uses asp.net and mssql, so I needed a solution to backup the complete server and database from the commandline.
I found a PHP script which does most of the job. The script needs php-mssql extension, so install it with:

sudo apt-get install php5-mssql

If you want to query the MS-SQL-Server from the commandline, use tsql (from freetds), install it with

sudo apt-get install freetds-bin freetds-common

Now download my modified script from here (php_mssql_backup.php)

This script is basically from http://www.php-trivandrum.org/code-snippets/php-mssql-backup/ I just modified the code for a couple of data-types in ms-sql-server 2008.

Open the script and insert your cretentials (host,user,pass,db) at the bottom of the script.
Then execute the script on the commandline:

php5 php_mssql_backup.php ./output.sql

That’s it, feel free to copy or modify the script. Feedback is also welcome!

0 Kommentare

Hinterlasse einen Kommentar

An der Diskussion beteiligen?
Hinterlasse uns deinen Kommentar!

Kommentar verfassen

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.