The first-principles method has been used to explore how to minimize the over-erase phenomenon in charge trapping memory. Over-erase phenomenon originates from the nitrogen vacancy due to its weak localization of charge on Si atoms. Therefore, we develop a defect model for studying Si3N4 supercells. The defect model consists of an N vacancy and a substitutional atom on the Si site. The substitutional atoms can be C, N, and O atoms, respectively. The Si site belongs to the N vacancy. Then, the Bader charge distribution after program/erase operation, the interaction energy and density of states are calculated for the model so as to analyze the effects of the substitutional atoms on the over-erase phenomenon. The obtained results of the Bader charge distribution show that the substitution of O for the 128th Si can minimize the over-erase phenomenon in Si3N4, and the replacement of the 128th Si by C can also reduce the over-erase phenomenon. However, the model represents a weak localization of charge due to the replacement by C, which is not preferable for charge storage. And the results also reveal that the substitution of N for the 128th Si completely fails to reduce the over-erase phenomenon. With regard to the 162th and 196th Si sites, the substitutions of the three atoms for the two sites cannot minimize the over-erase phenomenon. Furthermore, the analysis of the interaction energies indicates that the combination of each of the three atoms with the N vacancy can form stable clusters on the 128th site in the model. In particular, the attractive interaction between O and N vacancy is the weakest of the three so that the injected charge can temporarily break the stability of the O cluster to rearrange the charge distribution, realizing the localization of charge around the O cluster. And then, the results of the density of states designate that subtitutional O atom at the 128th Si atom site produces a deep-level trap in the band gap, which has a powerful ability to localize the charge. The above results suggest that substitution of O for Si is an excellent solution for the minimization of over-erase phenomenon in Si3N4. This work can provide a method for the minimization of over-erase phenomenon in charge trapping memory and also can be helpful to the improvement of charge retention and optimization of memory window in the charge trapping memory.