Wednesday, November 19, 2025

Tip of the Day - Oracle & PostgreSQL (Thu, 19 Mar 2026)

Backup PostgreSQL DB with pg_dump Utility

To backup a database with pg_dump utility:

$ pg_dump -h localhost -U postgres -p 5432 pgdb1 > pgdb1_dump.sql

To restore this dump to a new database (Make sure that the new empty database is already created with "CREATE DATABASE .." command)

$ psql -h localhost -U postgres -p 5432 -d pgdb2 -f pgdb1_dump.sql