In the case of a plaintiff called Sarah P., 22, conceived with donated sperm, the court said Wednesday the right of a child to know his or her origin, recognized regularly by Germany's Constitutional Court, overrules the guaranteed anonymity of the donor.
It also said doctors must attempt to provide necessary information in cases in which the donor's name cannot easily be found.
There is no national registry in Germany, the German radio network Deutsche Welle reported.
"The government has to introduce a register in which all the sperm donors and the children is kept permanently. At the moment these documents are kept by the doctors who are responsible for the treatment," said Dr. Andreas Hammel, who heads a sperm bank in Erlangen, Germany.
Deutsche Welle said about 100,000 children in Germany have been born through sperm donation, and noted Europe is a patchwork of laws regarding revealing donors' names.
In Britain, it said, names of donors are documented and available to children at age 18. Denmark allows donors to remain anonymous if they choose, while in Spain and the Netherlands the identity of sperm donors is kept secret.
Couple mistakenly served bag of cash at McDonald's drive-thru
Benedict Cumberbatch's dramatic reading of R. Kelly lyrics is just what you need