how to backup postgresql database code example

Example 1: postgres make sql dump

pg_dump -U username dbname > dbexport.pgsql

Example 2: backup postgres database docker

docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql

Example 3: how to take backup in dbeaver with postgresql

Check

Native client configuration

Example 4: postgresql copy backup table

psql -U postgres -d postgres < "C:\Users\Nilay\Desktop\IBS\files\fddcerfltseg\fddcerfltseg.sql"> C:\Users\Nilay\Desktop\IBS\files\fddcerfltseg\logerror.log

Tags:

Sql Example