Postgresql – where does pg_dumpall store *.bak file

postgresql

I want to dump a database. and I use:

pg_dumpall

by using this code, data which has been stored on data base is scrolling in the terminal and it says:

PostgreSQL database dump complete

PostgreSQL database cluster dump complete

but I can not find any new .bak file any where. I also used:

pg_dumpall -f test

it goes to next line without showing any message.

finally, where is stored .bak file?!

Best Answer

There is no .bak file until you name it so.

With the last command in your question, the dump is written to the file test — this, then, is your “.bak file”.

In fact, it is an SQL script, because pg_dumpall only supports the plain text format.

You restore such a dump by feeding it to psql:

psql -h hostname -p 1234 -f test -d postgres -U postgres

Where “1234” is the port number of your new database cluster.