postgresql数据库备份与还原
备份数据库:
$ su - postgres
$ pg_dump testdb > testdb.sql
备份单个表:
$ pg_dump --table=aa testdb > testdb_aa.sql
仅备份单个表的数据(不要结构)
$ pg_dump --table=aa --data-only testdb > testdb_aa.sql
恢复数据库:
$ su - postgres
$ createdb testdb
$ psql testdb < testdb.sql (恢复单个表也是这个命令)
转载于:https://blog.51cto.com/yangzhiming/1621432