Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Getting disk info into oracle

RE: Getting disk info into oracle

From: Goulet, Dick <DGoulet_at_vicr.com>
Date: Thu, 3 Jun 2004 11:40:26 -0400
Message-ID: <4001DEAF7DF9BD498B58B45051FBEA650146C343@25exch1.vicorpower.vicr.com>


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]);

   }
   pv = pclose(c);
   return(rv);
}

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



The information transmitted is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please contact the sender and delete the material from any computer.


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
-----------------------------------------------------------------
----------------------------------------------------------------
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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US