From Wiki-UX.info

How to backup/restore the HP SIM database?
Jump to: navigation, search

How to backup/restore the HP SIM database?

Note:Still needs editing for mediawiki format. To be continued.


To backup the HP SIM database you need to run this command:

Back up the HP Systems Insight Manager database:

# /opt/hpsmdb/pgsql/bin/pg_dump -f filename 


where filename is the name of the backup file.


Database

HP SIM performs database maintenance once each day at 1:00 am. If you want to change the timing of this task, run the following command:

# mxglobalsettings -s DbMaintenanceHourOfDay=Hour of the day

The default value is 1. If you set the value greater than 25, database maintenance does not run at all. However, it can be triggered during data collection.

Other procedure

If you want to upgrade from PostgreSQL 7.x (Rhel 3 or 4) to PostgreSQL 8.x (Rhel 5). When you upgrade from 7.x to 8.x, the PostgreSQL service will fail to start because the internal data storage format changes with new releases of PostgreSQL (8.x). Therefore, if you are upgrading an existing installation that does not have a version number 8.1.x, you must back up and restore your data as shown here. Install the required operating system (Rhel 3 or 4) and HP SIM (4.x or 5.0.x or 5.1) and then perform the following steps to backup the database.

  • Login to the system from root user.
  • Stop the HP SIM service by running mxstop.
  • Verify that all the MX processes have stopped by running:
ps -ef | grep mx
  • MxDBUserPassword is internally set by HP SIM. This password is used to backup the database because mxadmin is the owner of the insight_v1_0 db. Change the MxDBUserPassword to appropriate user known password (In this case "test):
mxpassword -m -x MxDBUserPassword=test
  • Restart the PostgresSQL service to reflect the new MxDBUserPassword.

service postgresql restart or /etc/init.d/postgresql restart

  • Backup the database to a file using command pg_dump:
#pg_dump -h 127.0.0.1 -p 5432 -U mxadmin insight_v1_0 > /home/SaveHPSIMdb

Provide the password supplied in step 4 (test in this example) for the backup. SaveHPSIMdb = The file in which the old database is backed up. It is always safe to save this file in /tmp or /home directory.

The database name, port number, host values can be obtained from the /etc/opt/mx/config/database.props file.

  • Stop the PostgreSQL service:

service postgresql stop or /etc/init.d/postgresql stop

  • Move the old PostgreSQL files to mv /var/lib/pgsql/ /var/lib/pgsql.old

NOTE: The default postgres installation is /var/lib/pgsql and since the internal data storage format changes with new releases. It is safe to move old data from the /var/lib/pgsql path and have the fresh installation for PostgreSQL8.x.

  • Upgrade the operating from Rhel 3.x or 4.x to Rhel 5.x.
  • After the operating system is up, stop the HP SIM service and verify that the PostgreSQL service is up and running (PostgreSQL service should be running to perform database restore).
  • Add the following entry in pg_hba.conf file which is available under /var/lib/pgsql/data/pg_hba.conf (Comment out any existing entry in pg_hba.conf). Add the below mentioned entries in pg_hba.conf file.
local insight_v1_0 mxadmin password local all all trust
host insight_v1_0 root 127.0.0.1 255.255.255.255 trust
host template1 postgres 127.0.0.1 255.255.255.255 trust
host postgres postgres 127.0.0.1 255.255.255.255 trust
host insight_v1_0 mxadmin 127.0.0.1 255.255.255.255 trust
  • Restart the PostgreSQL service:
service postgresql restart or /etc/init.d/postgresql restart
  • Now login with PostgreSQL account to perform database operations:
su postgres
  • Change the working directory to /usr/bin:
cd /usr/bin
  • The below command is not required, since there is a new version PostgreSQL. However, HP recommends you execute the command and be sure insight_v1_0 is not present:
/dropdb -p 5432 -h 127.0.0.1 -i -e insight_v1_0

Press Y to confirm the delete of old database.

  • Create a user mxadmin and assign super user role:
./createuser -h 127.0.0.1 -p 5432 -U postgres mxadmin

Press Y to confirm adding the new user.

  • Create a fresh database with name insight_v1_0:
./createdb -O postgres -h 127.0.0.1 -p 5432 -U postgres insight_v1_0
  • Restore the data which was backed up in step 5:
./psql -q -h 127.0.0.1 -U mxadmin -p 5432 -f /home/SaveHPSIMdb -d

insight_v1_0 Exit from the postgres user

  • Login, change user to root, and restart the HP SIM service with mxstart and be sure HP SIM service comes up.
  • Browse to HP SIM and verify the database operations are done successfully. Compare the data with inventory.log to verify all the data is present.
  • Upgrade to HP SIM 5.3.



Go to http://www.hp.com/go/hpsim/, and click Questions & Answers for more information on migrating from Insight Manager 7 or Servicecontrol Manager 3.0 to HP SIM.


When upgrading your HP SIM installation on HP-UX to HP SIM 5.3, an automatic reboot is performed, and then the actual upgrade process begins. The HP-UX upgrade process includes an automatic reboot and can take up to two hours to complete. You can check the initconfig.log to determine if the upgrade has completed.


Authors

This page was last modified on 6 July 2009, at 16:07. This page has been accessed 1,543 times.