web analytics

Process all databases in Sybase

#!/usr/bin/ksh
echo "Started..."

print -u2 -n "Enter password:"
stty -echo
read PASS
stty echo
print

rm -f databases.lst
isql -U sa -S $DSQUERY -w 999<<EOF | awk '/DBLABEL/ { print $2 }' > databases.lst
$PASS
select 'DBLABEL' "XXX", name from master..sysdatabases
go
exit
EOF

for DB in $(cat databases.lst) ; do

print -u2 "Processing $DB ..."
isql -U sa -S $DSQUERY -w 999 -D $DB <<EOF
$PASS

-- some commands here
go

exit
EOF
done

print -u2 "Done."

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  

  

  

Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.