The objective of this study is to develop a simple tool for predicting the resonant frequency of the piston mode wave oscillation in a moonpool or a narrow gap between twin floating barges. Based on the dynamic analysis and the domain-decomposition, a linear harmonic oscillator model for the fluid oscillation in a confined space is formulated, which immediately leads to an explicit dynamic solution for the resonant frequency. In the model, it is assumed that the water depth is equal to or greater than a critical value dependent on the ratio of the draft to the breadth of the floating body. The predicted resonant frequencies are compared with the numerical results of the linear potential model and the viscous fluid model, the semi-analytical potential solutions and the experimental measurements. Good agreements are observed for a wide range of geometric parameters of the moonpool and the narrow gap of either sharp or round edge shapes. The present dynamic method is also applied to predict the resonant frequency of the piston mode oscillation in the gap between a floating body and a vertical wall with a reasonable success.