1

我需要进行新安装,我需要从当前安装中复制我的数据库。我需要远程服务器到本地机器的 pg_dumpall 命令。

我已经尝试过了,但它只适用于转储,不适用于转储

pg_dump -h hostname -Fc -o -U username database > databaseall.sql

pg_dumpall -h hostname -p 5432 -U username > databaseall.sql

给出错误

pg_dumpall: query failed: ERROR:  permission denied for relation pg_authid
pg_dumpall: query was: SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolconnlimit, rolpassword, rolvaliduntil, rolreplication, rolbypassrls, pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, rolname = current_user AS is_current_user FROM pg_authid ORDER BY 2

pg_dumpall -h hostname -p 5432 -U username -c -o -f "databaseall.sql"

给出错误

pg_dumpall: query failed: ERROR:  permission denied for relation pg_authid
pg_dumpall: query was: SELECT rolname FROM pg_authid ORDER BY 1
4

1 回答 1

0

使用 pg_dumpall/psql 命令转储和恢复

pg_dumpall > alldb.sql

加载另一个实例

psql -f alldb.sql postgres
于 2019-06-26T03:53:17.170 回答