2015-11-13 41 views
0

當恢復這樣的轉儲:pg_restore在告訴模式「測試」已存在,但它實際上不是

pg_restore --clean --create --exit-on-error --dbname=test test.tar 

這些錯誤消息得到了打印出來:

pg_restore: [archiver (db)] Error while PROCESSING TOC: 
pg_restore: [archiver (db)] Error from TOC entry 21; 2615 80924 SCHEMA test test 
pg_restore: [archiver (db)] could not execute query: ERROR: schema "test" already exists 
Command was: CREATE SCHEMA test; 

但當:

select schema_name from information_schema.schemata; 

這些得到打印出來

schema_name  
-------------------- 
pg_toast 
pg_temp_1 
pg_toast_temp_1 
pg_catalog 
public 
information_schema 

似乎模式「測試」尚不存在,爲什麼我會得到這種錯誤?

+0

如果您不是超級用戶,'schemata'可能會隱藏模式。此外postgres版本丟失。請參閱http://www.postgresql.org/docs/current/static/infoschema-schemata.html –

回答

0

您是否試圖自己尋找答案? 什麼操作系統,postgres轉儲的哪個版本被恢復到同一版本?

閱讀這篇文章,也許這有助於

link

它指出,有與--clean參數, 一些瑣碎的問題,你應該嘗試手動創建數據庫,並恢復它沒有 創建和清理選項。

相關問題