How to associate hardware information into an Oracle Table?
Hi,
I am new on Windows 2000 .
I am using the following script in order to get the windows 2000
hardware information.
I am using 8.1.7 version of ORACLE.
I am using a table "Server Hardware"(Server list,Network Adapter,RAM).
I would like to ask that how should or where should I use this script
in order to associate its information into my table "Server Hardware".
Could someone give me hints that how to use this script?
Thanks
Chuck
Following script returns the name and version number of the operating
system installed on a computer
Script Code
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo objOperatingSystem.Caption & " " &
objOperatingSystem.Version
Next
Two methods you can use. insert statement ot sql*loader method. For both the cases, you should create on table with the required structure. And format the output of your script and move it to temp file if you are using sql*loader or use the formatted output as such to move it to your table using insert statement. I have one script that captures vmstat and prstat out puts and moves it to your oracle table using sql*loader.
CREATE TABLE PRSTAT
("DATE" DATE,
PDI NUMBER,
USERNAME VARCHAR2(12),
STATE VARCHAR2(5),
TIME VARCHAR2(15),
CPU NUMBER,
PROCESS VARCHAR2(20)
)
/
****prstat.ctl****
load data
infile '/tmp/ldfile.tmp'
append
into table prstat
fields terminated by ' ' optionally enclosed by '"'
("DATE" SYSDATE,
PDI,
USERNAME,
STATE,
TIME "SUBSTR(:TIME,1,1)*3600+SUBSTR(:TIME,3,2)*60+SUBSTR(:TIME,6.2)",
CPU "RTRIM(:CPU,'%')",
PROCESS
)
****vmstat.ctl****
load data
infile '/tmp/ldfile.tmp'
append
into table vmstat
fields terminated by ' ' optionally enclosed by '"'
(PROC_RUN,
PROC_BLOCK,
PROC_WAIT,
PAGE_IN,
PAGE_OUT,
CPU_USER,
CPU_SYSTEM,
CPU_IDLE
)
----------------------------------------------------------
#!/bin/ksh
##################################
# script to monitor #
# top CPU using sessions #
# and overal system laod #
##################################
ORACLE_HOME=/oracle/product/8.1.7 ##needs to be changed according to environments
export ORACLE_HOME
ORACLE_SID=ODSD ##needs to be changed according to environments
export ORACLE_SID
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
OUT_FILE=/tmp/ldfile.tmp
export OUT_FILE
prstat 1 1 | head -12 | tail -10 | awk '{print $1" "$2" "$5" "$8" "$9" "$10}' > $OUT_FILE
$ORACLE_HOME/bin/sqlldr userid=/ control=/oracle/scripts/prstat.ctl > /dev/null ########
rm $OUT_FILE
vmstat 1 2 | tail -1 | awk '{print $1" "$2" "$3" "$8" "$9" "$20" "$21" "$22}' > $OUT_FILE
$ORACLE_HOME/bin/sqlldr userid=/ control=/odsd/oracle/scripts/vmstat.ctl > /dev/null ########
rm $OUT_FILE
Bookmarks