php MsSQL Backup

A php script to dump database as sql from MS SQL

We started porting (provide dual support) one of our application from MySQL to MSSQL, sorry, actually we were trying to run the same code base on either MSSQL or MySQL as the client wishes. And those who knows both, will agree to the level of toughness and agony when considers the fact that all of us are on MySQL and are new to MSSQL. In this context, we wanted to provide backup and restore to the application administrator through the system itself, and was not contented with the .bak files provided by MSSQL backup.

The above led to an experiment to try to code a php based database export as sql, with optional zip compression (and graceful degaradation). The outcome is published herewith with a clean intension. And there are a couple of drawbacks, like we have never used the foreign keys and constraints. Hence the backup tool does not address any fk_constratints.

I would appreceate any comments from MSSQL experts and veterans regarding the left out portions in the backup tool. Together I expect the tool to be made into a more useful one. The script in native php is attached here with. For this to run smoothly in ubuntu linux (my favorite distro), the php5-sybase package should be installed. Tweak the configuration part, as given in the example implementation at the bottom.

I would appreciate any one who is downloading and using this to make a comment and reference to how you used this script. Just for the sake of auditing.

Download

Note: While moving along, I have found that the dump which my script generates is just bare minimum and will be of use only to a very small and poorly designed database. I am working on enhancing the script with all the essentialities. A release date for the extended version cannot be noted now. (added Mar 1, 2010)