This study demonstrates a global, non-parametric, non-iterative optimization of time-mean value of a kind of index vibrated by time-varying forcing. It is based on the fact that the (steady) forced vibration of non-autonomous ordinary differential equation systems is well approximated by an analytical solution when the amplitude of forcing is sufficiently small and its base state without forcing is stable and steady. It is applied to optimize a time-averaged heat-transfer rate on a two-dimensional thermal convection field in a square cavity with horizontal temperature difference, and the globally optimal way of vibrational forcing, i.e. the globally optimal, spatial distribution of vibrational heat and vorticity sources, is first obtained. The maximized vibrational thermal convection corresponds well to the state of internal gravity wave resonance. In contrast, the minimized thermal convection is weak, keeping the boundary layers on both sidewalls thick.