This work investigates the optimal management of an aggregated defined pension plan in a stochastic environment. The interest rate is supposed to follow the Ornstein-Uhlenbeck model. The benefits follow the geometric Brownian motion while the contribution rate is determined by the spread method of fund amortization. The pension manager invests in the financial market with three assets: cash, bond and a stock. Regardless of the initial status of the plan, we suppose that the pension fund may become underfunded or overfunded at the terminal time. The optimization goal of the manager is to maximize the expected utility in the overfunded region minus the weighted solvency risk in the underfunded region. Based on theory of derivative pricing, we introduce an auxiliary process and related equivalent optimization problem. Using martingale method, four cases (high tolerance towards solvency risk, low tolerance towards solvency risk, extreme risk aversion and no solution) for the optimal wealth process, optimal portfolio, efficient frontier and probabilities in the overfunded (underfunded) are obtained. In the end of the paper, numerical analyses are present to illustrate the manager's economic behaviors.