Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Getting disk info into oracle
The following works fro me as an external procedure call:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
int mount_space(char *fs)
{ FILE *c = NULL;
char bfr[200];
char dv[100];
char dmy[6][80];
int pv = 0;
long int rv = -2;
sprintf(dv, "/usr/bin/bdf %s\n", fs);
c = popen(dv, "r");
if(!c) return(-1);
while(fgets(bfr, sizeof(bfr),c))
{ sscanf(bfr, "%s %s %s %s %s %s",
&dmy[0], &dmy[1], &dmy[2], &dmy[3], &dmy[4], &dmy[5]); if(!strncmp(dmy[5], fs, min(strlen(dmy[5]), strlen(fs)))) rv = atol(dmy[3]); if(!strncmp(dmy[4], fs, min(strlen(dmy[4]), strlen(fs)))) rv = atol(dmy[2]);
It returns the available disk space, in KBYTES. Add to that the bytes from dba_data_files for the same mount point & you've got total available disk space. To build it run:
make -f $ORACLE_HOME/rdbms/demo/demo_rdbms.mk extproc_no_callback SHARED_LIBNAME=<whatever you want>.so OBJS=same_as_before>.o
Dick Goulet
Senior Oracle DBA
Oracle Certified 8i DBA
-----Original Message-----
From: Kline.Michael [mailto:Michael.Kline_at_SunTrust.com]
Sent: Thursday, June 03, 2004 11:34 AM
To: oracle-l_at_freelists.org
Subject: Getting disk info into oracle
OS = HP/UX
Oracle = 8.1.3.4
Anyone got a working script that may allow me to strip off from a "bdf" the disk info?
What I'd really like to be able to do is capture the disk size that normally won't change, and then the used and free amount of disk. I'd like to bring this info in with a date stamp.
I'll take that and make a work table out of it.
Then I'd like to take that and merge the "auto extend" stuff with it and keep it for historical purposes.
There is a small chance that perhaps we've got someone already doing this or something very close.
They *MIGHT* have Perl here, but I'll have to check.
Some of these databases are growing by 1-2TB per year, and it would help with the keeping up of which disks are getting full.
Thanks.
Michael Kline
Database Administration
Outside 804.261.9446
Cell 804.744.1545
michael.kline_at_suntrust.com
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html ----------------------------------------------------------------- ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Thu Jun 03 2004 - 10:37:31 CDT
![]() |
![]() |