Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
BULK INSERT failing.
BULK INSERT failing.
Rate Topic
Display Mode
Topic Options
Author
Message
Jamie Ashton
Jamie Ashton
Posted Friday, February 03, 2012 3:45 AM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, August 29, 2012 2:08 AM
Points: 13,
Visits: 81
Hello,
I have a situation where I am trying to do a bulk insert of a file that's on a network share. It's failing with:
Cannot bulk load because the file "\\Server\Folder\File" could not be opened. Operating system error code 5 (failed to retrieve text for this error. Reason: 15105).
What I think is odd though is that use of xp_FileExist confirms that that the file exists and the SQL Server can see it.
The remote folder has permissions for "Everyone". Is there an internal setting in SQL Server that has been set to prevent me doing this? It's a new server and so this has never been done before. But it worked fine in pre-production, on a different server.
Hope you can help.
J
Post #1246339
Cadavre
Cadavre
Posted Friday, February 03, 2012 3:53 AM
SSCrazy
Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:16 AM
Points: 2,236,
Visits: 6,486
Jamie Ashton (2/3/2012)
Hello,
I have a situation where I am trying to do a bulk insert of a file that's on a network share. It's failing with:
Cannot bulk load because the file "\\Server\Folder\File" could not be opened. Operating system error code 5 (failed to retrieve text for this error. Reason: 15105).
What I think is odd though is that use of xp_FileExist confirms that that the file exists and the SQL Server can see it.
The remote folder has permissions for "Everyone". Is there an internal setting in SQL Server that has been set to prevent me doing this? It's a new server and so this has never been done before. But it worked fine in pre-production, on a different server.
Hope you can help.
J
Error code 5 is permissions, so it might be worth checking that whatever account your SQL Server runs under has permission. Check the account used by the pre-production server and see if it's using the same.
Not a DBA, just trying to learn
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better, quicker answers on SQL Server performance related questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
If you litter your database queries with nolock query hints, are you aware of the side effects?
Try reading a few of these links...
(*)
Missing rows with nolock
(*)
Allocation order scans with nolock
(*)
Consistency issues with nolock
(*)
Transient Corruption Errors in SQL Server error log caused by nolock
(*)
Dirty reads, read errors, reading rows twice and missing rows with nolock
LinkedIn
| Blog coming soon (for sufficiently large values of "soon"
)!
Post #1246345
derek.colley
derek.colley
Posted Friday, February 03, 2012 3:54 AM
SSC-Addicted
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 3:40 AM
Points: 496,
Visits: 583
Hi Jamie
I faced a similar situation not too long ago trying to do the exact same thing. I don't have a verifiable link but from experience, I've found SQL Server in general and SSIS packages in particular DO NOT get on with network shares at all.
You'll need to put the input file on a local drive for this to work. Don't forget about your BULK INSERT options, too - make sure they're set for the type of file you're using.
---
Note to developers:
CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
So why complicate your code AND MAKE MY JOB HARDER??!
Want to get the best help? Click here
http://www.sqlservercentral.com/articles/Best+Practices/61537/
(Jeff Moden)
My blog:
http://uksqldba.blogspot.com
Visit
http://www.DerekColley.co.uk
to find out more about me.
Post #1246346
Jamie Ashton
Jamie Ashton
Posted Friday, February 03, 2012 3:57 AM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, August 29, 2012 2:08 AM
Points: 13,
Visits: 81
Thanks both for your speedy answers!
Firstly the permissions... surely "Everyone" would encompass the SQL Server account?
And yes - I'd love to have the file locally - but it's impossible in this situation.
Don't you think it's odd that XP_FileExist can see it yet BULK INSERT fails?
Or are separate accounts involved?
J
Post #1246350
derek.colley
derek.colley
Posted Friday, February 03, 2012 4:03 AM
SSC-Addicted
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 3:40 AM
Points: 496,
Visits: 583
I think it's got to be something to do with accounts. Maybe grant the SQL Server accounts explicit permissions on the network share. In terms of the XP call working, I suspect that internally it's using something like the Windows COM objects or some other Windows API which is returning a result (as it would do if you e.g. browsed a normal window).
A quick bit of Googling has found this which might be of help:
1) The SQL Server services, on the Server containing the instance of SQL Server, must be running under a domain-level account (e.g. A Domain Administrator account). This is accomplished by changing the "Log On" properties for the services named "MSSQLSERVER" and "SQLSERVERAGENT" on the server running SQL Server (not your local instance). When you have completed changing the log on information for these 2 services, you will need to restart the "MSSQLSERVER" service on that server. Note that this will ask if you want to restart the "SQLSERVERAGENT" as well - Answer: Yes.
2) The SQL Server service account must have FULL CONTROL rights to the file system folder and to the share. That means you need to have a shared location in which the logon account you specified in 1 (above) has full control rights.
3) The file share should only be accessed via UNC name. Mapped drives may not be consistently visible to the SQL Service.
4) You cannot specify the path by using the browse ellipses (...). You must type the fully qualified path into the text box as:
file://ComputerName/ShareDirectoryWithRightsForDomain-levelAccountUsed/NameofFile.Extension
Additional Notes:
When creating or restoring backups on a network share, a significant increase in network traffic may result. You should ensure that your network can handle this without causing poor performance for other systems or end users. It may also benefit you to establish a dedicated physical network connection between your database server and your backup file host. Once the SQL Server instance is configured, you can use your local Enterprise Manager to create or restore a database backup that resides on a network device other than the device your instance of SQL Server is running on.
(from
http://www.fmsinc.com/free/NewTips/SQL/SQLtip9.asp
)
I know this relates to SQL Server 2000 but I suspect it's right.
---
Note to developers:
CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
So why complicate your code AND MAKE MY JOB HARDER??!
Want to get the best help? Click here
http://www.sqlservercentral.com/articles/Best+Practices/61537/
(Jeff Moden)
My blog:
http://uksqldba.blogspot.com
Visit
http://www.DerekColley.co.uk
to find out more about me.
Post #1246355
Jamie Ashton
Jamie Ashton
Posted Monday, February 06, 2012 2:19 AM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, August 29, 2012 2:08 AM
Points: 13,
Visits: 81
Thanks all for your help on this one.
My research indicates numerous possible causes, but in this instance, it looks to be a permissions issue going across domains.
J
Post #1247136
timexist
timexist
Posted Monday, January 14, 2013 9:15 PM
SSC Rookie
Group: General Forum Members
Last Login: Thursday, February 07, 2013 11:21 PM
Points: 34,
Visits: 60
I just solved this issue.
two ways,
1, remote desktop to sql server do bulk insert there.
2, or you can use sql authentication to login.
have fun
Post #1407013
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.