General formulae of the second order perturbation energies due to the tensor force are given in the case of the closed shell+one nuclei, and useful formulae for calculating the two-body matrix elements are also derived. Using these formulae, the D-state doublet splitting in O17 is estimated and it is found that about a half of the observed value is explained in terms of the second order effect of the tensor force as in the case of He5 and N15.