Showing posts with label package. Show all posts
Showing posts with label package. Show all posts

Monday, March 19, 2012

Deadlock in Dataflow

Hi all,

I have encountered a SQL 2005 deadlock issue while executing dataflow in a SSIS package. The deadlock happens when I have indexed two columns. If I don't have index, deadlock does not happen.

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 Native Client" Hresult: 0x80004005 Description: "Transaction (Process ID 67) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.".

The above causes the rest of the dataflow execution to be terminated.

What my dataflow does is to extract data from 14 flat files and then insert the records into a single table (no primary key, but with two columns indexed).

Can anyone please advise how I can avoid deadlock with indexes in a table?

Thank you and much appreciated!

Before the data flow, in the control flow, I'd issue an Execute SQL task to disable the indexes on the table. Then after the data flow, I'd re-enable them. Should help with performance as well.|||

Hi Phil,

Thank you very much for your response.

Would you mind tell me how do I disable and re-enable indexes (the SQL command/syntax ?) in a SQL task?

Thanks again.

|||http://msdn2.microsoft.com/en-us/library/ms177406.aspx

To disable:
ALTER INDEX your_index_name ON your_table_name DISABLE

To reenable:
ALTER INDEX your_index_name ON your_table_name REBUILD|||

I tried the ALTER INDEX ... DISABLE command and also in SQL Server Management Studio manually right-clicked INDEX folder to "disable all" index, but they didn't seem to disable the index. Deadlock still occurs.

Did I miss something?

Thanks!

|||

I think I got this deadlock solved.

Not sure why disabling index does not work for me, but instead of disabling it, I drop the index before the data load. After finishing data loading, I re-create the index and rebuild it. It works fine that way.

Thanks Phil!

Saturday, February 25, 2012

DBSTATUS_UNAVAILABLE with OLEDB Command

Hello,

I have an issue with the OLEDB Command in a package of mine where it used to work and now it doesn't. I had 4 different packages where I was bringing in a flat file, massaging the data, and calling 1 of 4 Stored procedures using the OLEDB Command. Everything was working great, then we decided to use the SSIS EBCDIC conversion in the flat file connection rather than converting to ASCII outside of SSIS. This wasn't a problem for 3 of the 4. The one I have an issue with seems to be somehow corrupt, I keep getting the error "Invalid character value for cast specification", as well as "DBSTATUS_UNAVAILABLE", for a particular column. When I re-map that column in the OLEDB Command task, re-run the package, it then tells me a different column has the exact same error. So in going through and re-mapping all of the columns, it goes back to the 1st column I had an error with and gives me the exact same error... ARRRGGGGHHHH!!!!

It seems like something is corrupt in SSIS or something. Does anyone have any thoughts, other than re-writing the package from scratch?

I know there's no issue with the data, I imported the same file into a test table without problems.

Hi, I solved my problem.

When I switched over to using EBCDIC instead of ASCII, normally I get an error for any string values coming in that I need to convert them from Code Page 37 to Code Page 1252. Also, normally I get an error anytime I'm trying to insert a value into a column if I have a different datatype on the input as opposed to the column, i.e. my input is a string and the column is an Integer. I wasn't getting an error for this, in fact I was getting error's for other columns that didn't have any issues. Perhaps this is because i'm calling a Stored Procedure rather than using a SQL Server destination, as I never seem to have this problem with a SS Destination.

Very weird and error messages were not intuitive at all. Oh well, at least it's resolved.

Andy

|||

Ok.. finnaly, what did you made for fix this?

I got the same problem but using a dataconversion from NUMERIC to STR

|||I only got the problem for strings. Just create another column with that value and make the new column ascii.|||

If you decide to do EBCDIC conversion in SSIS at the beginning of your stream you might want to check out the following component.

http://www.aminosoftware.com

It is a custom source component which allows you to do the EBCDIC conversion (including packed decimal, occurs, redefine, etc) all within the source component so that what comes out is ASCII columns.

DBSTATUS_UNAVAILABLE with OLEDB Command

Hello,

I have an issue with the OLEDB Command in a package of mine where it used to work and now it doesn't. I had 4 different packages where I was bringing in a flat file, massaging the data, and calling 1 of 4 Stored procedures using the OLEDB Command. Everything was working great, then we decided to use the SSIS EBCDIC conversion in the flat file connection rather than converting to ASCII outside of SSIS. This wasn't a problem for 3 of the 4. The one I have an issue with seems to be somehow corrupt, I keep getting the error "Invalid character value for cast specification", as well as "DBSTATUS_UNAVAILABLE", for a particular column. When I re-map that column in the OLEDB Command task, re-run the package, it then tells me a different column has the exact same error. So in going through and re-mapping all of the columns, it goes back to the 1st column I had an error with and gives me the exact same error... ARRRGGGGHHHH!!!!

