INFORMATICS

The Best

Migrating PostgreSQL files to new server

Звезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активнаЗвезда не активна
 

Migrating PostgreSQL files to new server

Install the latest minor release of the same PostgreSQL major version - e.g. if you were using 9.4.1 before, install 9.4.26. Make sure it's the same architecture - i.e. if you were using a 32-bit PostgreSQL before you must install 32-bit PostgreSQL now.

  • Stop the service (postgresql) using the services control panel (services.msc).
  • Path in services - "C:\Program Files\PostgreSQL\9\bin\pg_ctl.exe" runservice -N "postgresql-x64-9" -D "D:\PostgreSQL\9\data" -w do not
  • Modify the configuration to the following with the sc command:  sc config postgresql-x64-9.4 binPath= "\"C:\Program Files\PostgreSQL\9.4\bin\pg_ctl.exe\" runservice -N \"postgresql-x64-9.4\" -D \"E:\pg_db\data\" -w"
  • Delete %PROGRAMFILES%\PostgreSQL\9.4\data.
  • Copy the old data directory to that location - copy C:\Program Files\PostgreSQL\9.4\data\ to E:\pg_db\data
  • Get properties on the data directory and in the security tab recursively grant full control to NETWORKSERVICE or pgsql -  - bad permissions will prevent the database from starting
  • Start the service using services.msc
  • immediately set up backups.

Search