Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non default collation fails on msdb when MSSQL_AGENT_ENABLED=True #629

Open
WantStuff opened this issue Jul 4, 2020 · 2 comments
Open

Comments

@WantStuff
Copy link

WantStuff commented Jul 4, 2020

Changing the collation from default using MSSQL_COLLATION AND enabling SQL Agent using MSSQL_AGENT_ENABLED fails to set the collation on msdb (the other DBs are correctly set).

Error:
The database could not be exclusively locked to perform the operation.

Run command:

docker run -d \
    --name mssql-u1 \
    -h mssql-u1 \
    --restart always \
    --network=mybridge-net \
    -e 'ACCEPT_EULA=Y' \
    -e 'MSSQL_PID=Standard' \
    -e 'SA_PASSWORD=P4ssw0rd!' \
    -e 'MSSQL_COLLATION=Latin1_General_CI_AS' \
    -e 'MSSQL_AGENT_ENABLED=True' \
    -m 8G \
    -p 14331:1433 \
    -v /data/docker/container-data/mssql-u1/restore:/var/opt/mssql/restore \
    -v /mnt/nas2/mssql-u1/Backup:/var/opt/mssql/backup \
    -v mssql-u1-data:/var/opt/mssql \
    mcr.microsoft.com/mssql/server:2017-latest

Logs:

2020-07-04 14:20:59.24 Server      Microsoft SQL Server 2017 (RTM-CU20) (KB4541283) - 14.0.3294.2 (X64)
        Mar 13 2020 14:53:45
        Copyright (C) 2017 Microsoft Corporation
        Standard Edition (64-bit) on Linux (Ubuntu 16.04.6 LTS)
