FairCom DB is a flexible database engine capable of running on many platforms and system architectures. It is frequently useful to move a database from a Unix based high low architecture to a Windows low-high Intel architecture. There are a couple issues with doing so:
FairCom has long provided utilities for doing such data and index file conversions, namely, ctunf1. To apply these to a full FairCom DB SQL database, perform the following steps.
- User# 00016 Server shutdown completed
- User# 00016 Maximum memory used was 230102654 bytes
#!/bin/sh
# usage: convert.sh DATABASE
# runs ctunf1 on a database and session dictionary
# converts from HIGH-LOW to LOW-HIGH ENDIAN-NESS
err(){
echo ERROR converting file $1
echo Check convert.log for error code
exit 1
}
usage(){
echo usage:
echo convert DATABASE
echo runs ctunf1 on DATABASE and session dictionary
echo converts from HIGH-LOW to LOW-HIGH ENDIANNESS.
exit 1
}
dbname=$1
echo ${dbname}
if [ ! -d ${dbname}.dbs ]; then
echo Database ${dbname}.dbs not found
usage
fi
if [ ! -f ${dbname}.dbs/SQL_SYS/${dbname}.fdd ]; then
echo Database Dictionary not found
exit 1
fi
if [ ! -f ctdbdict.fsd ]; then
echo Session dictionary ctdbdict.fsd not found
exit 1
fi
echo STARTING DATABASE ENDIAN CONVERSION.
echo ENSURE SERVER WAS SHUTDOWN CLEANLY.
echo ENSURE DATABASE $dbname HAS BEEN BACKED UP.
echo THIS UTILITY CONVERTS FILES IN PLACE.
echo ANY ERROR DURING CONVERSION WILL CORRUPT DATA.
echo PRESS ctrl-z TO EXIT.
echo PRESS ENTER TO CONTINUE CONVERSION.
read
echo CONVERTING DATABASE DICTIONARY
./ctunf1 ./${dbname}.dbs/SQL_SYS/${dbname}.fdd 8 L Y B2 512 >convert.log
if [ $? != 0 ]; then
err ${dbname}.dbs/SQL_SYS/${dbname}.fdd
fi
echo CONVERTING ALL DATA... Please be patient
for i in ./${dbname}.dbs/*.dat
do
./ctunf1 $i 8 L Y B2 256 >>convert.log
if [ $? != 0 ]; then
err $i
fi
done
echo DATA FILE CONVERSION SUCCESS!
echo CONVERTING INDEX FILES
for i in ./${dbname}.dbs/*.idx
do
./ctunf1 $i 8 L Y B2 256 >>convert.log
if [ $? != 0 ]; then
err $i
fi
done
echo INDEX FILE CONVERSION SUCCESS!
echo CONVERTING Session dictionary
./ctunf1 ctdbdict.fsd 8 L Y B2 512 >>convert.log
if [ $? != 0 ]; then
err ctdbdict.fsd
fi
echo CONVERSION COMPLETE!
exit 0