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

Article ID: 247
Category: Database
Applies to: 2.93 and newer
Updated: 2019-12-09

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 v9.6 Service (Administrative Tools > Services panel on your Windows Server)

  • Copy "C:\Program Files (x86)\EventSentry\data96" in an elevated command prompt using Xcopy to retain permissions to the destination directory (ex. D:\EventSentry\Data96)
  • Example Commmand:

    Xcopy "C:\Program Files (x86)\EventSentry\data96" "D:\EventSentry\Data96" /e /o

    *Note: If you use PostgreSQL 9.1, the default folder would be "C:\Program Files (x86)\EventSentry\data". PostgreSQL 9.6 started shipping with EventSentry v3.3.

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

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

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


Before:
C:/Program Files (x86)/EventSentry/postgresql/bin/pg_ctl.exe runservice -N "eventsentrydatabase" -D "C:/Program Files (x86)/EventSentry/data96" -o "-p 5432"

After:
C:/Program Files (x86)/EventSentry/postgresql/bin/pg_ctl.exe runservice -N "eventsentrydatabase" -D "D:/EventSentry/Data96" -o "-p 5432"

  • Start the EventSentry Database v9.6 Service (Administrative Tools > Services panel on your Windows Server)