PostgresSQL Database Backup

PostgreSQL gives the pg_dump utility to help you back up information bases. It creates a data set record with SQL orders in a configuration that can be effortlessly reestablished from now on.

To back up, a PostgreSQL information base, begin by signing into your data set server, then change to the Postgres client record, and run pg_dump as follows (supplant tecmintdb with the name of the data set you need to reinforcement). Naturally, the result design is a plain-text SQL script record.

Make sure you are logged in as the postgres user:

$ su – postgres

$ pg_dump testdb >  /opt/backup/testdb.sql


The pg_dump upholds other result designs also. You can indicate the result design utilizing the – F choice, where c means custom arrangement document record, d means registry design document, and t implies tar design file record: all organizations are appropriate for input into pg_restore.

To back up all PostgreSQL databases, use the pg_dumpall tool as shown.

$ pg_dumpall > all_pg_dbs.sql

Click to rate this post!
[Total: 0 Average: 0]