  Aims: We aim to determine the abundances of SiO, CS, SiS, SO, and SO$_2$ in a
large sample of oxygen-rich AGB envelopes covering a wide range of mass loss
rates to investigate the potential role that these molecules could play in the
formation of dust in these environments.
  Methods:We surveyed a sample of 30 oxygen-rich AGB stars in the $\lambda$ 2
mm band using the IRAM 30m telescope. We performed excitation and radiative
transfer calculations based on the LVG method to model the observed lines of
the molecules and to derive their fractional abundances in the observed
envelopes.
  Results:We detected SiO in all 30 targeted envelopes, as well as CS, SiS, SO,
and SO$_2$ in 18, 13, 26, and 19 sources, respectively. Remarkably, SiS is not
detected in any envelope with a mass loss rate below $10^{-6}$ M$_{\odot}$
yr$^{-1}$, whereas it is detected in all envelopes with mass loss rates above
that threshold. From a comparison with a previous, similar study on C-rich
sources, it becomes evident that the fractional abundances of CS and SiS show a
marked differentiation between C-rich and O-rich sources, being two orders of
magnitude and one order of magnitude more abundant in C-rich sources,
respectively, while the fractional abundance of SiO turns out to be insensitive
to the C/O ratio. The abundance of SiO in O-rich envelopes behaves similarly to
C-rich sources, that is, the denser the envelope the lower its abundance. A
similar trend, albeit less clear than for SiO, is observed for SO in O-rich
sources.
  Conclusions: The marked dependence of CS and SiS abundances on the C/O ratio
indicates that these two molecules form more efficiently in C- than O-rich
envelopes. The decline in the abundance of SiO with increasing envelope density
and the tentative one for SO indicate that SiO and possibly SO act as gas-phase
precursors of dust in circumstellar envelopes around O-rich AGB stars.
