<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://sqlzoo.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://sqlzoo.net/w/index.php?title=Find_another_process_and_kill_it.&amp;feed=atom&amp;action=history</id>
		<title>Find another process and kill it. - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://sqlzoo.net/w/index.php?title=Find_another_process_and_kill_it.&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://sqlzoo.net/w/index.php?title=Find_another_process_and_kill_it.&amp;action=history"/>
		<updated>2013-05-24T23:00:18Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.4</generator>

	<entry>
		<id>http://sqlzoo.net/w/index.php?title=Find_another_process_and_kill_it.&amp;diff=1505&amp;oldid=prev</id>
		<title>Connor at 13:34, 17 July 2012</title>
		<link rel="alternate" type="text/html" href="http://sqlzoo.net/w/index.php?title=Find_another_process_and_kill_it.&amp;diff=1505&amp;oldid=prev"/>
				<updated>2012-07-17T13:34:09Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:34, 17 July 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;ALTER SYSTEM KILL SESSION '12,33'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;ALTER SYSTEM KILL SESSION '12,33'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;-- 12,33 is the sid and serial#&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;-- 12,33 is the sid and serial#&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/source&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang='sql' class='def e-sqlserver'&amp;gt;USE master;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;source lang='sql' class='def e-sqlserver'&amp;gt;USE master;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;SELECT spid , nt_username,&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;SELECT spid , nt_username,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Connor</name></author>	</entry>

	<entry>
		<id>http://sqlzoo.net/w/index.php?title=Find_another_process_and_kill_it.&amp;diff=1503&amp;oldid=prev</id>
		<title>Connor: Created page with &quot;Change the default schema/database. &lt;div class='ht'&gt; &lt;div class=params&gt;schema:gisq&lt;/div&gt; &lt;div&gt; Sometimes users set off queries that may take a very long time to complete. We m...&quot;</title>
		<link rel="alternate" type="text/html" href="http://sqlzoo.net/w/index.php?title=Find_another_process_and_kill_it.&amp;diff=1503&amp;oldid=prev"/>
				<updated>2012-07-17T13:26:15Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Change the default schema/database. &amp;lt;div class=&amp;#039;ht&amp;#039;&amp;gt; &amp;lt;div class=params&amp;gt;schema:gisq&amp;lt;/div&amp;gt; &amp;lt;div&amp;gt; Sometimes users set off queries that may take a very long time to complete. We m...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Change the default schema/database.&lt;br /&gt;
&amp;lt;div class='ht'&amp;gt;&lt;br /&gt;
&amp;lt;div class=params&amp;gt;schema:gisq&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
Sometimes users set off queries that may take a very long time to complete.&lt;br /&gt;
We may want to find such long running processes and stop them. Some kind of administrative account is usually required. &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;source lang=sql class='tidy'&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=sql class='setup'&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sqlite'&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-db2'&amp;gt;LIST APPLICATION;&lt;br /&gt;
-- 294 and 306 are &amp;quot;Appl Handle&amp;quot; values&lt;br /&gt;
FORCE APPLICATION (294,306)&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-ingres'&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-access'&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-postgres'&amp;gt;SELECT * FROM pg_stat_activity;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-oracle'&amp;gt;SELECT sid, serial#, username,&lt;br /&gt;
       TO_CHAR(logon_time,'Month dd hh24:mi:ss')&lt;br /&gt;
  FROM sys.v_$session;&lt;br /&gt;
ALTER SYSTEM KILL SESSION '12,33'&lt;br /&gt;
-- 12,33 is the sid and serial#&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sqlserver'&amp;gt;USE master;&lt;br /&gt;
SELECT spid , nt_username,&lt;br /&gt;
       datediff(s,login_time,GETDATE())&lt;br /&gt;
   FROM sysprocesses;&lt;br /&gt;
DECLARE @var1 int&lt;br /&gt;
SELECT @var1 = spid &lt;br /&gt;
  FROM sysprocesses&lt;br /&gt;
 WHERE nt_username='andrew'&lt;br /&gt;
   AND spid&amp;lt;&amp;gt;@@spid&lt;br /&gt;
EXEC ('kill '+@var1);&lt;br /&gt;
SELECT spid , nt_username,&lt;br /&gt;
       datediff(s,login_time,GETDATE())&lt;br /&gt;
   FROM sysprocesses;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-mysql'&amp;gt;SHOW PROCESSLIST;&lt;br /&gt;
KILL 16318&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-mimer'&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang='sql' class='def e-sybase'&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-db2&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;These commands may be executed by a system administrator using the CLP (command line processor - enter db2 at the prompt).&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-mysql&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;Use the KILL command. Does what it says.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-mimer&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;We can list the processes with the operating system command&lt;br /&gt;
 miminfo -u&lt;br /&gt;
We can kill process number 123 in database GISQ with the command&lt;br /&gt;
 mimcontrol -l 123 GISQ&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;ecomm e-sqlserver&amp;quot; style=&amp;quot;display: none&amp;quot;&amp;gt;sysprocesses in the master database includes all the SQL statements that are currently running. @@spid is your process. @var1 is a local variable.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{Users ref}}&lt;/div&gt;</summary>
		<author><name>Connor</name></author>	</entry>

	</feed>