Maintenance of Applications Manager backend database

Maintenance of Applications Manager backend database

Note: Please take complete database backup without fail prior to these steps.

I. Applications Manager with PostgreSQL Database.

  1. Shutdown all Applications Manager related process as follows:
    1. For windows:
      1. Open services.msc --> stop ManageEngine Applications Manager service.
      2. Open Command Prompt as an Administrator, go to AppManager_Home\ and then execute the below command
        shutdownApplicationsManager.bat -force 
        (execute this until you get a message that, all process have been shutdown)
    2. For Linux
      1. Open Command Prompt with proper privileges' go to AppManager_Home/ and then execute the below commands
        sh shutdownApplicationsManager.sh
        sh shutdownApplicationsManager.sh -force
  2. Start PostgreSQL using these steps:
    1. For windows, In Administrator Command Prompt, go to AppManager_Home\working\ folder and execute the below command to start PGSQL database:
      bin\startPGSQL.bat
    2. For Linux, In Command Prompt, go to AppManager_Home/working/ folder and execute the below command to start PGSQL database:
      ./bin/startPGSQL.sh
  3. Connect to PostgreSQL database from command prompt using the steps provided in this link: https://pitstop.manageengine.com/portal/en/kb/articles/connecting-to-applications-managers-bundled-database
  4. Once connected to the Applications Manager database (amdb) in PostgreSQL, execute below query to repair / reindex database: 
    VACUUM FULL VERBOSE ANALYZE;
  5. Once execution completes, you can exit the PostgreSQL's Command Line using the meta-command \q
  6. Stop PostgreSQL using these steps:
    1. For windows, In Administrator Command Prompt, go to AppManager_Home\working\bin folder and execute the below command to start PGSQL database:
      stopPGSQL.bat
    2. For Linux, In Command Prompt, go to AppManager_Home/working/bin folder and execute the below command to start PGSQL database:
      ./stopPGSQL.sh
  7. Go to AppManager_Home directory rename the logs folder to logs_old, create a new folder name it as logs. Then proceed to start Applications Manager.


II. Applications Manager with Microsoft SQL Database

  1. Shutdown all Applications Manager related process as follows:
    1. For windows:
      1. Open services.msc --> stop ManageEngine Applications Manager service.
      2. Open Command Prompt as an Administrator, go to AppManager_Home\ and then execute the below command
        shutdownApplicationsManager.bat -force 
        (execute this until you get a message that, all process have been shutdown)
    2. For Linux
      1. Open Command Prompt with proper privileges' go to AppManager_Home/ and then execute the below commands
        sh shutdownApplicationsManager.sh
        sh shutdownApplicationsManager.sh -force
  2. Connect to Applications Manager backend Microsoft SQL database using SQL Server Management Studio (SSMS) and execute the below queries:
    1. To repair the database: 
      DBCC CHECKDB WITH ALL_ERRORMSGS, NO_INFOMSGS; 
    2. To reindex/reduce size:
      EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ', 80)"; 
      EXEC sp_updatestats;
  3. Go to AppManager_Home directory rename the logs folder to logs_old, create a new folder name it as logs. Then proceed to start Applications Manager.


III. Applications Manager with MySQL Database

  1. Shutdown all Applications Manager related process as follows:
    1. For windows:
      1. Open services.msc --> stop ManageEngine Applications Manager service.
      2. Open Command Prompt as an Administrator, go to AppManager_Home\ and then execute the below command
        shutdownApplicationsManager.bat -force 
        (execute this until you get a message that, all process have been shutdown)
    2. For Linux
      1. Open Command Prompt with proper privileges' go to AppManager_Home/ and then execute the below commands
        sh shutdownApplicationsManager.sh
        sh shutdownApplicationsManager.sh -force
  2. Execute repairMysqlDB.bat (.sh for Linux) file present under the <AppManager_Home>/bin directory & then run optimizeMysqlDB.bat (.sh for Linux) file present in the same location via command prompt with administrator permission.
  3. Rename the <AppManager_Home>/logs directory as logs_old and then create a new logs folder. Then proceed to start Applications Manager.
If the Applications Manager cannot be started, even after following the above steps to repair MySQL database, then do the below steps (Only in Windows servers):

  1. Open the command prompt, go to the location <AppManager_Home>\working\mysql\data\AMDB folder and execute the below commands one by one:
    DIR *.MYD-*  >> tables.txt`
    REN  *.MYD
    -*  *.MYD  >> tables.txt
    DIR *.MYD
    -* >> tables.txt
  2. Restart Applications Manager from services and it may fail for first time. Please wait for couple of minutes and then restart again
  3. Still if you are not able to start the Applications Manager, send us the support information file and the latest tables.txt file from step 1.

      New to ADSelfService Plus?

        Resources