Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 Permission issues with sqlcmd running sp

Author  Topic 

Svett
Starting Member

3 Posts

Posted - 2013-08-06 : 08:50:05
Hi!

I have a SP that uses OPENQUERY and a linked server (FoxPro Datasource) to copy data from a FoxPro database to a database in my SQL Server.

When I run this as an domain admin from within Management studio, it works fine. But when I use a schedule a task (task scheduler in windows, this is a Express edition) to run a batch file that runs the SP using SQLCMD, I dont get access to the physical path of the *.dbf (foxpro database) files.

I run the task as the same domain administrator I used to run the SP withing mangement studio. Im hoping to gain some insight in how you should approach a problem like this. I would like to use a SQL Server login to run the SP, but how do I give that SQL Login access to physical paths withing my network?

Thanks for any help or links concerning this matter!!

/Olof

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-06 : 09:28:40
ideally you'll create a domain account for this task and define it as proxy account. then you can configure your sql agent job to use this proxy account and perform the required activities

see

http://sqlblog.com/blogs/allen_white/archive/2008/05/06/use-a-sql-agent-proxy-for-special-tasks.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Svett
Starting Member

3 Posts

Posted - 2013-08-06 : 09:53:41
quote:
Originally posted by visakh16

ideally you'll create a domain account for this task and define it as proxy account. then you can configure your sql agent job to use this proxy account and perform the required activities

see

http://sqlblog.com/blogs/allen_white/archive/2008/05/06/use-a-sql-agent-proxy-for-special-tasks.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs



I'm using an Express version and it doesnt have any Agent. Thats why I need to use the Task Scheduler.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-07 : 01:12:46
quote:
Originally posted by Svett

quote:
Originally posted by visakh16

ideally you'll create a domain account for this task and define it as proxy account. then you can configure your sql agent job to use this proxy account and perform the required activities

see

http://sqlblog.com/blogs/allen_white/archive/2008/05/06/use-a-sql-agent-proxy-for-special-tasks.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs



I'm using an Express version and it doesnt have any Agent. Thats why I need to use the Task Scheduler.


you should still be able to use proxy account for executing the task I guess

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-08-07 : 13:18:57
It's the service account for Task Scheduler that needs access. It's probably set to Local System Account right now. You'll need to use an account that has access to the dbf files.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Svett
Starting Member

3 Posts

Posted - 2013-08-28 : 10:10:27
The Task Scheduler was using a domain admin account but still refused to find the dbf files. Turns out the ODBC Data Source was set to look at a mapped network drive instead of the local drive where the dbf files where located. I dont know why the domain admin account could not move outside the local drives to access these files. But in this scenario, just modifying the DSN to look at D: instead of V: made it work!
Go to Top of Page
   

- Advertisement -