Sharepoint URL not able to acess through SQL agent Job - sql

I am running a sql server job which is loading data from a file kept in a sharepoint document library.File is an excel format and is getting loaded when executed through solution .But when i am using an SQL Agent job to pick up the file it doesnt get the path and agent job fails.I have deployed the SSIS Package through SQL Server 2012 deployment methodologies.I am not able to trace the error of loading data from a sharepoint library.library. Sql agent jobs works fine when i give local path.The account which is running the sql agent job is the same who has access to document library.I also tried to run the job through proxy but then a strange error comes of error authenticating proxy:unknown username and password whereas my password and username are all correct.I am in between of my deployment to production and facing such issue from a long time.

Related

SSIS package failing - Working in BIDS but not working after deployment - Package contains excel connection with sql command [duplicate]

I have a OLEDB task that connects to ms-access database on local file system and dumps data into sql database.
Access db connection string is: Data Source=\\my-share\accessdbfile.accdb;Provider=Microsoft.ACE.OLEDB.16.0;
The SSIS package runs OK in visual studio. Access 2016 32-bit runtime is installed on this computer.
After deployment to SSIS catalog, right click and execute works OK. Access 2016 64-bit runtime is installed on this computer.
When this package is scheduled to run via SQL Agent job, using proxy/credential [domain user - example: domainname\user1] (having read permission on the access db file), then the job fails. The SSIS execution report shows error as: Unexpected Termination. There is no further information.
Suppose if I add the proxy credential (domainname\user1) to the local administrators group (in computer management) then the SQL Job runs OK. What could be the solution to this so I can give only the minimum required permissions?
The error is very difficult to debug as it doesn't occur when running via visual studio. Even when deployed to the SQL server and run from the SSIS catalog, the execution works OK. The error occurs only when the package is run via SQL server agent job (via credential/proxy) - the SSIS execution report doesn't show any helpful messages; and surprisingly the error gets resolved when the credential is added as local administrator on the computer - which is a bad practice.
The solution is analyse what kind of ms access file you are using and appropriately use the correct access runtime version (2013 vs 2016) and the correct provider value in the connection string.
Access runtime:
In my case, I uninstalled Access 2016 64-bit runtime and installed Access 2013 64-bit runtime.
Provider version:
I changed the provider version from 16.0 to 15.0, as shown below-
Before: Data Source=\\my-share\accessdbfile.accdb;Provider=Microsoft.ACE.OLEDB.16.0;
After: Data Source=\\my-share\accessdbfile.accdb;Provider=Microsoft.ACE.OLEDB.15.0;
Note:
There is no need to add the user to the local administrator group.
There is no need to login to the computer using that account.
Only read permission (under windows folder security) is sufficient assuming the SSIS packge will only read the ms access database.
It's hard to debug this only with the information provided, but in general:
The user running the job requires at least write and delete access on the underlying folder in which the Access database resides. This is required to generate a lockfile for the database.
If this is undesirable because the job may be modified by a malicious user, I've seen deployments where a copy is made in a temporary folder with write access and a size quota, and that temporary folder is removed as soon as the job finishes, regardless of if the job succeeded.

SSIS package unable to write csv file to shared location

SSIS Job was able to run and create CSV files to shared location until last week when it was executed from scheduled job. The ssis package reports success but does not write file to shared location. When I run the package manually from visual studio it works fine. Please help
Permissions to the file share seem to be your issue.
When running the package as a scheduled job from SQL Agent. It is executed under the context of the service account for the SQL Agent Service. So make sure the the sql agent account has the appropriate read/write access to the file share, and/or set the job to execute as a user with enough permissions.
You need to give Modify permissions to the file share for the SQL Server Agent account. Executing an SSIS package in Visual Studio is executing it under the context of your account (or the account that you are logged onto the server with if doing it from a server). But when you use SQL jobs to execute the ssis package, then it runs under the context of the service account that SQL Server Agent is running under.

SQL Agent job hangs on packages with Execute Process Task

I have an SSIS package with the Execute Process Task, which runs 7zip exe to zip a file. This works fine when I run the SSIS. But when I run this SSIS from the SQL Agent it hangs. I assume this is something to do with the permission. I have given full control to Network Services and sqlsvc to the folder which has the zip exe and the folder it is extracting to. Still no luck. What should I do to make this SSIS run from the SQL agent.
I have created a proxy account which has administrator privilege and change the Job Step "Run As" property to the new proxy account instead of SQL Agent Service Account. I think the SQL Agent Service account doesnt have the access to run the process. You can also change the SQL Agent Serice Account group policies to make it work.
I would change the WindowStyle property to Hidden - the SQL Server agent may be hanging when it tries to create a Windowed process.

Failed to generate user instance in SQL Server 2012

I am using .mdf file for connectivity, when I select it it generates error:
Failed to generate user instance in SQL Server due to failure in starting the process for the user instance
I have attached image to make it clear to you.
http://i.stack.imgur.com/B1ae2.png
Can anyone answer my question.
Thank you!!
Try following steps :
Stop all user instance processes of SQL Server running under your local account (open up task manager and look for sqlsrv.exe process and end it)
Delete all files in the %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS folder
F5 again
The problem is known issue. SQL Server Express cannot create a user instance using the set of engine files in your local app data folder, deleting them should allow SQL Server to recreate them with the correct credentials for you to F5 successfully.

SSIS Package runs from Windows, but fails when run from SQL Agent jobs

I have a SSIS package (exports some database tables --> CSV file)
After creation of this package, I can run the package
from Visual Studio or just by clicking it.
But it fails if i add to execute this package as a SQL Agent Job scheduled at some arbitrary time of a day.
Pointers needed if i have to configure anything related to Permissions/Command line args ??
Thanks in advance
You don't give details of the error message received when the package is run by the Agent, but you need to check the rights of the Windows account under which the SQL Server Agent is running.
If all the package does is export database tables to text files you need to check that the service account has rights to:
connect to the database and run
select statements on the source
tables (if you are using Windows
Authentication to control the
database connection).
Create files
in the target location(s) in the
file system.
The windows account under which my SQL Server Agent runs belongs to sysadmin
Also the same user has admin privileges in my system to access the folders while exporting to the csv file.
The error message in the Job history :
Executed as user: MymachineName\JOBUSER. The package execution failed. The step failed.
In the step i have the SSIS Package included, with correct datasource connections,
Run as : SQL Agent Service Account (this is also run under MymachineName\JOBUSER user)