Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

OPENROWSET() Intermittently Fails to Read Excel File Expand / Collapse
Author
Message
Posted Thursday, July 21, 2011 8:35 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Wednesday, November 26, 2014 9:31 AM
Points: 717, Visits: 3,037
I've had this problem a number of times: every so often, I receive errors like this when trying to query an Excel xls file:

OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Could not find installable ISAM.".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".


What I've tried:

1. Ensuring the Excel file is not open. The OPENROWSET() statement is correctly configured, b/c the query works sometimes.

2. Bouncing the SQL service. This always fixes the problem, but doesn't tell me why it happens or when it will recur. And of course, it's a horrible "solution."

3. Checking MDAC. Used the MS consistency checker, and all looked OK.

4. Reading in the file saved in Excel XSLX 2007 format using the Microsoft.ACE.OLEDB.12.0' provider. This game me the following out-of-memory error:
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. The provider ran out of memory.
Msg 7320, Level 16, State 2, Line 1
Cannot execute the query "SELECT * FROM [Sheet1$]" against OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".


5. Tweaking the "MemToLeave" setting with the -g startup switch for the service, as described here: http://www.johnsansom.com/sql-server-memory-configuration-determining-memtoleave-settings/#axzz1SkRKB7Fz. I later ran the query given at his web page and returned the following values of Total avail mem, KB: 23800 and Max free size, Kb: 3444.

UPDATE: After a service restart, I immediately checked and got values of 216056 and 91840 for Total Available Memory, Kb and Max Free Size, Kb, respectively. Again, after a service restart I had no problem running the same OpenRowset() query. I started the service without the "-g" flag, using default values of MemToLeave. BOL (http://msdn.microsoft.com/en-us/library/ms190737%28v=SQL.90%29.aspx) says the default is 256 Mb.

This seems to suggest that there's insufficient RAM for running the OPENROWSET() query, consistent with the out-of-memory error trying to execute the query using the ACE.OLDEDB.12.0 provider for the XSLX file.

So.

I've seen enough blog postings to know that this is a pervasive problem with an often indeterminate solution.

1. Is this a problem caused by insufficient memory for Virtual Address Space?

2. If so, how do I find the cause of the problem?

3. If not, what can I do to fix this so it doesn't recur?

This is a significant problem for me, b/c I'm using OPENROWSET for importing Excel files into SQL. I am reluctant to use SSIS, b/c it's hitting a nail with a sledge hammer.

Any assistance would be welcome.
Rich
Post #1145948
Posted Friday, July 22, 2011 3:48 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 28, 2014 11:02 AM
Points: 2,397, Visits: 3,419
Use IMEX=1 in your extended properties for the driver.



N 56°04'39.16"
E 12°55'05.25"
Post #1146471
Posted Friday, July 22, 2011 6:19 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Wednesday, November 26, 2014 9:31 AM
Points: 717, Visits: 3,037
SwePeso (7/22/2011)
Use IMEX=1 in your extended properties for the driver.

Thanks, but that's not the issue here.

The same query on the same Excel file works fine immediately after (and for some varying time after) a service restart.

Likewise, though I didn't include this in my o.p., the issue some have written about re: NTFS permissions in the user temp folder is not germane. I can run the same query on the same spreadsheet without problem after a service restart. So NTFS permissions aren't in play.

Anyone else have an idea?
Rich
Post #1146578
Posted Sunday, May 19, 2013 12:27 PM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, June 23, 2014 6:49 AM
Points: 62, Visits: 326
hi,
I had check following query it is working,

select * from OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=c:\Employee.xls;',
'SELECT * FROM [Sheet1$]')

If any problem ,Let me know.

Regards,
Dinesh
Post #1454360
Posted Monday, May 20, 2013 7:28 AM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 4:02 PM
Points: 492, Visits: 2,040
rmechaber (7/22/2011)
SwePeso (7/22/2011)
Use IMEX=1 in your extended properties for the driver.

Thanks, but that's not the issue here.

The same query on the same Excel file works fine immediately after (and for some varying time after) a service restart.

Likewise, though I didn't include this in my o.p., the issue some have written about re: NTFS permissions in the user temp folder is not germane. I can run the same query on the same spreadsheet without problem after a service restart. So NTFS permissions aren't in play.

Anyone else have an idea?
Rich


I used to get that pretty often using Jet 4.0, and the only solution anyone ever had was to cycle the service. Recently switched to Ace, and hoping I don't also run into the other error now too. That was half the reason I switched.


Post #1454528
Posted Sunday, May 26, 2013 9:48 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Wednesday, November 26, 2014 9:31 AM
Points: 717, Visits: 3,037
Old thread, but in case someone finds this still relevant, I did finally discover the problem and solution.

If you Google memtoleave you will find the answer: SQL 2005 sets aside a separate address space apart from the buffer pool, used for things like OPENROWSET queries. If this becomes fragmented, you will be limited to using the largest contiguous chunk of memory left in it. The only way I'm aware of to reset this separate address space to the unfragmented value is to restart the SQL service, which is why bouncing the service "fixed" the problem.

The solution was to alter the service startup switch that allocates memtoleave memory to a larger value:
http://www.johnsansom.com/sql-server-memory-configuration-determining-memtoleave-settings/
http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/07/07/understanding-the-vas-reservation-aka-memtoleave-in-sql-server.aspx

For SQL 2005, the relevant explanation is here, look for the "-g" startup switch, and increase it as needed. This robs RAM from the buffer pool, so be careful with it.

The article on Kehayias' link, above, includes a query you can run to determine how much VAS is left available, and the largest contiguous chunk left. I put a version of this query on an Agent job and ran it hourly, dumping the results to a logging table, so I could track the pool's depletion.

I think 2008 fixed this, but in case anyone still runs 2005 I figured I'd post this fix.

Rich
Post #1456869
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse