[More tips at ./MOS.html]
How to Download My Oracle Support SRs Programmatically
Oracle SRs (service requests), previously called TARs (technical assistance requests), are tickets
you open with Oracle for technical support. Unlike MOS (MyOracleSupport) notes, bug reports or
forum messages, SRs can't be searched. How do you find an SR you opened with Oracle some time ago
that had the words, say, "ORA-04031" and "PRODDB2", and you forget the SR title (called summary on
MOS) and obviously the number? If the SR was opened not too long ago, you may be able to spot it
when you show the titles of the latest SRs. Nevertheless, the fact that you can't search within
SRs, and you can only view one SR at a time (except with some trick) is very annoying. (Ironically,
I opened an SR asking Oracle whether they plan to add the SR search functionality to MOS. The
analyst filed an enhancement request for me.)
This note is about downloading all your SRs so that you can search for a string on your local hard
drive. We'll use Microsoft VBScript to simulate a real person's clicking and typing. Obviously this
only works on Windows.[note] These are the steps.
1. Use Opera, not Firefox or IE, to get the HTML source for the page showing all SRs. In Opera,
login the HTML MOS, i.e. http://supporthtml.oracle.com. Click Service Request. (If you have
multiple CSIs, make sure the SRs shown are what you need; filter as needed.) Select "Show All
" in the drop-down in the upper right corner. Save the HTML source of this Web page to
ShowAllSR_ViewSource.html.
2. Use Notepad to create ExtractSRNum.pl:
#!perl -w
#Generate all SR numbers plus first 30 chars of SR summary (title)
#Usage: perl ExtractSRNum.pl ShowAllSR_ViewSource.html
while (<>) {
@line = (); #just in case
@line = split /x62" nowrap>/; #SR number adjacent HTML code on MOS SR page as of 20091201
foreach (@line) {
#For each line, extract SR number, which is at the line beginning, and the first 30
#chars (adjust if you wish) of the SR summary to be used for our document title later,
#separated by tab
print "$1\t$2\n" if /(^[\d-]+).*?>([^<]{30})/;
#print "$1\n" if /x62" nowrap>([\d-]+)/; #catch remaining SR numbers; maybe unnecessary
}
}
Run command on command console (Start -> Run -> cmd):
perl ExtractSRNum.pl ShowAllSR_ViewSource.html > SRList.txt
where perl.exe should be in %path% such as %oracle_home%\perl\5.8.3\bin\MSWin32-x86-multi-thread
Make sure SRList.txt has all SR's, each one per line.
3. Run the program below to generate our VBScript.
----- begin cut: MOS.pl -----
#!perl -w
print
'Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 500
WshShell.AppActivate "Mozilla Firefox"
';
while (<>) {
chomp;
($srnum, $srsmr) = split /\t/; #SR number and SR summary (i.e. title)
$srsmr =~ s/[^\w\d ]//g; $srsmr =~ s/ /-/g; #only preserve alphanumerics and replace space with -
print
'WshShell.sendkeys "^lhttps://support.oracle.com/CSP/main/sr/detail?exportType=PV&entrySortOrder=ascending&sr_number=' . $srnum . '~"
WScript.Sleep 16000
WshShell.sendkeys "^s' . $srsmr . '.html~"
WScript.Sleep 500
WshShell.sendkeys "{ESC}"
WScript.Sleep 500
';
}
----- end cut: MOS.pl -----
Now run the program as
perl MOS.pl SRList.txt > MOS.vbs
Make sure MOS.vbs looks like this (2-1234567 is an example SR).
----- begin cut: MOS.vbs -----
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 500
WshShell.AppActivate "Mozilla Firefox"
WshShell.sendkeys "^lhttps://support.oracle.com/CSP/main/sr/detail?exportType=PV&entrySortOrder=ascending&sr_number=2-1234567~"
WScript.Sleep 16000
WshShell.sendkeys "^sWe-have-a-8-nodes-RAC-under-t.html~"
WScript.Sleep 500
WshShell.sendkeys "{ESC}"
WScript.Sleep 500
[repeat lines like the above 6 lines for another SR...]
----- end cut: MOS.vbs -----
4. In Firefox, not Opera or IE or any other browser, go to
https://support.oracle.com/CSP/main/sr/detail?exportType=PV&entrySortOrder=ascending&sr_number=2-1234567
Change 2-1234567 to your SR number. Make sure you can view this page correctly. Also test this key
sequence:
Control-L to highlight browser address field;
Control-S to popup Save As dialog; choose appropriate folder such as c:\temp\MOS_SRs (create it
first). Choose "Web Page, HTML only" as Save as type. Type a file name and save.
Disable screen saver or set the time for it to kick in to a long time, so you can watch. Stop any
CPU-hogging program (check Task Manager). Now make absolutely sure your PC won't be used, I mean,
literally, touched, for any other use in the following few hours, depending on how many SRs you
need to download. Run your VBScript either by double clicking the MOS.vbs program in Windows
Explorer or, as I prefer, go to command console and type
cscript //nologo MOS.vbs
Now have a cup of coffee or tea ready, sit back and watch the invisible hand working on your
computer. It will open the Web page for the latest SR, wait 16 seconds (adjust it in MOS.pl as
needed) for the download to complete, save the page as .html in the currently selected
download folder, go to the next SR and do the same,... The is the first 30 characters
(adjust it in ExtractSRNum.pl) of the SR summary i.e. title minus non-alphanumerics and with spaces
replaced with hyphens.
After all the SRs are downloaded, it's up to you as to how you implement keyword search, Copernic
Desktop Search, Google Desktop Search, Windows Desktop Search for personal use, or SharePoint
Server for many people to share. If you don't like any of them, just use Windows Explorer's word
search, or Windows console command findstr.
_______________
[note] There're other ways to download Web pages that require login on a login Web page, e.g.
Q&A 4.1 at
http://wget.addictivecode.org/FrequentlyAskedQuestions?action=show&redirect=Faq
But my approach is generally easier.