PostgreSQL

Backup

Backup a plain sql script:


./pg_dump.exe --host thehost-server.postgres.database.azure.com --username theusername --exclude-table-data 'public.tableprefix1*' --exclude-table-data 'public.tableprefix2*' --file C:\thepath\backup.sql thedatabasename

Backup a custom-format sql script:


./pg_dump.exe --host thehost-server.postgres.database.azure.com --username theusername --format custom --exclude-table-data 'public.tableprefix1*' --exclude-table-data 'public.tableprefix2*' --file C:\thepath\backup.dump thedatabasename

Restore

Restore a plain sql script (database should be newly created):


./psql --host thehost-server.postgres.database.azure.com --username theusername -d thedatabasename -f C:\thepath\backup.sql

Restore a custom-format sql script (data-only for a specific table):


./pg_restore --host thehost-server.postgres.database.azure.com --username theusername --data-only -d thedatabasename -t thetabletorestore C:\thepath\backup.dump