How to take the backup of PostgreSQL?
Here are the steps to back up a single database in PostgreSQL. We shall be using the pg_dump tool as it dumps out the content of all the objects in the database to a single file.
Step 1: First of all, navigate to the PostgreSQL BIN folder:
C:\>cd C:\Program Files\PostgreSQL\9.2\bin
Step 2: Now, we shall execute the pg_dump program and use the following method to back up the examples database to the example.tar file to the c:\pgbackup\ folder.
pg_dump -U postgres -W -F t examples > c:\pgbackup\examples.tar
Step 3: Here is your backed up database
c:\pgbackup\dvdrental.tar
BY Best Interview Question ON 21 Jul 2020