Apply database updates without the data service
Your software vendor ships database changes as signed packages, but you do not run the data service. In that case, the “WKL Database Update” service applies the packages on the server: checked, backed up, in one transaction, and after your confirmation where you want one.
Solution overview
graph LR
H[Vendor] -->|signed package| E[Inbox]
E --> D[WKL Database Update service]
K[Protected configuration] --> D
D -->|check, back up, apply| B[(Database)]
A[Administrator] -->|command line| DYou install the service, create a protected configuration with the vendor's keys for each database, and give the service account the permissions it needs in the database. From then on, the service takes every package from the inbox. You confirm what should wait with the command line on the server. For all details, see the reference.
Steps
Install the package as an administrator:
msiexec /i Wkl.Data.Update-1.0.0.msi /qn /l*v install.log
The
Wkl.Data.Updateservice then runs asNT SERVICE\Wkl.Data.Update. For a group managed service account, addUPD_SERVICE_ACCOUNT=DOMAIN\name$.Give the service account a login in SQL Server and, in the database, the permissions to change its structure and back it up, for example the
db_ownerrole. If open sessions of older applications should hold a deadline back, the login also needsVIEW SERVER STATE(VIEW SERVER PERFORMANCE STATEfrom SQL Server 2022).CREATE LOGIN [NT SERVICE\Wkl.Data.Update] FROM WINDOWS; USE Kunden; CREATE USER [NT SERVICE\Wkl.Data.Update] FOR LOGIN [NT SERVICE\Wkl.Data.Update]; ALTER ROLE db_owner ADD MEMBER [NT SERVICE\Wkl.Data.Update];
If SQL Server runs on another computer, the virtual account appears there as the computer account (
DOMAIN\SERVER$); use a group managed service account instead.Create the inbox and the archive folder. Only Administrators, SYSTEM, and the service account may change them; the service creates the subfolders
doneandfailedand archives packages:mkdir D:\Updates\Kunden D:\Updates\Kunden-Archiv icacls D:\Updates\Kunden /inheritance:r /grant:r *S-1-5-32-544:(OI)(CI)F *S-1-5-18:(OI)(CI)F "NT SERVICE\Wkl.Data.Update:(OI)(CI)M" icacls D:\Updates\Kunden-Archiv /inheritance:r /grant:r *S-1-5-32-544:(OI)(CI)F *S-1-5-18:(OI)(CI)F "NT SERVICE\Wkl.Data.Update:(OI)(CI)M"
As an administrator, create the protected configuration in
C:\ProgramData\WKL\Database Update\databases\kunden.json:{ "format": 1, "id": "kunden", "product": "Kunden", "dialect": "sqlserver", "connection": { "string": "Server=sql01;Database=Kunden;Integrated Security=True;Encrypt=True" }, "keys": [ "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE…" ], "inbox": "D:\\Updates\\Kunden", "archive": "D:\\Updates\\Kunden-Archiv", "backup": { "mode": "native", "target": "D:\\Sicherung" } }keysis the public key your vendor gives you;productis the product name in the vendor's packages.backup.targetis a folder on the database server.From an elevated command prompt, check that the service accepts the configuration:
"C:\Program Files\Wkl\Database Update\Wkl.Data.Update.exe" databases
If the file is listed as left out (“nicht beachtet”), the line gives the reason.
Set what should wait, for example confirm every package and also report to a file:
Wkl.Data.Update.exe settings kunden --expand confirm --contract confirm --channels eventlog,file
Put the vendor's packages into the inbox, or hand one over directly:
Wkl.Data.Update.exe upload kunden D:\Lieferung\Kunden-schema-14.zip
See what is waiting, and confirm:
Wkl.Data.Update.exe status kunden Wkl.Data.Update.exe confirm kunden 41
Notes
- The commands run only on the server itself and only from an elevated command prompt.
- On a confirmation, the service records your Windows account in the database as the one who confirmed.
- With
contract = automatic, the service announces a breaking package and applies it at the deadline;move-deadlinemoves the deadline,cancel-noticewithdraws the announcement. - Reports go to the event log (source
WKL Database Update) and, when switched on, toC:\ProgramData\WKL\Database Update\log. For mail, add the mail server asmailto the protected configuration and turn on the channel with recipients:settings kunden --channels eventlog,email --email-to "it@example.com". - The command line and the service answer in German.
- If you run the data service, use its update module instead.