Abort process shuts down the SQLBase-Server

forum.advanced.programming (1998-2005)
Thomas Heim

Abort process shuts down the SQLBase-Server

Post by Thomas Heim » 14 Feb 2005, 15:07

 Posted by:  Thomas Heim 

Hi all

I'd like to unload/Load the DB via NT-Service. I'm using SQLWNTM.DLL and the
function sqlsab. This function does not only kill the process it shuts down
the server (
SQLBase 8.5 ) too. Can anybody help to get the correct function?

PLEASE, Help!!!

!!CB!! 145
Function: sqlsab
Description: Abort Database Process
Export Ordinal: 0
Returns
Number: INT
Parameters
Number: WORD
Number: WORD

!!CB!! 134
Function: UdfKillServerProcesses
Description:
Returns
Parameters
Static Variables
Local variables
Number: hServer
String: sProcesses
Number: nLength
Number: nOffset
!
Number: nRecordLength
String: sIsolation
String: sUser
String: sDb
Number: nPID
String: sInfo
Number: nAddOffset
!
String: sDummy
Number: nCountCursors
Actions
! ==> Connect to Server
If SqlServerConnect( hServer, sServerName, "" )
!
!
! ==> If running against SQLBase >= 8.0 set this to 8, otherwise to 0
! ==> You can query the version as follows: SqlGetParameterAll(hSql,
SQLPVER, nTmp, sVersion, FALSE)
Set nAddOffset = 8
!
!
! - Get Processes
Call SqlGetServerProcesses( hServer, sProcesses, nLength )
! Initial Offset
Set nOffset = 12
While nOffset Process ID
Set nOffset = nOffset + 17
Set nPID = CStructGetByte( sProcesses, nOffset )
! ==> Isolation Level
Set nOffset = nOffset + 1
Set nRecordLength = 3
Call SalStrSetBufferLength( sIsolation, nRecordLength )
Call CStructGetString( sProcesses, nOffset, nRecordLength, sIsolation )
! ==> User Name
Set nOffset = nOffset + 3
Set nRecordLength = 19
Call SalStrSetBufferLength( sUser, nRecordLength )
Call CStructGetString( sProcesses, nOffset, nRecordLength, sUser )
! ==> Database Name
Set nOffset = nOffset + 19
Set nRecordLength = 10 + nAddOffset
Call SalStrSetBufferLength( sDb, nRecordLength )
Call CStructGetString( sProcesses, nOffset, nRecordLength, sDb )
! ==> Offset to Beginning of next information
Set nOffset = nOffset + 12 + nAddOffset
!
If sDb = SqlDatabase
If NOT sInfo
Set sInfo = 'PID Database User Isolation
'
Set sInfo = sInfo || SalNumberToStrX( nPID, 0 ) || ' ' || sDb || ' ' ||
sUser || ' ' || sIsolation || '
'
!
Call Call sqlsab( hServer, nPID )
! ==> Disconnect From Server
Call SqlServerDisconnect( hServer )
!

RainerE
Germany
Posts: 2283
Joined: 27 Apr 2021, 12:40
Location: Germany

Re: Abort process shuts down the SQLBase-Server

Post by RainerE » 14 Feb 2005, 18:11

 Posted by:  Rainer Ebert 

Hi Thomas,

the code looks as if it is from an example posted by me. I'm using this code
with SB8.5 without DB-Server crashes. Are you sure, that you have the
correct sqlwntm.dll on the server and on the client and that no other and
incorrect sqlwntm.dll is somewhere around the system?

Have you tried to check if the PID is correct determinded? Start SQLConsole
and check if it determines the same PIDs.

Have you tried to kill the processes with SQLConsole and is this working
properly?

Note that a process can have more than one cursor. You have to kill the
process only once. Ensure, that you only kill a process if the same PID has
not been used to kill a process before.

Rainer

Jim McNamara

Re: Abort process shuts down the SQLBase-Server

Post by Jim McNamara » 14 Feb 2005, 20:53

 Posted by:  Jim McNamara 

Looks like the code snippit is checking for SqlBase version.

If you use the 8.5 dll to kill a process, say, on a 7.5.1 server (or
vice-versa) you are very likely to kill the database service. Make sure
that the program that is attempting to kill the process is using EXACTLY the
same dll version that the target database uses.

Thomas Heim

Re: Abort process shuts down the SQLBase-Server

Post by Thomas Heim » 15 Feb 2005, 08:22

 Posted by:  Thomas Heim 

Hi Rainer, Hi Jim

Yes, it's the code Rainer posted.

There were several versions of sqlwntm on the System. But now theres only
one left and in use (version 8.5.0.13463).

The PID I kill the process is correct.

Killing the Process works fine with SQLConsole .

There are more than one cursor I kill. But the DB crashes right afther I
kill the first Cursor I get.

I'm using SQLBase 8.5 und TD 1.1 and 3.1

Alberto Aviles

Re: Abort process shuts down the SQLBase-Server

Post by Alberto Aviles » 15 Feb 2005, 19:55

 Posted by:  Alberto Aviles \(mx\) 

Hi, just one note:

2 years ago, i have one similar trouble, mi server freeses or database shut
down, when i chek all the software every thing look fine, buth when i check
the motherboard, some components are damaged ( capacitores ). and when we
change the server, the trouble is solved.

and another cause maybe is that u don't have enof space un the HardDisk, a
few days ago mi server shuth down any user can connect at the database, i
have the log file turn on and in Level4 (catch all ), and the log file are
to big...

see u
Suerte.

Thomas Heim

Re: Abort process shuts down the SQLBase-Server

Post by Thomas Heim » 16 Feb 2005, 07:40

 Posted by:  Thomas Heim 

Hi Alberto

I don't think we have a hardware-problem. The 34GB harddisk has 25GB free
and the memory is about 2GB.
We have two similar servers. One is the spare and the other is the hot one.
They only have to manage SQLBase.
We test our application on the testserver.
But thank you anyway.

Thomas

RainerE
Germany
Posts: 2283
Joined: 27 Apr 2021, 12:40
Location: Germany

Re: Abort process shuts down the SQLBase-Server

Post by RainerE » 16 Feb 2005, 10:18

 Posted by:  Rainer Ebert 

Thomas,

sorry, I have no more ideas.

The only time I crashed a SB-server by killing a process (with SQLConsole),
I had mismatching SB-versions on the server and on the client.

But what I can offer you is, that you make a small program which can kill
processes and I'll try it here to check, if it also crashes our SB8.5TE PTF3
server.

Rainer

Thomas Heim

Re: Abort process shuts down the SQLBase-Server

Post by Thomas Heim » 16 Feb 2005, 17:25

 Posted by:  Thomas Heim 

I've just send you the apt to your privat Mail ( I replaced _at_ with @ )

Return to “advanced.programming”

Who is online

Users browsing this forum: [Ccbot] and 0 guests