使用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