Quantcast
Viewing all articles
Browse latest Browse all 1519

How to find user databases with no users?

Can anyone recommend a script I can run against a group of SQL server instances which will return a list of user databases (exclude system db's) which have no users in them?  Ideally, this should exclude public, dbo, guest, sys & INFORMATION_SCHEMA, since those are default users present in all databases.

The purpose of this report would be to help identify databases that may no longer be used (orphaned database) because they don't have any database users in them. Understanding, of course, that some Logins with certain instance-level server roles, can access databases, even though they may not map to a user at the database level.

Thanks in advance,


Phil Streiff, MCDBA, MCITP, MCSA


Viewing all articles
Browse latest Browse all 1519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>