We carry out two-dimensional global particle-in-cell simulations of the interaction between the solar wind and a dipole field to study the formation of the bow shock and magnetosphere. A self-reforming bow shock ahead of a dipole field is presented by using relatively high temporal-spatial resolutions. We find that (1) the bow shock and the magnetosphere are formed and reach a quasi-stable state after several ion cyclotron periods, and (2) under the Bz southward solar wind condition the bow shock undergoes a self-reformation for low b{eta}i and high MA. Simultaneously, a magnetic reconnection in the magnetotail is found. For high b{eta}i and low MA, the shock becomes quasi-stationary, and the magnetotail reconnection disappears. In addition, (3) the magnetopause deflects the magnetosheath plasmas. The sheath particles injected at the quasi-perpendicular region of the bow shock can be convected to downstream of an oblique shock region. A fraction of these sheath particles can leak out from the magnetosheath at the wings of the bow shock. Hence, the downstream situation is more complicated than that for a planar shock produced in local simulations.