对postgresql的命令行操作,导入导入SQL资料,以及生成INSERT语句

对postgresql的命令行操作,导入导入SQL文件,以及生成INSERT语句

xxx\\PostgreSQL\9.0\bin

然后,使用dos窗口
进入这个位置

导入

导入schema 到 新instance中 (新instance名字叫pis2)
psql -d pis2 -h 192.168.16.179 -p 5432 -U postgres -f ../data/output.sql
[2011-3-28 14:04:40] 张义家: 根据自己的postgre 来导入这个库

导出

psql -d pis2 -h 192.168.16.179 -p 5432 -U postgres -f ../data/output.sql
这里 ,最后的xxx.sql
 是你要导入的数据库文件

导出INSERT语句

首先要定位到这里
D:\Program Files\PostgreSQL\9.0\bin
然后执行该命令
pg_dump   -h 192.168.16.179 -p 5432  -U postgres  --column-inserts -t pisdb.t_p_mp_rpt  -f  ../data/output.sql  pis2

pis为数据库服务名,pisdb为schema名