大師 我需要備份和恢復一個PostgreSQL數據庫。 我的操作系統版本是Ubuntu的14.04 64位,而PostgreSQL是:如何備份和恢復一個PostgreSQL數據庫?
gid: ~/works $ pg_config --version
PostgreSQL 9.3.15
我用pg_dump的備份數據庫:
gid: ~/works $ pg_dump -U db_name_user -F t db_name > db_name.tar
我嘗試使用pg_restore的恢復數據庫並獲取失敗:
gid: ~/works $ pg_restore -U db_name_user -F t -d db_name db_name.tar
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3621; 0 0 COMMENT EXTENSION plpgsql
pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of extension plpgsql
Command was: COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
pg_restore: WARNING: no privileges could be revoked for "public"
pg_restore: WARNING: no privileges could be revoked for "public"
pg_restore: WARNING: no privileges were granted for "public"
pg_restore: WARNING: no privileges were granted for "public"
WARNING: errors ignored on restore: 1
我不知道這是什麼意思? 如何備份和恢復PostgreSQL數據庫?
非常感謝。
------------------------ update 1 -------------------- ----
即使我補充說:「--no所有者」選項時的pg_dump和pg_restore的,我還是得到了同樣的錯誤消息:
gid:~/works $ pg_restore -U db_name_user -O -Ft -d db_name db_name.tar
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3621; 0 0 COMMENT EXTENSION plpgsql
pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of extension plpgsql
Command was: COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
pg_restore: WARNING: no privileges could be revoked for "public"
pg_restore: WARNING: no privileges could be revoked for "public"
pg_restore: WARNING: no privileges were granted for "public"
pg_restore: WARNING: no privileges were granted for "public"
WARNING: errors ignored on restore: 1
您可以放心地忽略此錯誤。缺乏對plpgsql的評論不會影響你的代碼。如果你想以超級用戶的身份運行pg_restore,你不應該看到這樣的警告 –