我需要进行新安装,我需要从当前安装复制数据库。我需要pg_dumpall命令将远程服务器连接到本地计算机。
我已经尝试过了,但是它仅适用于转储,不适用于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
答案 0 :(得分:0)
使用pg_dumpall / psql命令转储和还原
pg_dumpall > alldb.sql
载入另一个实例
psql -f alldb.sql postgres