Обсуждение: unable to restore from a pgdump file
Hi. I am trying to restore a database from a pgdump file, something that I've sucessfully done before. I created a new database cluster, created the database that I want to restore using create database subptf with template = template0; and then I tried to restore the database using ./psql subptf < subptf.pgdump The first part of what I get is ERROR: syntax error at or near "PGDMP" LINE 1: PGDMP ^ GRANT GRANT ERROR: syntax error at or near "" LINE 1: ptffield integer, ^ ERROR: syntax error at or near "" LINE 1: f1 integer, ^ ERROR: syntax error at or near "" LINE 1: AS $$ ^ ERROR: syntax error at or near "" LINE 1: AS $_X$ ^ ERROR: syntax error at or near "" LINE 1: AS $_X$ ^ ERROR: syntax error at or near "" LINE 1: AS $$ ... The last part of what I get is ... vJ?N'G?D@??????Q7?2G?0k??$??Slz^P?>??k??|????A?ʞ?A??f-j \p: extra argument "Zr_?Q«+_???c?ܦ?E??L??@???ߒQ????y+?V?*?x?D}x?R?ǯ?67??e???Y?/4O?f?u??ڇW?5???.??A????????N???@??_???--kD??I?SatB?Ak????Ƴ?ҕZ?K??&?{?zUt_???{ ?????Tt ???Au????.?V9?rpZ?g?l??8???0³???3 ޒ????}?-??Vӭ????f????+,?mo?HN??+? ?R??z?:?x[bk˯?R_?8ed?ЀI???&=>%?2H??B"???" ignored \p: extra argument ":P" ignored \p: extra argument ";???P?+?1?i?)??a=?" ignored unterminated quoted string invalid command \??c?> ??Փ%??U???3+??U?SƳǕ???9?????.???e+ invalid command \W??????????????_tUÁ+MK??z?ܦ?H??`o??-/s??N?s?3?Sy?6{7??^gRP???????F@?l#??g7HW??j?ӣ?T30={?? invalid command \??g.??? invalid command \AJ??E?$?TC?r?f]?B?? invalid command \??Hzp?Y2??8?@ invalid command \Ā?(?%?O \connect: FATAL: database "???6??$?^" does not exist I feel like I'm making some beginner's error here, but I haven't run into this before. I am running 8.3.7 on a linux system Thanks, Janet
On Feb 13, 2010, at 7:36 PM, Janet S Jacobsen wrote: > Hi. I am trying to restore a database from a pgdump file, something > that I've sucessfully done before. > > I created a new database cluster, created the database that I want > to restore using > > create database subptf with template = template0; > > and then I tried to restore the database using > > ./psql subptf < subptf.pgdump > > The first part of what I get is > > ERROR: syntax error at or near "PGDMP" I'd guess that you created the dump in custom format, rather than sql format. If so, you'd need to use pg_restore to restore it rather than psql. Cheers, Steve
Thanks, Steve. You are exactly right. pg_restore was the right command to use! Janet On Feb 13, 2010, at 7:36 PM, Janet S Jacobsen wrote: > > Hi. I am trying to restore a database from a pgdump file, something > > that I've sucessfully done before. > > > > I created a new database cluster, created the database that I want > > to restore using > > > > create database subptf with template = template0; > > > > and then I tried to restore the database using > > > > ./psql subptf < subptf.pgdump > > > > The first part of what I get is > > > > ERROR: syntax error at or near "PGDMP" I'd guess that you created the dump in custom format, rather than sql format. If so, you'd need to use pg_restore to restore it rather than psql. Cheers, Steve