I need to create a dump of all the commands below.
test=> create user rdstest login password 'rdstest';
CREATE ROLE
test=> grant connect on database test to rdstest;
GRANT
test=> create user devadmin login password 'devtest';
CREATE ROLE
test=> grant connect on database test to devadmin;
GRANT
test=> grant rdstest to devadmin with admin option;
GRANT ROLE
test=> grant rdstest to devadmin;
GRANT ROLE
test=> create schema authorization rdstest;
CREATE SCHEMA
when i tried to create it using pg_dump as pg_dump -U devadmin -h ****xxx.rds.amazonaws.com test > Outfile.sql
I can only see the schema related commands
CREATE SCHEMA rdstest;
ALTER SCHEMA rdstest OWNER TO rdstest;
How to get pg_dump to include all the commands:create user command,grant connect on database test to rdstest etc.
pg_dump is a utility for backing up a PostgreSQL database. 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). pg_dump only dumps a single database.
Go to Edit the system environment variables. Then Environement variables. Then Path then add the location of bin of postgres in my case C:\Program Files\PostgreSQL\14\bin\
Description. pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats. It will issue the commands necessary to reconstruct the database to the state it was in at the time it was saved.
It took ~60 minutes.
pg_dump
can not do that, because pg_dump
only dumps a single database and that information is not part of one database, but stored globally in the Postgres "cluster".
You need to use pg_dumpall
for that, using the --globals-only
option:
pg_dumpall --globals-only --file=globals.sql
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