Skip to content

Instantly share code, notes, and snippets.

@nicokruger
Last active September 21, 2020 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicokruger/7ecb6ced45677f3995373be87cd5318b to your computer and use it in GitHub Desktop.
Save nicokruger/7ecb6ced45677f3995373be87cd5318b to your computer and use it in GitHub Desktop.
list databases: \l *;
non-binary way:
export PGPASSWORD=whatever
for F in $(cat dbs); do echo $F; psql -h dt-rds-test.coivvuccn9hs.eu-west-1.rds.amazonaws.com -v -U postgres -d ${F} < ${F}.sql ; done
binary way:
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html
# above way doesnt seem to work with roles etc.
psql -h database-2.coivvuccn9hs.eu-west-1.rds.amazonaws.com -v -U postgres -d postgres < alldb.dump ;
pg_dumpall -h localhost -p 5033 -U postgres > alldb.dump
for F in $(ls *xml); do sed -i "s;sql:\/\/.*?\/;sql:\/\/database-2.coivvuccn9hs.eu-west-1.rds.amazonaws.com\/;g" $F; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment