注:命令需在服务器运行

备份

1
2
--backup_name: /soft/database_name.bak
pg_dump -h localhost -p 5432 -U postgres -d database_name > backup_name

还原

1
2
--backup_name: /soft/database_name.bak
psql -h localhost -U postgres -d database_name < backup_name