Well, as a matter of fact,dolce and gabbana is one of the most expensive and nice fashion brands in the world and it is now making a wide variety of products. Founded in Italy in 1994, they have been always trying to protect customers' rights and benefits, thus they introduced serial numbers in an effort to boycott fake products. So once you have got those serial numbers , you can contact their customer service hotline to check if yours are real and ok.
Yes, the dolce and gabbana sunglasses have serial number which gives you the actual size of the frames, lenses and so on. If you want to check whether it is real, you could measure the size of the sunglasses to see whether the number is correct. It is such an easy way.