hi all
i have a shell script for connecting in sybase env what i need is i have around 10 servers , i need to connect to all servers and retrive the database inforamtion in the servers and display them
any one of u have it request to share it asap !
"QUERY TO Connect to all servers and collect DATABASE information"
---------- Post updated at 08:31 PM ---------- Previous update was at 08:11 PM ----------
hi all below is the script ,just i need a query in this to add ,if any one can please help me in this regard
#!/bin/sh
#SERVER_TYPE=$1 # rep or sql
SYBASE_VER=`ls -1 $SYBASE | grep ASE- | cut -d"/" -f1`
SYBOCS_VER=`ls -1 $SYBASE | grep OCS- | cut -d"/" -f1`
SYB_OCS=$SYBASE/$SYBOCS_VER
SYB_ASE=$SYBASE/$SYBASE_VER
SYBASE_ASE=$SYBASE_VER; export SYBASE_ASE
SYBASE_OCS=$SYBOCS_VER; export SYBASE_OCS
ISQL_CMD=$SYBASE/$SYBASE_OCS/bin/isql
COMMAND_TO_RUN=<<PUT YOUR QUERY HERE>>
DATABASE=$3
SERVER=$4
if [ "$DATABASE" != "" ]; then # database name provided, use it
DATABASE="use $DATABASE"
fi
if [ "$SERVER" = "" ]; then # server not provided, use DSQUERY
SERVER=$DSQUERY
else
SERVER=`echo $SERVER | tr '[a-z]' '[A-Z]'` # server provided, translate to uppercase
fi
## get the password for the server
PW=`/sybase_sa/bin/get_pw $SERVER`
## run the command
$ISQL_CMD -S$SERVER -Usa -w1000 <<EOF
$PW
set nocount on
go
$DATABASE
go
select @@servername, db_name(), convert(varchar,getdate(),109)
go
print ''
go
set nocount off
go
$COMMAND_TO_RUN
go
EOF
exit