It seems like something is corrupt in SSIS or something. Does anyone have any thoughts, other than re-writing the package from scratch?

I know there's no issue with the data, I imported the same file into a test table without problems.

Hi, I solved my problem.

When I switched over to using EBCDIC instead of ASCII, normally I get an error for any string values coming in that I need to convert them from Code Page 37 to Code Page 1252. Also, normally I get an error anytime I'm trying to insert a value into a column if I have a different datatype on the input as opposed to the column, i.e. my input is a string and the column is an Integer. I wasn't getting an error for this, in fact I was getting error's for other columns that didn't have any issues. Perhaps this is because i'm calling a Stored Procedure rather than using a SQL Server destination, as I never seem to have this problem with a SS Destination.

Very weird and error messages were not intuitive at all. Oh well, at least it's resolved.

Andy

|||

Ok.. finnaly, what did you made for fix this?

I got the same problem but using a dataconversion from NUMERIC to STR

|||I only got the problem for strings. Just create another column with that value and make the new column ascii.|||

If you decide to do EBCDIC conversion in SSIS at the beginning of your stream you might want to check out the following component.

http://www.aminosoftware.com

It is a custom source component which allows you to do the EBCDIC conversion (including packed decimal, occurs, redefine, etc) all within the source component so that what comes out is ASCII columns.

DBSTATUS_UNAVAILABLE with OLEDB Command

Hello,

I have an issue with the OLEDB Command in a package of mine where it used to work and now it doesn't. I had 4 different packages where I was bringing in a flat file, massaging the data, and calling 1 of 4 Stored procedures using the OLEDB Command. Everything was working great, then we decided to use the SSIS EBCDIC conversion in the flat file connection rather than converting to ASCII outside of SSIS. This wasn't a problem for 3 of the 4. The one I have an issue with seems to be somehow corrupt, I keep getting the error "Invalid character value for cast specification", as well as "DBSTATUS_UNAVAILABLE", for a particular column. When I re-map that column in the OLEDB Command task, re-run the package, it then tells me a different column has the exact same error. So in going through and re-mapping all of the columns, it goes back to the 1st column I had an error with and gives me the exact same error... ARRRGGGGHHHH!!!!

It seems like something is corrupt in SSIS or something. Does anyone have any thoughts, other than re-writing the package from scratch?

I know there's no issue with the data, I imported the same file into a test table without problems.

Hi, I solved my problem.

When I switched over to using EBCDIC instead of ASCII, normally I get an error for any string values coming in that I need to convert them from Code Page 37 to Code Page 1252. Also, normally I get an error anytime I'm trying to insert a value into a column if I have a different datatype on the input as opposed to the column, i.e. my input is a string and the column is an Integer. I wasn't getting an error for this, in fact I was getting error's for other columns that didn't have any issues. Perhaps this is because i'm calling a Stored Procedure rather than using a SQL Server destination, as I never seem to have this problem with a SS Destination.

Very weird and error messages were not intuitive at all. Oh well, at least it's resolved.

Andy

|||

Ok.. finnaly, what did you made for fix this?

I got the same problem but using a dataconversion from NUMERIC to STR

|||I only got the problem for strings. Just create another column with that value and make the new column ascii.|||

If you decide to do EBCDIC conversion in SSIS at the beginning of your stream you might want to check out the following component.

http://www.aminosoftware.com

It is a custom source component which allows you to do the EBCDIC conversion (including packed decimal, occurs, redefine, etc) all within the source component so that what comes out is ASCII columns.

Friday, February 17, 2012

DBMS_SQL package

I've described:

col_value varchar2(4000);

now i'm trying in a procedure the following

DBMS_SQL.COLUMN_VALUE(c3,col_num,col_value);

normally this should return data buth it gives nothing...

Somebody has an idea?

Here under I'll give you the full code:

CREATE OR REPLACE PROCEDURE xxresponsabilities_sp3 (PIN_PAGE IN NUMBER) IS
/* Cursor declaration */
CURSOR C1 is
SELECT id
,table_name
FROM xxtables
WHERE page_ID = PIN_PAGE;

CURSOR C2(cin_table_id in number) is
SELECT column_name, alias_name, typevar, leng
FROM xxcolumns
WHERE table_id = cin_table_id
order by id;

/* Type declaration */
TYPE resrec IS RECORD(V_COL VARCHAR2(60),
V_DATA VARCHAR2(240));
TYPE t_restab is table of resrec index by binary_integer;
TYPE colrec IS RECORD(V_COL VARCHAR2(240));
TYPE t_coltab is table of colrec index by binary_integer;

