How to backup and restore of vCloud Usage Meter DB

Backup / Restore of vCloud Usage Meter DB

In this post, I explained how to backup/restore the vCloud Usage meter DB that I found through surfing, collectively it took me more than 60+ minutes to find the steps.

Any one can use this post regardless of the Usage Meter version.

 

To Backup: 


– Login to Usage Meter appliance as root  and run following commands
[code]#su – postgres [/code]

[code]#cd /opt/vmware/vpostgres/xx/bin/[/code]
(xx = Version of the postgres, it varies version to version)

[code]#./pg_dump usage_meter_db >> /tmp/dbbackup[/code]


To Restore: 

Take a snapshot of the VM before restoring

Login to Usage Meter appliance as root  and run following commands

[code]su – postgres [/code]

[code]cd /opt/vmware/vpostgres/xx/bin/[/code]
(xx = Version of the postgres, it varies version to version)

[code]./dropdb usage_meter_db[/code]
(Delete the existing DB

[code]./createdb usage_meter_db[/code]
(Create a empty DB)

[code]psql usage_meter_db < /tmp/dbbackup[/code]
(Restore DB)

or

[code]sudo -u postgres /opt/vmware/vpostgres/xx/bin/psql usage_meter_db < /tmp/dbbackup usage_meter_db[/code]
(xx = Version of the postgres, it varies version to version)

 

This post first appeared on the Virtualization Express blog at virtualizationexpress.com, by Karthic Kumar +.
Copyright © 2013 – VirtualizationExpress +. All rights reserved. Not to be reproduced for commercial purposes without written permission.

Leave a Reply

Your email address will not be published. Required fields are marked *