#!/bin/sh # # $TOOLS/locks # # Create a report of the locks for the $1 (Default of $ORACLE_SID) # database. # # Last Change 02/20/97 by Brian Lomasky # # 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$database to ; # grant select on v$lock to ; # grant select on v$process to ; # grant select on v$rollname 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). # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # As an alternative to the above makeops and grantool, you can do: # # (Assuming that there is an ops$oracle user account) As SYS, type: # grant select on v_$database to ops$oracle with grant option; # grant select on v_$lock to ops$oracle with grant option; # grant select on v_$process to ops$oracle with grant option; # grant select on v_$rollname to ops$oracle with grant option; # grant select on v_$session to ops$oracle with grant option; # grant select on v_$sqlarea to ops$oracle with grant option; # grant select on dba_objects to ops$oracle with grant option; # As ops$oracle, type: # grant select on v_$database to public; # grant select on v_$lock to public; # grant select on v_$process to public; # grant select on v_$rollname to public; # grant select on v_$session to public; # grant select on v_$sqlarea to public; # grant select on dba_objects to public; # if [ "$1" != "" ] then ORACLE_SID="`fixcase $1`" SID=$ORACLE_SID . define # As an alternative to the previous 2 lines, you can replace them with: # ORAENV_ASK=NO; export ORAENV_ASK # . oraenv fi if [ "$ORACLE_SID" = "" ] then echo "Error: ORACLE_SID must be defined before running locks\007" exit 2 fi echo "\nCreating a report of the locks for the $ORACLE_SID database..." echo "\n Please wait - This may take a few seconds to run..." sqlplus -s / @$TOOLS/locks # As an alternative to requiring the user to have an OPS$username account, you # can replace the previous "sqlplus /" line with the following 7 lines: # echo "\n Please enter your Oracle username for SQL*Plus: \c" # read usr # echo "\n Please enter your Oracle password for SQL*Plus: \c" # stty -echo # read pwd # stty echo # sqlplus $usr/$pwd @$TOOLS/locks if [ -r locks.lis ] then rm locks.lis fi