SSIS not running in SQL JOB - sql-server

I have a problem with SQL JOB.
I am using SSIS to import data into database. While I am running SSIS through Visual studio it works as expected. Also when I am running the SSIS from Integration Services Catalogues in SQL Server, it works fine. But my issue is that when I am trying to import data into my DB using SQL JOB (using the same SSIS as in previous cases), although there is no error message and Sql job runs with success, the destination table in my DB is empty (no data are imported into my DB).
When I checked the execution report for SSIS, run by SQL I see this warning:”Foreach Loop Container: Warning: The for each file enumerator is empty. The for each file enumerator did not find any files that matched the file pattern, or the specified directory was empty.”
Once again, everything works OK when I am running SSIS in other way than by using SQL JOB.
Am I doing something wrong? How can I solve this problem? Please help me, because I am not able to solve this issue.
Thank you.

Related

SSIS package stuck in validation phase beginning when trying to import/export excel files

On our servers (windows 2016, SQL reporting server 2016, Microsoft Access Database Engine 2016) we run 2 SSIS packages. 1 imports data from an excel file to the database and 1 exports data from the database to an excel file. Both are xlsx files.
We run this exact package on TST, ACC, RES and PRD (same server and access setup). We didn't have any issues until a week ago the packages on PRD just kept on getting stuck in the "beginning validation phase" of the Dataflow Task. The other environments are fine.
We've determined that it is not a problem in the application since a simple read package that we created for this issue, gave the same problem. It doesn't seem to be an access issue either. The account that runs the script is sysadmin in SQL and local admin on the fileserver.
We also tried
• Only using one import flows instead of two in Data Flow task: no change https://social.msdn.microsoft.com/Forums/sqlserver/en-US/781c855f-833e-4578-a43a-1729482bbabd/dtspipeline-validation-phase-is-beginning-but-never-stop?forum=sqlintegrationservices
• Set connection managers for OLE DB sources are all set toDelayValidation to True: no change SSIS pre-evaluation phase taking long
• Set ValidateExternalMetadata is set to false for Excel Sources: no change SSIS pre-evaluation phase taking long
• Reinstall Microsoft Access Database Engine on server: no change
• Tested reading a flat file (txt) which worked without issue.
We're fresh out of ideas so any help would be greatly appreciated.
UPDATE:
When manually trying to run the import/export wizard (and selecting excel file) I get "The operating system is not presently configured to run this application". Investigating this message as well.
If you had no problem reading a text file then that would point me to the excel driver (32 or 64), however I would think if that was the issue you would see a connection error. Do this as test.
Go to the console and open excel on the server. This will let you know if you have some licensing issue or something preventing excel from opening on the server.
Import a small amount of data into SQL server from excel using the import data into a test database (or just make a test table). Be sure to use the same driver you are using in the SSIS package.

I get the error "The return value was unknown. The process exit code was 128.The Step failed" when executing a ssis package from an SQL job

I am getting that error when executing an SSIS package (.dtsx) from a sql job.
The package has two connections, one with a local database and one against a remote database. The databases have the same structure, and basically what this package does is transfer records from the local database to the remote one.
The package is tested, in fact if it is run manually in visual studio it works correctly. The problem comes in execution from the SQL Job. In that case it is when you get the error message.
On the same computer I have other packages that do the same (they share the local database but they work with another remote database) and they work correctly and do not give this error.
Any idea what could be the problem that is causing this?
Any help will be appreciated.
are you using SSIS Catalog?
were is the package located for the sql scheduler?
I had similar problem but when i moved the package to SSIS Catalog the problem was solved.
Kfir

SSIS package doesn't write data to excel destination

