Bubble dynamics near a rigid boundary are associated with wide and important applications in cavitation erosion in many industrial systems and medical ultrasonics. This classical problem is revisited with the following two developments. Firstly, computational studies on the problem have commonly been based on an incompressible fluid model, but the compressible effects are essential in this phenomenon. Consequently, a bubble usually undergoes significantly damped oscillation in practice. In this paper this phenomenon will be modelled using weakly compressible theory and a modified boundary integral method for an axisymmetric configuration, which predicts the damped oscillation. Secondly, the computational studies so far have largely been concerned with the first cycle of oscillation. However, a bubble usually oscillates for a few cycles before it breaks into much smaller ones. Cavitation erosion may be associated with the recollapse phase when the bubble is initiated more than the maximum bubble radius away from the boundary. Both the first and second cycles of oscillation will be modelled. The toroidal bubble formed towards the end of the collapse phase is modelled using a vortex ring model. The repeated topological changes of the bubble are traced from a singly connected to a doubly connected form, and vice versa. This model considers the energy loss due to shock waves emitted at minimum bubble volumes during the beginning of the expansion phase and around the end of the collapse phase. It predicts damped oscillations, where both the maximum bubble radius and the oscillation period reduce significantly from the first to second cycles of oscillation. The damping of the bubble oscillation is alleviated by the existence of the rigid boundary and reduces with the standoff distance between them. Our computations correlate well with the experimental data (Philipp & Lauterborn, J. Fluid Mech., vol. 361, 1998, pp. 75–116) for both the first and second cycles of oscillation. We have successively reproduced the bubble ring in direct contact with the rigid boundary at the end of the second collapse phase, a phenomenon that was suggested to be one of the major causes of cavitation erosion by experimental studies.