#!perl -w #Perl script in Windows simulating the Oracle oerr utility in UNIX #This script should be run by oerr.bat. See the URL below. #This script is published as freeware at #http://yong321.freeshell.org/freeware/Windowsoerr.html #(C) Copyright 2000-2009 Yong Huang (yong321@yahoo.com) #Please modify $dir, $colon and select $fsp, and $lsp. #On your computer, open Oracle Documentation homepage with a Web browser #and find the error message page. E.g. for Version 8.1, it may be #Oracle8i Server -> Oracle8i Error Messages (in section References). #Find the URL for the message page (if it's in an HTML frame, View Frame Info #in Firefox, Properties in IE). Take the string before "\TOC.HTM". Follow my #format below. E.g., on my machine, the URL for error message Table of Contents #page is # for 9.2 Enterprise Ed # file:///C:/ora9idoc/server.920/a96525/toc.htm # C:\ora9idoc\server.920\a96525\toc.htm in IE #$dir shown below should use "/" not "\", no "/" at the end #(Additional work is needed if you use 8.1.5 documentation) #$dir="C:/ora8idoc/server.817/a76999"; #$dir="C:/ora9idoc/server.920/a96525"; #$dir="C:/ora10gdoc/server.101/b10744"; #10gR1 #$dir="C:/ora10gdoc/server.102/b14219"; #10gR2 #$dir="C:/ora11gdoc/server.111/b28278"; #11gR1 $dir="C:/ora11gdoc/server.112/e10880"; #11gR2 #For Oracle8i only. Ignore this paragraph if your doc is > 8i. #$colon=":"; #Let's say you look up ORA-00600. Click on it. If you see # ORA-00600 internal error code... #please leave the above line commented out so $colon will not be set. #For very old versions, you may see # ORA-00600: internal error code... #then uncomment $colon=":". #Error message toc.htm page searches individual error message files. We need to #collect all those file names. $fsp is the file search pattern. #If Oracle8i (except 8.1.5), use this #$fsp='CLASS="TitleTOC">) { if (/$fsp/) { $allfile{$1}=1 if defined $1; #use hash to ensure uniqueness #Last version uses array which contains some filenames more than once #That's very bad when running against Ver. 7.3.4 Documentation #push @allfile,$1 if defined $1; } } close TOC; if ($ARGV[0]!~/-/) { $facility=uc $ARGV[0]; $code=$facility."-".(sprintf "%05d",$ARGV[1]); #e.g. ORA-00600, IMP-000001 } else { @a=split /-/,$ARGV[0]; $facility=uc $a[0]; $code=$facility."-".(sprintf "%05d",$a[1]); } #05/21/00 note: Found another inconsistency in Oracle doc: Image Data Cartridge #Error Messages use "," instead of ":" after facility-errorno, e.g. "IMG-00001," #This is the only one I find that uses anything other than ":". If you need #"oerr img [errono]", better comment out the line $colon=":" which may #introduce the problem described in last paragraph. Inconsistent documentation #style always causes trouble. $code .= $colon if defined $colon; $flag=0; #print join("\t", sort keys %allfile), "\n"; #for debug foreach $file (keys %allfile) { open INP, "$dir/$file" or next; while () { exit 0 if ($flag==1 and /$facility-/); #if (/$code/i) #Actually 9i uses , 8i . if (/${lsp}$code/) { &rawprint; $flag=1; #print "This is in file ".$file.".\n"; #for debug } elsif ($flag==1) { &rawprint; } } close INP; } sub rawprint { s/<.*?>//g; #de-HTMLize print unless /^$/; }