Execute SSIS from remote machine - c#

I need to execute an SSIS package from an .net application that's on a remote machine. The machine running the application does not have SSIS installed.
I know this can be accomplished using T-SQL with xp_cmdshell http://www.databasejournal.com/features/mssql/article.php/3372131/Using-xpcmdshell.htm but am unable to use this approach because of security issues.
I would like to put store this package as an Agent job on the remote server (running sql server 2008) and execute it though the Agent service. I found an article about that here http://msdn.microsoft.com/en-us/library/ms403355.aspx#agent but am unable to find out how to pass the package in variables.
These variables will change from each run and I know I could store them in the database and load them while executing the package but it seems a hacky solution. Is anyone aware of a work around for this?

Have you considered/read about package configurations? You may want to read that if you have not done so already. Also, read about the DTEXEC utility which is the command line SSIS executable. You can easily pass variables through a batchfile and DTEXEC utility.

Related

SSIS package executes fine from my machine, but failing as a SQL job

I have an SSIS package which uses C# script and 3rd party libraries to perform the required task. The package executes fine from visual studio, however when I try to run the same as SQL job, I see a successful completion, however the task the script is expected to perform is not happening (The 3rd party dll methods appears to be ignored).
The SQL job is run using service account and for Visual studio it is with my windows user credentials.
Is it a credentials issue for the service user or a firewall issue, any suggestions which can direct me to a way forward will be greatly appreciated. Thanks.
One time, I faced a similar issue while using Microsoft.Office.Interop.Word.dll assembly, after spending my time trying to resolve this issue, I some functionalities require a Windows user to run without any error.
Try to add a proxy account (run SQL job with the same credentials use to run manually), you can follow one of these links for a step-by-step answer.
Running a SSIS Package from SQL Server Agent Using a Proxy Account
Create a SQL Server Agent Proxy
How do you load the reference to the 3rd party in your script?
I guess you are experiencing dll loading issue while running your code as a SQL Job.
Can you provide more details?

SSDT BI Custom connection manager AccessViolationException

I've created a custom connection manager for SSDT BI (SSIS) which will connect to an Oracle database using Oracle's managed data access library (Oracle.ManagedDataAccess.dll).
On my development machine, this connection manager, and the custom "data source" pipeline component which goes with it, will work fine. When I deploy the package to the server and try to run it, the package will always fail with an "AccessViolationException".
The server is running Windows Server 2012R2 with Sql Server 2014
So far, debugging hasn't give me much info. When I step though my code, my empty, default, constructor gets called but nothing else. As soon as it exits the constructor I get the exception. No other methods within my custom class are ever called.
Here's the information which is dumped to the windows event log.
Application: ISServerExec.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSPackagePersist100.LoadPackageFromXML(System.Object, Boolean, Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSEvents100)
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSPackagePersist100.LoadPackageFromXML(System.Object, Boolean, Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSEvents100)
at Microsoft.SqlServer.Dts.Runtime.Package.LoadFromXML(System.String, Microsoft.SqlServer.Dts.Runtime.IDTSEvents)
at Microsoft.SqlServer.Dts.Runtime.Project.LoadPackage(Microsoft.SqlServer.Dts.Runtime.IProjectStorage, Microsoft.SqlServer.Dts.Runtime.Package, System.String, Microsoft.SqlServer.Dts.Runtime.IDTSEvents)
at Microsoft.SqlServer.Dts.Runtime.PackageItem.Load(Microsoft.SqlServer.Dts.Runtime.IDTSEvents)
at Microsoft.SqlServer.Dts.Runtime.PackageItem.LoadPackage(Microsoft.SqlServer.Dts.Runtime.IDTSEvents)
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ISServerExecutionEvents.LoadPackage(Microsoft.SqlServer.Dts.Runtime.PackageItem)
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ProjectOperator.StartPackage()
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ProjectOperator.PerformOperation()
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ExecuteMain.Main(System.String[])
I've run into a similar issue before. The resolution was the sql server agent not having correct permissions to use the dll file.
Possible Fixes:
Check the location of the dll on the server.
Confirm permissions to use the dll.
Sorry I can't provide more precise fixes, the DBAs at my site ended up fixing it for me and this was the summary they gave me after.
can you sketch for me the outline of the SSIS package?
I have a hunch that this problem can occur when nesting Sequence Container objects in SSIS 2008. When you create a package with SQL Business Intelligence Development Studio 2008, and nest Sequence Containers, and then upgrade the package to SSIS 2012 or greater, and then open the package in SQL Server Data Tools 2012 or greater, the package will not display the same way as it did in 2008. The outer sequence container will not be attached to anything.