/* Variables */
v_restab t_restab;
v_coltab t_coltab;
i number;
j number;
z number;
lengte number;
tabstr varchar2(4000);
str varchar2(4000);
v_value varchar2(4000) := null;
tablename varchar2(30);
r1 c1%rowtype;
c3 INTEGER;
ignore INTEGER;
v_exec INTEGER;
col_cnt INTEGER;
col_num number;
colposition INTEGER;
rec_tab dbms_sql.desc_tab;
col_value Varchar2(4000);
num_value number;
the_id number;

BEGIN
OPEN c1;
FETCH c1 into r1.id, r1.table_name;
IF c1%found THEN
tablename := r1.table_name;
i := 0;
tabstr := 'SELECT ';
FOR r2 in c2(r1.id) loop
v_coltab(i).v_col := r2.column_name;
tabstr := concat(tabstr,r2.column_name);
tabstr := concat(tabstr,',');
i:=i+1;
if r2.column_name != 'ID' then
****print
end if;
END LOOP;
lengte := length(tabstr);
tabstr := substr(tabstr,1,lengte-1);
tabstr := concat(tabstr,' from ');
tabstr := concat(tabstr,tablename);
END IF;

j := 0;
i := i-1;
z := 1;
CLOSE C1;

c3 := dbms_sql.open_cursor;
DBMS_SQL.PARSE(c3,tabstr,DBMS_SQL.native);

v_exec := DBMS_SQL.EXECUTE_AND_FETCH(c3);

dbms_sql.describe_columns(c3,col_cnt,rec_tab);

htp.tableRowOpen;
LOOP
col_num := rec_tab.first;
IF (col_num is not null) then
LOOP
DBMS_SQL.define_column(c3,col_num,rec_tab(col_num) .col_name,rec_tab(col_num).col_max_len);
if rec_tab(col_num).col_name = 'ID' then
DBMS_SQL.column_value(c3,col_num,col_value);
the_id := col_value;
else
str := 'SELECT '||rec_tab(col_num).col_name||' from '||tablename||' where id = '||the_id;
dbms_output.put_line(str);
EXECUTE IMMEDIATE str INTO v_value;
v_restab(j).v_data := v_value;
j := j+1;
EXIT WHEN j > i;
end if;
col_num := rec_tab.next(col_num);
EXIT WHEN (col_num is null);
END LOOP;
END IF;
IF DBMS_SQL.FETCH_ROWS(c3)=0 THEN
EXIT;
END IF;
END LOOP;
htp.tableRowClose;
DBMS_SQL.CLOSE_CURSOR(c3);

FOR k IN v_restab.FIRST .. v_restab.LAST LOOP
****Print
END LOOP;
END;have a look at: http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg09dyn.htm#26586

Some two years ago I completely switch from using the dbms-sql package to "native dynamic sql", which seems to be easer for my approaches.

coming back to your coding.
(1) I have never used a dbms_sql.execute_and_fetch Procedure ... only dbms_sql.fetch_rows
(2) code the dbms_sql.define_columns BEFORE the dbms_sql.fetch_rows ...

DBMS_DDL Error

when the package dbms_ddl is used, I get an error message as given below .

Pl SQL Code :

begin
dbms_ddl.analyze_object('table','scott','emp','com pute');
end;

error message :

ERROR at line 1
ORA-20000: Unable to analyze table "scott"."emp", insufficient privileges or does not exist
ORA-06512: at "SYS.DBMS_DDL",line 192
ORA-06512: at line 2

-----------

I have checked and the table does exist under the same schema(viz. SCOTT). So I think it is a privilege problem. What may be the privileges( other than the owner privilege) that may be required for the succesful execution of this PL/SQL code?

TIA for assistanceDoes your user has the right to execute package dbms_dll ?|||HI,

The table name and schema name have to be in the correct case for the package to work.

dbms_ddl.analyze_object('TABLE','SCOTT','EMP','COM PUTE');

Parameter descriptions for the ANALYZE_OBJECT procedure specifies the SCHEMA and object NAME are both case sensitive.

Tuesday, February 14, 2012

DB-Library C API and SQL Server 2005 (ntwdblib.lib and ntwdblib.dl

We own a software package that has a SQL Server driver based on ntwdblib.dll
.
Will we be able to run this software on SQL Server 2005? In other words, wil
l
the DB library be supported?Hi
No. It has been in end of life mode since SQL Server 7.0 and no new data
types added in SQL Server 7/2000 are supported. In SQL server 2005, it is no
t
supported at all.
http://msdn.microsoft.com/data/mdac...mdacroadmap.asp
Regards
Mike
"BizTalk" wrote:

> We own a software package that has a SQL Server driver based on ntwdblib.d
ll.
> Will we be able to run this software on SQL Server 2005? In other words, w
ill
> the DB library be supported?