The order made public late Wednesday requires Google to turn over the database to Viacom, which is in the middle of a massive copyright lawsuit against Google.
The New York Times said that while Viacom insists the privacy of the YouTube viewers will be protected, some privacy advocates said the case highlights the huge amounts of personal information collected by Google that could be stolen or misused.
The court order includes the login names and IP addresses of each viewer, which The Times said could potentially be used to identify each person who viewed a YouTube clip.
"Inherent within the law is the notion that the users have an interest and a right in the privacy of the information and under the law," said Kurt Opsahl of the Electronic Frontier Foundation. "Users should have the right to challenge and contest the production of this deeply private information."