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

Article ID: 247
Category: Database
Applies to: 2.93 and newer
Updated: 2022-05-06

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 9.6, you would be dealing with the "EventSentry Database v9.6" service and the "C:\Program Files (x86)\EventSentry\data96" folder instead

    Example Commmand:

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

    *Note: If you still use PostgreSQL 9.6, the default folder would be "C:\Program Files\EventSentry\data14" and you would be dealing with the "EventSentry Database v9.6" service. PostgreSQL 14 started shipping with EventSentry version 5.0.

  • 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 (x86)/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.