Move the database on the same computer
This moves the database to a different drive using a PostgreSQL tablespace, without changing computers.1
Stop the Application Server
Stop the EkranServer service.
2
Identify the PostgreSQL service account
Open
services.msc, find the postgresql-xxx service, and note the account it runs as (for example, Network Service).3
Create and permission the new folder
Create a folder on the target drive, then on its Properties > Security tab, add the PostgreSQL service account and grant it full permissions.
4
Create a tablespace
In pgAdmin, right-click Tablespaces, select Create > Tablespace…, name it, and point it at the folder created above. Click Save.
5
Move each Syteca database to the new tablespace
For
ekranactivitydb, EkranManagementDatabase, and EkranUbaDatabase: right-click the database, open Properties > Definition, set Tablespace to the one created above, and click Save.The transfer completes once the confirmation pop-up closes.
6
Close any open connections if the move fails
If open connections block the transfer, run the following (replacing
database_name), then retry step 5:Move the database to another computer
By default, PostgreSQL for Windows stores its data inC:\Program Files\PostgreSQL\<version>\data (the PGDATA directory).
1
Stop the Application Server
Open Windows Services and stop the EkranServer service.
2
Stop PostgreSQL on both computers
Stop the PostgreSQL service on both the old and new PostgreSQL servers.
3
Move the PGDATA directory
Move the entire PGDATA directory to the new machine, which must have the same PostgreSQL version installed.
Perform this as an Administrator, and confirm the PostgreSQL service account has the required permissions on the new directory — otherwise PostgreSQL won’t start.
4
Update the registry path
On the new machine, open
regedit.exe, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pgsql-<version>, and edit ImagePath so the path after -D points to the new PGDATA location.Wrap the path in quotes if it contains spaces.
5
Update pg_hba.conf
On the new machine, open the
pg_hba config file in the PGDATA folder (by default C:\Program Files\PostgreSQL\13\data). Under IPv4 local connections, add a new line below the existing one, using the Syteca Application Server’s IP address and md5 as the encryption method (instead of scram-sha-256).6
Restart the PostgreSQL service
Close and reopen the Windows Services window (so it picks up the registry change without a full system restart), then confirm the service’s path to executable still ends with the new
-D location before starting it.7
Update the Database Parameters tool
On the Application Server computer, open Database Parameters from the Syteca Server tray icon, and update Host Name to the new PostgreSQL server’s address.
If the
postgres user’s password changed on the new server, update it here too.8
Restart the Application Server
Start the EkranServer service.
Related
Moving the MS SQL Database
The equivalent procedure for MS SQL Server deployments.
PostgreSQL performance tuning
Optimize the database after moving it.
Database parameters
Update the connection after a move.