|
Script to check whether a sybase database is offline or online
|
|
04-27-2010, 02:33 AM
Post: #1
|
|||
|
|||
|
Script to check whether a sybase database is offline or online
Does anyone has a script that checks if any database on a particular sybase server is offline and sends an email alert ( listing the database/s if any database/s is offline)?
Thanks, Kishor |
|||
|
04-30-2010, 02:46 PM
Post: #2
|
|||
|
|||
|
RE: Script to check whether a sybase database is offline or online
i have one something like below.
Not sure if it helps u..... #!/bin/ksh #stty -echo . /u02/sybase/SYBASE.sh if [ $# -ne 1 ] then echo "Usage dbdump.sh <SERVER NAME>" exit fi export logdir=/home/sybase/dbawork/logs export scriptdir=/home/sybase/dbawork/scripts export DSQUERY=$1 export USERID=sa export PASSWD=`cat "$scriptdir/.ABCDEFG_sa.dat" ` isql -U$USERID -Jiso_1 -S$DSQUERY -X -P$PASSWD -w5000 <<EOF> ${logdir}/dbnames.log set nocount on go select name from sysdatabases where status2=-32752 go EOF cat ${logdir}/dbnames.log |egrep -v "name|-" > ${logdir}/dblist.log for j in `cat ${logdir}/dblist.log` do echo "Database ${j} - is offline" >> (redirect to a file which can be monitored or else using isql/dbcc to print in errorlog) done (04-27-2010 02:33 AM)Kishor Wrote: Does anyone has a script that checks if any database on a particular sybase server is offline and sends an email alert ( listing the database/s if any database/s is offline)? |
|||
|
04-30-2010, 06:24 PM
Post: #3
|
|||
|
|||
|
RE: Script to check whether a sybase database is offline or online
Hi,
Thanks.However the status2=-32752 in the query below select name from sysdatabases where status2=-32752 indicates 'Database has some portion of the log which is not on a log-only device'. So, not sure if it is going to work. I would suggest using the below to find out the databases that are offline. Code: select name from master..sysdatabases where status2=16where status2=16 indicates 'Database is offline' JP, TechSupport-Member(SybaseTeam.Com) |
|||
|
05-07-2010, 08:56 AM
Post: #4
|
|||
|
|||
|
RE: Script to check whether a sybase database is offline or online
Hi Mate,
I agree with you, but checking for status2=16 does not show the name of offline databases if it has both data and log on the same devices. It is always a better practice to have data and log on seperate devices but its feasible only in production environments. In some cases testmachines and UAT machines may have such setups with data and log on the same device. status2=-32752 indicates both offline and data/log on same device. (-32768+16=-32752) when status2=-32768 it indicates data/log on same device and status2=0 indicates data/log on seperate devices... so for offline databases it is status2=-32752(same devices) or status2=16(seperate devices) hope the below on should be a better query to resolve this. select name from sysdatabases where status2 in (-32752,16) go Cheers, Karthik (04-30-2010 06:24 PM)Joshi Wrote: Hi, |
|||
|
05-07-2010, 03:19 PM
Post: #5
|
|||
|
|||
|
RE: Script to check whether a sybase database is offline or online
Karthik,
Thanks.You rock. I didn't realize this before. JP, TechSupport-Member(SybaseTeam.Com) |
|||
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| Script to report non logged or minimally logged operation in sybase | Kishor | 2 | 353 |
08-04-2010 09:21 AM Last Post: chandrashekhar |
|
| Process to manage transaction log using automated script | Huseni Kathiria | 0 | 366 |
06-17-2010 10:27 AM Last Post: Huseni Kathiria |
|
| Sybase SQL script to find out user database data and log size , data free , log free | Joshi | 0 | 406 |
05-21-2010 09:00 PM Last Post: Joshi |
|
| Dataserver Health Checkout/QA Script | sybanva | 18 | 1,355 |
04-21-2010 03:28 PM Last Post: karthik8880 |
|
| Errorlog Monitoring Script for NT env in Perl | sybanva | 0 | 242 |
04-20-2010 03:58 PM Last Post: sybanva |
|
| Sybase Database maintenance script | crazYoga | 0 | 597 |
02-02-2010 05:59 PM Last Post: crazYoga |
|


Chat Support
Search
Disclaimer & Rules
Help


