  We investigate the use of the [O II] $\lambda3727$ emission line as a star
formation rate (SFR) estimator using Sloan Digital Sky Spectra for nearly
100,000 star-forming galaxies and 5,500 galaxies with narrow-line active
galactic nuclei. Consistent with previous work, we find that the [O
II]/H$\alpha$ ratio in star-forming galaxies depends strongly on gas-phase
metallicity. Using metallicities derived from the [N II] $\lambda 6584$/[O II]
$\lambda 3727$ method, we refine a metallicity-dependent SFR estimator based on
[O II] that is calibrated within a scatter of 0.056 dex against the more
commonly used SFR indicator based on H$\alpha$ emission. The scatter increases
to only 0.12 dex if the metallicity is estimated using the stellar
mass-metallicity relation. With the aim of extending the [O II]-based SFR
estimator to active galaxies, we calculate radiation pressure-dominated
photoionization models to constrain the amount of [O II] emission arising from
the narrow-line region. We use the sample of active galaxies to demonstrate
that the SFRs derived from [O II], after accounting for nonstellar
contamination, are consistent with independent SFR diagnostics estimated from
the stellar continuum of the host galaxies.
