  In this paper, we establish the second term identity of the Siegel-Weil
formula in full generality, and derive the Rallis inner product formula for
global theta lifts for any dual pair. As a corollary, we resolve the
non-vanishing problem of global theta lifts initiated by Steve Rallis.
