#!/usr/bin/ksh ############################################################################### # # Module: disable_logging.sh # Author: Peter R. Schmidt # Description: Disable transaction logging # # Change Log # # Date Name Description................. # 01/27/01 Peter R. Schmidt Start Program # ############################################################################### echo "Disable transaction logging" echo echo "Enter DATABASE name" read DATABASE echo echo "It is normally desirable to set TAPEDEV to /dev/null before disabling transaction logging." echo echo "The current value of TAPEDEV is:" onstat -c | egrep "^TAPEDEV" echo echo "Press to disable transaction logging now." read answer ontape -s -L 0 -N $DATABASE if [ $? = 0 ] then echo echo "Completed" echo echo "Don't forget to set TAPEDEV back to it's original setting" echo "and re-enable transaction logging when you are done with" echo "whatever you are going to do." else echo echo "Error: failed to disable transaction logging!" exit 1 fi ############################################################################### OUTPUT=dblist.out TMPFILE=dblist.tmp XDATE=`date +%D-%T` MACHINE=`uname -n` if [ -f $OUTPUT ] then rm -f $OUTPUT fi if [ -f $TMPFILE ] then rm -f $TMPFILE fi echo echo "Display current logging status of the databases" echo echo "Collecting database info from the sysmaster database..." dbaccess <<-EOF database sysmaster; unload to '$TMPFILE' delimiter "|" select dbinfo("DBSPACE",partnum) dbspace, name, owner, created, is_logging, is_buff_log, is_ansi, is_nls, flags from sysdatabases order by name, dbspace; EOF echo "Completed - creating report..." awk ' \ BEGIN { FS="|" cnt_db=0 } { if (NR == 1) { split (xdate,b,"-") udate=b[1] utime=b[2] printf "%s %s Informix Database Report for %s@%s\n\n", udate, utime, server, machine print "Database Dbspace Date Logging Buffered Other" print "Name Name Owner Created Enabled Logging Info" print "" } dbspace = $1 dbsname = $2 owner = $3 created = $4 is_logging = $5 is_buff_log = $6 is_ansi = $7 in_nls = $8 flags = $9 cnt_db++ if (is_logging = 1) { flag_logging = "Y" } else { flag_logging = "N" } if (is_buff_log = 1) { flag_buff_log = "Y" } else { flag_buff_log = "N" } if (flags = 0) { flag_desc = "No Logging" } if (flags = 1) { flag_desc = "Unbuffered Logging" } if (flags = 2) { flag_desc = "Buffered Logging" } if (flags = 4) { flag_desc = "ANSI-compliant database" } if (flags = 8) { flag_desc = "Read-Only Database" } if (flags = 16) { flag_desc = "NLS database" } printf "%-15s %-10s %-10s %-10s %1s %1s %1s\n",dbsname, dbspace, owner, created, flag_logging, flag_buff_log, flag_desc } END { printf "\nTotal of %d databases\n", cnt_db } ' xdate=$XDATE machine=$MACHINE server=$INFORMIXSERVER $TMPFILE > $OUTPUT cat $OUTPUT rm -f $TMPFILE rm -f $OUTPUT