Context. Longitudinal filament oscillations recently attracted increasing attention, while the restoring force and the damping mechanisms are still elusive. Aims. We intend to investigate the underlying physics for coherent longitudinal oscillations of the entire filament body, including their triggering mechanism, dominant restoring force, and damping mechanisms. Methods. With the MPI-AMRVAC code, we carried out radiative hydrodynamic numerical simulations of the longitudinal prominence oscillations. We modeled two types of perturbations of the prominence, impulsive heating at one leg of the loop and an impulsive momentum deposition, which cause the prominence to oscillate. We studied the resulting oscillations for a large parameter scan, including the chromospheric heating duration, initial velocity of the prominence, and field line geometry. Results. We found that both microflare-sized impulsive heating at one leg of the loop and a suddenly imposed velocity perturbation can propel the prominence to oscillate along the magnetic dip. Our extensive parameter survey resulted in a scaling law that shows that the period of the oscillation, which weakly depends on the length and height of the prominence and on the amplitude of the perturbations, scales with R/g , where R represents the curvature radius of the dip, and g is the gravitational acceleration of the Sun. This is consistent with the linear theory of a pendulum, which implies that the field-aligned component of gravity is the main restoring force for the prominence longitudinal oscillations, as confirmed by the force analysis. However, the gas pressure gradient becomes significant for short prominences. The oscillation damps with time in the presence of non-adiabatic processes. Radiative cooling is the dominant factor leading to damping. A scaling law for the damping timescale is derived, i.e., τ ∼ l 1.63 D 0.66 w −1.21 v −0.30 0 , showing strong dependence on the prominence length l, the geometry of the magnetic dip (characterized by the depth D and the width w), and the velocity perturbation amplitude v 0 . The larger the amplitude, the faster the oscillation damps. We also found that mass drainage significantly reduces the damping timescale when the perturbation is too strong.