SQL Server 2016 test VM
A Windows Server 2019 VM on this host's KVM with SQL Server 2016 SP3, for running the project against the
engine version the client uses. Microsoft publishes no Linux or container image of SQL Server 2016 (they start at
2017), and a 2017 server at compatibility level 130 still accepts functions 2016 lacks (TRIM, STRING_AGG,
CONCAT_WS...), so a real 2016 install is the only faithful test.
this host
├── the project (uv envs or Docker), as deployed
└── KVM VM "sql2016": Windows Server 2019 Evaluation
└── SQL Server 2016 SP3, default instance, TCP 1433, databases cacu, cama, tea, governance at level 130
The project stays on Linux and connects to the VM over libvirt's default network, the same shape as an app
server talking to the client's SQL Server. Nothing runs in Docker inside Windows.
1. Downloads
Put the files in e2e/sqlserver2016/downloads/ (gitignored). All come from Microsoft's own servers.
| File | From | Notes |
|---|---|---|
17763.3650.221105-1748.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso (5.6 GB): Windows Server 2019 evaluation, English |
Evaluation Center, "ISO downloads", English 64-bit | Free for 180 days. |
SQLServer2016-SSEI-Expr.exe (5.9 MB): SQL Server 2016 SP2 Express web installer |
Download Center, id 56840 | No account. The VM downloads the media with it, so it needs internet (the NAT gives it). The SP3 Express page (id 103447) and its file are gone. |
SQLServer2016SP3-KB5003279-x64-ENU.exe (861 MB): Service Pack 3 |
Download Center, id 103440 | Applied after the install, which brings the instance to SP3 (13.0.6300). Leave it out to test SP2. |
| or, instead of the two SQL files: "SQL Server 2016 Developer with Service Pack 3" ISO (~3 GB) | my.visualstudio.com → Downloads, with a free Visual Studio Dev Essentials account | Keep a name with sql and 2016 in it; it's attached as a third disc and used instead of Express. Closest to a Standard or Enterprise server. |
Why not Windows Server 2022: Microsoft doesn't support SQL Server 2016 on it (Using SQL Server in Windows). Express or Developer: since 2016 SP1 every edition has the same T-SQL surface; Express caps a database at 10 GB and memory at about 1.4 GB, which the test data fits.
2. What to ask the client
Run on their server and send back the output; set SQL_COLLATION (and the media) to match before step 3.
SELECT @@VERSION, SERVERPROPERTY('Edition'), SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Collation');
SELECT name, compatibility_level, collation_name FROM sys.databases;
SELECT name, default_language_name FROM sys.server_principals WHERE name = '<the login we will be given>';
ProductLevelRTM means noCREATE OR ALTER, which dbt-sqlserver uses (it needs SP1). Test that case apart: the VM installs SP3.- A database below level 130 changes query behaviour: set
SQL_COMPATIBILITY_LEVEL. - The collation decides how accents and case compare (the timeline's
sin_acentos_mayusculas). The default here,Modern_Spanish_CI_AS, is what a Spanish (Mexico) Windows gives; replace it with theirs. - A login whose language is Spanish reads
'2025-03-04'as 3 April when it becomes aDATETIME(DATEcolumns aren't affected). If theirs is, setdefault_languageofisss_appto match.
3. Build and run
Rule 7: starting the VM is a long-running service; get the owner's OK first.
cd e2e/sqlserver2016
./01-check-host.sh # read-only: KVM, libvirt, disk, RAM, downloads
./02-build-setup-iso.sh # answer file + scripts + passwords (.env) + SSH key -> build/sql2016-setup.iso
./03-create-vm.sh # copies the ISOs to the 'images' pool and starts the unattended install
./04-wait.sh # 30-60 min: Windows, OpenSSH, SQL Server, the databases; prints the version
./05-snapshot.sh clean # a clean state to come back to
./07-publish-ports.sh # SQL Server on <host>:9533, RDP on <host>:9534, for the LAN and the containers
./06-run-checks.sh ../../ISSSTELEON # or a worktree path: version, migrations, dbt build, 2017-syntax scan
./05-snapshot.sh --revert clean # before the next round
Each step is safe to rerun. Settings (VM size, collation, databases, login) are in config.sh and can be
overridden in .env, which also holds the generated passwords (WIN_ADMIN_PASSWORD, SQL_SA_PASSWORD,
SQL_APP_PASSWORD) and VM_IP. The project connects as isss_app, db_owner of each database, not as sa.
What the install does, unattended:
- Windows setup reads
autounattend.xmlfrom the setup disc: wipes the VM's disk, installs image index 2 (Standard Evaluation, Desktop Experience), sets the Administrator password, logs in once. post-install.ps1opens ports 22 and 1433, installs OpenSSH with the host key in.ssh/, and callsinstall-sql2016.ps1: Developer disc if attached, otherwise downloads the Express media; installs the engine as the default instance (mixed authentication, TCP on, the configured collation); creates the databases at the configured level and theisss_applogin; writesC:\setup\version.txt.
4. Getting in
. ./config.sh && vm_ssh # PowerShell on the VM
virsh vncdisplay sql2016 # e.g. 127.0.0.1:0 -> port 5900
ssh -L 5900:127.0.0.1:5900 <this host> # from a laptop, then a VNC viewer on localhost:5900
RDP is enabled too (port 3389 on VM_IP, Administrator and WIN_ADMIN_PASSWORD).
Only this host reaches VM_IP (libvirt's NAT), and ufw drops what other machines and containers send to
ports a host process opens. 07-publish-ports.sh runs one alpine/socat container per port instead: ports
Docker publishes pass ufw, and containers do reach the VM.
| From | SQL Server | RDP |
|---|---|---|
| this host | VM_IP:1433 or 127.0.0.1:9533 |
VM_IP:3389 |
| the LAN | 10.0.10.41:9533 |
10.0.10.41:9534 |
| a container | 10.0.10.41:9533 or 172.17.0.1:9533 |
Connection URL for the project: mssql+pymssql://isss_app:<SQL_APP_PASSWORD>@10.0.10.41:9533/<domain>.
./07-publish-ports.sh --stop removes the forwarders; rerun it if the VM's address changes.
5. When something goes wrong
| Symptom | Look at |
|---|---|
04-wait.sh never gets an address |
the screen (VNC): setup may be waiting on a question the answer file missed, often the image index. WIN_IMAGE_INDEX 2 is Standard with Desktop Experience on the evaluation ISO. |
| SSH never answers | OpenSSH comes from Windows Update; without internet it fails. Read C:\setup\post-install.log over VNC or RDP. |
C:\setup\FAILED |
its text, then C:\Program Files\Microsoft SQL Server\130\Setup Bootstrap\Log\Summary.txt |
| setup exit code 3010 | a reboot is pending: virsh reboot sql2016, then vm_ssh "& C:\setup\install-sql2016.ps1" (it skips what exists) |
| the evaluation expires | 180 days; slmgr /rearm on the VM extends it, or rebuild with 99-destroy.sh |
6. Removing it
./99-destroy.sh # the VM, its disk and snapshots; keeps the ISO volumes in the pool
./99-destroy.sh --all # the ISO volumes too