Product Documentation

Knowledgebase

Previous Topic

Next Topic

HP-UX

In This Section

Moving a HP-UX FairCom DB SQL Database to Windows

Previous Topic

Next Topic

Moving a HP-UX FairCom DB SQL Database to Windows

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:

  • File headers
  • Binary data

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.

  1. Shutdown the server. Check for a clean shutdown logged in CTSTATUS.FCS with the final messages:

    - User# 00016 Server shutdown completed

    - User# 00016 Maximum memory used was 230102654 bytes

  2. Backup the database directory, making sure to include files ctdbdict.fsd, <dbname>.dbs/*.dat, <dbname>.dbs/*.idx, and <dbname>.dbs/SQL_SYS/<dbname>.fdd.
  3. Copy ctunf1 and convert.sh into the same directory as the server. (See below for convert.sh)
  4. Run ./convert.sh <dbname>
  5. Copy ctdbdict.fsd and the <dbname>.dbs folder to the windows machine if no errors occurred.
  6. Start the Windows FairCom DB Server process.
  7. Use the ctpath utility to change paths from ./<dbname>.dbs/SQL_SYS/ to .\<dbname>.dbs\SQL_SYS\
  8. Use the ctpath utility to change paths from .<dbname>.dbs/ to .\<dbname>.dbs\

convert.sh

In This Section

convert.sh

Previous Topic

Next Topic

convert.sh

#!/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

TOCIndex