yandyand

导航

pg数据库的导入导出功能

使用pg_dumo进行导出数据

基于表进行导出:

pg_dump -U postgres -t test1 yy >/root/test1.sql

-U 用户名

-t 表名

yy库名

 

基于库进行导出:

pg_dump -U postgres  -d yy >/root/test1.sql

 

导出时不导出建表语句只导出数据

pg_dump -U postgres -t test1 yy -a >/root/test1.sql

 

恢复:

psql -U postgres -d yy -t test1 </root/test2.sql 

 

posted on 2020-07-14 15:01  yandyand  阅读(1331)  评论(0编辑  收藏  举报