1

I want to restore a database from backup and rewrite all data that is there with backup data.

My current command is like this:

pg_restore -h localhost -U postgres -d dbName -v autobackup_file.dmp

How to restore and rewrite all data?
I've seen an option -c; is that the correct way?
And where should I put it in my command?

1 Answer 1

1

-c can be anywhere, e.g. immediately after pg_restore.

It will DROP all restored objects before restoring them, but it will not drop any objects that are not in the dump.

To drop and recreate the whole database so you get a clean copy, you can use -C -c.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.