Upgrade postgresql from 9.3 to 9.5 in Ubuntu 16.04 LTS Upgrade postgresql from 9.3 to 9.5 in Ubuntu 16.04 LTS postgresql postgresql

Upgrade postgresql from 9.3 to 9.5 in Ubuntu 16.04 LTS


To see if your database is still on your server check this folder :

ls /var/lib/postgresql/9.3/main/base/

If you have files there, this mean your database is still here !!If nothing in this folder, this mean your life data have been deleted.

Did you made a regular backup of your database ?

If so, you need to install back your previous version of PostgreSQL and make a restore of it.

apt-get install postgresql-9.3psql -h localhostcreate database dbname;psql -h localhost dbname < backup_file

After the normal process to upgrade on Debian or Ubuntu is this one :service postgresql stop

On vire le clus­ter de la nouvelle version (norma­le­ment vide si on vient juste de l’ins­tal­ler : faire gaffe à ne pas lais­ser passer de temps entre l’ins­tal­la­tion de la nouvelle version et la migra­tion des données, pour que personne n’uti­lise le nouveau clus­ter)

Stop the new updated version of PostreSQL :

service postgresql stop

Drop the new updated version cluster to be sure nothing is inside :

pg_dropcluster --stop 9.5 main

Then data migration :

pg_upgradecluster -m upgrade 9.3 main

Then stop previous version of PotsgreSQL :

pg_dropcluster 9.3 main --stop

Remove the old version :

apt-get autoremove --purge postgresql-9.3 

Then just restart PostgreSQL, the new version with database migrated :

service postgresql start

Hope this help.

But if you didn't do any backup, unfortunatly you should have loose everything.