The invention discloses a pulse coding distribution-type fiber Raman and Brillouin scattering sensor which comprises a waveform generator, a semiconductor F-P (Fabry-Perot) cavity broadband fiber laser, a semiconductor outer cavity narrow-band pulse fiber laser, a fiber wave separator, a pulse coding photomodulator, an one-way device, an Er-doped fiber amplifier, a bidirectional coupler, a sensing fiber, an integrated wavelength division multiplexer, two photoelectric receiving and amplifying modules, a direct detection system, a narrow-band transmission fiber bragg grating, a circulator, a coherent detection system and an industrial personal computer. The sensor adopts tow laser sources, wherein the semiconductor F-P cavity broadband fiber laser measures temperature by use of a spontaneous fiber Raman scattering intensity ratio; and the other one semiconductor outer cavity narrow-band pulse fiber laser measures strain of frequency shift by use of the spontaneous fiber Brillouin scattering ray. A time sequence codes laser pulse, the spatial resolution is improved by lowering laser pulse width while the transmission photon number is improved, the signal to noise ratio of the systemis improved, and the measurement precision is measured and improved while on-line temperature and strain are realized in space.