Skip to content

Failed to import database - Collation 2052 is not supported #292

@scott-avery

Description

@scott-avery
  • SqlPackage or DacFx Version: 162.0.52.1
  • .NET Framework (Windows-only) or .NET Core: 1.1.0
  • Environment (local platform and source/target platforms): ubuntu 20.04

Steps to Reproduce:
In my team, we want to import an exported bacpac from azure sql to local machine. Then we use the official sql server for linux image and sql package to restore the database.

Our bacpac file use the collcation with Chinese_PRC_CI_AS, whose LCID is 2052

We use the following to build a custom image.

FROM mcr.microsoft.com/mssql/server
USER root
VOLUME download
RUN apt-get update \
    && ACCEPT_EULA=Y apt-get install -y \
        unzip \
        msodbcsql18 \
        mssql-tools18 \
        libunwind8 \
        libicu-dev
RUN wget --no-check-certificate -O sqlpackage.zip https://download.microsoft.com/download/9/1/6/9167b423-2087-4210-93ec-c9467a408ea2/sqlpackage-linux-x64-zh-Hans-162.0.52.1.zip 
  && unzip -q sqlpackage.zip -d /opt/sqlpackage || true
  && chmod +x /opt/sqlpackage/sqlpackage 
  && rm /sqlpackage.zip
#USER mssql
ENV PATH=$PATH:/opt/mssql-tools/bin:/opt/sqlpackage

And we use the following commands to initiate the container and import the bacpac file.

docker run -d -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Admin12345-' -e "MSSQL_COLLATION=Chinese_PRC_CI_AS" -e "MSSQL_LCID=2052" -p 1433:1433 --name sqlfts0 db-test
docker exec -it sqlfts0 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'Admin12345-' -Q 'CREATE DATABASE MyDb0'
docker cp ~/Downloads/database.bacpac sqlfts0:/download/database.bacpac
docker exec -it sqlfts0 /opt/sqlpackage/sqlpackage /A:Import /tsn:localhost /tu:SA /tp:'Admin12345-' /tdn:MyDb0 /sf:/download/database.bacpac /TargetEncryptConnection:False /TargetTrustServerCertificate:True

However, the import failed.

Importing to database 'MyDb1' on server 'localhost'.
Creating deployment plan
Initializing deployment
*** Error importing database:Could not read schema model header information from package.
Collation 2052 is not supported. You must specify one of the supported collations in the Collation attribute.
Time elapsed 0:00:01.68

Unfortunately, we can not find any solution to fix the problem. Seeking help from the community.

(DacFx/SqlPackage/SSMS/Azure Data Studio)

Metadata

Metadata

Assignees

Labels

P1P1 bugbugSomething isn't workingfixed-pending-releaseFix in upcoming release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions