Re: Question To All
Posted in 1998
shahid@ares.csd.net (SK) emitted:
>>Hey there,
>>
>>I unload frequently updated tables twice a day through an SQL script,
>>i.e. "unload to <file_name> select * from <table_name>". Some files
>>are more then 100MBs.
>>Is there any way that though SQL script, right after unloading the
>>table i can compress the file and then start unloading the next table
>>and so on....
>>
>>Thanx in advance for all your help
You could write a UDR in C (or something else) to try to do it. I don't know
of an easy way off hand. Or you could do it using a shell script like so:
------------------------------------------------------------------
#!/sbin/ksh
# script to back stuff up on demand
COMPRESSOR="gzip -9"
DDATE=`date +"%m%d%y.%H%M"`
DBNAME="mydb"
# perform an ASCII backup of selected tables
# when I ask for it.
TABLIST="wbbinaries wbextensions wbpages wbprojects wbresprojects wbtags
webpages webtags webimages webprojects"
DDIR="unload/${DDATE}"
if [ -d "${DDIR}" ]
then
print - "Backup dir exists, wait a minute and try again"
exit 1
else
mkdir -p ${DDIR}
cd ${DDIR}
for table in ${TABLIST}
do
dbaccess ${DBNAME} <<EOF!
unload to ${table}.unl select * from ${table};EOF!
done
${COMPRESSOR} *
cd ../..
print - "Data tables [ ${TABLIST} ] unloaded..."
fi
print - "Done for now..."
------------------------------------------------------------------