天天看點

postgresql 導出某張表,然後恢複到另一個庫中

導出某張表: pg_dump -Udelta -h localhost -p 5432 -t display_fields -s -f ddd.sql  aa_db

恢複到bb_db資料庫中: psql -U delta -h localhost -p 5432 -d  bb_db  -f ./ddd.sql

-s: 不導出資料,隻導出結構

-c: 建立對象前先删除對象,就是先按drop主句生成檔案,再按create語句生成檔案 。