在Windows上备份:
pg_dump -U postgres olddb > db.backup
在Linux上恢复:
#su - postgres
$createdb newdb
$initdb newdb
$psql -U postgres newdb < db.backup
$psql newdb
#select * from tablename; (看看数据是否都过来了:)
pg_dump -U postgres olddb > db.backup
在Linux上恢复:
#su - postgres
$createdb newdb
$initdb newdb
$psql -U postgres newdb < db.backup
$psql newdb
#select * from tablename; (看看数据是否都过来了:)

本文介绍如何在Windows和Linux环境下使用pg_dump命令备份PostgreSQL数据库,并详细展示了通过一系列命令进行数据库恢复的过程。
2995

被折叠的 条评论
为什么被折叠?



