How to upgrade postgresql database from 10 to 12 without losing data for openproject

前端 未结 3 802
醉梦人生
醉梦人生 2021-02-14 01:55

My OpenProject management software is installed with default postgresql 10. Currently the postgresql DB is 12, It is having lot of new features.

I want to upgrade my Pos

3条回答
  •  感动是毒
    2021-02-14 02:12

    1. Backup the database
      psql --version sudo -u postgres psql pg_dumpall > alldbs.sql
      
      (this command will backup all databases from the postgresql db)

    Then exit from postgres user, and:

    1. Inside a terminal run these commands:

      sudo systemctl stop postgres
      sudo apt-get install -y postgresql-12 postgresql-server-dev-12 postgresql-contrib-12 libpq-dev postgresql-12-hypopg
      sudo pg_dropcluster 12 main --stop
      sudo pg_upgradecluster 10 main
      sudo pg_dropcluster 10 main --stop
      
    2. restart the postgresql service:

      sudo systemctl restart postgresql
      
    3. login to the postgres:

      su - postgres
      
    4. to check the version:

      psql --version
      

    I have done using the above steps and I could update the DBand restore all data.

提交回复
热议问题