数据库 [dbName] 不可访问.(对象浏览器) [英] The database [dbName] is not accessible. (ObjectExplorer)

查看:57
本文介绍了数据库 [dbName] 不可访问.(对象浏览器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have an issue in regards to using SQL Server 2008 R2.

我的计算机最近出现问题,因此我不得不重新启动 Windows,并且不得不将一个用户的权限授予另一个用户(使用属性中的安全功能).最初授予权限时,它会通过拒绝访问"消息.

I recently had an issue with my computer and therefore I had to reboot windows and had to grant permission from one user to another user (using the security feature in the properties). When giving permission initially though, it through a "Access Denied" message.

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

After much research, it stopped producing this error (the user which I needed to grant permission too wasn't available), which then caused another issue to occur, but this time within SQL Server. It produces this message;

无法访问数据库 [dbName].(对象资源管理器)

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

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

This error occurs when I try to select the drop down option to see the list of tables and stored procedures of the database within SQL Server. I found an explanation for this on the following link;

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

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

Using a script I created (luckily before this problem occurred) it through a whole lot of messages;

消息 15151,级别 16,状态 1,第 1 行
找不到用户DBName\MyName",因为它不存在或您没有权限.
消息 262,级别 14,状态 1,第 2 行
CREATE DATABASE 权限在数据库master"中被拒绝.
消息 5011,级别 14,状态 9,第 1 行
用户无权更改数据库DBName"、数据库不存在或数据库未处于允许访问检查的状态.
消息 5069,级别 16,状态 1,第 1 行 ...

在发生这一系列错误之后,我已经陷入困境,因此如果有人能就我可以做些什么来解决这个问题给我一些反馈,我将不胜感激.干杯.

After this bunch of errors, I have become unstuck and therefore would much be grateful if anyone could give me some feedback in regards to what I could do to resolve this issue. Cheers.

推荐答案

通常,直接向登录授予权限是一个坏主意.您应该在数据库中创建角色对象,并将数据库中的所有权限分配给角色.

Generally it is a bad idea to grant permissions directly to logins. You should create role objects in the database, and all permissions in the database should be assigned to the roles.

然后,当将数据库移动到另一台计算机(或重新安装)时,您唯一需要修改的是服务器登录名和角色分配.

Then when moving the database to another computer (or reinstalling) the only things you have to modify are server logins and role assignments.

这篇关于数据库 [dbName] 不可访问.(对象浏览器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