dbTalk Databases Forums  

How to kill a db <spid> if kill <spid> does not work

comp.databases.sybase comp.databases.sybase


Discuss How to kill a db <spid> if kill <spid> does not work in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
D. Peglow
 
Posts: n/a

Default How to kill a db <spid> if kill <spid> does not work - 06-28-2004 , 09:19 AM






Hello group,

how can I kill a process if


isql -Usa -Pxxxxx

1> kill <spid>
2> go

does not work ?

I retrieve the <spid> from

1> select * from sysprocesses where program_name = "<Program>"
2> go

The <Program> originally called a stored procedure that had a bad SQL
Statement which caused an insert into a temporary table in tempdb with
millions of lines. The calling (unix) program was killed using kill -9
because it was frozen.

Adding the correct procedure into the database does not work because
SQL-Server says "Cannot drop proc XXX because it is currently in use".

How can such a <spid> be killed ?

Any help greatly appreciated.

Best regards and thanks in advance,

Dietmar

Reply With Quote
  #2  
Old   
D. Peglow
 
Posts: n/a

Default Re: How to kill a db <spid> if kill <spid> does not work - 06-28-2004 , 09:21 AM






Maybe I should add this:

The Syabse version is Sybase ASE 12.0 on Solaris 2.8.

Reply With Quote
  #3  
Old   
Rob Verschoor
 
Posts: n/a

Default Re: How to kill a db <spid> if kill <spid> does not work - 06-28-2004 , 10:38 AM



When you've done a 'kill' on an ASE session, you *have*killed it, and it
will eventually disappear. However, when that sessionw as doing a large
transaction (as you described), it will first need to roll back the entire
transaction. For big transactions, this may take a long time since a long of
disk I/O may be required for this. There's hardly a different choice than to
let it continue (well, there is, but yo'd have to throw away your entire
database). In particular, do NOT shut down ASE before the rollback is
complete (and the killed session has disappeared) -- this will only waste
time, since ASE will re-start the rollback when it's restarted.
The thing to keep in mind is that you should really avoid running very long
transactions in a prodution system , unless you know what you're doing and
understand the possible implication.
If you're interested in more technical details, check out my book "Tips,
Tricks & Recipes for Sybase ASE" (www.sypron.nl/ttr), which covers these
things in detail.

HTH,

Rob
-------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
and Replication Server 12.5

Author of various Sybase books. New book (coming soon): "The
Complete Sybase Replication Server Quick Reference Guide"
Online orders accepted at http://www.sypron.nl/shop

mailto:rob (AT) YOUR (DOT) SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------

"D. Peglow" <info_peg04 (AT) snafu (DOT) de> wrote

Quote:
Hello group,

how can I kill a process if


isql -Usa -Pxxxxx

1> kill <spid
2> go

does not work ?

I retrieve the <spid> from

1> select * from sysprocesses where program_name = "<Program>"
2> go

The <Program> originally called a stored procedure that had a bad SQL
Statement which caused an insert into a temporary table in tempdb with
millions of lines. The calling (unix) program was killed using kill -9
because it was frozen.

Adding the correct procedure into the database does not work because
SQL-Server says "Cannot drop proc XXX because it is currently in use".

How can such a <spid> be killed ?

Any help greatly appreciated.

Best regards and thanks in advance,

Dietmar



Reply With Quote
  #4  
Old   
D. Peglow
 
Posts: n/a

Default Re: How to kill a db <spid> if kill <spid> does not work - 06-28-2004 , 10:55 AM



Hi Rob,

many thanks for that explanation. I'll check you book

Kind regards,

Dietmar

Rob Verschoor schrieb:
Quote:
When you've done a 'kill' on an ASE session, you *have*killed it, and it
will eventually disappear. However, when that sessionw as doing a large
transaction (as you described), it will first need to roll back the entire
transaction. For big transactions, this may take a long time since a long of
disk I/O may be required for this. There's hardly a different choice than to
let it continue (well, there is, but yo'd have to throw away your entire
database). In particular, do NOT shut down ASE before the rollback is
complete (and the killed session has disappeared) -- this will only waste
time, since ASE will re-start the rollback when it's restarted.
The thing to keep in mind is that you should really avoid running very long
transactions in a prodution system , unless you know what you're doing and
understand the possible implication.
If you're interested in more technical details, check out my book "Tips,
Tricks & Recipes for Sybase ASE" (www.sypron.nl/ttr), which covers these
things in detail.

HTH,

Rob
-------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
and Replication Server 12.5

Author of various Sybase books. New book (coming soon): "The
Complete Sybase Replication Server Quick Reference Guide"
Online orders accepted at http://www.sypron.nl/shop

mailto:rob (AT) YOUR (DOT) SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------

"D. Peglow" <info_peg04 (AT) snafu (DOT) de> wrote in message
news:40E028D5.6B2DCB1D (AT) snafu (DOT) de...
Hello group,

how can I kill a process if


isql -Usa -Pxxxxx

1> kill <spid
2> go

does not work ?

I retrieve the <spid> from

1> select * from sysprocesses where program_name = "<Program>"
2> go

The <Program> originally called a stored procedure that had a bad SQL
Statement which caused an insert into a temporary table in tempdb with
millions of lines. The calling (unix) program was killed using kill -9
because it was frozen.

Adding the correct procedure into the database does not work because
SQL-Server says "Cannot drop proc XXX because it is currently in use".

How can such a <spid> be killed ?

Any help greatly appreciated.

Best regards and thanks in advance,

Dietmar

Reply With Quote
  #5  
Old   
Rob Verschoor
 
Posts: n/a

Default Re: How to kill a db <spid> if kill <spid> does not work - 07-05-2004 , 08:01 AM




"D. Peglow" <info_peg04 (AT) snafu (DOT) de> wrote

Quote:
Maybe I should add this:

The Syabse version is Sybase ASE 12.0 on Solaris 2.8.

'kill' works almost always. In most cases where the killed session doesn't
go away, kill has worked fine, but the session is busy rolling back a
transaction. If the transaction is large, this may take a long time. In any
case, there isn't a stronger way of killing the session. When a rollback is
being performed, doing a 'shutdown with nowait' may only make matters worse,
since the rollback will be restarted when ASE starts up. Unless you're
prepared to throw away your entire database (and I mean *really* throw it
away, beyond repair or recovery), a shutdown may be a way out. In all other
cases, better wait patiently until the rollback is finished.
My book "Tips, Tricks & Recipes for Sybase ASE" (www.sypron.nl/ttr) explains
in detail what happens behing the scenes when you kill a process and how to
determine whether a rollback is indeed being performed.

HTH,

Rob
-------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
and Replication Server 12.5

Author of various Sybase books. New book (coming soon): "The
Complete Sybase Replication Server Quick Reference Guide"
Online orders accepted at http://www.sypron.nl/shop

mailto:rob (AT) YOUR (DOT) SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.