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

BCP Out Failure About Login Failure Expand / Collapse
Author
Message
Posted Friday, December 13, 2013 8:30 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: 2 days ago @ 7:44 AM
Points: 29, Visits: 124
I am having this issue about a command line bcp out. I use that same command line on another SQL 2008 server and it is working fine. I even force it to use a SQL authentication user. Here is the command line

EXEC MASTER.dbo.xp_cmdshell 'bcp Compsee_Asset_Tracker.dbo.CompseeEmployeeUpdate out \\MIANOTES2\attach\CompseeEmployeeUpdate.txt -c -T -t"|"'

I got this error message below
SQLState = 37000, NativeError = 4060
Error = [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot open database "Compsee_Asset_Tracker" requested by the login. The login failed.
SQLState = 28000, NativeError = 18456
Error = [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'MIADOM\MIAISOASVC'.

Please help. I don't know what else to do.
Post #1522720
Posted Monday, December 16, 2013 5:11 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, July 21, 2014 2:56 AM
Points: 2,603, Visits: 2,061
Check the user permission on the on the server which you are getting this error message. Also check if the user is not orphan.

HTH


---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
Post #1523165
Posted Monday, December 16, 2013 6:13 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:44 PM
Points: 12,880, Visits: 31,799
my first guess is permissions; xp_cmdshell doesn't typically use the network permissions you expect.

run this command, and it can help you see if the user SQL uses for disk access returns is a domain user or not, and whether that account has access to the share
DECLARE  @Results table(
ID int identity(1,1) NOT NULL,
TheOutput varchar(1000))

insert into @Results (TheOutput)
exec master..xp_cmdshell 'whoami' --nt authority\system for example

insert into @Results (TheOutput)
exec master..xp_cmdshell 'cd %userprofile%' --If this is NULL it because account(nt authority\system?) is not a user...command fails.

--can this user actually see the share?
exec master..xp_cmdshell '\\MIANOTES2\attach\'
select * from @Results


my results:
ID  TheOutput
1 nt service\mssqlserver
2 NULL
3 NULL



Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1523179
Posted Wednesday, December 18, 2013 6:25 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: 2 days ago @ 7:44 AM
Points: 29, Visits: 124
Hi Lowell,

Once again, thanks for your wonderful help. I have asked the developer to re-write the code by declaring variables and this suggestion fixes the problem. You were and are a big help.

Have a wonderful holiday seasons.

Regards,
Reynold
Post #1524095
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse