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
Usually its as simple as:
psql dbname < infile
or if it's a custom-format dump:
pg_restore --dbname mydb infile
11 Comments
akalthubaity
So I dont have to creat a new DB cuz that what I did first and then I typed that command but nothing happened!!
Jim Archer
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?
akalthubaity
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?
Jim Archer
No no... Don't do step number 2. Just run step 3 from the command prompt.
akalthubaity
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
|