microsoft / mssql-docker

Official Microsoft repository for SQL Server in Docker resources
MIT License
1.75k stars 760 forks source link

Modify default sqlcollation for mssql linux container #219

Open CindyXing opened 6 years ago

CindyXing commented 6 years ago

There is no way to modify the sqlcollation for the mssql linux container. This can be done for the mssql windows container by updating the setup command in the dockerfile.

Also, no way to attach DB or restore DB using existing mdf/bak file for the linux container.

Thanks

twright-msft commented 6 years ago

You can set the collation using the MSSQL_COLLATION environment variable. https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-environment-variables

Configuring attach/restore DB for Linux containers through an env var is tracked by this issue:

4

isupovs commented 1 year ago

Hi, I'm trying to start backup restore from another container using docker-compose.

2022-12-21 11:33:26.30 spid21s Attempting to change default collation to Cyrillic_General_CI_AS. 2022-12-21 11:33:26.83 spid21s index restored for master.syspriorities. 2022-12-21 11:33:34.85 spid21s Error: 1205, Severity: 13, State: 56. 2022-12-21 11:33:34.85 spid21s Transaction (Process ID 21) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. 2022-12-21 11:33:34.86 spid21s Error: 3434, Severity: 20, State: 1. 2022-12-21 11:33:34.86 spid21s 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. 2022-12-21 11:33:34.88 spid21s SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.

But if I don't change the default collation it works ok. Is there a way to wait for collation changing? Mabye I can't build an image on top of the official image with predefined collation?