Catalyzes the interconversion of L-alanine and D-alanine. Overexpression due to a natural mutation in the promoter is responsible for mediating resistance to D-cycloserine (DCS) in mycobacteria. L-alanine = D-alanine Amino-acid biosynthesis; D-alanine biosynthesis; D-alanine from L-alanine: step 1/1. Belongs to the alanine racemase family.