简体   繁体   中英

SSIS Package stopped working with Error code: 0x80004005

I got this SSIS package working this past December. It only runs on Friday mornings. Last Friday it failed with this error message:

Package:Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft Access Database Engine" Hresult: 0x80004005 Description: "The Microsoft Access database engine cannot open or write to the file '\\ServerShare\IT\Reports\Export Templates\YoderReport.xlsx'. It is already opened exclusively by another user, or you need permission to view and write its data.".

I've checked out a couple of other questions that were similar, but they did not answer my question. I have checked to make sure that no one has that file open.

The file in question is a template that is copied over then populated, so no one should have it open, to begin with.

I've tried changing the RetainSameConnection to True , but no difference. I have run it in debug mode, and it works fine.

Anyone got any ideas how to clear this up so it runs automatically again?

UPDATE

After some more testing, it appears that the file is getting the data, but isn't being copied. Here is what I have setup:

  • I have a File System Task that copies a template from my template folder to my Export folder.
  • Then I have a Data Flow Task
    • Begins with a OLE DB Source that runs a SQL script to pull data
    • Runs a Data Conversion to update a couple of fields to the correct format
    • Excel Destination is used for the output. (This is the template that was copied to the Export folder
    • There is also a Flat File Destination just in case there are any errors
  • Then back to the Control Flow with another File System Task , this one moves the file from the Export folder to its final destination on a shared drive

When I run this from VS 2015 it works fine and creates the file. When I run this from the SQL Agent job it fails with the above error message. The only thing that I can think of is that in the Data Flow Task the Excel Destination isn't releasing the file before the final File System Task tries to copy it? But if that is the case, why did that just start happening now?

I think that there is a problem in the filepath, as you can see the file path start with one single backslash:

\ServerShare\IT\Reports\Export Templates\YoderReport.xlsx

Maybe it should start with double back slash \\ if it is on the network

\\ServerShare\IT\Reports\Export Templates\YoderReport.xlsx

Or the Partition is missed --> Incomplete path

Check the way that the file path is provided to the connection manager (if you are using expressions)


Also based on this microsoft article , there is two possible causes:

  1. You must have permission to read data in the specified file in order to view its data. To change your permission assignments, see your system administrator or the table or query's creator.
  2. You tried to open the indicated file exclusively, but another user already has the file open.

Looks like an access issue. Ensure that the Agent Service Account is running with full rights to the network share path. Maybe you can try with your credentials on the Agent Server.

Also, Ensure that your Excel destination connection string supports .xlsx.

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\path\xxx.xlsb;Extended Properties="Excel 12.0;HDR=YES";

Changing “ Excel 12.0 ” to “ Excel 12.0 Xml ” will tell the provider to output in .xslx format instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM