2012-03-23 21 views
14

我一直在使用的pg_dump以下語法和恢復pg_restore在

pg_dump eval --inserts -b -c --encoding UTF8 -Fc -f eval.sql.tar.gz -x -U postgres 
createdb -T template0 test -U postgres 
pg_restore -d test eval.sql.tar.gz -e -U postgres 

轉儲是全成沒有錯誤,但恢復TOC的錯誤作出了一些錯誤,我傾倒在同一臺機器上有相同的用戶恢復和特權所有...

我與其他格式嘗試了也,平原,焦油,壓縮的全得到了同樣的錯誤..

我PG的版本是8.4.11和psql版本8.4.11是

我不知道是什麼讓這些錯誤..任何人都可以幫我

pg_restore: [archiver (db)] Error while PROCESSING TOC: 
pg_restore: [archiver (db)] Error from TOC entry 4965; 0 138871 TABLE DATA ir_act_report_xml insigni 
pg_restore: [archiver (db)] could not execute query: ERROR: invalid input syntax for integer: "purchase.order" 
LINE 1: ...st for Quotation', 'ir.actions.report.xml', NULL, 'purchase.... 
                  ^
    Command was: INSERT INTO ir_act_report_xml VALUES (350, 'Request for Quotation', 'ir.actions.report.xml', NULL, 'purchase.order', 'purcha... 
+1

看來你是轉儲SQL腳本,需要使用PSQL運行,而不是pg_r estore – 2012-03-23 11:38:05

回答

18

這並獲得成功

pg_dump database_name -c -Ft -f file_name.tar 

pg_restore -d database_name -c file_name.tar 

這一點,我是想用了,包括C(清潔)恢復之前

即使-c包括來自pg_dump它不是在pg_restore的,除非我們說使用使用

...

+2

對於'-c'標誌+1。 – Jonah 2013-11-06 01:07:19

+4

使用「乾淨」標誌也會導致很多問題,因爲它會在使用新數據庫時抱怨丟失的對象。 – cslotty 2015-07-14 09:54:39

相關問題