issues in executing as400 command from SSIS execute sql task - sql-server

I am working on an ssis package to process data from text file into as400 system. In one of the steps, i have to create a copy of an existing file object in iseries and i am executing the below command from execute sql task.
{CALL QSYS.QCMDEXC('CRTDUPOBJ OBJ(CKFMTWRK) FROMLIB(MYWRKLIB) OBJTYPE(*FILE) TOLIB(MYWRKLIB) NEWOBJ(CKFMTWRKPN) DATA(*NO)',0000000101.00000)}
This command works fine when i run it from the IBM Personal Communications terminal but throws below error when i do it from SSIS package.
[Execute SQL Task] Error: Executing the query "CALL QSYS.QCMDEXC('CRTDUPOBJ OBJ(CKFMTWRK) FROMLIB..." failed with the following error: "Routine *N in *N not found with specified parameters. SQLSTATE: 42884, SQLCODE: -440". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Further information on my environment:
I'm using sql server data tools 2015.
I've established the connection to as400 using Microsoft OLEDB provider for DB2.
I have sufficient permissions on the server (i guess, coz i am able to execute the commands from the terminal)
This is my first ever with as400 and I am stuck here in this step. I tried looking up online but there is nothing much that could help me in resolving this.
Any suggestions/help on this would be much appreciated.
Thanks.
Dvr

You are trying to perform AS/400 OS level command from a SQL environment (SSIS) which is not correct. QCMDEXEC is AS/400 command line interpreter while CRTDUPOBJ is creation of an identical object from the source with the option to duplicate its data as well.
Personal Communication terminal is fine cos you think you are using SQL service but actually not. It's AS400 command.
End up, you better do it over AS/400 terminal for duplicating object. Just use
CRTDUPOBJ OBJ(CKFMTWRK) FROMLIB(MYWRKLIB) OBJTYPE(*FILE) TOLIB(MYWRKLIB) NEWOBJ(CKFMTWRKPN) DATA(*NO)
The last keyword DATA(*NO) means create the object only but not the data, so you will get an empty file after completion.

Related

SSIS to Oracle "Could not create a managed connection manager."

I'm trying to use SSIS to load some data from Oracle database to MSSQL database.
I created the project and used the ADO.Net source and was able to create a connection to Oracle and run queries and view results.
However when I actually run the package I get the following error:
Error: 0xC0208449 at Data Flow Task, ADO NET Source 2: ADO NET Source has failed to acquire the connection {EECB236A-59EA-475E-AE82-52871D15952D} with the following error message: "Could not create a managed connection manager.".
It seems similar to the issue here
And I did find that I have two oracle clients version installed "11.1" and "12.2".
One is used by PL/SQL and the other by other entity framework project.
If this is the issue I just wanted a way to tell the SSIS to pick-up the correct one.
I tried adding Entry in machine.config for "oracle.manageddataaccess.client" section with the desired version.
I also tried using other types of data sources but couldn't even create a successful connection
I tried changing the Run64bitRuntime property in the project to False
Note: I don't have SSIS installed on my machine.
Eventually, I just had to remove the entries related to 11.1 in path variable then restarted my machine.
Also I switched to "dotConnectForOracle" for connection and now it seems to be working fine.
I'm expecting issues related to other applications that might still be using the 11.1 version, but that will be a problem for another day.
Always make sure to write the user (oracle schema) in uppercase and some special characters [in my case it was $] in the password needs escape character even if you're using the wizard not the cmd
I still don't understand the whole issue but I hope this helps someone some day.

SQL Server Agent Job stops SSIS Step with "unexpected error" and without any error informations

I am dealing with my problem on some Windows Server 2019 (Core) with one running SQL Server 2019 CU4 instance each.
What we try to do
We are currently building a data warehouse with distributed databases. The individual layers of the DWH are located on one database server each. The data exchange between the layers/servers takes place via SSIS ETLs, which use Linked Servers to reach the other layers and drag and drop data. Each layer also has its own SSIS service instance and executes the corresponding SSIS packets.
The SSIS packages are called by SQL Server Agent jobs. We have a job that executes the SSIS packets (#1), which in turn calls another job (#2) as the last step, which after a short wait time executes the calling job (#1). Thus, controlled by schedules, a loop is created and data is continuously transferred with ETLs.
I hope this was not too much unnecessary background
The error
Basically the job is running and there are numerous successful executions. However, we are observing interruptions at job #1 without helpful information regarding the error. This means that the job history log refers to the SSIS log, which again only contains an "unexpected termination". In the SSIS log, we only see behavior that indicates that the ETL packet active at that time stopped after validation. Depending on the log level, nothing is logged at all, not even the execution of single packages of the project. The package where this error occurs is different and not limited to a specific one.
What I have already tried
Re-create the jobs and SSIS Enviroments by hand (scripted before)
Using the 32Bit Runtime
Upgrade the SSIS project/package version to
2019
Increase the log level to "verbose"
Patching the SQL Server to CU4
Save ssis dump files (couldn't find them or they weren't created)
Search Windows and SQL Server Logfiles
Does anyone have some suggestions or some ideas how to become more error specific informations?
Thank you very much and take care :)
UPDATE We have an error message (OLE DB 0xC0202009 and 0X80004005)!
In order to exclude the use of environments as a cause, I manually set the parameters in the SSIS job step instead of overwriting them by selecting an environment.
Long story short: Today it turns out that the parameter for an OLE DB Connection String is not passed correctly.
The following is specified as a parameter in the job step:
However, the following connection string is specified in the context of the error message:
Please note that some arguments are added twice to the parameter (red).
What could have caused that?

