#!/bin/sh # # $TOOLS/dbousers # # Last Change 02/20/97 by Brian Lomasky # # Displays a report of all current users for the specified database ($1) # (Default of all databases) # # To allow a non-privileged user access to this script, as oracle, type: # # makeops # grantool # # OPS$ # # where: is the Oracle SID of the database to access # is the username (without any OPS$) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Note that grantool simply executes the following commands: # grant select on v$lock to ; # grant select on v$session to ; # grant select on v$sqlarea to ; # grant select on dba_objects to ; # (This presumes that your current username has the WITH GRANT OPTION on # these privileges so that you can grant these privileges to someone # else). # echo "" echo "Displays a report of all current users for one or more databases" if [ "$1" != "" ] then mysid=`fixcase $1` outfil="dbousers.lis" else mysid="" outfil="dbousers.lis" fi ORIIFS="$IFS" IFS="~" for LINE in `cat $TOOLS/database` do # # Extract the first parameter as the database SID # ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -` # # Process only if first field matches specified SID or no # parameter was specified # if [ "$ORACLE_SID" = "$mysid" -o "$mysid" = "" ] then SID=$ORACLE_SID . define is_dbo $ORACLE_SID if [ $? -eq 1 ] then export ORACLE_SID sqlplus -s / @$TOOLS/dbousers $ORACLE_SID if [ -r $outfil ] then cat dbousers.lst >> $outfil rm dbousers.lst else mv dbousers.lst $outfil fi fi fi done IFS="$ORIIFS" # # Display the report file # if [ -r $outfil ] then cat $outfil rm $outfil fi if [ -r $TOOLS/dbousers.inf ] then cat $TOOLS/dbousers.inf fi