Question about job using powershell steps then SQL DTSX File - sql

I have a simple SQL export to an XLS file. To keep the file clean, I have powershell steps:
Deletes the current file
Copies a template to the location
then runs a SQL step running a DTSX file that does a simple query and exports to the file.
when I run the DTSX file step it works fine, however after I run the two powershell steps it somehow permanently breaks the DTSX step, even if I run the job at that step only.
The only thing I can think of is I had to do set-location C: on the two powershell steps to have the code work, after i changed this the DTSX step constantly fails till I build it again, upload the new file, then it works until I run all three steps again. Any thoughts? I guess I could just build this in Visual Studio instead of using Powershell.
I tried to make the DTSX clear out the spreadsheet before it exports but that always failed, not sure if this is the way to go instead?
Step 1 (works every time):
Set-Location c:
Remove-Item -Path ""
Step 2 (works every time):
Set-Location c:
Copy-Item -Path "" -Destination ""
Step 3 (only works if I run it before ever trying the two above steps)
Type: SQL Server Integrations Service Package
Package Source: File system
I made it using a simple Export Data task.
Error after running the powershell steps, when running the DTSX step:
Executed as user:. Microsoft (R) SQL Server Execute Package Utility
Version 11.0.6260.1 for 32-bit Copyright (C) Microsoft Corporation.
All rights reserved. Started: 12:00:05 AM Error: 2019-01-24
00:00:05.92 Code: 0xC0202009 Source: Data Flow Task 1
Destination - Query [32] Description: SSIS Error Code
DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code:
0x80040E37. End Error Error: 2019-01-24 00:00:05.92 Code:
0xC02020E8 Source: Data Flow Task 1 Destination - Query [32]
Description: Opening a rowset for "Query" failed. Check that the
object exists in the database. End Error Error: 2019-01-24
00:00:06.00 Code: 0xC004706B Source: Data Flow Task 1
SSIS.Pipeline Description: "Destination - Query" failed validation
and returned validation status "VS_ISBROKEN". End Error Error:
2019-01-24 00:00:06.00 Code: 0xC004700C Source: Data Flow Task
1 SSIS.Pipeline Description: One or more component failed
validation. End Error Error: 2019-01-24 00:00:06.00 Code:
0xC0024107 Source: Data Flow Task 1 Description: There were
errors during task validation. End Error DTExec: The package
execution returned DTSER_FAILURE (1). Started: 12:00:05 AM
Finished: 12:00:06 AM Elapsed: 0.812 seconds. The package execution
failed. The step failed.

Related

Get Error While Job executed by SQL JOB AGENT

