Unsolved
This post is more than 5 years old
2 Posts
0
2193
July 28th, 2010 23:00
How do you convert StorageScope SQL queries into a KSH script ?
Anyone know how to convert a StorageScope Query into a ksh script ?
The following is an example of an oracle SQL query within Storage Scope...
SELECT srmhosthost.hostalias, srmhosthost.hostos, srmhosthost.hostoslevel, srmhosthost.powerpathversion, srmhosthost.lastdiscoverytime, sr
mhosthost.hostcpucount, srmhosthost.hostosrelease, srmhosthost.hostosversion FROM srmhost srmhosthost, (SELECT srmhostmetrics.* FROM srmho
stmetrics, latestetlload WHERE srmhostmetrics.datekey = latestetlload.datekey) srmhostmetricshost, srmudfinstance udfhostshost, srmagentco
mponent srmagentcomponentcomponent WHERE (srmhosthost.iscurrent = 'Y' OR srmhosthost.iscurrent IS NULL) AND srmhosthost.hostkey = srmhostm
etricshost.hostkey(+) AND srmhosthost.hostkey = udfhostshost.mokey(+) AND srmhosthost.hostkey(+) = srmagentcomponentcomponent.hostkey ORDE
R BY srmhosthost.hostalias asc
This codes runs and creates the pdf file successfully in SS , but i'd like to wrap this into a ksh script.
The following is an example of a working ksh script to extract the cisco switch config details...
${ORACLE_HOME}/bin/sqlplus -s /nolog < connect userid/password
set heading on
set pagesize 0
set feedback off
set linesize 500
set tab on
set trimspool on
spool ${SQL_LOG}
select ST_ID ||' '|| ST_ALIAS ||' '||ST_MODEL ||' '||ST_VERSION ||' '||ST_VENDOR ||' '|| SW_MANAGEMENTURL ||' '||SW_PORTCOUNT ||' '||
SW_PORTCOUNT_STARRAY||' '|| SW_PORTCOUNT_SWITCH ||' '||SW_PORTCOUNT_HBAS ||' '||SW_PORTCOUNT_UNKNOWN ||' '||SW_PORTCOUNT_FREE from sts_sw
itch;
spool off
EOF
this works as planned ie...
$./get-details.ksh
Connected.
2165811 PLUM-CS-F09-EMCS-FS02 DS-C9134-K9 4.1(3a) Cisco 10.85.26.53 32 0 0 9 9 14
2162157 NWM-NS-F09-EMCS-FS02 DS-C9509 3.3(3) Cisco 192.168.197.172 120 6 0 41 1 72
386075 NWM-NS-F09-EMCS-SRDF-FS01 DS-C9124-K9 3.3(3) Cisco 192.168.197.222 24 1 3 1 6 13
168246 NWM-GS-F17-EMCS-FS02 DS-C9509 3.3(3) Cisco 192.168.214.133 120 12 0 41 1 66
386086 NWM-NS-F09-EMCS-SRDF-FS02 DS-C9124-K9 3.3(3) Cisco 192.168.197.223 24 1 3 1 6 13
386539 NWM-GS-F17-EMCS-SRDF-FS02 DS-C9124-K9 3.3(3) Cisco 192.168.214.9 24 1 3 1 4 15
386525 NWM-GS-F17-EMCS-SRDF-FS01 DS-C9124-K9 3.3(3) Cisco 192.168.214.8 24 1 3 1 3 16
167325 NWM-GS-F17-EMCS-FS01 DS-C9509 3.3(3) Cisco 192.168.214.52 120 12 0 41 1 66
2161068 NWM-NS-F09-EMCS-FS01 DS-C9509 3.3(3) Cisco 192.168.197.171 120 6 0 43 1 70
2165197 PLUM-CS-F09-EMCS-FS01 DS-C9134-K9 4.1(3a) Cisco 10.85.26.52 32 0 0 8 9 15
2165811 PLUM-CS-F09-EMCS-FS02 DS-C9134-K9 4.1(3a) Cisco 10.85.26.53 32 0 0 9 9 14
2162157 NWM-NS-F09-EMCS-FS02 DS-C9509 3.3(3) Cisco 192.168.197.172 120 6 0 41 1 72
386075 NWM-NS-F09-EMCS-SRDF-FS01 DS-C9124-K9 3.3(3) Cisco 192.168.197.222 24 1 3 1 6 13
168246 NWM-GS-F17-EMCS-FS02 DS-C9509 3.3(3) Cisco 192.168.214.133 120 12 0 41 1 66
386086 NWM-NS-F09-EMCS-SRDF-FS02 DS-C9124-K9 3.3(3) Cisco 192.168.197.223 24 1 3 1 6 13
386539 NWM-GS-F17-EMCS-SRDF-FS02 DS-C9124-K9 3.3(3) Cisco 192.168.214.9 24 1 3 1 4 15
386525 NWM-GS-F17-EMCS-SRDF-FS01 DS-C9124-K9 3.3(3) Cisco 192.168.214.8 24 1 3 1 3 16
167325 NWM-GS-F17-EMCS-FS01 DS-C9509 3.3(3) Cisco 192.168.214.52 120 12 0 41 1 66
2161068 NWM-NS-F09-EMCS-FS01 DS-C9509 3.3(3) Cisco 192.168.197.171 120 6 0 43 1 70
2165197 PLUM-CS-F09-EMCS-FS01 DS-C9134-K9 4.1(3a) Cisco 10.85.26.52 32 0 0 8 9 15
$
i don't know how to convert the SQL query ...
"SELECT srmhosthost.hostalias, srmhosthost.hostos, srmhosthost.hostoslevel, srmhosthost.powerpathversion, srmhosthost.lastdiscoverytime, sr
mhosthost.hostcpucount, srmhosthost.hostosrelease, srmhosthost.hostosversion FROM srmhost srmhosthost, (SELECT srmhostmetrics.* FROM srmho
stmetrics, latestetlload WHERE srmhostmetrics.datekey = latestetlload.datekey) srmhostmetricshost, srmudfinstance udfhostshost, srmagentco
mponent srmagentcomponentcomponent WHERE (srmhosthost.iscurrent = 'Y' OR srmhosthost.iscurrent IS NULL) AND srmhosthost.hostkey = srmhostm
etricshost.hostkey(+) AND srmhosthost.hostkey = udfhostshost.mokey(+) AND srmhosthost.hostkey(+) = srmagentcomponentcomponent.hostkey ORDE
R BY srmhosthost.hostalias asc"
into something that resembles the example above....
I have tried the ||' '|| notation but it produces nothing.
I'm not an oracle admin
any ideas share is much appreciated.
psetags
14 Posts
1
August 8th, 2010 16:00
raffs
You may want to post this on the IONIX forum.
Thanks
Peter