Tips to keep in mind in case you need to recover your postgresql database from the folder … DATA of a previous postgresql installation.
1. DO NOT try to write over the files in the folder … DATA of a new installation, with the folder … DATA retrieved, postgresql may not recognize, or not read, the previous databases existing in the recovered folder.
Examples of Incompatibility:
Previous Installation v8.3 → new installation v8.4.
The language of the previous installation must be the same as that of the new installation.
DO NOT copy from a previous installation in C:\Program Files\PostgreSQL8.4\data
To an installation C:\Program Files\PostgreSQL8.4\data
Postgresql must be installed on the same versions of operating systems, if the previous version was in Windows XP Professional, the new installation must be under the same operating system, if you have made an upgrade to Windows 7 You may have problems with the Folder … previous DATA.
2. If all of the above is compatible; Then stop the postgresql service
You can write a recent (new) installation of postgresql, copying your folder … previous DATA recovered, about the new installation.
3. If the service is not stopped, and then restart the PC or the database service, the Postgresql service will not run successfully, the service will fail because the folder information … DATA retrieved contains installation configurations From where the folder … DATA was extracted.
4. If you recovered the folder … DATA from another postgresql installation we suggest that if you are going to restore the database, do it from a new postgresql installation, or if it is about an old postgresql installation, you should try to backup it Folder … current DATA, taking into account the above compatibility.
5. DO NOT try for any reason to mix the files of the folder … current DATA with those of another folder … DATA retrieved, will fail to upload the postgresql service.
Extra Credits for @Al_Hilario (twitter) for his recommendations and contributions.
Do not hesitate to provide other suggestions in these cases, or if you present other concerns at the moment we hope and guide you in the process.