The self-alignment process can provide an accurate initial attitude of SINS. The conventional two-procedure method usually includes coarse and fine alignment processes. Coarse alignment converges fast because of its batch estimating characteristics and the initial attitude does not influence the results. But coarse alignment is low accuracy without considering the IMU's bias. The fine alignment is more accurate by applying a recursive Bayesian filter to estimate the IMU's bias, but the attitude converges slowly as the initial value influence the convergence speed of the recursive filter. Researchers have proposed the unified self-alignment to achieve self-alignment in one procedure, existing unified methods make improvements on the basics of recursive Bayesian filter and those methods are still slow to converge. In this paper, a unified method based on batch estimator FGO (factor graph optimization) is raised, which is converge fast like coarse alignment and accurate than the existing method. We redefine the state and rederivation the state dynamic model first. Then, the optimal attitude and the IMU's bias are estimated simultaneously through FGO. The fast convergence and high accuracy of this method are verified by simulation and physical experiments on a rotation SINS.