Re: Terminate Users!!

From: Chris Little <littlec1_at_jaguar.uofs.edu>
Date: 23 Sep 93 14:27:46 GMT
Message-ID: <27sbp2$ruk_at_gopher.cs.uofs.edu>


Here is my attempt at converting the KILL_USERS.COM DCL script to a UNIX script. Please note that I am not an UNIX expert and would appreciate feedback and corrections. I hope this gets you started. Please let me know how you make out.

! /bin/sh
#
# Purpose: To kill all user processes currently connected to the database
# Script: KILL_USERS.COM
# Author: Chris Little (based on code provided by
# David Sidwell - Oracle VMS World Wide Support)
# Date: 2 November 1992
#
# Open SYSTEM account password file, read password
set syspass `cat /oracle/users/system_pass.dat`
#

sqlplus system/$syspass _at_ora_util/kill_users.sql $$ /bin/sh kill_procs
#
# Ignore this warning: DCL is trying to execute a SQL status line
#

rm kill_procs
echo "All user processes stopped - pause 3 minutes for cleanup" sleep 180

The corresponding SQL script is something like this:

REM

REM     Purpose: To query the database to determine all connected users PID's
REM              exluding background processes and user running the script.
REM     Params:  &1 which should contain the calling user's system PID.
REM     Script:  KILL_USERS.SQL
REM     Author:  David Sidwell - Oracle VMS World Wide Support
REM     Date:    7th April 1992.

REM
SET HEADING OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET ECHO OFF
SET PAGESIZE 1000
SET LINESIZE 80
SET TERMOUT OFF SELECT 'kill '||spid
FROM V$PROCESS
WHERE BACKGROUND IS NULL
AND spid != UPPER('&1')

SPOOL kill_procs
/
SPOOL OFF
EXIT

--
Chris Little, Programmer/DBA                    Computing & Data Services
                                                University of Scranton
  LITTLEC1_at_JAGUAR.UOFS.EDU                      Scranton, PA 18510
Received on Thu Sep 23 1993 - 16:27:46 CEST

Original text of this message