Why can#39;t I read from .BAK files on my Desktop using SQL Express in Windows Authentication Mode(为什么我无法在 Windows 身份验证模式下使用 SQL Express 从桌面上的 .BAK 文件中读取)

本文介绍了为什么我无法在 Windows 身份验证模式下使用 SQL Express 从桌面上的 .BAK 文件中读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 SQL Express 中恢复 .BAK 文件之前执行此 SQL 查询.最初,我在用户帐户的桌面上有该文件.我以管理员身份登录.

I am trying to execute this SQL query prior to restoring a .BAK file in SQL Express. Initially, I had the file on the Desktop of my user account. I am logged in as Administrator.

当我尝试像这样访问桌面上的 .BAK 文件时

When I try to access the .BAK file on the desktop like this

RESTORE FILELISTONLY FROM DISK= 'C:\Documents and Settings\Administrator\Desktop\file.bak'

出现错误.

Msg 3201, Level 16, State 2, Line 1
Cannot open backup device 'C:\Documents and Settings\Administrator\Desktop\file.bak'. Operating system error 5(Access is denied.).
Msg 3013, Level 16, State 1, Line 1
RESTORE FILELIST is terminating abnormally.

但是,当我将 .BAK 文件移动到 C:\temp 并执行此

However, when I move the .BAK file to C:\temp, and execute this

RESTORE FILELISTONLY FROM DISK= 'C:\temp\file.bak'

效果很好.

我无法弄清楚发生了什么.有没有办法通过 SQL Express 使用 Windows 身份验证访问桌面上的文件?

I cant figure out what is going on. Is there a way to access files on Desktop using Windows Authentication with SQL Express?

推荐答案

尝试授予 UsersLOCAL SERVICE 对文件夹 C:\Documents and Settings\ 的读取权限策略编辑器中的 Administrator\Desktop\(右键单击该文件夹,然后在安全"选项卡中单击添加...",然后单击高级..."|立即查找

Try granting read permission to Users or LOCAL SERVICE to the folder C:\Documents and Settings\Administrator\Desktop\ in your Policy Editor (right click the folder and in the Security tab click Add... then Advanced...|Find Now

这篇关于为什么我无法在 Windows 身份验证模式下使用 SQL Express 从桌面上的 .BAK 文件中读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!