This article will show you how to use the pg_dump utility that is built-in to PostgreSQL to backup or dump the database to a file. This is a utility I use all the time to quickly make periodic backups of my databases. This tool has the ability to create both compressed and uncompressed dumps of your database. So if you have a small database, you should be OK using the uncompressed version, which is easily human-readable. However, for large databases it will be optimal to use the compressed formats. Below are some examples:
Create Non-compressed PostgreSQL Database Backup
pg_dump -U <DB Username> <DB Name> > backup.sql
Create Compressed PostgreSQL Database Backup
pg_dump -U <DB Username> <DB Name> -Fc > backup.dump
Create a Schema-only PostgreSQL Database Backup
In some cases, you are not interested in backing up all of the Data in the database and only want to backup the schema (tables, indexes, triggers, etc). This is done by using the -s option.
pg_dump -U <DB Username> <DB Name> -s > schema.sql
Coming soon, we will show you how to restore the database using these dumps
hi guys can u pls help me how to take backup of postgres databses by step by step procedure it is needful for me
Hi PRAVEEN KUMAR,
You can simply use PostgreSQL-Backup tool to backup your Postgres database. Chech it out postgresql-backup . com