IDB restore with Data Protector 8 and later is really straight forward. It allows a much more granular recovery than in previous versions, since it’s done using a fully featured module instead of a file system hot-backup. You’re able to restore the IDB (PostgreSQL database) including log file recovery, DCBF files and configuration files individually or all together in a one-step process.
To be able to recovery, you need a valid backup first. Regular IDB backups are strongly recommended and can be created at any given time without interrupting backup operation.
On a Linux Cell Manager the Internal Database is located in /var/opt/omni/server/db80. For this example I will restore the database to /var/opt/omni/server/db80_restore since it cannot be overwritten and all commands I’ll use later will refer to this path. If you need to adjust that, change the commands accordingly or make the changes manually using a text editor of your choice.
Once the restore has been done, the Cell Manager will be up and operational. Just reconnect the GUI, since the IDB was switched during the process. Now it’s time to check if the restored version of the backup suits your needs. If everything is fine, we can start our clean up.
Please note: The clean up is disruptive to the service (we need to bring down Data Protector services) and should be scheduled in a maintenance window. It is not required for operation after a recovery, but I recommend it. It removes stale files and directories from file system and make directory structure look like before the restore. It can be done immediately or weeks after the restore. Create a tarball of /etc/opt/omni and /var/opt/omni to allow fail-back.
- Stop the services and check restored directory structure
[root@linux ~]# omnisv stop Cell Server services successfully stopped. [root@linux ~]# ls -l /var/opt/omni/server drwxr-xr-x 5 hpdp hpdp 4096 May 9 12:44 AppServer drwxr-xr-x 19 root sys 4096 May 10 10:52 db80 drwxrwxrwx 5 root root 4096 May 10 10:49 db80_restore drwxr-xr-x 4 root sys 4096 Mar 17 18:21 export drwxr-xr-x 4 root sys 4096 Mar 17 18:21 import drwxr-xr-x 4 root sys 4096 May 10 10:48 log drwxr-xr-x 2 root sys 4096 Mar 17 18:21 sessions [root@linux ~]# ls -l /var/opt/omni/server/db80_restore drwx------ 3 hpdp hpdp 4096 May 10 10:49 idb drwx------ 3 hpdp hpdp 4096 May 10 10:49 jce drwx------ 15 hpdp hpdp 4096 May 10 10:56 pg
- Move the restored database in the target directory and adjust symlinks. Please note: the name of the symlinks might vary on your Cell Manager.
[root@linux ~]# rm -rf /var/opt/omni/server/db80/idb [root@linux ~]# rm -rf /var/opt/omni/server/db80/jce [root@linux ~]# rm -rf /var/opt/omni/server/db80/pg [root@linux ~]# mv /var/opt/omni/server/db80_restore/* /var/opt/omni/server/db80/ [root@linux ~]# ls -l /var/opt/omni/server/db80/pg/pg_tblspc lrwxrwxrwx 1 hpdp hpdp 37 May 10 10:49 16387 -> /var/opt/omni/server/db80_restore/idb lrwxrwxrwx 1 hpdp hpdp 37 May 10 10:49 16445 -> /var/opt/omni/server/db80_restore/jce [root@linux ~]# ln -sf /var/opt/omni/server/db80/idb /var/opt/omni/server/db80/pg/pg_tblspc/16387 [root@linux ~]# ln -sf /var/opt/omni/server/db80/jce /var/opt/omni/server/db80/pg/pg_tblspc/16445
- Update configuration files accordingly. Please note: more complex changes should be done using a text editor
[root@linux ~]# perl -p -i -e 's/db80_restore/db80/g' /var/opt/omni/server/db80/pg/postgresql.conf [root@linux ~]# perl -p -i -e 's/db80_restore/db80/g' /var/opt/omni/server/db80/pg/postmaster.opts [root@linux ~]# perl -p -i -e 's/db80_restore/db80/g' /etc/opt/omni/server/idb/idb.config [root@linux ~]# perl -p -i -e 's/db80_restore/db80/g' /etc/init.d/hpdp-idb
- Additional clean up, depending on your configuration
[root@linux ~]# rm -rf /var/opt/omni/server/db80_restore [root@linux ~]# rm -rf /var/opt/omni/server/db80/msg_* [root@linux ~]# rm -rf /var/opt/omni/server/db80/meta_* [root@linux ~]# rm -rf /var/opt/omni/server/log/auditing_*
- Start the services and do basic verification
[root@linux ~]# omnisv start -idb_only The Internal database services successfully started. [root@linux ~]# omnisv status ProcName Status [PID] =============================== crs : Down mmd : Down kms : Down hpdp-idb : Active  hpdp-idb-cp : Active  hpdp-as : Down omnitrig : Down Sending of traps disabled. =============================== Status: At least one of the Cell Server processes/services is not running. [root@linux ~]# grep PGSUPERUSER /etc/opt/omni/server/idb/idb.config PGSUPERUSER='hpdp'; [root@linux ~]# grep PGPORT /etc/opt/omni/server/idb/idb.config PGPORT='7112'; [root@linux ~]# su - hpdp [hpdp@linux ~]$ /opt/omni/idb/bin/psql -U hpdp -h /var/opt/omni/tmp -p 7112 postgres postgres=# SELECT spcname, spclocation FROM pg_tablespace; spcname | spclocation ------------+------------------------------- pg_default | pg_global | hpdpidb | /var/opt/omni/server/db80_restore/idb hpjce | /var/opt/omni/server/db80_restore/jce (4 rows) postgres=# UPDATE pg_tablespace SET spclocation = '/var/opt/omni/server/db80/idb' where spcname='hpdpidb'; UPDATE 1 postgres=# UPDATE pg_tablespace SET spclocation = '/var/opt/omni/server/db80/jce' where spcname='hpjce'; UPDATE 1 postgres=# \q [hpdp@linux ~]$ exit [root@linux ~]# omnisv start Cell Server services successfully started. [root@linux ~]# omnidbcheck -extended Check Level Mode Status =========================================================== Database connection -connection OK Schema consistency -schema_consistency OK Datafiles consistency -verify_db_files OK Database consistency -database_consistency OK Media consistency -media_consistency OK SIBF(readability) -sibf OK DCBF(presence and size) -bf OK OMNIDC(consistency) -dc OK DONE! [root@linux ~]# omnib -idb_list LINUX_IDB -barmode full [...] [Normal] From: BSM@linux.syncer.de "LINUX_IDB" Time: 05/10/2014 12:44:16 PM OB2BAR application on "linux.syncer.de" successfully started. [Normal] From: OB2BAR_POSTGRES_BAR@linux.syncer.de "DPIDB" Time: 05/10/2014 12:44:16 PM Checking the Internal Database consistency [Normal] From: OB2BAR_POSTGRES_BAR@linux.syncer.de "DPIDB" Time: 05/10/2014 12:44:17 PM Check of the Internal Database consistency succeeded [Normal] From: OB2BAR_POSTGRES_BAR@linux.syncer.de "DPIDB" Time: 05/10/2014 12:44:17 PM Putting the Internal database into the backup mode finished