Archives of the TeradataForum
Message Posted: Fri, 31 Aug 2007 @ 14:43:27 GMT
Subj: | | Re: Finding Multiload locks |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Friday, August 31, 2007 08:47 -->
Hi Anom,
I have written a sample shell script to release the locks on the tables if they are locked in apply phase.
This script is written just to give you an idea.
#Script:
# Get all tables in the database
bteq << EOI > ./out 2>&1
.logon edwd/sc4ls_nsb,beta12;
.set width 250;
help database sample_database;
.logoff;
EOI
#Write the tables list into a file
cat out | grep -i "T " | awk '{ print $1}' > ./table_list
echo "bteq << EOI > ./out1 2>&1 " > ./run_file
echo ".logon edwd/sc4ls_nsb,beta12;" >> ./run_file
echo "database sample_database;" >> ./run_file
#Check whether can be accessed or not
#I am trying to release the tables which are in apply phase
for i in `cat ./table_list`
do
echo "sel count(*) from ${i};" >> ./run_file
echo ".IF ERRORCODE = 2572 THEN RELEASE MLOAD ${i} IN APPLY;" >>
./run_file
done
echo ".logoff;" >> ./run_file
#remove all temporary files
rm ./out
rm ./table_list
chmod 777 ./run_file
#run the bteq script to release all locks
sh run_file
rm ./run_file
Regards
|