Sunday, May 14, 2023

Upgrade Postgres from 9.6 to 14 on Ubuntu Bionic (18)

I had to first install Postgres 14. 15 was available but that was too far ahead of my Mac OS X machine that I use in my house. So I installed 14. This left 9.6 and 14 simultaneously installed. I had to migrate my data, and I believe I accomplished that. The commands were:

  # drop the post 14 installation cluster
  > sudo pg_dropcluster 14 main

  # upgrade the 9.6 cluster to 14 (migrates your data, I think)
  > sudo pg_upgradecluster 9.6 main

I had two databases being used, and they made it over. I accidentally removed the cluster files in the 14 installation at first, so I had to restore them and do a chown -R to make pg_dropcluster work again.

No comments:

Post a Comment