[英]Is it possible to import postgresql custom-format dump file in cloud sql without using pg_restore?
I downloaded the postgresql.dmp file from the chembl database.我从 chembl 数据库下载了 postgresql.dmp 文件。
I want to import this into gcp cloudsql.我想将其导入 gcp cloudsql。
When I run it with the console and gcloud command, I get the following error:当我使用控制台和 gcloud 命令运行它时,我收到以下错误:
Importing data into Cloud SQL instance...failed.
ERROR: (gcloud.sql.import.sql) [ERROR_RDBMS] exit status 1
The input is a PostgreSQL custom-format dump.
Use the pg_restore command-line client to restore this dump to a database.
Can I import custom-format dmp files without using the pg_restore command?我可以在不使用 pg_restore 命令的情况下导入自定义格式的 dmp 文件吗?
https://cloud.google.com/sql/docs/postgres/import-export/importing https://cloud.google.com/sql/docs/postgres/import-export/importing
There is a description of pg_restore in the document on that site, but I didn't get it right.该站点上的文档中有对 pg_restore 的描述,但我没有正确理解。
In the case of custom-format files, is it necessary to pg_restore after uploading them to the cloud shell?如果是自定义格式的文件,上传到云端shell后是否需要pg_restore?
According to the CloudSQL docs :根据CloudSQL 文档:
Only plain SQL format is supported by the Cloud SQL Admin API.
The custom format is allowed if the dump file is intended for use with pg_restore.
If you cannot use pg_restore
for some reason, I would spin up a local Postgres instance (ie, on your laptop) and use pg_restore
to restore the database.如果由于某种原因您不能使用pg_restore
,我会启动一个本地 Postgres 实例(即在您的笔记本电脑上)并使用pg_restore
来恢复数据库。
After loading into your local database, you can use pg_dump
to dump to file in plaintext format, then load into CloudSQL with the console or gcloud
command.加载到本地数据库后,您可以使用pg_dump
以明文格式转储到文件,然后使用控制台或gcloud
命令加载到 CloudSQL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.