ORA-12557 TNS:protocol adapter not loadable

I am trying to develop a C# Windows Forms Application targeting the .net 4 framework. The program will execute a stored procedure against an Oracle Database and I get the following error when I try to open the connection to the database.
ORA-12557 TNS:protocol adapter not loadable
I am developing this in Visual Studio 2012 and have managed to make the Server Explorer connect to the database successfully, however I keep getting this error through my application.
I have two Oracle 11g clients on my machine. One is 32bit and the other is 64bit. I do need both for different applications so it is not possible to remove one. I have also tried changing the order of the Oracle home directories in the PATH variable. Currently I have the 64bit one first which is the one I would like to connect with.
I am connecting my application to the Database using ODP.NET and have referenced the dll from the 64bit application.
As far as I can tell I have done what has been suggested and have not managed to get it working. If anyone could help it would be appreciated.
The ORA-12577 error is related to Windows Environment or Oracle Home PATH because sqlplus command works smoothly when I execute it inside ORACLE_HOME\bin .
Its because of two or more oracle installs (say database and companion) in separate ORACLE_HOMEs on that machine unset the ORACLE_HOME value in your window
For Details please follow the following steps and hope so you will get the solution.
http://www.dba-oracle.com/t_ora_12577.htm
The base problem is that there are DLLs missing in the Oracle instant client installation that exist in the RDBMS server installation that the application requires. This is why switching Oracle homes from client_1 to db_1 works, rather than it being a purely a PATH problem.
sqlplus works in either situation because it uses the minimal set of DLLs which exist in both Oracle installations.
Here are a few things to check. Dont forget to try #3 if needed, it fix the problem for me!
Make sure all Oracle services are started
Make sure environment variables are set (PATH, ORACLE_SID=ORALOCAL, TNS_ADMIN=C:\Dev\Oracle\product\11.2.0\dbhome\NETWORK\ADMIN)
Try shifting the Path environment variable values like so:
“D:\Dev\Oracle\product\11.2.0\dbhome\bin” to be before the
“D:\dev\Oracle\product\11.2.0\client_32\bin” in the order
Fissh
For me I am using IIS .net provider. I was able to fix the problem with sqlplus by putting oracle64 before oracle32 in the path. This did not fix problems with .net. I have apps that use oracle32 and oracle64. To solve this problem registry keys HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE must point to \oracle32 home and HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE must point to the \oracle(64) home.

How to execute sql scripts other than OSQL command?

In my product we are using OSQL to execute the sql script files. Unfortunatly some clients don't have OSQL installed in their machine. They don't agree to install sql management studio for license issues.
Is there any alternative to execute the sql scripts rather than OSQL through c# ?
SQLCMD.EXE will be installed in the SQL Server binn directory on the server. You will need SQLCMD.EXE on the client, where your application runs. You can install the SQLCMD.EXE and other command line utilities separately, see Microsoft® Command Line Utilities 11 for SQL Server®.
But is not necessary to install SQLCMD, writing a C# script executor is fairly trivial. In fact I wrote one myself, see https://github.com/rusanu/DbUtilSqlCmd and is also available as a NuGet.
I think SSMS is free for download from microsoft portal and there are no licence issues with it. Check this

How to pass data (located on user's local drive) to SSIS package run from C# client application?

I want do run an SSIS package from a C# client application.
The package needs to import data from a user provided file which would reside on user's local drive or his network share.
I do not want to run SSIS Package Programmatically on the Local Computer as it would require SSIS to be installed on user machines.
Form what I read, a better approach is to run SSIS Package Programmatically on a Remote Computer (via a webservice which runs on the sql server and triggers the ssis package).
The problem is that the remote package would execute in the remote server context (SQL server machine) and it will not have access to the user provided path. Is there a solution to that issue that would not involve creating a network location accessible both to the users and sql server machine?
Have the C# client application FTP the file to the server prior to executing the package. Or have the client application insert the data into a staging table on the database first. Or have the web service accept the data, and write it to a staging area.
SSIS doesn't include any functionality for streaming a file to a package as input, so you have to rely on a standard way of accessing the data.

Categories

Resources