How do I restore a plain text postgres .backup file












16















I exported a postgres db from pgAdmin in a plain format because I wanted to search the whole db text. I then tried to restore the database back but it gives an error saying that the archive file is not valid archive file. How do I restore the db back if it can be restored?










share|improve this question













migrated from stackoverflow.com Feb 21 '12 at 16:57


This question came from our site for professional and enthusiast programmers.























    16















    I exported a postgres db from pgAdmin in a plain format because I wanted to search the whole db text. I then tried to restore the database back but it gives an error saying that the archive file is not valid archive file. How do I restore the db back if it can be restored?










    share|improve this question













    migrated from stackoverflow.com Feb 21 '12 at 16:57


    This question came from our site for professional and enthusiast programmers.





















      16












      16








      16


      3






      I exported a postgres db from pgAdmin in a plain format because I wanted to search the whole db text. I then tried to restore the database back but it gives an error saying that the archive file is not valid archive file. How do I restore the db back if it can be restored?










      share|improve this question














      I exported a postgres db from pgAdmin in a plain format because I wanted to search the whole db text. I then tried to restore the database back but it gives an error saying that the archive file is not valid archive file. How do I restore the db back if it can be restored?







      postgresql pgadmin






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 21 '12 at 11:06









      yankitwizzyyankitwizzy

      191126




      191126




      migrated from stackoverflow.com Feb 21 '12 at 16:57


      This question came from our site for professional and enthusiast programmers.









      migrated from stackoverflow.com Feb 21 '12 at 16:57


      This question came from our site for professional and enthusiast programmers.
























          2 Answers
          2






          active

          oldest

          votes


















          17














          run:



          psql -U your_user_name your_db_name < your_dump_file





          share|improve this answer


























          • I am on windows 7. Can I do this on windows 7?

            – yankitwizzy
            Feb 21 '12 at 11:09











          • it should, if psql frontend is included in the postgresql package. Try to fire up a terminal, then cd to postgresql bin directory and try to run psql

            – guido
            Feb 21 '12 at 11:13











          • I tried it now. It didnt work. There is psql.bat file in the postgres bin directory. I am using postgres 8.3

            – yankitwizzy
            Feb 21 '12 at 11:17











          • what do you mean with 'it didnt work'? if there is psql.bat however, try with that, it should run psql. look here for help archives.postgresql.org/pgsql-admin/2006-12/msg00091.php

            – guido
            Feb 21 '12 at 11:22











          • Sorry I meant there is no psql.bat file in the bin directory

            – yankitwizzy
            Feb 21 '12 at 11:27



















          0














          HOW TO RESTORE NAME AS DEO.BACKUP EXE FILE IN MY PSQL





          share








          New contributor




          Raju Kharikap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "182"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f13585%2fhow-do-i-restore-a-plain-text-postgres-backup-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            17














            run:



            psql -U your_user_name your_db_name < your_dump_file





            share|improve this answer


























            • I am on windows 7. Can I do this on windows 7?

              – yankitwizzy
              Feb 21 '12 at 11:09











            • it should, if psql frontend is included in the postgresql package. Try to fire up a terminal, then cd to postgresql bin directory and try to run psql

              – guido
              Feb 21 '12 at 11:13











            • I tried it now. It didnt work. There is psql.bat file in the postgres bin directory. I am using postgres 8.3

              – yankitwizzy
              Feb 21 '12 at 11:17











            • what do you mean with 'it didnt work'? if there is psql.bat however, try with that, it should run psql. look here for help archives.postgresql.org/pgsql-admin/2006-12/msg00091.php

              – guido
              Feb 21 '12 at 11:22











            • Sorry I meant there is no psql.bat file in the bin directory

              – yankitwizzy
              Feb 21 '12 at 11:27
















            17














            run:



            psql -U your_user_name your_db_name < your_dump_file





            share|improve this answer


























            • I am on windows 7. Can I do this on windows 7?

              – yankitwizzy
              Feb 21 '12 at 11:09











            • it should, if psql frontend is included in the postgresql package. Try to fire up a terminal, then cd to postgresql bin directory and try to run psql

              – guido
              Feb 21 '12 at 11:13











            • I tried it now. It didnt work. There is psql.bat file in the postgres bin directory. I am using postgres 8.3

              – yankitwizzy
              Feb 21 '12 at 11:17











            • what do you mean with 'it didnt work'? if there is psql.bat however, try with that, it should run psql. look here for help archives.postgresql.org/pgsql-admin/2006-12/msg00091.php

              – guido
              Feb 21 '12 at 11:22











            • Sorry I meant there is no psql.bat file in the bin directory

              – yankitwizzy
              Feb 21 '12 at 11:27














            17












            17








            17







            run:



            psql -U your_user_name your_db_name < your_dump_file





            share|improve this answer















            run:



            psql -U your_user_name your_db_name < your_dump_file






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jul 8 '14 at 7:51









            Community

            1




            1










            answered Feb 21 '12 at 11:07









            guidoguido

            28626




            28626













            • I am on windows 7. Can I do this on windows 7?

              – yankitwizzy
              Feb 21 '12 at 11:09











            • it should, if psql frontend is included in the postgresql package. Try to fire up a terminal, then cd to postgresql bin directory and try to run psql

              – guido
              Feb 21 '12 at 11:13











            • I tried it now. It didnt work. There is psql.bat file in the postgres bin directory. I am using postgres 8.3

              – yankitwizzy
              Feb 21 '12 at 11:17











            • what do you mean with 'it didnt work'? if there is psql.bat however, try with that, it should run psql. look here for help archives.postgresql.org/pgsql-admin/2006-12/msg00091.php

              – guido
              Feb 21 '12 at 11:22











            • Sorry I meant there is no psql.bat file in the bin directory

              – yankitwizzy
              Feb 21 '12 at 11:27



















            • I am on windows 7. Can I do this on windows 7?

              – yankitwizzy
              Feb 21 '12 at 11:09











            • it should, if psql frontend is included in the postgresql package. Try to fire up a terminal, then cd to postgresql bin directory and try to run psql

              – guido
              Feb 21 '12 at 11:13











            • I tried it now. It didnt work. There is psql.bat file in the postgres bin directory. I am using postgres 8.3

              – yankitwizzy
              Feb 21 '12 at 11:17











            • what do you mean with 'it didnt work'? if there is psql.bat however, try with that, it should run psql. look here for help archives.postgresql.org/pgsql-admin/2006-12/msg00091.php

              – guido
              Feb 21 '12 at 11:22











            • Sorry I meant there is no psql.bat file in the bin directory

              – yankitwizzy
              Feb 21 '12 at 11:27

















            I am on windows 7. Can I do this on windows 7?

            – yankitwizzy
            Feb 21 '12 at 11:09





            I am on windows 7. Can I do this on windows 7?

            – yankitwizzy
            Feb 21 '12 at 11:09













            it should, if psql frontend is included in the postgresql package. Try to fire up a terminal, then cd to postgresql bin directory and try to run psql

            – guido
            Feb 21 '12 at 11:13





            it should, if psql frontend is included in the postgresql package. Try to fire up a terminal, then cd to postgresql bin directory and try to run psql

            – guido
            Feb 21 '12 at 11:13













            I tried it now. It didnt work. There is psql.bat file in the postgres bin directory. I am using postgres 8.3

            – yankitwizzy
            Feb 21 '12 at 11:17





            I tried it now. It didnt work. There is psql.bat file in the postgres bin directory. I am using postgres 8.3

            – yankitwizzy
            Feb 21 '12 at 11:17













            what do you mean with 'it didnt work'? if there is psql.bat however, try with that, it should run psql. look here for help archives.postgresql.org/pgsql-admin/2006-12/msg00091.php

            – guido
            Feb 21 '12 at 11:22





            what do you mean with 'it didnt work'? if there is psql.bat however, try with that, it should run psql. look here for help archives.postgresql.org/pgsql-admin/2006-12/msg00091.php

            – guido
            Feb 21 '12 at 11:22













            Sorry I meant there is no psql.bat file in the bin directory

            – yankitwizzy
            Feb 21 '12 at 11:27





            Sorry I meant there is no psql.bat file in the bin directory

            – yankitwizzy
            Feb 21 '12 at 11:27













            0














            HOW TO RESTORE NAME AS DEO.BACKUP EXE FILE IN MY PSQL





            share








            New contributor




            Raju Kharikap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.

























              0














              HOW TO RESTORE NAME AS DEO.BACKUP EXE FILE IN MY PSQL





              share








              New contributor




              Raju Kharikap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.























                0












                0








                0







                HOW TO RESTORE NAME AS DEO.BACKUP EXE FILE IN MY PSQL





                share








                New contributor




                Raju Kharikap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.










                HOW TO RESTORE NAME AS DEO.BACKUP EXE FILE IN MY PSQL






                share








                New contributor




                Raju Kharikap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share


                share






                New contributor




                Raju Kharikap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 8 mins ago









                Raju KharikapRaju Kharikap

                1




                1




                New contributor




                Raju Kharikap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                Raju Kharikap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                Raju Kharikap is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Database Administrators Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f13585%2fhow-do-i-restore-a-plain-text-postgres-backup-file%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    SQL Server 17 - Attemping to backup to remote NAS but Access is denied

                    Always On Availability groups resolving state after failover - Remote harden of transaction...

                    Restoring from pg_dump with foreign key constraints