How to Renaming the PostgreSQL database while restoring the backup dump ?
In this postgresql backup and recovery process we are taking the actual backup from 63 server the database name is 2ndquadrant.in after that we will restore the backup to 185 server with different name of www.tutorialdba.com
- current server is windows client server
- 172.10.16.63 server is linux server
- 172.13.32.185 server is windows server
We are taking 2ndquadrant.in databse backup from 172.10.16.63 by using windows client server :
pg_dump -d 2ndquadrant.in -h 172.10.16.63 -p 5444 -U enterprisedb -f "E:\dc.sql"
Then we are creating the database name as www.tutorialdba.com to destination server that is the windows server
psql -U enterprisedb -h 172.13.32.185 -p 5434 -c "create database www.tutorialdba.com;"
Restore the taken backup of dc file into the 185 windows server by using windows client server utility
psql -U enterprisedb -d www.tutorialdba.com -h 172.25.154.185 -p 5434 -f "E:\dc.sql"