在 Microsoft Sql Server 2008R2 及更高版本上隐藏用于登录的数据库 [英] Hiding databases for a login on Microsoft Sql Server 2008R2 and above
问题描述
任何人都可以帮助隐藏 sql server 2008R2 或更新版本上的可用数据库.
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.
这是 100% 但我的问题是我不希望登录甚至看到那些其他数据库可用.
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?
推荐答案
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
拉杰
这篇关于在 Microsoft Sql Server 2008R2 及更高版本上隐藏用于登录的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!