1

i am totally new to postgresql and i have database as dump file on postgresql which i need to restore/upload it back.. i didnt dumped the file its already available online. I read the documentation of restore command on postgresql but it didnt work w me and i am not sure from the steps that I should follow to successfully upload it!! Please if anyone has an idea or could at least refer me to a really good resources for how to do it I will really appreciate it

1 Answer 1

1

Usually its as simple as:

psql dbname < infile

or if it's a custom-format dump:

pg_restore --dbname mydb infile
11
  • So I dont have to creat a new DB cuz that what I did first and then I typed that command but nothing happened!! Sep 28, 2015 at 22:34
  • Well, help me help you. What do you mean by "nothing happened"? Did you get an error of some type? Did you see any text scroll by? Anything? What operating system are you using?
    – Jim Archer
    Sep 28, 2015 at 22:39
  • thanks for helping me... I am using mac, so what I did is the following: 1. create a new database called ex new 2. run SQL shell (psql) 3. type psql new < file.dump and there is no error, and when I checked back the new db there was no tables!! I am not sure what I did is right? Sep 28, 2015 at 23:59
  • No no... Don't do step number 2. Just run step 3 from the command prompt.
    – Jim Archer
    Sep 29, 2015 at 0:12
  • oh I see so now I get an error "syntax error at or near "psql""; I tried to use psql --set ON_ERROR_STOP=on dbname < infile but still getting the same error Sep 29, 2015 at 0:35

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.