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