Cannot Import the *.bak to GCP Cloud SQL not a supported compatibility level


At the time, May 25th 2021, When performing importing the *.BAK to the GCP SQL Cloud, the SQL Cloud Instance is running SQL Server 2017 Standard.

Cannot Import the *.bak to GCP Cloud SQL due to compatibility level

ERROR: (gcloud.sql.import.bak) [ERROR SQL SERVER EXTERNAL WARNING] 120 is not a supported compatibility level. Supported: [140, 130, 120, 110, 100]

  • My local SQL Server 2014, version: 120
  • GCP SQL Cloud Instance, running SQL Server 2017 Standard/Enterprise

Although my exporting server running 120 , checked by this query:

SELECT compatibility_level
FROM sys.databases
WHERE name = 'mydb-name';

and this query:

SELECT @@version

The response said:

Microsoft SQL Server 2014 (SP3-CU4) – 12.0.6329.1 (X64) Enterprise Edition

Here’re my steps:

  • Exporting the BAK file from my server (120 version)
  • Create the SQL instance with SQL Server 2017 Standard, also created the user login (same as my exporting server)
  • Perform the import command:
cloud beta sql import bak my-sql-instance gs://my-bucket/file.bak --database=mydb-name

Solution

Since no one answer my question on stackoverflow, may be no one faced this issue, so I would like to update the solution for anyone who want to reference.

  • Import the *.bak to the server which is running SQL Server version >120, ex SQL Server 2016 or newer.
  • Do the Upgrade Db compatible level to >120
  • After that, do the backup the Db from this server
  • Using the GCP command to import again/Perform the import from GCP Console.
gcloud beta sql import bak my-sql-instance gs://my-bucket/file.bak --database=mydb-name

Upgrade Db compatible level

Ref: Cannot Import the bak to GCP Cloud SQL due to compatibility level

Nam Le, https://nready.net


Leave a Reply