Loading temporary tables in parallel - sql-server

I load data from one SQL Server A to temporary table via Execute SQL Task (select * into x from remote_server) and join with another remote SQL Server B in Data flow.
So I have two source in Data Flow:
1.Local temporary table which contains date from SQL Server A (loaded in previous task)
2.Table on remote SQL Server B.
To achieve it I change "RetainSameConnection" connection manager property (which I use it to pull data from SQL Server A to local machine (SSIS server) to TRUE. It works but I cannot load these tasks parallely, because I get:
S [[209]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error
has occurred. Error code: 0x80040E14. An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E14
Description: "Statement(s) could not be prepared.". An OLE DB record
is available. Source: "Microsoft SQL Server Native Client 11.0"
Hresult: 0x80040E14 Description: "Invalid object name
'##V_DEL'.".
[SSIS.Pipeline] Error: "S" failed validation and returned validation
status "VS_ISBROKEN".
How to solve it?

If you are using RetainConnection = True then only 1 object at a time can have the retained connection. This means that if 2 sql tasks run in parallel then only 1 will use the retained connection. Similar to the issue that you cant have a lookup and a dest with the same retained connection.
The only workaround is to serialize your SQL calls.

Simple solution: Just take Global temp table creation task in one sequence container and insert part in another sequence container. It will work fine and we can run the 2 task in parallel.

Take temp table creation part in one sequence container and insert part in another sequence container and it will work even if we run task in parallel having more than one Global temp tables.

Related

SSIS - Cannot insert duplicate key in object 'dbo.FACT_TABLE'

I know that we can't have duplicate records in Fact Table but I'm very new in SQL Integration Services and I'm looking for a package that can recognize that if the surrogate keys already exists in fact tables...
In this moment I've this package:
Each lookup objects get the business key of each dimension in my datawarehouse.
At the first time it run very well because in Fact Table I don't have records, but next I made the test and I run the same data again (because in future I want to run this package every 10 minutes so it will get the same data ofentimes) and I get the following error (that I understand very well I want to build an approach to handle this automatically):
[Load into dbo_DimCI [144]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK_FACT_FACT_TABLE'. Cannot insert duplicate key in object 'dbo.FACT_TABLE'. The duplicate key value is (337, 44, 3, 19, 4682, 12).".
Which objects I need to insert in my package in order to handle this error?
I believe your intention is to load only the deltas in each load.
Which means if a record already exists in the fact table, then the record should not be inserted again.
You could achieve this by using a Merge Query.
I do not have an example to load a fact table, but I can point you to an example of a post that talks about loading a Type 2 Dim Table.
Check this link:https://www.mssqltips.com/sqlservertip/2883/using-the-sql-server-merge-statement-to-process-type-2-slowly-changing-dimensions/
You should be able to use such a statement in your SSIS package to update your fact table.
Happy to answer any further questions.
Cheers
Nithin

SSIS OLE DB Source - move cache location

When SSIS package is run by scheduler on server, the disc C: gets full and computation crashes with error Failed to retrieve long data for column "Col1".
Package has 3 steps:
OLE DB Source - Retrieve whole table with binary data - this step fails
Script Component - Compute hash of each data
OLE DB Destination - Save hash to different table
If I run sql script from 1) in Management Studio SQL Query, it fails with error: "An error occurred while executing batch. Error message is: There is not enough space on the disk."
Is it possible to move any caching of this particular package to other disc?
Or to move caching of all packages to other disc?
By other disc I mean disc, where neither SQL Server is installed, nor SQL Server Data are saved.
Changing Tools > Options: Query Results > SQL Server > General: Default location for saving query results in Management Studio did not help.
Thanks
When you go to the 'Data Flow' Tab, right click anywhere not on a task and select properties.
There will be two items
BLOBTempStoragePath
BufferTempStoragePath
you can change the location there.

SSIS Connection to ORACLE (Multiple-step OLE DB operation generated errors)

I have an "Native OLE DB\Oracle Provider for OLEDB" connection in SSIS package to execute a procedure on ORACLE.
Procedure is working fine but in log file I am seeing below mentioned warning, which is slowing down the execution.
Warning : Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
The procedure is having 5 inputs and 2 out paras. After reading few articles which point says it could be due to data type/size mismatch.
I personally think its something to do with connection setting. I created a simple task of deleting data from a table without any para or variable. Still there was a warning
Its simple delete statement.
BEGIN DELETE FROM KC.KC_PAYMENT; END;
The warning appears after "validation is completed". and before the delete statement "Progress" event.
Deepak
There are many ways to work around this problem. What I am thinking as of now is
1) Store the Connection string that points to oracle into sql server table or in variable.
https://www.connectionstrings.com/oracle-provider-for-ole-db-oraoledb/
2) Check for security while fetching the records.
3) Use the "Oracle provider for OLE DB" from SSIS, don't use the "Microsoft Provider for Oracle" because a 64 bit version of it does not exist.
4) Schedule your packages with the SQLAgent.