I am getting below error while execute SSIS Package with SQL Server Agent. I have use administrator account(proxy) to execute this job.
SSIS Package contain data flow task. I have used ODBC connection as data source and OLEDB connection for data destination.
Data Souce :- AS400 JDE system & Data Destination - SQL Server 2019
SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on ODBC Source returned error code 0x80004005. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.There may be error messages posted before this with more information about the failure.End Error DTExec: The package execution returned DTSER_FAILURE (1)
`
Here is the SSIS Log.
Here the some more details.
• SQL Edition: 2019 Enterprise
• OS: Windows 2019 server edition
Issue description:
• I have SSIS Package which connect to JD Edwards database via ODBC Connection
• I have Scheduled SQL Job and one of the step is using above package to load data form JD Edwards
• The job step throw error during execution. Below is the detail description of the error
Executed as user: {DomainName}{UserName}. Microsoft (R) SQL Server Execute Package Utility Version 15.0.2000.5 for 32-bit Copyright (C) 2019 Microsoft. All rights reserved. Started: 12:39:40 PM Error: 2020-06-11 12:40:02.18 Code: 0xC0047038 Source: Data Flow Task SSIS.Pipeline Description: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on ODBC Source returned error code 0x80004005. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 12:39:40 PM Finished: 12:40:02 PM Elapsed: 21.969 seconds. The package execution failed. The step failed.
'
Can Anyone Help in this ?
That log you're looking at must be incomplete. To get all error messages:
USE SSISDB
SELECT * FROM catalog.executions WHERE package_name LIKE 'NameOfYourPackage'
Copy the execution_id of the relevant execution (look at dates and times)
SELECT * FROM catalog.event_messages WHERE operation_id=[execution_id from previous query] AND message_type>110

SSIS Package is working fine in SSDT but throwing an error in a SQL Server Agent JOB

I am getting the error shown below using a SSIS package created in SSDT 2019 and SQL Server 2019 in SSMS v18.4.
It's working fine when I am running it from SSDT and only throwing the error when run in a SQL Server agent job. I am not passing any parameters. It's a simple package with just one script task. I don't think it's an issue with the script task because I also checked with execute process task in SSIS with simple different package and that is also throwing the same error.
Is there any help? Thanks in advance....
Error:
Description: Cannot create a task from XML for task "Script Task", type "Microsoft.ScriptTask" due to error 0x80070057 "The parameter is incorrect.". End Error Error: 2019-12-23 00:29:35.22
Code: 0xC0010018
Source: Script Task
Description: Failed to load task "Script Task", type "". The contact information for this task is "". End Error Error: 2019-12-23 00:29:35.22
Code: 0xC0010026
Source: Script Task
Description: The task has failed to load. The contact information for this task is "". End Error Error: 2019-12-23 00:29:35.22
Code: 0xC0024107
Source: Script Task
Description: There were errors during task validation. End Error Error: 2019-12-23 00:29:35.22
Code: 0xC0010025
Source: Package2
Description: The package cannot execute because it contains tasks that failed to load. End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started: 12:29:35 AM
Finished: 12:29:35 AM
Elapsed: 0.094 seconds.
The package execution failed. The step failed.

SSIS Package loading data from Excel fails when run as a job

I have created a SSIS Package using Visual Studio 2015 that takes an Excel file and imports it into a database. The job has been running smoothly for weeks, but for some reason, it failed this morning. When I run it as its own package, it runs perfectly but whenever it is in a job, even if it's the only step in the job, it fails. It is running using 32-bit runtime. The error I receive is pasted below.
Executed as user: NA\SQL_INTDB01$. Microsoft (R) SQL Server Execute Package
Utility Version 13.0.1601.5 for 32-bit Copyright (C) 2016 Microsoft. All
rights reserved. Started: 9:41:48 AM Error: 2018-01-04 09:41:49.36
Code: 0xC0202009 Source: STRATImport Connection manager "Excel
Connection Manager" Description: SSIS Error Code DTS_E_OLEDBERROR. An
OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is
available. Source: "Microsoft Access Database Engine" Hresult: 0x80004005
Description: "Failure creating file.". End Error Error: 2018-01-04
09:41:49.36 Code: 0xC020801C Source: Data Flow Task 1 Excel Source
[71] Description: SSIS Error Code
DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection
method call to the connection manager "Excel Connection Manager" failed with
error code 0xC0202009. There may be error messages posted before this with
more information on why the AcquireConnection method call failed. End Error
Error: 2018-01-04 09:41:49.36 Code: 0xC0047017 Source: Data Flow
Task 1 SSIS.Pipeline Description: Excel Source failed validation and
returned error code 0xC020801C. End Error Error: 2018-01-04 09:41:49.36
Code: 0xC004700C Source: Data Flow Task 1 SSIS.Pipeline Description:
One or more component failed validation. End Error Error: 2018-01-04
09:41:49.36 Code: 0xC0024107 Source: Data Flow Task 1
Description: There were errors during task validation. End Error DTExec:
The package execution returned DTSER_FAILURE (1). Started: 9:41:48 AM
Finished: 9:41:49 AM Elapsed: 0.438 seconds. The package execution
failed. The step failed.
Microsoft Access Database Engine has thrown the following error:
Failure creating file
This error is thrown when the Excel connection manager cannot access to the chosen path, it might be caused by:
You are using a network path / try replacing with a local path
it might be pointed to your local server, but when it is deployed to another server it will throw error
you do not have permission to access the selected path from the account that is running the SSIS
path does not exists
References
SSIS Excel File issue - Failure creating file
Failure creating file" error trying to drop and create tables in an Excel data source

Loading Access data to SQL Server

My aim is to update some fields in SQL Server 2008 R2 database from an Access database 2007
I created an ssis package using an Access source which is mapped to network drive, I shared the database
The package executes fine in ssis.
I have to run job for scheduling, and when I run this in SQL Agent job it gets an error shown below
Date,Source,Severity,Step ID,Server,Job Name,Step
Name,Notifications,Message,Duration,Sql Severity,Sql Message
ID,Operator Emailed,Operator Net sent,Operator Paged,Retries Attempted
03/02/2015 12:48:53,test_job,Error,0,PAVAN,test_job,(Job outcome),,The
job failed. The Job was invoked by User PAVAN. The last step to run
was step 1 (testjob_step).,00:00:01,0,0,,,,0
03/02/2015
12:48:53,test_job,Error,1,PAVAN,test_job,testjob_step,,Executed as
user: PAVAN\sys-32. Microsoft (R) SQL Server Execute Package Utility
Version 10.50.1600.1 for 32-bit Copyright (C) Microsoft Corporation
2010. All rights reserved. Started: 12:48:53 PM Error: 2015-03-02 12:48:54.93 Code: 0xC0202009 Source: FirstPackage Connection
manager "\RAGHU-PC\vijay\access db\weighbridge.mdb" Description:
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error
code: 0x80004005. An OLE DB record is available. Source: "Microsoft
Office Access Database Engine" Hresult: 0x80004005 Description: "The
Microsoft Office Access database engine cannot open or write to the
file '\RAGHU-PC\vijay\access db\weighbridge.mdb'. It is already
opened exclusively by another user or you need permission to view
and write its data.". End Error Error: 2015-03-02 12:48:54.93
Code: 0xC020801C Source: datafor sqlserver OLE DB Source [1]
Description: SSIS Error Code
DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The
AcquireConnection method call to the connection manager
"\RAGHU-PC\vijay\access db\weighbridge.mdb" failed with error code
0xC0202009. There may be error messages posted before this with more
information on why the AcquireConnection method call failed. End
Error Error: 2015-03-02 12:48:54.93 Code: 0xC0047017 Source:
datafor sqlserver SSIS.Pipeline Description: component "OLE DB
Source" (1) failed validation and returned error code 0xC020801C. End
Error Error: 2015-03-02 12:48:54.93 Code: 0xC004700C Source:
datafor sqlserver SSIS.Pipeline Description: One or more component
failed validation. End Error Error: 2015-03-02 12:48:54.93 Code:
0xC0024107 Source: datafor sqlserver Description: There were
errors during task validation. End Error DTExec: The package
execution returned DTSER_FAILURE (1). Started: 12:48:53 PM
Finished: 12:48:54 PM Elapsed: 0.936 seconds. The package execution
failed. The step failed.,00:00:01,0,0,,,,0
Along the lines of the above, make sure whoever has Access open did not open it via a shortcut that in the command line has /excl in it, which opens it exclusively and maybe locking this data pump.
Also just for kicks and giggles try running the SSIS package with nobody in it.
Also make sure \RAGHU-PC\vijay\access db\weighbridge.mdb is a valid path on the server where the SSIS package is executed, just it case that is not a correct mapping.

SSIS Package working in BI Studio but not working in SQLServer 2008

I have the SSIS package which iterates all excel files in the particular folder and import rows into the SQL 2008 database. I use 4 Package Scope Variables for files and folders paths.
I could run the package and import all data in excel files if I run the package in BI Studio.
But when I move the package and set up the job in the SQL 2008 server, I could not run the package and it shows me the following message.
Executed as user: xxxxx Microsoft (R) SQL Server Execute Package Utility Version 10.0.4000.0 for 32-bit. Started: 16:19:23 Error: 2011-05-26 16:19:23.53 Code: 0xC0202009 Source: PCounter Connection manager "Excel Connection Manager" Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "The Microsoft Jet database engine cannot open the file ''. It is already opened exclusively by another user, or you need permission to view its data.". End Error Error: 2011-05-26 16:19:23.53 Code: 0xC020801C Source: Data Flow Task Excel Source 1 Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed. End Error Error: 2011-05-26 16:19:23.53 Code: 0xC0047017 Source: Data Flow Task SSIS.Pipeline Description: component "Excel Source" (1) failed validation and returned error code 0xC020801C. End Error Error: 2011-05-26 16:19:23.53 Code: 0xC004700C Source: Data Flow Task SSIS.Pipeline Description: One or more component failed validation. End Error Error: 2011-05-26 16:19:23.53 Code: 0xC0024107 Source: Data Flow Task Description: There were errors during task validation. End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 16:19:23 Finished: 16:19:23 Elapsed: 0.547 seconds. The package execution failed. The step failed.
I am sure that the files are not opened by anyone and my SSIS Proxy account do has the permission to access that folder. It still shows me this error however I tried.
Please give me suggestions.
You are using a variable to set the excel file via your Excel Connection Manager. Unless you have DelayValidation set to true at the package level, the connection manager will fail when it can't find the file you originally specified when you set up the Excel Connection Manger. Try setting DelayValidation on both the package and the connection manager to true - or make sure that the file you used to set up the connection manager is accessible by your sql server/sql agent account.