rc=1
while [ $rc -ne 0 ]
do
echo "Trying to rename the database $1 to $2"
echo "rename database $1 to $2" | $DBACCESS
rc=$?
if [ $rc -ne 0 ]
then
echo "WARNING: Failed to rename the database $1 to $2."
echo "Retrying. Please wait..."
#
# bounce the Informix engine
#
stop_start_informix
fi
done
#
# bounce the Informix engine
#
stop_start_informix
if [ $position0 -lt 0 ]
then
echo "First seperator $file_seperator0 is not found in file. "
exit 1
elif [ $position1 -lt 0 ]
then
echo "Second seperator $file_seperator1 is not found in file."
exit 1
elif [ $position2 -lt 0 ]
then
echo "Second seperator $file_seperator2 is not found in file."
exit 1
fi
echo "$position0 $position1 $position2"
diff_12=`expr $position2 - $position1`
head -${position0} ${EXPORTED_SQL}>; ${EXPORTED_DIR}/${TABLE_SQL}
head -${position1} ${EXPORTED_SQL} | tail +${position0} >; ${EXPORTED_DIR}/${PROC_SQL}
tail +${position1} ${EXPORTED_SQL} | head -${diff_12} >;>;${EXPORTED_DIR}/${TABLE_SQL}
if [ -d "$EXPORT_PATH/$lockedDB.exp" ]; then
echo "Moving $EXPORT_PATH/$lockedDB.exp to another directory."
mv $EXPORT_PATH/$lockedDB.exp $EXPORT_PATH/$lockedDB.exp.old
fi
if [ "$DB" = "small_db2" ]
then
su - informix -c "echo 'grant dba to root' | $DBACCESS $DB; exit 0"
fi
rename_db $DB $lockedDB
echo "Exporting the $lockedDB database. Please Wait..."
$DBEXPORT -q $lockedDB -o $EXPORT_PATH -ss
ok=`grep "dbexport comleted" dbexport.out`
if [ "$ok" = "dbexport completed" ]
then
echo "dbexport completed with no error."
else
echo "Check dbexport.out file; your export has problems!"
tail dbexport.out
exit 1;
fi
if [ "$ok" = "dbimport completed" ]
then
echo "dbimport completed with no errors."
else
echo "Check dbimport.out; problems in dbimport."
tail dbimport.out
exit 1;
fi