Trying to call a T-SQL Stored Procedure which selects data from linked server in SSIS package

I have a scenario where I am trying to select some data in a table t1 & t2 from a remote Server (on which I just have read permissions) S1 in DB db1 from another remote Server(on which I am DBO but dont really have all the permissions so that I can do whatever I want) S2 in DB db2 into table t1 through a SSIS package.
S1 and S2 both are linked servers. I linked to S1 from S2 through object server in SSMS.
Now, I created a stored procedure sp1 in S2.db2 which has some select statements from two different tables with a join for a range of dates which are passed as parameters to the sp1.
for example as below :
SELECT * from s1.db1.schema1.t1
LEFT JOIN
s1.db1.schema1.t2
ON [CONDITION]
WHERE [CONDITIONS]
Now my SSIS package has a Dataflow task which has OLE DB source and Destination with a connection string to s2.db2
In the source I am calling the above mentioned query in the SQL Command directly and populating into the destination table which is S2.db2.t1 and it is working fine
But it is throwing an error when I am trying to do the following
Create 2 package level DATETIME variables as v1, v2 and pass default
values - No Problem
In the OLE DB SOURCE->CONNECTION STRING -> SQL COMMAND -> EXEC sp1 ?, ? - No Problem
click on PARAMETERS tab and select both the user parameters for Parameter0 and parameter1 - No problem
Now when I say ok for the SQL COMMAND Window its giving me the error as follows
The Error is :
TITLE: Microsoft Visual Studio
Error at FII54_CBI_TM51 [FII54_CBI 1]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Operand type clash: int is incompatible with date".
Error at FII54_CBI_TM51 [FII54_CBI 1]: Unable to retrieve column information from the data source. Make sure your target table in the database is available.
ADDITIONAL INFORMATION:
Exception from HRESULT: 0xC020204A (Microsoft.SqlServer.DTSPipelineWrap)
BUTTONS:
OK
I understand what the error mean but I dont understand why is it throwing this error at all.
I appreciate if someone can help me solve this issue? This is pretty urgent for me.
When using a stored procedure as an OLEDB source, you should make sure that inside the stored procedure you have:
SET NOCOUNT ON;
and then before you execute the procedure, add: SET FMTONLY OFF
SET FMTONLY OFF;
EXEC CBI_MASTER_PID ?, ?
Can you try this one out?

SSIS transactions with multiple OLE DB commands

I have the following Data Flow task in my SSIS package:
alt text http://img228.imageshack.us/img228/358/ssis1.png
It reads a file from an external vendor that has records with a column "change" that cointains A, C or D for add, change and delete. I have to process these in my SQL Server database. The conditional split checks the value of the change column and sends the row off to the appropriate command. This works fine.
Because the input files sometimes contain errors I would like to make this process transactional (there are 10 of these Data Flow tasks).
If I enable transactions on the SSIS package however the OLE DB commands seem to interfere with each other (they do not operate on the same rows). I get the error:
Error: 2010-02-02 12:21:08.39
Code: 0xC0202009
Source: name OLE DB Command 1 [58]
Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred.
Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0
" Hresult: 0x80004005 Description: "This operation conflicts with another pend
ing operation on this transaction. The operation failed.".
End Error
Error: 2010-02-02 12:21:08.39
Code: 0xC004701A
Source: name SSIS.Pipeline
Description: component "OLE DB Command 1" (58) failed the pre-execute phase
and returned error code 0xC0202009.
End Error
Progress: 2010-02-02 12:21:08.39
I have tried any order of the conditional split and all the IsolationLevels on the Transaction settings but nothing seems to work. If I make the conditional split use only 1 of the branches it works fine.
How to proceed?
Try replacing SQL Server Destination with a "OLEDB Destination" for the inserts.
SSIS is so bad it makes me scream - Seriosuly you should revist whether SSIS is the correct tool here

Resources