Google Cloud SQL恢复BAK文件 [英] Google Cloud SQL Restore BAK file
问题描述
我是Google Cloud的新手.我创建了一个Cloud SQL实例,需要从 .bak
文件还原数据.我在GCS存储桶中有 .bak
文件,并且正在尝试使用Microsoft Management Studio->任务->还原进行还原.但是我无法访问该文件.
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.
任何人都可以帮助我解决如何从 .bak
文件还原的过程吗?
Can anyone help me with the procedure on how to restore from a .bak
file?
推荐答案
您需要授予Cloud SQL服务帐户对文件存储所在存储桶的访问权限.
You need to give the Cloud SQL service Account access to the bucket where the file is saved.
在 Cloud Shell 上,运行以下命令:
gcloud sql instances describe [INSTANCE_NAME]
在输出中,搜索"serviceAccountEmailAddress"字段,其中是SA电子邮件的副本.
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.
还请记住:
您不能导入从更高版本的SQL Server导出的数据库.例如,如果导出了SQL Server 2017 Enterprise版本,则无法将其导入SQL Server 2017 Standard版本.
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.
这篇关于Google Cloud SQL恢复BAK文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!