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

Home -> Community -> Usenet -> c.d.o.server -> Re: Hardware info from Oracle server?

Re: Hardware info from Oracle server?

From: Jack <none_at_mail.com>
Date: Fri, 01 Apr 2005 08:19:22 GMT
Message-ID: <eu73e.90$cl2.54@read3.inet.fi>

"Rauf Sarwar" <rs_arwar_at_hotmail.com> wrote in message news:1112319934.955222.4860_at_l41g2000cwc.googlegroups.com...
>
> jackzhunj_at_gmail.com wrote:
>> Is there any way I can get Oracle machine information (# of CPUs,
> RAM,
>> etc) from some Oracle system views or calling some Oracle packages?
>> (Oracle 9iR2)
>>
>> Thanks a lot!
>
> I don't know of any system view/package but if you have JServer
> installed then you can use java stored procedure and a PLSQL wrapper
> function. I use psinfo.exe from www.sysinternals.com in my example on
> Windows to get system info. psinfo.exe must be in system path.
>
> SQL> create or replace and compile java source
> 2 named "SysInfo"
> 3 as
> 4
> 5 import java.io.*;
> 6
> 7 public class SysInfo {
> 8
> 9 public static String getInfo ()
> 10 throws Exception {
> 11
> 12 Runtime r = Runtime.getRuntime();
> 13 Process p = r.exec("psinfo.exe");
> 14 BufferedReader br
> 15 = new BufferedReader(new
> InputStreamReader(p.getInputStream()));
> 16 p.waitFor();
> 17 String a;
> 18 StringBuffer sb = new StringBuffer();
> 19 while ((a = br.readLine()) != null) {
> 20 sb.append(a + "\n");
> 21 }
> 22 br.close();
> 23 return sb.toString();
> 24 }
> 25 }
> 26 /
>
> Java created.
>
> SQL> create or replace function foo return varchar2
> 2 is
> 3 language java name 'SysInfo.getInfo() return java.lang.String';
> 4 /
>
> Function created.
>
> SQL> set heading off
> SQL> select foo from dual;
>
> System information for \\RASA:
> Uptime: 0 days 3 hours 26 minutes 42 seconds
> Kernel version: Microsoft Windows XP, Uniprocessor Free
> Product type: Professional
> Product version: 5.1
> Service pack: 1a
> Kernel build number: 2600
> Registered organization:
> Registered owner: RASA
> Install date: 07/02/2004, 02:31:27
> Activation status: Activated
> IE version: 6.0000
> System root: C:\WINDOWS
> Processors: 1
> Processor speed: 600 MHz
> Processor type: Intel(R) Pentium(R) M processor
> Physical memory: 1022 MB
> Video driver: ATI MOBILITY RADEON 7500
>
> You can easily parse the return string.
>
> Regards
> /Rauf
>

Hi!

If I put
Process p = r.exec("psinfo.exe | grep Processors:");

It will give:
ERROR at line 1:
ORA-24345: A Truncation or null fetch error occurred ERROR:
ORA-01002: fetch out of sequence

How to fix it?

Jack Received on Fri Apr 01 2005 - 02:19:22 CST

Original text of this message

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