Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 137
  • Last Modified:

Error message when scheduling a job using a linked Server

Getting error message when running a job when scheduling a job using a linked Server.  It fails when it runs the following statements below. Screenshots are attached. Both scripts run fine in a query window. Any insight will be appreciated.

SELECT * into WOMAST01B FROM OPENQUERY(ATQAV, 'SELECT * FROM WOMAST01 where 1=0')
SELECT * into WOLABO01B FROM OPENQUERY(ATQAV, 'SELECT * FROM wolabo01 where 1=0')

Open in new window

Capture.PNG
Capture2.PNG
0
maximus1974
Asked:
maximus1974
  • 5
  • 5
1 Solution
 
Dung DinhDBA and Business Intelligence DeveloperCommented:
It looks like SQL Agent Job account has not been granted permissions on the LINKED SERVER. Be aware of this,  whenever you run any statement via SQL Agent Job, it uses SQLAGENTSERVICE account to execute your statements by default. In case, the account has not permission on the linked server, it will be failed.

From your attached files, you run the statements under System Administration account so they were run successfully. Please check your SQL Agent Service account and be sure that you must grant permissions appropriately to the account.

Another way, you can create Proxy Account in SQL Server  to run SQL Agent Job instead of using SQL Agent Account by default.
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Is the Linked Server using the current user credentials or it has his own security credentials?
0
 
maximus1974Author Commented:
The linked Server has it's own credentials used ot authenticate against another network. I am linking an old Foxpro DBF database to SQL Server then importing the DBF into SQL. Currently, the SQL Server agent can authenticate on network it is on.

Does this mean the SQL agent will need access to authenticate against the linked Server on the other network? what happens to the jobs that run on it now which authenticate against a different network than the linked Server?
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Apologizes for not returning to this question. I just missed the mail informing that you posted here.
So, if you have the credentials stored with the Linked Server then it should work. Did you try to open the Linked Server to perform a connection test?
0
 
maximus1974Author Commented:
Vitor responded.
0
 
maximus1974Author Commented:
When I run a query or insert statement from the query Window against the linked Server, it works fine so this proves I am able ot authenticate against the linked Server. However, when i attempt to schedule an import, I am getting invalid path or file name as illustrated in the attached screenshots above.

When you say to use the correct credentials in the SQL agent service, do you mean here?
screenshot
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
It shouldn't have nothing with the SQL Server Agent as you said the Linked Server has an user and password configured.
But just for sanity check and if you can change the SQL Server Agent to a non Local System account it will be a good test because Local System account doesn't have access on the network.
0
 
maximus1974Author Commented:
screenshots and errors attached. Queries against the linked Server works via the query window, when manually importing via SISS,  executing the package via integrated services. however, when scheduled via a SQL agent job is fails stating : invalid file name or path".
Capture.PNG
Capture2.PNG
Capture3.PNG
Capture4.PNG
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
when scheduled via a SQL agent job is fails stating : invalid file name or path".
That's a new information and very important one. This means it has nothing to do with the Linked Server but the permissions to access a file in the network.
A Local System account has no privileges in the network and that's why is returning that error. You need to provide an AD account that has access to the file through the network.
0
 
maximus1974Author Commented:
I have since changed it to an AD accoutn with permission to the directory and i am receiving the same error. If it's permissions, how come it works using all other means except vai the SQL agent job?

new screenshot attached.
Capture.PNG
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
If it's permissions, how come it works using all other means except vai the SQL agent job?
Because you're not using the same user for the other process, right?
Btw, do you also have an AD account for the SQL Server service?
And for the user that is running the job also? A SQL Login doesn't have access to network.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now