List of commands/steps involved in Migrate on-premises PostgreSQL databases to Azure PostgreSQL using DMS are :
Setup Azure database for PostgreSQL using below link:
Link/guide to migrate databases from on-prem to Azure cloud using DMS, go through below link:
https://learn.microsoft.com/en-us/azure/dms/tutorial-postgresql-azure-postgresql-online-portal
Setttings in on-prem server: Settings in postgresql.conf listen_addresses = '*' wal_level = logical max_replication_slots = 5 max_wal_senders = 10
Then to effect these changes, we must restart postgresql server
sudo systemctl restart postgresql
Create following role on on-prem PostgreSQL Server:
CREATE ROLE db_migrationuser WITH LOGIN SUPERUSER CREATEDB CREATEROLE INHERIT REPLICATION CONNECTION LIMIT -1 PASSWORD 'admin@123';
Grant postgres access to rreplication role:
grant postgres to db_migrationuser;
Add user in pg_hba file
host replication db_migrationuser 0.0.0.0/0 md5
After modification of pg_hba.conf file, we have to connect to postgresql and run below command:
select pg_reload_conf();
pg_dump -O -h ub2022pg12.eastus.cloudapp.azure.com -U postgres -d r2schools -s > r2schools_schema.sql
psql -h az14pgserver.postgres.database.azure.com -U postgres -d r2schools < r2schools_schema.sql