简体   繁体   中英

pg_restore works with zip file?

Just trying to restore tutorial database from resource: 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

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):

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

Sorry about that....

following the instructions I unzipped the file and after finding a tar file, restored with the command:

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

so you were meant to specify format tar with -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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM