Spectral analysis of a nonlinear oscillator driven by random and periodic forces. I. Linearized theory