Backup and restore PostgreSQL database in a minute

Backup and restore your data very easily.

PostgreSQL is a widely used database over the world.Working with databases always needs some basic features and backup/restore database is a regularly needed scenario.PostgreSQL has its own tool called pgAdmin. pgAdmin is the most popular and feature-rich Open Source administration and development platform for PostgreSQL. pgAdmin is a powerful tool for managing PostgreSQL. Some other tools to manage databases are datagrip(a product of JetBrains) is paid. 

Another popular one is omniDB and it is completely free. pgAdmin is also free and I suggest it when you need some features like backup/restore.With PostgreSQL, we can take a full, incremental, or continuous backup easily. You can use pg_dump utility to back up the PostgreSQL database.

Let’s begin backup the database

The backup process can happen in many ways, some prefer to do with the command line, some prefer other tools but I will suggest doing it with pgAdmin.

Here is an interface of pgAdmin. Just open the project and find your desired database then right-click on it and go to the backup.

Enter a valid filename. You have options to backup with SQL format or backup format. I prefer backup format. In the format, section must choose custom.

The backup process has been started and it will take a while. In my case it takes up to 5 minutes, sometimes for a small database, it can take around 1/2 minutes. Finally, you got a backup file into your selected directory.

Time to restore

Restore is nothing complex but we should remember one thing, create a fresh copy of the database or erase the database otherwise the backup will not restore. Just select your database where you want to restore and right-click then select restore.

Just choose the format then choose the filename from the directory you saved before and hit restore. Then the process will be begun to restore the database and it will take a few minutes.

That’s the easiest way I followed before.

Conclusion

Obviously, you may not need all of these in your day-to-day life.But this may help you if you are a regular user of PostgreSQL.

Have a great day!

Leave a Reply

Your email address will not be published. Required fields are marked *