Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore from the dump #3

Open
tomasovic opened this issue Apr 29, 2021 · 10 comments
Open

Restore from the dump #3

tomasovic opened this issue Apr 29, 2021 · 10 comments

Comments

@tomasovic
Copy link

Hi!

I tried to restore this postgres_air database in a few ways ( psql, pg_restore) from the files you gave us in the Gdrive, but no luck. In one particular situation, the error is with postgres COPY command and JDBC driver (??), and I think that's the major problem with other restore ways too.

Lost too much time already trying to restore it, now I HAVE TO..... :)

Can you please give us a command, set of commands, whatever, so we can restore this DB? I would love to have it, seems very funny to play with.

Thank you!!

@hettie-d
Copy link
Owner

Hi @tomasovic , if you downloaded the postgres_air.backup file, and if you have Postgres installed locally on your computer,
you should go to the command line and execute the pg_restore utility:

pg_restore -h localhost -d - p 5432 -f postgres_air.backup --no-owner

You may need to specify the path to pg_restore if it was not added to your PATH, and you may need to specify a full pth to the
postgres_air.backup file.

Here you can find the complete description of the utility:
https://www.postgresql.org/docs/12/app-pgrestore.html

You can copy/paste the errors you received here and we wi try to diagnose them. Please let us know how it will go!

@tomasovic
Copy link
Author

tomasovic commented Apr 29, 2021

Hi !
Thank you for your answer.
I am not a Postgres master, so pardon me if I make some stupid comments.

When I copy/paste the command you gave me, I receive
pg_restore: error: options -d/--dbname and -f/--file cannot be used together

So I removed -d switch and run the command. But after that, the terminal is stuck for 30 min or so.

I managed to restore with some other ways, thru DataGrip for example, but the DB is empty, just the schema is created, so again I'm suspicious about COPY command.

@tomasovic
Copy link
Author

I've got it working. I didn't get it with pg_restore but with psql it's ok.

if someone needs it. you need to make DB first and that start this command in the terminal with a specific user:
psql -U postgres -d postgres_air -f postgres_air.sql

cheers....

@hettie-d
Copy link
Owner

@tomasovic - thank you for your feedback! We will update the read.me file to make sure all the steps are included. That was definitely an oversight on our part. Thank you for helping us to improve this repo!

@ghost
Copy link

ghost commented Jul 6, 2021

I am running postgres from docker. Using that connection from datagrip and importing from psql. Scirpt ran successfully but i am not able to see and query from any tables. Secondly When i re run the script using psql it shows me already created error. @tomasovic or @hettie-d need your help in this

@hettie-d
Copy link
Owner

hettie-d commented Jul 6, 2021

Hi @Farrukh-Mubashir when you started the restore, did you have a database created? after restore is done, do you see a new schema?

@ghost
Copy link

ghost commented Jul 7, 2021

Yes I have new database created. and I cannot see any new schema created. But when I run the script again it shows me that tables already exist. But I cannot see any

@jwalsh2me
Copy link

@Farrukh-Mubashir what os are you using? Did you double check you docker networking to the Postgres container? If you are ssh into the container can you use psql and connect to the DB?

@dubcan
Copy link

dubcan commented Nov 21, 2022

@ghost If you have already exist errors during the re-roll, then the scheme must be created.

How did you determine that the scheme did not appear? What does the \dn+ command output?
Are postgres_air schema tables output if \dt *.* is executed?

Just in case, let me remind that the postgres_air schema is not public and its tables will not be shown when executing the \dt command
In order for \dt to output postgres_air schema tables, it is necessary to set search_path (as it is written in the book, Listing B.1):
SET search_path TO postgres_air;

@hettie-d
Copy link
Owner

@dubcan - I would never thought of that, but I think you are right! Thank you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants