简体   繁体   English

是否可以在不使用 pg_restore 的情况下在云 sql 中导入 postgresql 自定义格式转储文件?

[英]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.

相关问题 输入是PostgreSQL自定义格式转储。使用pg_restore命令行客户端将此转储还原到数据库。 - The input is a PostgreSQL custom-format dump. Use the pg_restore command-line client to restore this dump to a database. 如何连接到postgresql google云sql实例? 需要使用pg_restore命令导入postgresql转储 - How to connect to postgresql google cloud sql instance? Need to import postgresql dump using pg_restore command 将 PostgreSQL SQL 转储转换为 PostgreSQL 自定义格式转储 - Convert PostgreSQL SQL dump to PostgreSQL custom-format dump 在转储文件上使用pg_restore - Using pg_restore on dump file 如何使用 pg_restore 在 cloudsql 中导入转储文件? - How to use pg_restore to import dump file in cloudsql? PostgreSQL:提高 pg_dump、pg_restore 性能 - PostgreSQL: improving pg_dump, pg_restore performance 用于 Postgresql 迁移的 pg_dump/pg_restore 的理想版本 - Ideal version of pg_dump/pg_restore for Postgresql Migration 恢复大型 PostgreSQL 转储(gzipped -.sql.gz)并出现跳过错误(psql/pg_restore) - Restore large PostgreSQL dump (gzipped - .sql.gz) with skipping errors (psql/pg_restore) PostgreSQL 的 pg_dump 和 pg_restore 会影响缓冲区缓存和内核文件系统缓存吗? - Will pg_dump and pg_restore of PostgreSQL affect the buffer cache and kernel file system cache? 如何从自定义格式转储中恢复 postgres 数据库? - How to restore a postgres database from a custom-format dump?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM