A novel method to detect the defect location and corrosion degree of petroleum pipelines by microwave is proposed in this paper. Three hypotheses are set in the simulation experiment: (a) intact oil pipeline; (b) corrosive oil pipeline; (c) broken oil pipeline. Among them, the flawed oil pipelines are divided into different grades according to different defect depths in the experiment. The probe is scanned on the pipe, and then the waveform of the scattering parameter (S11) is simulated. When the curve fluctuates, it means that the pipeline at the fluctuating place is incomplete, and can classify defects according to the amplitude of fluctuations (degree of corrosion). From the experimental results, we can discover that microwave technology can be used to accurately locate and classify the defects of an oil pipeline.