简体   繁体   English

pg_restore 适用于 zip 文件?

[英]pg_restore works with zip file?

Just trying to restore tutorial database from resource: http://www.postgresqltutorial.com/load-postgresql-sample-database/只是试图从资源恢复教程数据库: http : //www.postgresqltutorial.com/load-postgresql-sample-database/

so, after this code所以,在这段代码之后

pg_restore -U postgres -d dvdrental /Users/fedotarte/Downloads/dvdrental.zip

i got current message:我收到当前消息:

pg_restore: [archiver] input file does not appear to be a valid archive pg_restore: [archiver] 输入文件似乎不是有效的存档

what should i do to restore database successfully?我应该怎么做才能成功恢复数据库?

Thank you in advance!提前谢谢你!

.tar is also triggered as a invalid input file, after unzip dvdrental.zip i typed next command(pointed the folder): .tar 也被触发为无效的输入文件,在解压缩 dvdrental.zip 后,我输入了下一个命令(指向文件夹):

pg_restore -U postgres -d dvdrental /Users/fedotarte/Downloads/dvdrental

And now it works correctly!现在它可以正常工作了!

PS聚苯乙烯

i duplicated this question: Postgres Tutorial: pg_restore: [archiver] input file does not appear to be a valid archive我重复了这个问题: Postgres 教程:pg_restore:[存档] 输入文件似乎不是有效的存档

Sorry about that....对此感到抱歉......

following the instructions I unzipped the file and after finding a tar file, restored with the command:按照说明解压缩文件,找到 tar 文件后,使用以下命令恢复:

-bash-4.2$ pg_restore -d dd -F t /tmp/dvdrental.tar

so you were meant to specify format tar with -F t所以你打算用-F t指定格式 tar

-bash-4.2$ psql -d dd -c "\dt+"
                          List of relations
 Schema |     Name      | Type  |  Owner   |    Size    | Description
--------+---------------+-------+----------+------------+-------------
 public | actor         | table | postgres | 40 kB      |
 public | address       | table | postgres | 88 kB      |
 public | category      | table | postgres | 8192 bytes |
 public | city          | table | postgres | 64 kB      |
 public | country       | table | postgres | 8192 bytes |
 public | customer      | table | postgres | 96 kB      |
 public | film          | table | postgres | 464 kB     |
 public | film_actor    | table | postgres | 264 kB     |
 public | film_category | table | postgres | 72 kB      |
 public | inventory     | table | postgres | 224 kB     |
 public | language      | table | postgres | 8192 bytes |
 public | payment       | table | postgres | 888 kB     |
 public | rental        | table | postgres | 1224 kB    |
 public | staff         | table | postgres | 16 kB      |
 public | store         | table | postgres | 8192 bytes |
(15 rows)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用pg_restore创建或覆盖表 - Using pg_restore to create or overwrite tables PostgreSQL pg_restore错误:授权,撤销 - PostgreSQL pg_restore errors: GRANT, REVOKE 将 PostgreSQL pg_restore 性能从 130 小时提高 - Improve PostgreSQL pg_restore Performance from 130 hours 如果 pg_restore 正在进行,我们会在应用程序中遇到任何运行时问题吗? - Will we face any runtime issue in application if pg_restore is in progress? 如何在Windows命令行上使用pg_restore? - How to use pg_restore on Windows Command Line? pg_restore 错误:角色 XXX 不存在 - pg_restore error: role XXX does not exist 不同服务器之间的 pg_dump 和 pg_restore 具有对要转储的数据的选择标准 - pg_dump and pg_restore between different servers with a selection criteria on the data to be dumped pg_restore后,报错; PG::ConnectionBad fe_sendauth:未提供密码 - After pg_restore, an error; PG::ConnectionBad fe_sendauth: no password supplied pgadmin4的PostgreSQL pg_restore错误显示角色不存在 - PostgreSQL pg_restore error from pgadmin4 showing role doesn't exist 如何连接到postgresql google云sql实例? 需要使用pg_restore命令导入postgresql转储 - How to connect to postgresql google cloud sql instance? Need to import postgresql dump using pg_restore command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM