Featured Database Articles

Keeping Track of Virtual Databases

If you have SQL Server or Oracle databases in a Microsoft
Windows clustered environment, then you'll want to keep virtual servers running
on their preferred nodes, especially if you have more than one virtual database
in a cluster.

However, sometimes you may discover that database servers
are not performing well and you may find that two or more virtual servers may
be running on same node. This can happen if there was any error on one of the
servers and virtual databases failed over to other node. On the other hand, you
may have applied patches on Windows operating servers and rebooted them but
forgot to failover the virtual servers to the proper nodes.

You may have a server monitoring system in place to alert you
about any resource failovers but as an administrator, you may get tons of
alerts of different criticality everyday and may miss the email.

To overcome this situation, you can write a script to go
after all of your clustered databases and find where they are running. You can
run this VBScript every morning or schedule it and send report via email, which
you should not ignore.

The following script (save as c:\checkservice\checkservice.vbs)
generates a report in HTML format. You can change the color scheme to your
liking.

The script uses arrays to store server name and service
names you want to report on. It can report on clustered or stand-alone servers;
the number of services on stand-alone will be half of clustered ones.

The first entry in the array is the physical server name, the
rest are service names.

You can add as many servers and services as you need to the
list, just make sure to change the array SQLServer and OracleServer. Also
change the number in the WHILE LOOP as well.

This script calls the WMI script to query each server in the
list to query service status, so the account you log in to run the script must
have administrative rights on all of the servers.

SendmailHTML.vbs is also a VBScript, which sends email in
HTML format using an SMTP server. Replace YOUR_SMTP_SERVER_NAME with your SMTP
server name or IP. You can also send file attachments or plain text email with
this script.

The code listed above generates a status
report for one Oracle and one SQL Server, so as it is, it provides a lot of value.
However, you may have many more servers and services in your environment that
you need to keep track of. Just edit the array and increase the loop counter
and enjoy your daily report; no more logging onto each machine to check the
status.