How to display User Mapping for offline databases? When I use the GUI (SSMS) to review the User Mapping, where the Login has mapping to a database that is offline (or otherwise not available) I get the message below and it only displays Mapping for databases that are online.


  One or more databases are inaccessible and will not be displayed in list


All the details should actually be in the Master DB, there should be something I can run that will show me what the full User Mapping is.

How can I display User Mapping for offline databases?
You can use sys.databases joined with sys.server_principals

SELECT sd.NAME AS databaseName
    ,sp.NAME AS database_owner
FROM sys.databases sd
INNER JOIN sys.server_principals sp ON sd.owner_sid = sp.SID
WHERE sd.state_desc = 'OFFLINE' --&gt; since you want for offline databases !




You can even use at your own risk --> sp_msloginmappings ( &lt;-- Undocumented and unsupported :-) )