Hiding databases for a login on Microsoft Sql Server 2008R2 and above [closed]

限于喜欢 提交于 2019-12-31 14:46:34

问题


Please can anyone assist with hiding the available databases on sql server 2008R2 or newer versions.

I have a new login user that I mapped to a specific database. When logging in with the specific login user I can see all the databases on the server, although I cannot access them except for the one I mapped to the login.

This is 100% but my problem is that I do not want the login to even see that those other databases are available.

How do I prevent those other databases that are not mapped to the login from displaying?


回答1:


USE master;
GO
DENY VIEW ANY DATABASE TO [newlogin]; 
GO
USE yourDB;
GO
DROP USER newlogin;
GO
USE master;
GO
ALTER AUTHORIZATION ON DATABASE::yourDB TO [newlogin];
GO

Raj



来源:https://stackoverflow.com/questions/14120624/hiding-databases-for-a-login-on-microsoft-sql-server-2008r2-and-above

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!