Moving the PostgreSQL Database on the Same Computer

To transfer PostgreSQL database from C drive to another drive on the same computer, do the following:

1. Stop the EkranServer service.

2. Open services.msc, and find the postgresql-xxx service, and then check the account under which the service is running (by way of example, the Network Service account is shown on the following screenshot).


3. Create a folder on another drive in the location where you want to transfer the database to, and in the folder’s Properties, on the Security tab, add the user who will run the PostgreSQL Server, and grant them all permissions.


4. Open pgAdmin, and right-click on the Tablespaces section, and then select Create > Tablespace…


5. Specify a name for the new Tablespace, and then select the folder created in Step 3, and click Save to apply the changes.

6. For all Ekran System databases (i.e. ekranactivitydb, EkranManagementDatabase, and EkranUbaDatabase) do the following:

Right-click on the database, and open the Properties > Definition section, and then find the Tablespace field.

• Select the name of the Tablespace created in Step 4, and click Save to apply the changes.

    After a while, the pop-up window will then close, and the databases will have been transferred to the new Tablespace.

7. If any connections to the databases were open at the time of transference, you will see an error. To resolve this issue, close the connections that are open by running the following script, and then repeat the instructions once again:

1SELECT pg_terminate_backend (

2FROM pg_stat_activity

3WHERE pg_stat_activity.datname = 'database_name';