Guide for Postgresql Backup and Restore

Unknown | 02:21 | 0 comments

Let’s consider the following for easy understanding of tutorial


DB DB Name: admindb


DB UserName: postgres


DB Backup:


Backup:  $ pg_dump -U postgres admindb -f admindb.sql


Config DB Restore:


Restore: $ psql -U postgres -d admindb-f admindb.sql


Backup a single postgres table:


Example: test.sql and test1.sql from admindb                                          


pg_dump --table test -U postgres admindb -f  test.sql


pg_dump --table test1 -U postgres admindb -f test1.sql


Restore a single table to config DB(admindb):


psql admindb <  test.sql
psql admindb < test1.sql
========================================================================

Category: , , , ,

handsonbook.blogspot.com

0 comments