备份数据库:
创建一个文件 :testDB.sql
把文件的所有者和所有组改好: sudo chown postgres:postgres testDB.sql
给文件赋予写权限: chmod 755 testDB.sql
改变文件主: chown postgresql:postgresql testDB.sql
改变用户 su postgresql
进行备份 pg_dump dbName > testDB.sql
------------
导入数据库:
改变用户: su postgresql
先建立数据库: createdb -T template0 dbName
导入数据库: psql dbName < testDB.sql
最后运行: psql dbName
analyze
详见: http://www.php100.com/manual/PostgreSQL8/