Tuesday, November 10, 2020

[google-cloud-sql-discuss] Re: unknown error and invalid argument when importing .bak backup

I exported the database using sql management studio in a bak format.
I transferred this to a google storage bucket.
I then imported this with the gcloud sdk using the command    gcloud sql import bak %servername% gs://%bucketname%/%dbname%.bak --database=%dbname% (variables obfusticated for security)

On Tuesday, 10 November 2020 at 19:25:30 UTC Elliott (Google Cloud Platform Support) wrote:
Hello,

To offer further advice on this, can you please provide the steps you followed to import your database?

On Tuesday, November 10, 2020 at 9:49:38 AM UTC-5 richa...@tm2app.co.uk wrote:
I have also tried generating a sql script to export the schema and data with the sql version of the script set to 2017 and this doesn't seem to have worked either.

gcloud said it successfully imported the sql file but there doesn't seem to be much of anything in the database.

On Tuesday, 10 November 2020 at 09:54:30 UTC Richard Rea wrote:
Hi after double checking this it seems that the source DB is from server 2019 express and I'm trying to import into 2017 web.
SQL Service account is confirmed to have storage admin access.
I was already using the gcloud commands to import the bak file and that is what gave the error in my previous post.

On Tuesday, 10 November 2020 at 00:47:29 UTC Manpreet Sidhu (Google Cloud Support) wrote:
Hi!

This is an odd issue. I see that you mention that you are importing a backup from a Linux installation of SQL Server 2017 to the Cloud SQL offering of SQL Server 2017. I am assuming that you are importing a BAK file.

You are also certain that the SQL Service Account has the correct permissions to the Cloud Storage Bucket and that the DB doesn't exist.

Can you please verify if the version of your Linux backup is the same(or lower) than the Cloud SQL version of SQL Server? This is because you cannot import a database that was exported from a higher version of SQL Server. For example, if you exported a SQL Server 2017 Enterprise version, you cannot import it into a SQL Server 2017 Standard version.

And can you also please try using the Console to import the SQL file. If you are already using the Console, can you please attempt with the gcloud command[1]. This will isolate the Console from the shell.

We look forward to seeing your response.

On Monday, November 9, 2020 at 12:44:25 PM UTC-5 richa...@tm2app.co.uk wrote:
Hi there

I'm getting an error when trying to import a database from a Linux SQL machine into a Cloud SQL instance

The database name does not already exist.  The compatibility level is 100.  The Cloud SQL is 2017.  The cloud sql service account has permissions on the storage bucket the backup is in.  The backup is full and uncompressed.  

I'm out of ideas as to what is causing this and the error message isn't very helpful.  Does anyone have any suggestions?

Importing data into Cloud SQL instance...failed.
DEBUG: (gcloud.sql.import.bak) [INVALID_ARGUMENT]
Traceback (most recent call last):
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 983, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 808, in Run
    resources = command_instance.Run(args)
  File "/usr/lib/google-cloud-sdk/lib/surface/sql/import/bak.py", line 87, in Run
    return import_util.RunBakImportCommand(args, client)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/command_lib/sql/import_util.py", line 173, in RunBakImportCommand
    return RunImportCommand(args, client, sql_import_context)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/command_lib/sql/import_util.py", line 111, in RunImportCommand
    sql_client, operation_ref, 'Importing data into Cloud SQL instance')
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/sql/operations.py", line 100, in WaitForOperation
    sleep_ms=_BaseOperations._INITIAL_SLEEP_MS)
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 229, in RetryOnResult
    if not should_retry(result, state):
  File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/sql/operations.py", line 80, in ShouldRetryFunc
    raise result
googlecloudsdk.api_lib.sql.exceptions.OperationError: [INVALID_ARGUMENT]

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/67ffa376-2145-4a92-9ae0-f191e4383528n%40googlegroups.com.

No comments:

Post a Comment