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: Sar Loader Script?

Re: Sar Loader Script?

From: Charlie Mengler <charliem_at_mwh.com>
Date: Mon, 05 Feb 2001 12:14:49 -0800
Message-ID: <F001.002AAC89.20010205093137@fatcity.com>

#!/usr/local/bin/perl
# file - sar-d.pl
$sar_out = "/tmp/sar.out";
$sar_dat = ">/tmp/sar.dat";

# a file suitable for SQLLDR is created as /tmp/sar.dat system("sar -d > $sar_out");
open(INP,$sar_out);
open(OUT,$sar_dat);
$line_cnt = 1;

while (<INP>) {

   if ( ($line_cnt > 4) && (length($_) > 1) )    {

      if ( (substr($_,0,1) ne " ") && (substr($_,0,1) ne "A") )
      {
         $timestamp = substr($_,0,8);
         #print "$timestamp\n";
         $input = $_;
      } else
      {
         $input = $timestamp . substr($_,8);
      }
      print OUT $input;

   }
   $line_cnt++;
}
close(INP);
close(OUT);
unlink($sar_out);

HTH & HAND! > By chance, does anyone have a script that will reparse a collection of sar >statistics, that came from "sar -d", into a file that can be used by SQL*Loader?

-- 
Charlie Mengler               Maintenance Warehouse  
charliem_at_mwh.com              10641 Scripps Summit Ct   
858-831-2229                  San Diego, CA 92131    
HOME DEPOT - The Big Boy's Toy store!!!!!!!!!!!!!!!!!
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Charlie Mengler
  INET: charliem_at_mwh.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Feb 05 2001 - 14:14:49 CST

Original text of this message

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