RE: Quicker way of reading an input file? Script or Perl?

RE: Quicker way of reading an input file? Script or Perl?

 

  

Here's how I do it. I just rename it.

Oracle creates a new one if it wants to write to it.

Every Saturday night at 11:59pm for windows, cause notepad can #@$@.
For unix, you could go longer if you wanted.

-----Original Message-----
From: Strange James
[mailto:oracledba-ezmlmshield-x36022134.[Email address protected]
Sent: Tuesday, November 29, 2005 3:31 PM
To: LazyDBA Discussion
Subject: RE: Quicker way of reading an input file? Script or Perl?

I'm not entirely sure what you are trying to do; however, this is
how I handle the logs:

1. I have a cron job that runs on the first day of each month.
2. The job copies the alert log to a new file name, which has the
date tagged on it.
3. I empty the existing log file by using the > command.
4. I compress the copy of the log file.

The result is a compressed copy of each month's log.
The current log will only contain entries from the current month.

Best wishes,

James E. Strange
Database Architect Wellpoint IT
Office (317) 287-5423 Fax (317) 287-5428
Home 317 253-6154 Cell (317) 402-1742
Oracle Certified Professional DBA

-----Original Message-----
From: Benbart
[mailto:oracledba-ezmlmshield-x1367133.[Email address protected]
Sent: Tuesday, November 29, 2005 3:04 PM
To: LazyDBA Discussion
Subject: Quicker way of reading an input file? Script or Perl?

Hi all,
Am trying to cleanup my ALERT log file which has about 180000+
lines, roughly 8MB.
I have to read each line of the file and then check for the date
line. The month and year are normally on the same position if it is
indeed a date line. An example of a date line is [Thu Aug 11
16:21:46 2005] excluding the braces. Using awk I always look for
fields 2 and 5 and I use that to decide that this is a date line.
If it is, then I echo that line to a AUG_2005.TXT file based from
the previous example dateline. So I written a Korn shell script to
do a while read line and parse each line and the succeeding lines
after that line but before the next date line if the next date line
does not have the same month / year as the current date line. So if
my ALERT log have
1 Thu Aug 11 16:21:51 2005
2 ARC0: Completed archiving log 4 thread 1 sequence 132097
3 Thu Aug 11 16:22:41 2005
4 Completed checkpoint up to RBA [0x20402.2.10], SCN:
0x0000.2b720a27
5 Thu Aug 11 16:22:41 2005
6 Beginning log switch checkpoint up to RBA [0x20403.2.10], SCN:
0x0000.2b72342e
7 Thu Sep 11 16:22:41 2005
8 ARC0: Evaluating archive log 2 thread 1 sequence 132098
9 ARC0: Beginning to archive log 2 thread 1 sequence 132098
10 Creating archive destination LOG_ARCHIVE_DEST_1:
'/u06/backup/archivelog/arch0000132098.arc'

Then lines 1-6 go to AUG_2005.TXT and line 7-10 go to SEP_2005.TXT.
Then at the end of parsing the whole ALERT log file, I strip the
180000+ file and retain only the current month's log using sed -n
1,Xp.
Anyway, my script is sort of working, albeit slow. It took about 1.5
hours to parse thru the whole file.
Knowing that these two (2) forums are more likely to have script
writers/programmers. I just want to know if there is a quick way of
READING the whole chunks of 180000+ lines file into memory and parse
it from there. If so, how? Can I do this via the Korn shell script
or do I have to use Perl or a C program to do so? If Perl or C is
the preferred method, does anyone have an example on how to do this.
I can re-write the script in Perl and read the lines one by one as
it is with the Korn Shell Script but then I'll end up with the
similar scenario.
Any inputs or suggestion will be very much appreciated. Thanks in
advance ...




--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html



CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
confidential
and privileged information or otherwise protected by law. Any
unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the
intended recipient, please contact the sender by reply e-mail and
destroy
all copies of the original message.


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html



Oracle LazyDBA home page