LISTING 10: This script, dbAdmCron.sh, is called by the cron job in Listing 15. It calls various database administration utilities, including condiAnalyze1db.sh (Listing 13), which spawns group concurrent background jobs (condiAnalyze) to analyze histograms in parallel. #!/bin/ksh # Filename : dbAdmCron.sh # Author : Julius J.Y. Lin 01/08/96 # Purpose : # * This is a generic version for any Oracle Database on any UNIX host # * This is a V.7.3 This is a nightly process that analyzes histograms in parallel # based on the condi_analyze_ctrl.anal_group. This process will spawn # a number of group concurrent background jobs. # Usage : remember to redirect output in crontab job to ca$ORACLE_SID.log # ================================================================ cd ~oracle/Oradm # the generic version uses '-a' instead of '-s SID', the arguments # depend on the UNIX host. NOTE !! need ./ because PATH is not set yet . ./setOraEnv.sh -d -w -a for SID in $SIDs ; do . godb $SID egrep "^$SID " dbMajor.usr if [[ $? != 0 ]] ; then echo $?, $SID not specified in dbMajor.usr, skip to next database continue fi egrep "^$SID " dbMajor.usr | read db USR anal_method minExt host echo "$0 of user $USR @ $ORACLE_SID start at `date`" # ------------------------------ dbdskuse.sh $SID 1>/oracle/$SID/admin/dbdskuse.$day 2>&1 dbTbspUse.summary 1>/oracle/$SID/admin/dbTbspSmry.$day 2>&1 # ------------------------------ sqlplus -s system/$(systpswd "open seasame") @bigFreeExts \ 1>/oracle/$SID/admin/bigFreeExts.$day 2>&1 bigFreeExts.summary 1>/oracle/$SID/admin/bigFreeExtSmry.$day 2>&1 # ------------------------------ sqlplus -s system/$(systpswd "open seasame") \ @/home/oracle/Sqls/flagExts.sql $USR $minExt \ 1>/oracle/$SID/admin/flagExts.$day 2>&1 # ANALYZE V.2 use control and log tables and its procedures. if [[ $anal_method = HISTOGRAM ]] ; then condiAnalyze1db.sh $USR > /oracle/daily.log/ca$ORACLE_SID.log 2>&1 & # ANALYZE V.1 use procedures and log table only. elif [[ $anal_method = COST ]] ; then timex condition.analyze $USR & # timex analyzeSchema $USR & next run is Dec. 25, 1996 40% Estimate fi # ------------------------------ topRowCntV73.sh 1>/oracle/$SID/admin/top30tables.$day 2>&1 dbMailx.sh $SID # mail generated report to list in mailx.list done ; # for SID in #=============================== END of condiAnal.sh ===================