SQL> shutdown abort .com

About DBA Queries DBA Scripts Quick Guides Nooleus Other Stuff Contact
Andy only 
 
Top for Oracle (oratop)

Oratop provides a unix-top like display for oracle. Check out the following screenshot...

System: bloo                                            System time: 18:25:50 16-APR-07
Instance: scr10                                  Inst start-up time: 08:50:17 04-APR-07
18 sessions: 1 incactive, 17 active, 15 system, 0 killed
.
SID/SERIAL# USERNAME      OS USER       LASTCALL STATE     MACHINE      COMMAND
----------- ------------- ------------- -------- --------- ------------ ---------------
152,3       REP_OWNER     oracle        18:25:47 active    bloo         n/a
158,26924   SYS           oracle        18:25:50 active    bloo         sqlplus@bloo (T
173,26831   ANDY          oracle        18:23:21 inactive  bloo         TOAD 
Press CTRL-c to exit

If you want to install oratop, there are two parts to it; a stored procedure and a shell script.

First create the stored procedure by running the following code in sqlplus while logged in as sys (just cut&paste it into sqlplus):

oratop_proc.sql

Next, using your favourite text editor, create a file called oratop. Ideally you should place this file in a directory on your path such as /home/oracle/bin or /usr/local/bin. Anyway, cut and paste the following into it:
#!/bin/sh
if [ -n "$ORACLE_SID" ]; then
while [ 1 ]; do
clear
hsize=`stty size|cut -f2 -d" "`
vsize=`stty size|cut -f1 -d" "`
sqlplus -S "/ as sysdba" << SQL
set feedback off
set lines 200
set serveroutput on size 9999
exec shutabortcom_oratop(${hsize}, ${vsize})
SQL
echo "Press CTRL-c to exit"
sleep 5
done
else
echo ORACLE_SID not set
fi
Save the file and make it executable with the following command:

chmod 700 oratop
To run it type ./oratop or just oratop if you put it on the path.

Copyright© 2007-2010 Andrew Barry