How to rebuild client policy database LDClientDB.db3

Version 5

    Verified Product Versions

    Endpoint Manager 9.5Endpoint Manager 9.6Endpoint Manager 2016.x

    You can consider rebuilding the client policy database if there are errors similar to below in the policy.cgi.log:

     

    Tue, 06 Aug 2013 14:52:16 --> Listing policies (session 520087d71271a611dc)

    Tue, 06 Aug 2013 14:52:16 no such column: Category_IDN

    Tue, 06 Aug 2013 14:52:16 LdcDatabase::ExecuteQueryTable: failed sql "select distinct id, filename, name, description, status, nstatus, username, recommended, policyType, policyPeriod, lastRunTimeT, taskLastRescheduleTimeT, lastStartTimeT, installing, size, portalSessionId, TaskGroup, Category_IDN from PortalTaskInformation where IsPackage=1 and (username = '.\' or username = 'heatcraft\ctxuser7') order by recommended desc, name asc" with error "no such column: Category_IDN"

    Tue, 06 Aug 2013 14:52:16 ERROR 288 : LdcDbMutex::Unlock failed to release mutex PID = 5816 and ThreadId = 6020

    Tue, 06 Aug 2013 14:52:16 LdcDatabase::ExecuteQueryTable: failed unknown exception.


    Below are the steps to rebuild the database:

    1. In the Management Suite Console go to Tools- Distribution- Manage Scripts.
    2. RIght click on My Scripts and select New Custom Script.
    3. Delete everything that is pre-populated in the script editor.
    4. Copy and paste the following script into the editor.

      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      ;
      ; LANDesk(R) Management Suite Custom Script
      ;
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      ; MACHINES - This section is run once for each machine in the target set.
      ; Commands in this section will be processed in the order they are listed
      ; in the custom script. This section supports both local (LOCxxx) and remote
      ; (REMxxx) commands.
      [MACHINES_NT]

      REMEXEC1=cmd /c del /f /q "%LDMS_CLIENT_DIR%\sdclient.tasks.xml"
      REMEXEC2=cmd /c del /f /q "%LDMS_CLIENT_DIR%\..\Shared Files\cbaroot\alert\queue\internal*.xml"
      REMEXEC3=cmd /c net stop "LANDesk Policy Invoker"
      REMEXEC4=cmd /c del /f /q "c:\Documents and Settings\All Users\Application Data\LANDesk\ManagementSuite\Database\*.db3*"
      REMEXEC5=cmd /c del /f /q "c:\programdata\LANDesk\ManagementSuite\*.db3*"
      REMEXEC6=cmd /c "%LDMS_CLIENT_DIR%\clientdbutil.exe" /create
      REMEXEC7=cmd /c net start "LANDesk Policy Invoker"
      REMEXEC8=cmd /c ping 127.0.0.1
      REMEXEC9=cmd /c "%LDMS_CLIENT_DIR%\policy.sync.exe"
    5. Name the script "Client Policy DB Cleanup", click save.
    6. Right click on the script and select Schedule.
    7. Add the problematic machine to the task and run it.

     

    There is one caveat to this script, it does a complete rebuild of the client policy database. That being the case the client will attempt to rerun each policy distribution task that is currently assigned to it. So if you have regular Software Distribution or Patching tasks assigned to the clients being targeted they will try to run even if they have run successfully in the past. If you are worried about this happening remove the client from those tasks if possible.