. . . 
2020-07-04 14:21:52.95 spid10s     Warning ******************
2020-07-04 14:21:52.97 spid10s     Attempting to change default collation to Latin1_General_CI_AS.
2020-07-04 14:21:53.12 spid10s      index restored for master.syspriorities.
2020-07-04 14:21:53.15 spid10s      index restored for master.sysbrickfiles.
2020-07-04 14:21:53.17 spid10s      index restored for master.sysowners.
2020-07-04 14:21:53.19 spid10s      index restored for master.sysdbreg.
2020-07-04 14:21:53.22 spid10s      index restored for master.sysschobjs.
2020-07-04 14:21:53.23 spid10s      index restored for master.sysextsources.
2020-07-04 14:21:53.25 spid10s      index restored for master.sysextfileformats.
2020-07-04 14:21:53.26 spid10s      index restored for master.syscolpars.
2020-07-04 14:21:53.27 spid10s      index restored for master.sysxlgns.
2020-07-04 14:21:53.29 spid10s      index restored for master.sysxsrvs.
2020-07-04 14:21:53.30 spid10s      index restored for master.sysnsobjs.
2020-07-04 14:21:53.32 spid10s      index restored for master.syscerts.
2020-07-04 14:21:53.33 spid10s      index restored for master.sysrmtlgns.
2020-07-04 14:21:53.35 spid10s      index restored for master.sysxprops.
2020-07-04 14:21:53.36 spid10s      index restored for master.sysscalartypes.
2020-07-04 14:21:53.38 spid10s      index restored for master.sysidxstats.
2020-07-04 14:21:53.39 spid10s      index restored for master.sysendpts.
2020-07-04 14:21:53.41 spid10s      index restored for master.sysclsobjs.
2020-07-04 14:21:53.42 spid10s      index restored for master.sysremsvcbinds.
2020-07-04 14:21:53.43 spid10s      index restored for master.sysrts.
2020-07-04 14:21:53.44 spid10s      index restored for master.sysasymkeys.
2020-07-04 14:21:53.46 spid10s      index restored for master.syssqlguides.
2020-07-04 14:21:53.47 spid10s      index restored for master.syssoftobjrefs.
2020-07-04 14:21:53.49 spid10s      index restored for master.MSreplication_options.
2020-07-04 14:21:53.55 spid10s      index restored for tempdb.syspriorities.
2020-07-04 14:21:53.56 spid10s      index restored for tempdb.sysowners.
2020-07-04 14:21:53.57 spid10s      index restored for tempdb.sysdbreg.
2020-07-04 14:21:53.59 spid10s      index restored for tempdb.sysschobjs.
2020-07-04 14:21:53.60 spid10s      index restored for tempdb.sysextsources.
2020-07-04 14:21:53.61 spid10s      index restored for tempdb.sysextfileformats.
2020-07-04 14:21:53.63 spid10s      index restored for tempdb.syscolpars.
2020-07-04 14:21:53.64 spid10s      index restored for tempdb.sysxlgns.
2020-07-04 14:21:53.65 spid10s      index restored for tempdb.sysxsrvs.
2020-07-04 14:21:53.66 spid10s      index restored for tempdb.sysnsobjs.
2020-07-04 14:21:53.67 spid10s      index restored for tempdb.syscerts.
2020-07-04 14:21:53.68 spid10s      index restored for tempdb.sysrmtlgns.
2020-07-04 14:21:53.69 spid10s      index restored for tempdb.sysxprops.
2020-07-04 14:21:53.70 spid10s      index restored for tempdb.sysscalartypes.
2020-07-04 14:21:53.71 spid10s      index restored for tempdb.sysidxstats.
2020-07-04 14:21:53.72 spid10s      index restored for tempdb.sysendpts.
2020-07-04 14:21:53.73 spid10s      index restored for tempdb.sysclsobjs.
2020-07-04 14:21:53.74 spid10s      index restored for tempdb.sysremsvcbinds.
2020-07-04 14:21:53.75 spid10s      index restored for tempdb.sysrts.
2020-07-04 14:21:53.76 spid10s      index restored for tempdb.sysasymkeys.
2020-07-04 14:21:53.77 spid10s      index restored for tempdb.syssqlguides.
2020-07-04 14:21:53.78 spid10s      index restored for tempdb.syssoftobjrefs.
2020-07-04 14:21:53.79 spid10s      index restored for tempdb.#A2DCC187.
2020-07-04 14:21:53.86 spid10s      index restored for model.syspriorities.
2020-07-04 14:21:53.88 spid10s      index restored for model.sysowners.
2020-07-04 14:21:53.89 spid10s      index restored for model.sysdbreg.
2020-07-04 14:21:53.92 spid10s      index restored for model.sysschobjs.
2020-07-04 14:21:53.94 spid10s      index restored for model.sysextsources.
2020-07-04 14:21:53.96 spid10s      index restored for model.sysextfileformats.
2020-07-04 14:21:53.98 spid10s      index restored for model.syscolpars.
2020-07-04 14:21:53.99 spid10s      index restored for model.sysxlgns.
2020-07-04 14:21:54.00 spid10s      index restored for model.sysxsrvs.
2020-07-04 14:21:54.02 spid10s      index restored for model.sysnsobjs.
2020-07-04 14:21:54.03 spid10s      index restored for model.syscerts.
2020-07-04 14:21:54.05 spid10s      index restored for model.sysrmtlgns.
2020-07-04 14:21:54.06 spid10s      index restored for model.sysxprops.
2020-07-04 14:21:54.08 spid10s      index restored for model.sysscalartypes.
2020-07-04 14:21:54.10 spid10s      index restored for model.sysidxstats.
2020-07-04 14:21:54.11 spid10s      index restored for model.sysendpts.
2020-07-04 14:21:54.13 spid10s      index restored for model.sysclsobjs.
2020-07-04 14:21:54.14 spid10s      index restored for model.sysremsvcbinds.
2020-07-04 14:21:54.15 spid10s      index restored for model.sysrts.
2020-07-04 14:21:54.16 spid10s      index restored for model.sysasymkeys.
2020-07-04 14:21:54.18 spid10s      index restored for model.syssqlguides.
2020-07-04 14:21:54.19 spid10s      index restored for model.syssoftobjrefs.
2020-07-04 14:22:14.22 spid10s     Error: 5030, Severity: 16, State: 5.
2020-07-04 14:22:14.22 spid10s     The database could not be exclusively locked to perform the operation.
2020-07-04 14:22:14.26 spid10s     Error: 3434, Severity: 20, State: 1.
2020-07-04 14:22:14.26 spid10s     Cannot change sort order or locale. An unexpected failure occurred while trying to reindex the server to a new collation. SQL Server is shutting down. Restart SQL Server to continue with the sort order unchanged. Diagnose and correct previous errors and then retry the operation.
2020-07-04 14:22:14.34 spid10s     SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.```
@WantStuff
Copy link
Author

WantStuff commented Jul 4, 2020

For anyone having the same issue, there is a workaround, but you must map a persistent storage for the databases (e.g. -v mssql-u1-data:/var/opt/mssql).

  1. Perform the docker run without specifying MSSQL_AGENT_ENABLED; this will create the system databases with your collation.
  2. Wait for the container to fully initialise (check the logs)
  3. Stop and then delete the container.
  4. Perform the docker run again and this time include -e 'MSSQL_AGENT_ENABLED=True'

@kmute90
Copy link

kmute90 commented Nov 26, 2021

it is still a problem... when can we expect a fix or a reply?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants