postgres导入表数据

1.psql -h localhost -d p2pvpn_server -U openfire 连接某个指定的数据库
2.COPY statsconnection (statsnodes, relayconns, directconns, "timestamp", "year", "month", "day", "hour", "minute") FROM '/home/gaoyibo/backup.sql' 命令会自动将文件中的data部分insert.比如下面的数据,当读到\时,就结束插入.

0    0    0    2010-04-30 02:10:57.935    2010    4    30    2    10
0    0    0    2010-04-30 02:25:57.934    2010    4    30    2    25
\.


如果使用COPY * FROM stdin注意以下二点
1.输入被复制数据跟一个换行符
2.结束了一个反斜杠

posted @ 2010-04-30 16:36  highriver  阅读(878)  评论(0编辑  收藏  举报