I was running different postgresql versions. And accidentally they were removed. they contained several databases and I want to recover them. I'm wondering if there'a a command line in linux that allows me to recover lost data.

Your help would be so precious!

Thank you in advance

  • The Postgres executable files and the databases' data files are separate. Which files were removed?
    – CL.
    Oct 16 '18 at 8:35
  • The installations of the different postgresql versions that existed in my distant server which were removed Oct 16 '18 at 9:41
  • What do you mean with "installations", the executables or the data files? Do you know the names of the directories that were removed?
    – CL.
    Oct 16 '18 at 10:11
  • I accidentally removed the executables such as postgresql-8.4, postgresql-9.1. And I believe when you remove or unistall an app all the data inside is also gone. I wonder if there is a way to recover everything was unistalled Oct 16 '18 at 10:15
  • The actual data is stored somewhere else (see PostgreSQL database default location on Linux).
    – CL.
    Oct 16 '18 at 10:18
  1. Take a backup of the entire data directory for each.
  2. Reinstall the version of postgresql you need
  3. Point its data directory at your existing one

If you are running a packaged version of postgresql then there might be nothing to do for 3

  • I want to recover the ancient postgresql versions wich contains some databases. To be more clear. I wanted to install a newest version of postgresql then I accidentally removed the other versions that were previously installed. Now I want to recover this versions to have the ancient databases. I don't know if it's possible but if there's a way it would be great Oct 15 '18 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.