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
-- This works on a normal postgres install, but on RDS it errors out with something similar too: | |
-- ERROR: permission denied: "RI_ConstraintTrigger_a_6654774" is a system trigger | |
-- It seems like rds_admin isn't admin enough... | |
ALTER TABLE accept_language DISABLE TRIGGER all; | |
-- This apparently disables all foreign keys for the current session. | |
-- Too bad we can't ask DMS to execute it before starting the migration. | |
SET session_replication_role = replica; | |
-- Luckily enough we can set the above thing using a so called "parameter group" in RDS. |
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
SELECT max(pg_column_size(some_column)) / 1024.0 | |
FROM some_table; |
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
# Dump the database schema to the file schema.sql | |
pg_dump -h $SRC_SERVER_IP -d $DB_NAME -U $DB_USER -f dump.sql -W -s -v | |
# Restore the database schema into an empty database | |
psql -h $DST_SERVER_IP -d $DB_NAME -U $DB_USER -f dump.sql -W |
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
aws dms create-replication-task \ | |
--replication-task-identifier limited-lob \ | |
--source-endpoint-arn $SRC_ENDPOINT_ARN \ | |
--target-endpoint-arn $DST_ENDPOINT_ARN \ | |
--replication-instance-arn $RPL_SERVER_ARN \ | |
--migration-type full-load-and-cdc \ | |
--table-mappings file://limited_lob_tables.json \ | |
--replication-task-settings file://limited_lob_settings.json |
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
{ | |
"TableMappings": [ | |
{ | |
"Type": "Include", | |
"SourceSchema": "public", | |
"SourceTable": "%" | |
}, | |
{ | |
"Type": "Exclude", | |
"SourceSchema": "public", |
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
{ | |
"TargetMetadata": { | |
"TargetSchema": "", | |
"SupportLobs": true, | |
"FullLobMode": false, | |
"LobMaxSize": 8192, | |
"LimitedSizeLobMode": true, | |
"BatchApplyEnabled": false | |
}, | |
"FullLoadSettings": { |