close
PostgreSQL 備份與還原(WINDOWS 指令)

資料來源:http://ms7.fhsh.tp.edu.tw/blog/shyong/archives/480

::OK->備份
pg_dump -i -h 127.0.0.1 -p 5432 -U postgres -F c -b -v -f c:\v7-db-20151106.backup_c.sql v7
::school 資料庫有資料
::OK->還原
pg_restore -h 127.0.0.1 -p 5432 -U postgres -F c -c -d v7 c:\v7-db-20151106.backup_c.sql

參數介紹:

-F, --format=c|t|p          輸出檔格式 (自訂、tar、純文字)
-h, --host=主機名稱      資料庫伺服器主機或socket目錄
-p, --port=埠號          資料庫伺服器埠號
-U, --username=NAME      以指定的資料庫使用者連線
-c, --clean                 重新建立前先清除 (捨棄) 資料庫物件
-d,資料庫
-v, --verbose               詳細資訊模式
-f, --file=檔名         輸出檔名稱
arrow
arrow

    Johnson峰 發表在 痞客邦 留言(0) 人氣()