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.

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

沒有留言:

張貼留言

離線安裝SSMS 22 launched extracted application exiting with result code 0x138b

SSMS 22 安裝器下載頁面 https://learn.microsoft.com/zh-tw/ssms/install/install https://aka.ms/ssms/22/release/vs_SSMS.exe 將安裝檔下載到本機,檔案好大2.5G  https:...