gpt4 book ai didi

sql - 数据库 [dbName] 不可访问。 (对象资源管理器)

转载 作者:行者123 更新时间:2023-12-02 07:57:51 26 4
gpt4 key购买 nike

我在使用 SQL Server 2008 R2 时遇到问题。

我的计算机最近出现了问题,因此我必须重新启动 Windows,并且必须将一个用户的权限授予另一用户(使用属性中的安全功能)。不过,在最初授予权限时,会显示“访问被拒绝”消息。

经过大量研究,它不再产生此错误(我需要授予权限的用户也不可用),这导致另一个问题发生,但这次是在 SQL Server 中。它产生这个消息;

The database [dbName] is not accessible. (ObjectExplorer)

当我尝试选择下拉选项来查看 SQL Server 中数据库的表和存储过程列表时,会发生此错误。我在以下链接中找到了对此的解释;

http://www.microsoft.com/products/ee/transform.aspx?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1617&EvtSrc=MSSQLServer&EvtID=916

然后我尝试像这样实现;

 USE msdb;
GO
GRANT CONNECT TO [DBName\MyName] ;

CREATE DATABASE [DBNAME] ON PRIMARY

使用我创建的脚本(幸运的是在这个问题发生之前)它通过了大量的消息;

Msg 15151, Level 16, State 1, Line 1
Cannot find the user 'DBName\MyName', because it does not exist or you do not have permission.
Msg 262, Level 14, State 1, Line 2
CREATE DATABASE permission denied in database 'master'.
Msg 5011, Level 14, State 9, Line 1
User does not have permission to alter database 'DBName', the database does not exist, or the database is not in a state that allows access checks.
Msg 5069, Level 16, State 1, Line 1 ...

在发生了这堆错误之后,我已经摆脱了困境,因此,如果有人能给我一些关于我可以采取哪些措施来解决此问题的反馈,我将不胜感激。干杯。

最佳答案

使用 sa 登录并展开“安全”>“登录”,右键单击用户名,然后单击“属性”,单击用户映射并选择您希望用户访问的数据库,然后确定

关于sql - 数据库 [dbName] 不可访问。 (对象资源管理器),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14123917/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com