2012年10月5日 星期五

Excel openrowset 奇怪的問題(再續)

一段寫在stored procedure 的excel openrowset 今天又出問題了.

無法初始化連結伺服器'(null)'的OLE DB提供者 'Microsoft.Jet.OLEDB.4.0'的資料來源物件

這個問題困擾了好久, 有時重啟sql server 就好, 有時得要重開機.

很困擾.

查到這篇文章

OPENROWSET (T-SQL) – Sometimes You Have to Stop and Smell the Roses
講到權限問題, SQL Server service accounts必需要有TEMP directory的讀寫權限.

查看了一下, SQL SERVER是使用本機帳(local system) 號啟動的.

於是乎,再參考一下這篇文章Location of user account temp dir for service accounts

找到使用者對應
  • Local Service (NT AUTHORITY\LOCAL SERVICE)
  • Network Service (NT AUTHORITY\NETWORK SERVICE)
  • Local System (NT AUTHORITY\SYSTEM)
接著 在C:\Users\user.name\AppData\Local\Temp 安全性的檢查讀寫權限是否都已開放.

相關的討論在napierm 的回文中,也有說明.

So, the fix is to do one of the following:
 - Change the SQL Server's service Log On to "Local System account" OR
 - Provide full access to the "\Documents and Settings\NetworkService\Local Settings\Temp" for any account that needs to run the queries.

 希望這是最後一次搞這個問題了.

沒有留言:

張貼留言

publish error allowDefinition='MachineToApplication'

一個老舊的aspx web form專案,調了一些功能建置成功,但進行部署時顯示以下錯誤。 在應用程式層級之外使用註冊為 allowDefinition='MachineToApplication' 的區段發生錯誤。錯誤的原因可能是虛擬目錄尚未在 IIS 中設定為...