ssis moving data between sql and access databases

In SQL Server Data Tools 2015, I would like to move data from a SQL Server 2012 database into a new access database(2005) and need to create the access table as part of the process. Can this be done all in one Execute SQL process under control flow. This will be part of a loop to run through a list of tables that need to be dynamically created and loaded into an empty access db.
I have created a connection manager and that is in the connection field for the access database and put the code into the SQL statement field under the general tab of the Execute SQL Task component.
Both databases are on my local machine.
"SELECT a.* into providers from OPENROWSET('SQLNCLI', 'Server=localhost;Trusted_Connection=yes;', 'SELECT * FROM newResults.dbo.providers') as a"
I get the following error:
SSIS package "C:\Users\chris\source\repos\Integration Services
Project5\Integration Services Project5\Package1.dtsx" starting. Error:
0xC002F210 at Execute SQL Task 2, Execute SQL Task: Executing the
query "SELECT a.* into providers from OPENQUERYSET('SQLN..." failed
with the following error: "Syntax error in FROM clause.". Possible
failure reasons: Problems with the query, "ResultSet" property not set
correctly, parameters not set correctly, or connection not established
correctly. Task failed: Execute SQL Task 2 SSIS package
"C:\Users\chris\source\repos\Integration Services Project5\Integration
Services Project5\Package1.dtsx" finished: Success.
The SQL contained in the Execute SQL Task is executed in the destination's context. The SELECT INTO FROM OPENQUERYSET statement is being passed to Access. Access doesn't have the OPENQUERYSET function and even if it did, your source is SQL Server, which Access doesn't know about unless you have made a connection to SQL Server in Access. Copy your SQL statement into Access and try to execute it and you'll see the same or a similar error. That's what the Execute SQL Task is doing.
Dynamic data is one of the more challenging problems in SSIS. The COZYROC tools include a lot of support for handling dynamic scenarios. Check out the videos for their Data Flow Task Plus for some ideas.

SSIS: transaction during simultaneous moving of data

I implemented SSIS package which moves data from Sql Server database to another one. This package has set of Data Flow Tasks which copy data simultaneously in different tables. Each Data Flow Task contain OLE DB datasource and Sql Server destination.
Package worked fine until I decided to implement transaction. I found that it is not possible to just set TransactionOption to Supported on package level, because SSIS cannot handle transactions in multiple simultaneous processes. So, I decided to use this way:
http://consultingblogs.emc.com/jamiethomson/archive/2005/08/20/SSIS-Nugget_3A00_-RetainSameConnection-property-of-the-OLE-DB-Connection-Manager.aspx
But now I have another problem. I have "Unable to bulk copy data. You may need to run this package as an administrator" errors. These errors occur in random places. For example if I ran package in the first time Data Flow Task named "Task A" can be executed correctly, but when I run package in the second time it can throw the error.
How do I can implement transaction in my case? (Changing of package in order to perform execution of Data Flow tasks sequentially is not an option)
I got a recent error with our MS SQL Server 2008R2 and SSIS. Found the error:
[SQL Server Destination [16]] Error: Unable to bulk copy data. You may need to run this package as an administrator.
[SSIS.Pipeline] Error: component "SQL Server Destination" (16) failed the pre-execute phase and returned error code 0xC0202071.
but could not solve it with running as Admin. The error only came with one step and I finally found out that I get rid of the error when I increased the timeout of the SQL Server Destination. Funny is that with the read of external ADO NET Source I get a proper error that helped me to see the timeout is the problem.

SSIS Exec T-Sql Statement Task connection string

I dragged Execute t-sql statement task from toolbox. clicked new and created new connection.
when i executed, it executed successfully. there was no db showing in con string.
i changed the connection string to point to new server of above in Connection tab.
when i executed it, i recv errr
Description: Executing the query "DBCC SHRINKFILE (AppDB_log,300);" failed with the following error: "Could not locate file 'AppDB_log' for database 'master' in sys.database_files. The file either does not exist, or was dropped. ". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. End Error
DBCC Shrinkdatabase command i am using.
Try running the query directly in SSMS in the database where you think it will be run based on your connection. If it fails then it's probably a problem with the query (i.e. the data file really doesn't exist). If it succeeds then it's probably a problem with your connection.
If it's a problem with the connection, try running profiler on your server and see what pops up when you run the SSIS package.
Copuld it be a permissions problem? Do you have the rights to run the command on that database?

Resources