How to uninstall/reinstall a Windows installation of PostgreSQL software hosting the APM Database.

Document ID : KB000019255
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Sometimes it may be necessary to uninstall/reinstall PostgreSQL software e.g. errors during initial APM install, moving APM database to a new server etc.

Solution:

In what follows the default installation folder hierarchy of C:\Program Files\CA APM is assumed with APM 9.5 installation folder of C:\Program Files\CA APM\Introscope9.5.0.0.
Modify as necessary for actual installation folder.

PREPARATION

  1. Make any necessary database backups of any existing Postgres APM Database.
  2. Shutdown all Enterprise Managers (EM) in the cluster.

UNINSTALL steps

  1. Go to Control Panel -> Programs and Features
    Uninstall the Postgres software PostgreSQL 8.4

  2. Go to Control Panel -> Administrative Tools -> Services
    Check that the postgres service pgsql-8.4 no longer exists

  3. Go to Control Panel -> Administrative Tools -> Computer Management -> Local Users and Groups
    Delete the user postgres.

  4. Delete or rename this directory: C:\Program Files\CA APM\database

REINSTALL steps

  1. Rename any existing APM "install" folder for the installation process e.g. C:\Program Files\CA APM\Introscope9.5.0.0\install

  2. Run APM installer
    1. Select the "Database Only" option
    2. "Target Installation directory" - use the existing APM installation folder or create new (C:\Program Files\CA APM\Introscope9.5.0.0). If it already exists you will be asked to confirm.
    3. Select PostgreSQL
    4. Select "Install Database"
    5. "Target Installation directory for the database" - use default C:\Program Files\CA APM\database
    6. NOTES:
      The Postgres administrator password is used both for database administrator and the Windows user postgres that runs the service.
      The user admin is the default owner of the APM database (cemdb). Use the same password for admin as you did when you ran any previous EM installs so that the EM configuration file EM_HOME\config\tess-db-cfg.xml file already has the correct/matching credentials.

  3. If the installer reports any errors refer to the new log files in folder C:\Program Files\CA APM\Introscope9.5.0.0\install e.g. schematools.log.

POST-INSTALL checks/tasks

  1. Follow these steps to verify the Postgres server is running and can be connected from any remote location EM servers:
    1. Control Panel -> Administrative Tools -> Services. Check postgres service pgsql-8.4 is started.
    2. Run this command to check that Postgres server is listening on its default port of 5432: netstat -na | find "5432" |find "LISTENING"
      1 or 2 lines should be returned e.g.
       TCP    0.0.0.0:5432           0.0.0.0:0              LISTENING TCP    [::]:5432              [::]:0                 LISTENING
    3. Download & run the pgAdmin utility (http://www.pgadmin.org) on remote EM servers. Connect to the new Postgres server to verify successful connection and no firewall problems with blocking on port 5432. Alternatively "telnet postgres_server 5432" command can also be used to check for any firewall problems (no connection refused message indicates success)

  2. Restore any database backup. If the backup is for a version of APM prior to the new version being installed then the "REINSTALL steps" should be run again but for step (d) select "Upgrade database schema ..." and then proceed with upgrading the restored database.

  3. Restart all EMs in the cluster.

  4. Assuming the file C:\Program Files\CA APM\Introscope9.5.0.0\config\tess-db-cfg.xml has the correct admin password already, MOM and Collectors should be able to connect successfully to the new database.

  5. To verify correct database settings/connectivity for the MOM login to the CEM UI: http://MOM_server:8081/wily/cem/tess/app/login.html
    Go to System->Database Settings and run "Test Connection"
    If the connection encounters an error you can modify the password for the user name admin to match what was used in the Postgres reinstall step.
    Any changes made will be updated in the relevant config file C:\Program Files\CA APM\Introscope9.5.0.0\config\tess-db-cfg.xml on the MOM.

  6. If there is still a problem with the Collector's connections to the database e.g. Collector log file IntroscopeEnterpriseManager.log contains PSQLException errors due to failed database connection, the CEM UI->Setup->Services page only shows a MOM in the EM list (one or more missing Collectors)
    1. Stop all Collectors.
    2. Copy file C:\Program Files\CA APM\Introscope9.5.0.0\config\tess-db-cfg.xml from the MOM to each Collector.
      Make any necessary modifications to tess-db-cfg.xml to ensure that the correct hostname or IP Address is used for the Postgres server (postgres_server) in the JDBC URL property because if the MOM is on the same server as Postgres that value is often set to 127.0.0.1 i.e.
      Change: <property name="hibernate.connection.url">jdbc:postgresql://127.0.0.1:5432/cemdb</property>
      To: <property name="hibernate.connection.url">jdbc:postgresql://postgres_server:5432/cemdb</property>
    3. Restart all Collectors and recheck the IntroscopeEnterpriseManager.log file and CEM UI->Setup->Services page.