![](/img/trans.png)
[英]The input is a PostgreSQL custom-format dump. Use the pg_restore command-line client to restore this dump to a database.
[英]How to restore a postgres database from a custom-format dump?
我在使用 pg_restore 恢復數據庫時遇到問題。 我在運行 High Sierra (10.13.6) 的 Mac 上安裝了 Postgres 12.2。 它是用 Brew 安裝的。
我用表“foo”創建了一個簡單的數據庫“foo”來測試它:
Nates-MacBook-Pro:k8s natereed$ psql -d foo
psql (12.2, server 12.1)
Type "help" for help.
foo=# SELECT table_schema,table_name
FROM information_schema.tables
WHERE table_schema='public' ORDER BY table_schema,table_name;
table_schema | table_name
--------------+------------
public | foo
(1 row)
生成轉儲:
pg_dump -Fc foo -f foo.backup
當我嘗試恢復時,什么也沒有發生。 pg_restore 只是掛起:
pg_restore -h localhost -p 5432 -U postgres -v -Fc -f foo.backup
我已經嘗試過這個命令的各種排列,但每次它只是掛起。 在活動監視器中,我看到了進程,但它沒有使用任何 CPU。
在線幫助說:
pg_restore restores a PostgreSQL database from an archive created by pg_dump.
Usage:
pg_restore [OPTION]... [FILE]
General options:
-d, --dbname=NAME connect to database name
-f, --file=FILENAME output file name
-F, --format=c|d|t backup file format (should be automatic)
-l, --list print summarized TOC of the archive
-v, --verbose verbose mode
-V, --version output version information, then exit
-?, --help show this help, then exit
對於 pg_restore -f 是 output 文件的參數:它不是輸入文件。 刪除 -f。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.