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

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

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

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


当前回答

有这样的问题。对SQL Server文件夹启用压缩导致的错误。

其他回答

我也遇到过类似的问题。我试图恢复一个2005年的。bak文件,我收到了完全相同的错误。我也选择了覆盖选项,但无济于事。

我的解决方案是通过转到文件夹并通过属性屏幕编辑访问权限,授予SQL用户对所讨论的目录的访问权限。

我有同样的问题,但我使用sql server 2008 r2,你必须检入选项并验证sql将保存文件.mdf和.ldf的路径,你必须选择你的sql server安装的路径。我用这个解决了我的问题,希望它能帮助到你。

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.

最近我用SQL 2008 R2遇到了这个问题,下面的解决方案对我有用:

1)创建一个与您试图恢复的数据库同名的新数据库 2)在恢复时,使用与上面使用的名称相同的选项,单击覆盖选项

如果其他解决方案不奏效,你可以尝试上面的方法。

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

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

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

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