我在本地机器上创建了一个数据库,然后对表DataLabTables进行了名为tables.bak的备份。

我将备份移动到远程机器,没有该表,并尝试进行恢复,但得到以下错误:

sqlclient . sqlerror:操作系统返回 尝试访问时错误'5(访问被拒绝。)' 'RestoreContainer::ValidateTargetForCreation'在c:\程序 文件\Microsoft SQL Server\MSSQL.1\MSSQL\DataLabTables.mdf `。

如果这是问题所在,我该如何修正我的权利?


当前回答

Another scenario could be the existence of multiple database paths. First, make note of the path where new databases are currently being stored. So if you create a new empty database and then do Tasks/Restore, make sure that the path the restore is trying to use is the same directory that the empty database was created in. Even if the restore path is legal, you will still get the access denied error if it is not the current path you are working with. Very easy to spot when the path is not legal, much harder to spot when the path is legal, but not the current path.

其他回答

Frnds……我在恢复数据库时遇到了同样的问题,并尝试了所有解决方案,但无法解决。然后我尝试重新安装SQL 2005,问题解决了。实际上,上次我在安装SQL时忘记检查自定义选项..它来两次安装和我检查它只有一个..

我刚刚有这个问题与SQL Server 2012。

结果证明,我所要做的就是在“文件”部分勾选“将所有文件重新定位到文件夹”:

(点击查看图片完整尺寸)

当然,前提是你安装了正确的SQL Server版本。

我有这个问题,我以管理员身份登录,它解决了这个问题。

如果路径是正确的,但服务帐户不是数据文件的所有者(但它仍然有足够的读/写访问权限),也会发生这种情况。如果将文件的权限重置为与文件夹的权限匹配(当然,在服务停止时),就会发生这种情况。

在这种情况下,最简单的解决方案是分离每个数据库并再次附加它(因为在附加时所有者将更改为服务帐户)。

抱歉,因为我不能评论…

我也有同样的问题。在我的情况下,问题与试图恢复在一个旧的sql server文件夹(存在于服务器上)有关。这是由于旧的sql server备份(即sql server 2012备份)在新的sql server (sql server 2014)中恢复。真正的问题与@marc_s的回答没有太大的不同。无论如何,我只是将目标文件夹更改为新的SQL Server DATA文件夹。