a collection of scripts to ease the day-to-day work of an Oracle DBA
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
1.6 KiB

#!/bin/bash
#
# $Id$
#
# =============================================================================
# Setup configuration for tabmove.sh, idxmove.sh, idxrebuild*.sh and
# analobj.sh
# -----------------------------------------------------------------------------
# Itzchak Rehberg
export ORACLE_SID=$1
FEXT="$1-$2-$3"
ARGS=$*
# ------------------------------------------[ process command line options ]---
while [ -n "$1" ] ; do
case "$1" in
-s) shift; ORACLE_CONNECT="@$1";;
-u) shift; username=$1;;
-p) shift; passwd=$1;;
-c) shift; CONFIG=$1;;
-f) shift; DEFPREF=$1;;
-x) shift; FEXT=$1;;
-l) shift; LOGAL=$1;;
-o) shift; TR_OWNER=$1;;
--noadjust) adjust=0;;
--noanalyze) analyze=0;;
--force) force=1;;
esac
shift
done
. $CONFIG $ARGS
# ignore chain count percentage for tabreorg
if [ "$force" == "1" ]; then
TR_CHAINPCT=0
NUMROWS=0
CHAINCNT=0
fi
if [ -n "$LOGAL" ]; then
LOGALL=$LOGAL
fi
# Username/Password
if [ -n "$username" ]; then
user=$username
fi
if [ -n "$passwd" ]; then
password=$passwd
fi
# Setup connect string
if [ -z "${user}${password}${ORACLE_CONNECT}" ]; then
CONN='CONNECT / as sysdba'
else
CONN="CONNECT $user/${password}$ORACLE_CONNECT"
fi
# -----------[ name of the file to write the log to (or 'OFF' for no log) ]---
TPREF=`echo $PREFIX | tr 'a-z' 'A-Z'`
[ ! -d "$SPOOLDIR" ] && SPOOLDIR=""
[ -n "$SPOOLDIR" ] && SPOOLDIR="${SPOOLDIR}/"
case "$TPREF" in
OFF) SPOOL=OFF;;
DEFAULT) SPOOL="${SPOOLDIR}${DEFPREF}_${FEXT}.spool";;
*) SPOOL="${SPOOLDIR}${PREFIX}_${FEXT}.spool";;
esac