 |
|
Monitor
Oracle Windows disks
Oracle Tips by Burleson Consulting |
See these additional resources for Oracle
Windows scripts:
You can easily monitor Oracle Windows disk
space usage with a Windows script that monitors disk free space. If a disk volume
has less free space than a pre-determined threshold, an alert message is
sent to the DBA via, e-mail using the sendalrt.bat script
@ECHO OFF
REM
+---------------------------------
REM |
DISK_SPACE.BAT
REM |
REM | Author:
T. Clark
REM | Written:
03/16/03
REM
+---------------------------------
REM
+-------------------------------------
REM | Set up
client specific variables
REM
+-------------------------------------
set BC_DIR=C:\BC
REM
+-------------------------------------------------------------
REM | Define
minimum space value in floating point format
REM | Example:
1E5=100,000 (100K) 1.75E5=175,000 (175K)
REM |
2E6=2,000,000 (2MB)
REM
+-------------------------------------------------------------
set MINSPACE=1.75E5
ucd %BC_DIR%\script
REM
+-------------------------------------------------------------
REM | Now let's
go get disk space information for all disks and
REM | remove
commas from the byte values
REM
+-------------------------------------------------------------
df -a -t | sed
-e "s/,//g" > df.txt
REM
+-------------------------------------------------------------
REM | Select
lines for disks that fall within the critical free
REM | space
range and send them to the ALERT.TXT file
REM
+-------------------------------------------------------------
getrng "-d)"
-f2 -r 0,%MINSPACE% df.txt > alert.txt
REM
+-------------------------------------------------------------
REM | If we
found disks critically low on space, send an e-mail
REM | alert to
the DBA staff
REM
+-------------------------------------------------------------
test -s1
alert.txt run: sendalrt.bat alert.txt
rm -s df.txt
rm -s alert.txt
REM
+-------------------------------------
REM
| Set up client specific variables
REM +-------------------------------------
set FROM=Oracle@Client.com
set TO=Client@remote-dba.net
set SUBJECT=Client Freespace Alert
REM
+-------------------------------------
REM
| Build the message banner
REM
+-------------------------------------
echo. > message.txt
banner Disk Alert!
>> message.txt
echo. >> message.txt
cat message.txt %1% >> combined.txt
REM
+-------------------------------------
REM
| Send the alert message
REM
+-------------------------------------
sendmail -messagefile=combined.txt -subject="%SUBJECT%"
-from=%FROM% %TO%
rm message.txt
rm combined.txt
exit
exit
 |
If you like Oracle tuning, see the book "Oracle
Tuning: The Definitive Reference", with 950 pages of tuning tips and
scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |