We show that the resonant field enhancement of light obliquely incident on a quadratically nonlinear metamaterial with refractive index gradually changing from positive to negative values enables ultracompact geometry for second harmonic generation at significantly reduced input powers.