备份全部数据库:

cd /usr/local/pgsql/bin

./pg_dumpall -U postgres > /root/pgall.sql

恢复全部数据:

./psql -U postgres -f /root/pgall.sql

备份单个数据库

./pg_dump -U postgres > /root/singel.sql

恢复:

./psql -U postgres dbname < /root/singel.sql