I'm trying to run pg_dumpall on an AWS RDS instance (postgres). I tried to connect to the db by using psql:
psql -d $DBNAME -h $HOST -p $PORT -U $USERNAME
I'm of course prompt for password and everything works fine - I'm able to connect.
I then tried:
pg_dumpall.exe -d $DBNAME -h $HOST -p $PORT -U $USERNAME -f testme.sql
I get the following error:
pg_dumpall: missing "=" after "billingdb" in connection info string
I'm using git bash as my terminal, I'm on windows 10, my psql version is 9.6.4 The connection itself is done via port forwarding so my host is localhost and some port that the port_forwarding action provide if that matters. According to the documentation I'm doing everything right so I'm out of ideas.
pg_dumpall is a utility for writing out (“dumping”) all PostgreSQL databases of a cluster into one script file. The script file contains SQL commands that can be used as input to psql to restore the databases. It does this by calling pg_dump for each database in the cluster.
You can use pg_dumpall for that with the --globals-only option: pg_dumpall --globals-only --file=all_roles_and_users.
It makes consistent backups even if the database is being used concurrently. pg_dump does not block other users accessing the database (readers or writers).
The option -d
means something else in psql
and in pg_dumpall
. The pg_dumpall
documentation says:
-d connstr
--dbname=connstr
Specifies parameters used to connect to the server, as a connection string. See Section 32.1.1 for more information.
The option is called
--dbname
for consistency with other client applications, but becausepg_dumpall
needs to connect to many databases, database name in the connection string will be ignored. Use-l
option to specify the name of the database used to dump global objects and to discover what other databases should be dumped.
My advice is to just omit that option, then the database postgres
is used as it should.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With