2014-01-28 96 views
0

我有SQL文件的完全轉儲,如大小1.3GB從SQL文件恢復單個錶轉儲

dump_full.sql它有一個像

dancing_core_spice 
dancing_sea_beast 

forde_clear_one 
forde_super_now 

一些表現在,我想是需要恢復/取/轉儲這些表的only datadump_full.sql文件

psql -U postgres --table=dancing_core_spice dump_full.sql > dancing_core_spice.sql 

我試圖上述命令,但它不工作

所以,任何人都可以請讓我知道如何利用僅單個表的轉儲從SQL文件(完全轉儲)

回答

1

對於這些類型的操作轉儲文件應與pg_dump創建的PostgreSQL自定義格式:

pg_dump -Fc 

然後你就可以用pg_restore

pg_restore --table=dancing_core_spice dump_full.sql > dancing_core_spice.sql 

恢復單個表This question提供TI ps來處理您的實際情況:

  • 從文件中提取sql代碼。用編輯器,腳本或任何
  • 恢復轉儲臨時數據庫,並與pg_dump的
+0

你不能用一個SQL文件作爲輸入使用pg_restore的再次傾倒。 –

+0

它給我'pg_restore:[archiver]輸入文件看起來像是文本格式轉儲。請使用psql.' –

+0

這是正確的@a_horse_with_no_name,我編輯我的答案。 –