1.先重命名data文件
sudo mv data data2
2.重新初始化data目录
service postgresql initdb
如果是debian,ubuntu系统会有所不同
/usr/lib/postgresql/8.4/bin/initdb -D /path/to/data
3. 启动或者重启 pgsql
4. 还原备份文件
gzip -dc /path/to/backfile.gz | pg_restore -U username -d dbname
追问username指的是数据库的登录名称么?
还有dbname是表的名字么?
追答数据库登录名称,默认可能是postgres
可以自己查看各个参数
pg_restore --help
追问-U说是给指定的用户,这个用户怎么确定呀