#!/usr/bin/ksh #set -xv # Program : smenu_lst_disk.sh # Author : Bernard Polarski # note : The resize datafiles part is from Jonathan Lewis book Practical Oracle 8i HOST=`hostname` PAR1=$1 PAR2=$2 # -------------------------------------------------------------- function help { cat <] : List datafiles size and auto extend info, eventually limit to lstd -m : List candidate shrink datafiles lstd -s : show SQL statement to shink datafiles, default is all unless TBS name is given lstd -e : List datafile in autoextend that cannot extend anymore lstd -es : Show statement to set off datafiles that cannot extend anymore lstd -ck : List last checkpoint time for each datafile EOF exit } # -------------------------------------------------------------- TMP=$SBIN/tmp FOUT=$TMP/tmp_dsc$ORACLE_SID.txt while [ -n "$1" ] do case "$1" in -ck ) PAR1=checkpoint ;; -es ) PAR1=es ;; -e ) PAR1=autoextend ;; -m ) PAR1=shrink ; TBS="$2"; shift ;; -s ) PAR1=shrink2 ; TBS="$2"; shift ;; -h ) help ;; -t ) TBS="$2" ; shift ;; esac shift done . $SBIN/scripts/passwd.env . ${GET_PASSWD} $S_USER $ORACLE_SID if [ "x-$CONNECT_STRING" = "x-" ];then echo "could no get a the password of $S_USER" exit 0 fi # -------------------------------------------------------------- if [ "$PAR1" = "checkpoint" ];then sqlplus -s "$CONNECT_STRING" < maxbytes) b where a.file_name = b.file_name / EOF elif [ "$PAR1" = "autoextend" ];then sqlplus -s "$CONNECT_STRING" < maxbytes; EOF # -------------------------------------------------------------------------- elif [ "$PAR1" = "shrink" ];then if [ -n "$TBS" ];then WHERE_TBS=" where tablespace_name = upper('$TBS') " fi sqlplus -s "$CONNECT_STRING" <