How do I move the built-in EventSentry PostgreSQL database?

Article ID: 247
Category: Database
Applies to: 2.93 and newer
Updated: 2022-10-14

First we recommend you make a backup of the database in case you have any issues and need to re-install:

How do I back up the built in EventSentry database?

Once you've got a backup then you can proceed with moving the database by following these steps:

  • Stop the "EventSentry Database v14" Service (Control Panel > Administrative Tools > Services)

  • Copy "C:\Program Files\EventSentry\data14" in an elevated command prompt using Xcopy to retain permissions to the destination directory (ex. D:\EventSentry\Data14)
  • Note: If you still use Postgres v9.6, then you would use the "EventSentry Database v9.6" service and "C:\Program Files (x86)\EventSentry\data96" folder instead. PostgreSQL v14.x started shipping with EventSentry version 5.0.

    Example Commmand:

    xcopy "C:\Program Files\EventSentry\data14" "D:\EventSentry\Data14" /e /o

  • Open the Registry Editor (Start > Run > regedit.exe)

  • Go to HKLM\System\CurrentControlSet\Services\eventsentrydatabase14

  • Modify the "ImagePath" value so that the "-D" option points to the new database location.


Before:
C:\Program Files\EventSentry\postgresql14\bin\pg_ctl.exe runservice -N "eventsentrydatabase14" -D "C:\Program Files \EventSentry\data14" -o "-p 5432"

After:
C:\Program Files\EventSentry\postgresql14\bin\pg_ctl.exe runservice -N "eventsentrydatabase14" -D "D:\EventSentry\Data14" -o "-p 5432"

  • Start the "EventSentry Database v14" Service (Control Panel > Administrative Tools > Services) and start up the "EventSentry Collector" service as well.