只是尝试从资源恢复教程数据库: http://www.postgresqltutorial.com/load-postgresql-sample-database/
所以,在此代码之后
pg_restore -U postgres -d dvdrental /Users/fedotarte/Downloads/dvdrental.zip
我收到了最新消息:
pg_restore:[archiver]输入文件似乎不是有效存档
我该怎么做才能成功恢复数据库?
提前谢谢!
答案 0 :(得分:2)
.tar也被触发为无效的输入文件,解压后dvdrental.zip我输入了下一个命令(指向文件夹):
pg_restore -U postgres -d dvdrental /Users/fedotarte/Downloads/dvdrental
现在它正常工作了!
P.S。
我复制了这个问题: Postgres Tutorial: pg_restore: [archiver] input file does not appear to be a valid archive
对此抱歉......
答案 1 :(得分:1)
在解压缩文件后,我解压缩文件,找到tar文件后,使用命令恢复:
-F t
所以你打算用-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)
{{1}}