Google Cloud SQL Restore BAK file

眉间皱痕 提交于 2021-01-29 16:42:13

问题


I am new in Google Cloud. I created a Cloud SQL Instance and I need to restore the data from a .bak file. I have the .bak file in a GCS bucket, and I am trying to restore using Microsoft Management Studio -> Task -> Restore. But I'm not able to access the file.

Can anyone help me with the procedure on how to restore from a .bak file?


回答1:


You need to give the Cloud SQL service Account access to the bucket where the file is saved.

On Cloud Shell run the following:

gcloud sql instances describe [INSTANCE_NAME]

On the output search for the field "serviceAccountEmailAddress" an copy the SA email.

Then again on cloud shell run the following:

gsutil iam ch serviceAccount:<<SERVICE_ACCOUNT_EMAIL>:legacyBucketWriter gs://<<BUCKET_NAME>>


gsutil iam ch serviceAccount:<<SERVICE_ACCOUNT_EMAIL>:objectViewer gs://<<BUCKET_NAME>>

That should give the service account permission to access the bucket and retrieve the file, also here is the guide on doing the import, take in mind that doing the import will override all the data on the DB.

Also remember that:

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.



来源:https://stackoverflow.com/questions/61915558/google-cloud-sql-restore-bak-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!