I've read hundreds of posts/articles that simply claim that MS-SQL Server does not work on Linux. Let me tell you this: that's hogwash!
I have successfully installed MSDE 2000 (32-bit) on a Linux i686 architecture, more specifically on a Gentoo 32-bit machine where I have the WineHQ API framework, which allows applications designed for MS Windows to run on a POSIX-compliant OS.
- Later MS-SQL versions (eg. MS-SQL 2005,2008,etc)
- POSIX-like 32-bit operating system (eg. Linux with Gentoo distro)
- WineHQ library for your Linux flavor
- winetricks helper script
- MSDE 2000 installation package (copy it at /tmp/MSDE2000A.exe)
- run winescript
- click on "Select the default wineprefix" then OK
- click on "Run winecfg" then OK
- on Windows Version drop-down select Windows XP (or later version; I have tested Windows XP so at least I know that it works); Apply+OK
- Install a Windows DLL or component
- check dotnet20 (I'm not really sure that it is absolutely necessary), mdac27/mdac28 then press OK; after installing these packages close the winetricks application
- run the following commands:12wine /tmp/MSDE2000A.exe # this will unpack the MSDE to ~/.wine/drive_c:/MSDERelA/wine ~/.wine/drive_c/MSDERelA/setup.exe SAPWD="" DISABLENETWORKPROTOCOLS=0 SECURITYMODE=SQL
- it's possible that the setup crashes; don't worry, run the following command:1cp ~/.wine/drive_c/users/eugen/Temp/SqlSetup/Temp/*.* ~/.wine/drive_c/windows/system32/
- it's possible that the setup crashes; don't worry, run the following command:
The above statement copies the remaining setup' DLL into windowssystem32 folder. After the setup.exe returns (with whatever output messages you may find on your terminal) it would be a good idea to wait few minutes (because it's a chance that it still copies/starting/doing something while you think you are done). Then, just run the following command:
ps aux|grep "sqlservr.exe"
to make sure that there is a sqlservr.exe process running out there (it may appear as , but don't worry about that).
Normally the MSSQLSERVER service should be started automatically (by setup, right after the installation finishes). You can check this in at least three ways:
- in your terminal run the command "wine net start MSSQLSERVER"; it should return an output like this:
user@gentoo ~ $ wine net start MSSQLSERVER
The MSSQLSERVER service is starting.
Service already running.
user@gentoo ~ $
- in your terminal run the command "ps aux|grep -i sqlservr.exe"; if MSSQLSERVER is running then the command above should show the corresponding process
- in your terminal run the command
wine ~/.wine/drive_c/Program Files/Microsoft SQL Server/80/Tools/Binn/sqlmangr.exe
it will start an M$ application that allows you to control the MSSQLSERVER services.
If it seems that it's not installed properly then it is worthing reading also this post.
To check the stability and performance of MS-SQL SERVER 2000 Desktop Engine (MSDE) under Linux, I've done few tests.
Test 1: migrate a SQL2008 database (from a Windows Server) to the SQL 2000 (MSDE) instance that runs on top of Linux:
- I have a SQL2008 database (1GB data) with the following objects:
- tables: 1043
- primary keys: 1002
- indexes: 95
- defaults: 19569
- triggers: 3819
- views: 361
- stored procedures: 1314
- functions: 866
- tables: 1043
I exported this database from SQL 2008 to SQL 2000 (MSDE) instance. It exported successfully!
I created the script for all triggers, stored procedures, functions then I run the script against the SQL 2000 (MSDE) instance on Linux. It ran successfully!
The database is (in fact) the server component of a client-server ERP package.
I have also a client application (the client component of the mentioned ERP package) that was built to run on Windows but thanks to WineHQ it runs also on Linux.
I have also installed the MDAC 2.8 on this Linux machine so that the client application connects the server component (the SQL database) by using the ADO components.
I have run the client application against the new SQL Server under Linux, so the entire solution (designed for Microsoft Windows) runs now on top of Linux. It works just perfectly!
Note: I haven't found a way to determine SQL Server to use as many CPU as Linux provides. Maybe it's something between SQL Server and WineHQ, I don't know. So for the time being my SQL Sever seems to use only 1 CPU:
Also I've found out that the process name will appear as "sqlservr.exe ". A defunct process means that it's finished but still depends on its parent which is still alive. Well, I don't know about that, SQL Server looks pretty alive to me :o)
I hope that I've convinced you so far that in fact MS SQL Server does work on Linux.
- If the SQLServer server connection doesn't work
I have found out that sqlservr.exe (that seems for a reason) will not respond if you don't have a live connection to it that keeps him alive.
For instance, you may run the "SQL Server Service Manager" tool by running the following command:
wine "C:Program FilesMicrosoft SQL Server80ToolsBinnsqlmangr.exe"
By using this application you can start/stop the SQL Server service.
osql -U -P "sql-password" -S
This will give you a SQL console where you can send your queries (in batch-mode, by terminating the batch with a GO on the last line):
1> select top 5 id,xtype,crdate from sysobjects
id xtype crdate
----------- ----- -----------------------
1 S 2002-12-17 14:36:14.450
2 S 2002-12-17 14:36:14.450
3 S 2002-12-17 14:36:14.450
4 S 2002-12-17 14:36:14.450
6 S 2002-12-17 14:36:14.450
(5 rows affected)
- An existing connection was forcibly closed by the remote host
I have also found out that when querying the database from SSMS , if I query a table that has image/blob columns and if I include them in the query and if their values are not empty, then the connection between the SSMS and SQL Server is forcibly closed:
Msg 10054, Level 20, State 0, Line 0
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
It appears to work with no problem from osql utility but from a Windows station where I have SSMS...well, you may encounter this unfortunate situation.
SQL 2005 runs in top of .NET. This means you should firstly install .net on Linux and that's possible thanks to Mono Project. There are people who say they succeeded installing SQL2K8 on Linux (http://tenbulls.co.uk/2011/04/01/how-to-run-sql-server-on-linux/) so I guess it works (although I never tried anything else than SQL2K).
Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.