Good morning,
We received a database from a customer. On this database we execute a select into statement and the execution closes the connection immediately.
Looking at the dataserver.log file, we have the following output
01:00000:01488:2013/05/23 09:52:45.23 kernel Current process (0x7e607e6) infected with signal 11 (SIGSEGV)
01:00000:01488:2013/05/23 09:52:45.23 kernel Address 0x0000000000c282b6 (void LeSQLRep::_sqlRepParamSet(ExeCtxt&,e_param*,SQLBuf*)+0x4da), siginfo (code, address) = (1, 0x0000000000c282b6)
01:00000:01488:2013/05/23 09:52:45.23 kernel ************************************
01:00000:01488:2013/05/23 09:52:45.23 kernel SQL causing error : T.M_CANCEL = 0
01:00000:01488:2013/05/23 09:52:45.23 kernel ************************************
01:00000:01488:2013/05/23 09:52:45.23 server SQL Text: select distinct T.M_TYPE AS M_TYPE, T.M_COMPOUND AS M_COMPOUND, H.M_BO AS M_BO,
H.M_IDENTITY as M_REFERENCE, RN.M_GEN_NUM AS M_GEN_NUM,
(select max(R.M_IDENTITY) FROM table_A R where R.M_GEN_NUM = RN.M_GEN_NUM) as M_IDENTITY0,
(select min(R.M_IDENTITY) FROM table_A R where R.M_GEN_NUM = RN.M_GEN_NUM) as M_IDENTITY1,T.M_RATE,
-1 as M_RATE_TYPE0, -1 as M_RATE_TYPE1, 0 as M_LNGN_FLGS0, 0 as M_LNGN_FLGS1, T.M_EVT_FLAG as M_EVT_FLAG,
(select
01:00000:01488:2013/05/23 09:52:45.23 server SQL Text: L.M_EP_TYPE1 FROM table_A L where L.M_IDENTITY in (select min(R.M_IDENTITY) FROM table_A R where R.M_GEN_NUM = RN.M_GEN_NUM)) as M_LNGN_PAY_SCHED
into MY_DB..table_B lock datarows
from table_C T, table_D H, table_E RL, table_A RN
where H.M_EVT = T.M_ID + 378812 and H.M_BO = RL.M_NB and
T.M_TYPE in ('FIN_RAT', 'FIN_COLL_R', 'FIN_CLOSE', 'FIN_NOM_IN', 'FIN_GEN', 'FIN_QTY')
01:00000:01488:2013/05/23 09:52:45.23 server SQL Text: and
(case when RL.M_GEN_NUM < 0 then RL.M_GEN_INSNUM else RL.M_GEN_NUM end) = RN.M_GEN_NUM and T.M_CANCEL = 0
01:00000:01488:2013/05/23 09:52:45.23 kernel curdb = 11 tempdb = 2 pstat = 0x10100
01:00000:01488:2013/05/23 09:52:45.23 kernel lasterror = 0 preverror = 0 transtate = 0
01:00000:01488:2013/05/23 09:52:45.23 kernel curcmd = 195 program = Aqua_Data_Studio
01:00000:01488:2013/05/23 09:52:45.23 kernel extended error information: hostname: psimon login: simon
01:00000:01488:2013/05/23 09:52:45.23 kernel pc: 0x00000000018a049a pcstkwalk+0x35()
01:00000:01488:2013/05/23 09:52:45.23 kernel pc: 0x00000000018a024b ucstkgentrace+0x23f()
01:00000:01488:2013/05/23 09:52:45.23 kernel pc: 0x0000000001818332 ucbacktrace+0xe8()
01:00000:01488:2013/05/23 09:52:45.23 kernel pc: 0x0000000000b80e93 terminate_process+0x11f1()
01:00000:01488:2013/05/23 09:52:45.23 kernel pc: 0x000000000185d1e4 kisignal+0x22f()
01:00000:01488:2013/05/23 09:52:45.23 kernel end of stack trace, spid 1488, kpid 132515814, suid 3
First of all, this case should be adressed to SAP Sybase support.
But I'm trying to understand why it's failing.
This query executed on a previous dump is working.
I though of a database corruption, so I executed dbcc checkall/checkdb/checkcatalog and no errors were raised (or I didn't spot them in the output file) but it didn't resolve anything.
What also makes me think of any corruption is that if I executed the statement but instead of saving the results in MY_DB..table_B, I save it into tempdb..table_B. the query works.
What are the others checks I could do to try identifying the root cause ? (traceflags to activate? set options?)
Guilty sql statement is below:
select distinct T.M_TYPE AS M_TYPE, T.M_COMPOUND AS M_COMPOUND, H.M_BO AS M_BO,
H.M_IDENTITY as M_REFERENCE, RN.M_GEN_NUM AS M_GEN_NUM,
(select max(R.M_IDENTITY) FROM table_A R where R.M_GEN_NUM = RN.M_GEN_NUM) as M_IDENTITY0,
(select min(R.M_IDENTITY) FROM table_A R where R.M_GEN_NUM = RN.M_GEN_NUM) as M_IDENTITY1,T.M_RATE,
-1 as M_RATE_TYPE0, -1 as M_RATE_TYPE1, 0 as M_LNGN_FLGS0, 0 as M_LNGN_FLGS1, T.M_EVT_FLAG as M_EVT_FLAG,
(select L.M_EP_TYPE1 FROM table_A L where L.M_IDENTITY in (select min(R.M_IDENTITY) FROM table_A R where R.M_GEN_NUM = RN.M_GEN_NUM)) as M_LNGN_PAY_SCHED
into MY_DB..table_B lock datarows
from table_C T, table_D H, table_E RL, table_A RN
where H.M_EVT = T.M_ID + 378812 and H.M_BO = RL.M_NB and
T.M_TYPE in ('FIN_RAT', 'FIN_COLL_R', 'FIN_CLOSE', 'FIN_NOM_IN', 'FIN_GEN', 'FIN_QTY') and
(case when RL.M_GEN_NUM < 0 then RL.M_GEN_INSNUM else RL.M_GEN_NUM end) = RN.M_GEN_NUM and T.M_CANCEL = 0
Thank you
Simon