#!/bin/ksh ################################################################ # Script to dump and load the Report Writer Tables from PL to PL # Alistair Hull # ################################################################ # # Configurable Variables HERE # What database - Options are ibm, ora9, ora10, msf db=ibm # Destination for Dump Files dumpdest=${LAWDIR}/tmp # # debug=true - will not load the destination tables # debug= - the destination tables WILL be loaded debug= # Configurable Variables END # # List of Tables to process..... tlist=" RWFORMAT CMPUTE RWGRPDET RWHEADER RWROWDET RWREQUEST RATOTALS RWUSER RADEFINE " clear while true do echo "\n\rFROM Product Line: \c" read frompl fromplu=`echo $frompl | tr 'a-z' 'A-Z' ` fromplue=`rngdbdump -cn gen prodline -f ProductLine -v ProductLine=$fromplu 2>/dev/null | sed -n -e 's/"//p' | wc -l` if [ "$fromplue" -ne "1" ] then echo "Usage: FROM Product Line '$fromplu' Does Not exist" else break 2 fi done while true do echo "\n\r TO Product Line: \c" read topl toplu=`echo $topl | tr 'a-z' 'A-Z' ` toplue=`rngdbdump -cn gen prodline -f ProductLine -v ProductLine=$toplu 2>/dev/null | sed -n -e 's/"//p' | wc -l` if [ "$toplue" -ne "1" ] then echo "Usage: TO Product Line Does Not exist" else break 2 fi done for table in $tlist do tblf=`echo ${table} " " | cut -c 1-10` echo "Dumping ${fromplu}/${tblf}.....\c" rngdbdump -c $fromplu $table >$dumpdest/$fromplu.${table}.rngdbdump 2>/dev/null echo "done." done echo "\n\rDo you wish to load these to the ${toplu} Product Line Now?: \c" read yesno case $yesno in Y|y|YES|yes) for table in $tlist do tbl10=`echo ${table} " " | cut -c 1-10` if [ "${debug}" = "true" ] then echo "SIMULATING 'bld${db)ddl' of ${toplu}/${tbl10}.....\c" sleep 2 echo "done." echo "SIMULATING 'importdb' of ${toplu}/${tbl10}.....\c" sleep 2 echo "done." else echo "Rebuilding ${toplu}/${tbl10}.....\c" bld${db}ddl -URY ${toplu} ${table} >/dev/null 2>/dev/null echo "done." echo "Loading ${toplu}/${tbl10}.....\c" importdb -af ${toplu} ${table} ${dumpdest}/${fromplu}.${table}.rngdbdump >/dev/null 2>&1 echo "done." fi done echo "\n\r\n\rSummary of Operation....." for table in $tlist do count ${toplu} ${table} done ;; *) echo "No action Taken - Tables NOT loaded." ;; esac