Steps to perform pg_dump on Postgresql RDS instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alter schema schema_name1 owner to rds_superuser; | |
alter schema schema_name2 owner to rds_superuser; | |
\dn; | |
CREATE FUNCTION exec(text) returns text language plpgsql volatile AS $f$ | |
BEGIN EXECUTE $1; RETURN $1; END; $f$; | |
SELECT exec('ALTER TABLE ' || quote_ident(s.nspname) || '.' || quote_ident(s.relname) || ' OWNER TO rds_superuser') | |
FROM ( | |
SELECT nspname, relname | |
FROM pg_class c JOIN pg_namespace n ON (c.relnamespace = n.oid) | |
WHERE nspname in ('schema_name1', 'schema_name2') AND | |
relkind IN ('r','S','v') ORDER BY relkind = 'S') | |
s; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update the change_owner.sql script with the relevant "rds_superuser" and "schema_name" | |
Connect to RDS instance through psql prompt and run the change_owner.sql script | |
External reference: | |
http://stackoverflow.com/questions/4363697/copy-a-postgres-database-without-lock-permissions | |
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html#Appendix.PostgreSQL.CommonDBATasks.PostGIS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment