Oberramsern is a former municipality in the district of Bucheggberg, in the canton of Solothurn, Switzerland. On 1 January 2010 the former municipalities of Balm bei Messen, Brunnenthal and Oberramsern merged into the municipality of Messen.