Facing global energy shortage,shale gas has become a research hotspot as new unconventional resources. A 3D geological model is established to analyze the effect of injection rate of CO2 or mixture of CO2 and N2 as well as percentage of N2 in mixed gas on shale gas production by numerical simulation of the Yanchang Formation shale in Ordos Basin. Results show that the injection of CO2 or mixture of CO2 and N2 at the rate of 0.05,0.5 and 1 kg/s can increase shale gas production,and the injection of mixed gas obtains better recovery than injection of CO2 only. When CO2 is only injected at the rate of 0.05 kg/s,shale gas production is increased by 13.21% after 30 years with no CO2 breakthrough in methane production wells. When the mixture of CO2 and N2 is injected at the rate of 0.05 kg/s,N2 will occur in the methane production wells. The ratio of N2 is larger,the content of N2 is higher after breakthrough. However,in order to avoid gas content in the methane production well exceeding the 10% when the breakthrough occurs,it is necessary to strictly control the injection rate of CO2 or mixture of CO2 and N2 as well as percentage of N2 in the mixed gas.