HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Upgrading using pg_upgrade on windows fails

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
failsupgradingpg_upgradeusingwindows

Problem

When upgrading from postgres 9.2 to 9.3 by following the upgrade procedure found in PostgreSQL 9.3.4 documentation about pg_upgrade, the following command fails:

RUNAS /USER:postgres "CMD.EXE"


After some investigation, it seems there is no postgres windows user on the machine. This causes the pg_upgrade command to fail as well.

How should I run the upgrade process?

Solution

Open an administrator cmd window as described in the link above.

Make sure you cd into an empty writable folder (for example, c:\temp\somewhere).

Execute the pg_upgrade command, and make sure to add an -u postgres parameter to it:

"C:\Program Files\PostgreSQL\9.3\bin\pg_upgrade.exe" -u postgres
--old-datadir "C:/Program Files/PostgreSQL/9.2/data"
--new-datadir "C:/Program Files/PostgreSQL/9.3/data"
--old-bindir "C:/Program Files/PostgreSQL/9.2/bin"
--new-bindir "C:/Program Files/PostgreSQL/9.3/bin"

Context

StackExchange Database Administrators Q#64697, answer score: 8

Revisions (0)

No revisions yet.