Procedures to perform Control-M PostgreSQL Database Restore using Hot-Backup taken from another Control-M Installation - For UNIX OS
- This solution can be applied to both Control-M/Server and Control-M/Enterprise Manager PostgreSQL Database Server
For same purpose on Windows platform, please see How to restore Control-M PostgreSQL Database using hot backup taken from another Control-M - For Windows OS?
Requirements
===========
1. Make sure that the path for installation of software (the account name and HOME paths are same in both production and DR machines), including the backup folder and archive folder
2. Make sure that the port for PostgreSQL at both production and DR machines are same
3. Make sure to enable the archive mode at both production and DR machines
4. Make sure to test the steps repeatedly to familiarize so that the DR operation will be smooth
Best Practice
===========
1. Do the daily hot backup of the database
2. Daily backup and clearing of the archive folder
Steps for Hot Restore
=================
1. Transfer the backup folder and the archive folder from production to the backup folder of DR machine in binary mode
2. Make sure the Control-M components are not running including the database service in DR machine
3. Modify the untars.sh file from the backup folder in DR machine to remark the following lines(near bottom of the file):
#build for clean recover - remove base backup pg_xlog and postmaster.pid file
#remark the following lines so that we could recover the backup files from
#another machine to this machine
#rm -rf /home/ctm7pg/pgsql/data/pg_xlog/0*
#if [ $? -ne 0 ] ;
# then
# echo "delete of /home/ctm7pg/pgsql/data/pg_xlog/0* from PGDATA backup failed "
# exit 1
#fi
4. Run DBUHotRestore and specify the "Backup Directory" and "Archive Directory" values, and restore will finish and PostgreSQL services will be started automatically.
Example:
% DBUHotRestore
Backup Directory:/home/ctm7pg/BK
Archive Directory:/home/ctm7pg/ARCH
Restore finished.
To complete switching archive mode to status OFF, postgres database server reboot is required.
4. Stop the PostgreSQL services and modify the $PGHOME/etc/pg_service.conf file for the following lines:
from
[production_hostname]
host=production_hostname
to
[DR_hostname]
host=DR_hostname
If this is not done, you will be unable to stop the database for the next step.
5. Then, restart the PostgreSQL services and check the database contents before starting Control-M services(for DR purpose).
The same steps can be used for PostgreSQL on Windows platform, but the folder path should follow OS convention.