Link's:
[1] Osm2pgsql
[2] source
[3] gdal
[wiki.openstreetmap.org/wiki/Contours] Contours
[4] Export
Convert Database to *osm
osmosis --read-apidb host="x" database="x" user="x" password="x" --write-xml file="planet.osm"
Postgis Setup instructions [5]