#! /bin/sh # # $DBA/chkcrdb # # Checks for unexpected errors in the file specified by the optional argument # (Default of $ORACLE_BASE/admin/$ORACLE_SID/create/crdb$ORACLE_SID.lst) # # It displays all ORA- errors in the lst file, other than the ones that # immediately follow a previous "DROP xxx" command. Useful since there are # over 400 ORA- errors in the file. # # ----------------------------------------------------------------------------- # <<<<<<<<<< Modification History >>>>>>>>>> # Date Programmer Description # 01/28/97 Brian Lomasky Original # ----------------------------------------------------------------------------- # if [ "$1" = "" ] then if [ "$ORACLE_BASE" = "" ] then echo "The ORACLE_BASE environment variable is not defined" \ " - Aborting...\007" exit 1 fi if [ "$ORACLE_SID" = "" ] then echo "The ORACLE_SID environment variable is not defined" \ " - Aborting...\007" exit 1 fi the_file=$ORACLE_BASE/admin/$ORACLE_SID/create/crdb$ORACLE_SID.lst else the_file=$1 fi if [ ! -r $the_file ] then echo "Can't find $the_file - Aborting...\007" exit 1 fi # # See if awk or nawk should be used # cmd=awk (nawk '{ print ; exit }' /etc/passwd) > /dev/null 2>&1 if [ $? -eq 0 ]; then cmd=nawk fi # # Process each line in the listing file # if [ "$1" = "" ] then echo "Accessing the crdb lst file for the ORACLE_SID of $ORACLE_SID..." else echo "Accessing the $the_file file..." fi cat $the_file | $cmd 'BEGIN { n = 0 prev1 = "" prev2 = "" prev3 = "" prev4 = "" } { n = n + 1 myflag = 1 while (myflag != 0) { myflag = 0 if (substr($0, 1, 4) == "ORA-") { if (substr(prev1, 1, 4) == "DROP") { prev1 = "" prev2 = "" prev3 = "" prev4 = "" continue } if (substr(prev2, 1, 4) == "DROP") { prev1 = "" prev2 = "" prev3 = "" prev4 = "" continue } if (substr(prev3, 1, 4) == "DROP") { prev1 = "" prev2 = "" prev3 = "" prev4 = "" continue } if (substr(prev4, 1, 4) == "DROP") { prev1 = "" prev2 = "" prev3 = "" prev4 = "" continue } if (substr(prev1, 1, 4) != "") { if (index(prev1, "DROP PACKAGE") != 0) { if (index(prev1, "INSERT") == 0) { continue } } if (index(prev1, "DROP SYNONYM") != 0) { if (index(prev1, "INSERT") == 0) { continue } } if (index(prev1, "DROP PROCEDURE") != 0) { if (index(prev1, "INSERT") == 0) { continue } } if (index(prev1, "DROP VIEW") != 0) { if (index(prev1, "INSERT") == 0) { continue } } } if (substr(prev2, 1, 4) != "") { if (index(prev2, "DROP PACKAGE") != 0) { if (index(prev2, "INSERT") == 0) { continue } } if (index(prev2, "DROP SYNONYM") != 0) { if (index(prev2, "INSERT") == 0) { continue } } if (index(prev2, "DROP PROCEDURE") != 0) { if (index(prev2, "INSERT") == 0) { continue } } if (index(prev2, "DROP VIEW") != 0) { if (index(prev2, "INSERT") == 0) { continue } } } if (substr(prev3, 1, 4) != "") { if (index(prev3, "DROP PACKAGE") != 0) { if (index(prev3, "INSERT") == 0) { continue } } if (index(prev3, "DROP SYNONYM") != 0) { if (index(prev3, "INSERT") == 0) { continue } } if (index(prev3, "DROP PROCEDURE") != 0) { if (index(prev3, "INSERT") == 0) { continue } } if (index(prev3, "DROP VIEW") != 0) { if (index(prev3, "INSERT") == 0) { continue } } } if (substr(prev4, 1, 4) != "") { if (index(prev4, "DROP PACKAGE") != 0) { if (index(prev4, "INSERT") == 0) { continue } } if (index(prev4, "DROP SYNONYM") != 0) { if (index(prev4, "INSERT") == 0) { continue } } if (index(prev4, "DROP PROCEDURE") != 0) { if (index(prev4, "INSERT") == 0) { continue } } if (index(prev4, "DROP VIEW") != 0) { if (index(prev4, "INSERT") == 0) { continue } } } print "At line " n ": " $0 prev1 = "" prev2 = "" prev3 = "" prev4 = "" continue } prev4 = prev3 prev3 = prev2 prev2 = prev1 prev1 = toupper($0) } }' -