問題描述
我正在嘗試在 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?
推薦答案
嘗試授予 Users 或 LOCAL 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 文件中讀取的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!