I have an simple SSIS package and I'm trying to export same set of data from a table to both flat file and excel destination. The package works fine when I run locally and it creates both text file and excel file with data.
But when deployed to a different server the sql agent job runs fine and the log inside integrations services catalog for the package says it wrote like 9000 rows to excel, and a new excel file is also created but it doesn't write any data to it(blank with just headers). text file works fine and it has all data I need.
SSIS package flow:
I'm working with Sql server 2014, Visual studio 2013 with SSDT and used Excel 2007 in excel destination.
We had the same issue.
The solution is that the user, which runs the SSIS package, must have full access to c:\users\default.
You can check this by running sysinternals' process monitor on the machine that executes the SSIS job.
You can find more information here:
Empty Excel File permissions issue: SSIS Excel Destination buffers large record sets through C:\Users\Default - This post made me find this solution
https://www.csopro.de/biblog/2018/04/ssis-fehlerbehebung-bei-excel-destination-schreibt-keine-zeilen/ - my blog. Here I describe the issue - unfortunately in German]
I had the same problem writing to several worksheets in an Excel file from a scheduled SQL Agent job. It worked fine for about 4 months. Then suddenly with no changes to the package, one of the 5 worksheets was no longer populated with data. No error message generated and it worked fine on every test from Visual Studio and Data Tools (the old "BIDS" tools as we used to call it.)
I never did find a solution and it continues to not write any data to that single worksheet of the 5 in the Excel file. (So answers above about the Account that the job runs under from SQL Agent does not have the appropriate permissions is NOT a correct answer for this issue.)
Plus, a new package I built today is having the same issue, only this one has only a single worksheet. Again, works fine in the development environment, but no data appears in the destination file and no errors. Not only that, but the timestamp on the file is the same as the template file -- it seems that it never even TRIES to write to the file.
Checking each run log for the package in the Integration Services Catalog has an entry in each log that shows 9K+ records "written" for the dataflow task.
Lastly, if I change the destination file name, the SQL Agent job generates the expected error, so that rules out answers that guess that the path is wrong.
This is bizarre. And exasperating.
I have encountered odd behaviour when using scheduled SSIS packages which use the Excel object.
The fix for me, was to edit the Agent Job properties. On the Execution Properties tab, try enabling the "use 32-bit runtime" option and force the SSIS to run in 32-bit mode instead of 64-bit mode.

SQL Server SSIS Package Scheduling

We have a package that we created in VS. The package executes perfectly in VS. We then saved and deployed the package to SSIS. Inside SQL Server Management Studio, the SSIS package executes perfectly when done manually. We have 2 packages that we manually execute. We are trying to schedule these 2 packages to run automatically using the SQL Server Agent. When we set up a job and schedule it, the job fails. The first step in the package fails with the error: Failed Validation and returned validation status "VS_ISBROKEN"
We think it has to do with the security on SQL Server Agent, but we have checked and all the permissions seem to be set correctly.
Any help is greatly appreciated!
You should be getting additional error messages other than the VS_ISBROKEN, which will be more helpful in figuring out what's going on. It has been my experience that VS_ISBROKEN almost always refers to an invalid query. For example, the query could be referencing an object that doesn't exist on the target server.
I came across a similar problem in an earlier version of SSMS and found the problem was that the owner of the package in SQL server Agent was incorrect and should be sa or dbo
I don't know if it helps but the symptoms for this seem very similar to mine

sql server 2000 dts package fails when scheduled

I have a SQL Server 2000 dts package which copies data from a DBF file to SQL Table
I have created a System DSN and provided UNC Names for both Connection and Database file itself.
It runs smoothly when ran manually but fails when scheduled as a job?
I googled and found that it has to do with the permissions of SQL Server Agent etc
Can anyone guide me to the right source/post a solution?
"The error says xyz.dbf doesn't exist" in the job history
This is related but separate question
If i am pulling data from one SQL server to another using dts package provided a condition only,For example ,copy the data between the servers if SourceServer table has a value "OK"
i.e if SourceServer.SourceDB.Dbo.CheckStatusTable.Statuscolumn="OK" then copy the value else do not copy
If I have something like above condition how do i embed this into a dts package?
Thanks
Hey - I'll answer the first question in your post regarding the error you are receiving. When you run a DTS package manually, it runs under your context using your permissions. When run as a scheduled job, the package runs under the context of the job agent, in this case SQL Server agent.
It appears that the agent is lacking permissions that you have in attempting to complete the operation. Since the error is mentioning the DBF file, I'd start there. Check any permissions for the file itself or whether the context is being passed properly.

Resources