Thanks for the help :-), although the volumes count (unnamed[3] in your
example output) is a total volume count, rather than a count of the
volumes in that storage pool.
But.. as I was reading your reply a friendly DBA came over with this
piece of SQL;
select a.stgpool_name,a.maxscratch,count(*) from stgpools a, volumes b
where a.stgpool_name = b.stgpool_name and a.devclass = 'ULTRIUM1' group
by a.stg pool_name,a.maxscratch
To produce this output;
STGPOOL_NAME MAXSCRATCH Unnamed[3]
------------------ ----------- -----------
ONSITE 30 4
ONSITE_MNT 150 90
ONSITE_MNT_OFF 20 9
PERFTEST 20 6
RMM_ARCH_SHWD 20 6
RMM_COPY_SHWD 100 57
RMM_UNIX_SHWD 70 55
UKS_ARCH_SHWD 10 5
UKS_ONSITE 60 26
UKS_ONSITE_COLL 60 12
Just for comparison, this is what my previous SQL gives (with maxscratch
in the group by clause as you added it)
STGPOOL_NAME MAXSCRATCH Unnamed[3]
------------------ ----------- -----------
ONSITE 30 270
ONSITE_MNT 150 270
ONSITE_MNT_OFF 20 270
PERFTEST 20 270
RMM_ARCHIVE 270
RMM_ARCH_PHNX 20 270
RMM_ARCH_SHWD 20 270
RMM_COPY_PHNX 25 270
RMM_COPY_SHWD 100 270
RMM_DISKPOOL 270
RMM_RMAN_PHNX 40 270
RMM_RMAN_SHWD 40 270
RMM_UNIX_DISK 270
RMM_UNIX_PHNX 70 270
RMM_UNIX_SHWD 70 270
TEMP_DELPOOL 999 270
UKS_ARCHIVE 270
UKS_ARCH_PHNX 10 270
UKS_ARCH_SHWD 10 270
UKS_COPY_PHNX 100 270
UKS_DISKPOOL 270
UKS_DISKPOOL_COLL 270
UKS_OFFSITE_COLL 60 270
UKS_ONSITE 60 270
UKS_ONSITE_COLL 60 270
UNBOUND_DATA 270
You learn something new every day - I never knew you could get friendly
DBA's ;P
Thanks ,
Matt .
-----Original Message-----
From: Christian Svensson
<christian.svensson AT CRISTIE DOT SE>@EME
Sent: Friday, January 16, 2004 1:45 PM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: SV: SQL query
Hi Matt!
I try your last select command but just only add
stgpools.maxscratch in
the end of your line.
select stgpools.stgpool_name,
stgpools.maxscratch,count(*) from
volumes,stgpools where volumes.stgpool_name in (select
stgpool_name from
stgpools where devclass='ULTRIUM1') group by
stgpools.stgpool_name,
stgpools.maxscratch
Result :
STGPOOL_NAME MAXSCRATCH Unnamed[3]
------------------ ----------- -----------
ARCHIVEPOOL 11
BACKUPPOOL 11
COPYPOOL 3 11
DISKPOOL 11
SPACEMGPOOL 11
TAPEPOOL 11 11
/Christian
-----Ursprungligt meddelande-----
Fran: ADSM: Dist Stor Manager
[mailto:ADSM-L AT VM.MARIST DOT EDU]For Warren,
Matthew (Retail)
Skickat: den 16 januari 2004 14:30
Till: ADSM-L AT VM.MARIST DOT EDU
Amne: Re: SQL query
Hi Christian,
Sorry, I may not have worded my problem very clearly.
Using the
follwing tables and columns;
TABLENAME COLNAME
------------------ ------------------
STGPOOLS STGPOOL_NAME
STGPOOLS DEVCLASS
STGPOOLS MAXSCRATCH
VOLUMES STGPOOL_NAME
I would like to find out;
For every stgpool that has a device class of ultrium1, I
need to know
the stgpool name, the maxscratch value ((IE: the maximum
number of
scratch tapes alolwed for use in the pool)) for the
stgpool and a count
of how many volumes are in the stgpool
In case it helps (I doubt it :/ ) heres a copy of the
latest attempt
I made at trying to work it out;
tsm: CARSINGTON>select stgpools.stgpool_name,
stgpools.maxscratch,
count(*) from volumes where stgpool_name in (select
stgpool_name from
stgpools where devclass='ULTRIUM1') group by
stgpool_name
ANR2940E The reference 'STGPOOLS.STGPOOL_NAME' is an
unknown SQL column
name.
|
.......V.......................................................
select stgpools.stgpool_name,
stgpools.maxscratch, count(*) fro
ANS8001I Return code 3.
tsm: CARSINGTON>select stgpools.stgpool_name,
stgpools.maxscratch,
count(*) from volumes,stgpools where stgpool_name in
(select
stgpool_name from stgpools where devclass='ULTRIUM1')
group by
stgpool_name
ANR2941E The column reference 'STGPOOL_NAME' matches
more than one SQL
column name.
|
.........................V.....................................
m volumes,stgpools where stgpool_name in
(select stgpool_name f
ANS8001I Return code 3.
tsm: CARSINGTON>select stgpools.stgpool_name,
stgpools.maxscratch,
count(*) from volumes,stgpools where
volumes.stgpool_name in (select
stgpool_name from stgpools where devclass='ULTRIUM1')
group by
stgpool_name
ANR2941E The column reference 'STGPOOL_NAME' matches
more than one SQL
column name.
|
...................................................V...........
from stgpools where devclass='ULTRIUM1' ) group
by stgpool_name
ANS8001I Return code 3.
tsm: CARSINGTON>select stgpools.stgpool_name,
stgpools.maxscratch,
count(*) from volumes,stgpools where
volumes.stgpool_name in (select
stgpool_name from stgpools where devclass='ULTRIUM1')
group by
stgpools.stgpool_name
ANR2938E The column 'MAXSCRATCH' is not allowed in this
context; it must
either be named in the GROUP BY clause or be nested
within an aggregate
function.
|
..............................V................................
select stgpools.stgpool_name,
stgpools.maxscratch, count(*) fro
ANS8001I Return code 3.
tsm: CARSINGTON>pull hair, gnash teeth
-----Original Message-----
From: Christian Svensson
<christian.svensson AT CRISTIE DOT SE>@EME
Sent: Friday, January 16, 2004 1:06 PM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: SV: SQL query
Hi Matt!
Im not sure what you looking for.
But maybe this helps you...
Replace YOUR LTOCLASS NAME with the real
Device class
name.
select stgpool_name,count(*) as
"Maxscratch" from
volumes where
devclass_name='YOUR LTOCLASS NAME'
/Christian
-----Ursprungligt meddelande-----
Fran: ADSM: Dist Stor Manager
[mailto:ADSM-L AT VM.MARIST DOT EDU]For Warren,
Matthew (Retail)
Skickat: den 16 januari 2004 13:03
Till: ADSM-L AT VM.MARIST DOT EDU
Amne: SQL query
Hallo TSMers,
I think I've mentioned before, my SQL's
not so hot. I'm
practising all I
can, although, I can't seem to crack
this one, or others
like it;
I would like to find out (with SQL if
possible, I could
do it via script
etc.. easy enough) ;
For every stgpool that has a device
class of ultrium1;
the stgpool name,
the maxscratch value for the stgpool and
how many
volumes are in that
stgpool.
I'm incredibly hazy on things like
joins, despite having
read around the
subject, and TSM only implements a
cut-down SQL. It is,
to get
technical, doing my head in.
Thanks,
Matt.
___________________________ Disclaimer
Notice
__________________________
This message and any attachments are
confidential and
should only be
read
by those to whom they are addressed. If
you are not the
intended
recipient, please contact us, delete the
message from
your computer and
destroy any copies. Any distribution or
copying without
our prior
permission is
prohibited.
Internet communications are not always
secure and
therefore the Powergen
Group does not accept legal
responsibility for this
message. The
recipient is responsible for verifying
its authenticity
before acting on
the
contents. Any views or opinions
presented are solely
those of the author
and do not necessarily represent those
of the Powergen
Group.
Registered addresses:
Powergen UK plc, 53 New Broad Street,
London, EC2M 1SL
Registered in England & Wales No.
2366970
Powergen Retail Limited, Westwood Way,
Westwood
Business Park,
Coventry CV4 8LG.
Registered in England and Wales No:
3407430
Telephone +44 (0) 2476 42 4000
Fax +44 (0) 2476 42 5432
___________________________ Disclaimer Notice __________________________
This message and any attachments are confidential and should only be read
by those to whom they are addressed. If you are not the intended recipient,
please contact us, delete the message from your computer and destroy any
copies. Any distribution or copying without our prior permission is
prohibited.
Internet communications are not always secure and therefore the Powergen
Group does not accept legal responsibility for this message. The recipient is
responsible for verifying its authenticity before acting on the
contents. Any views or opinions presented are solely those of the author
and do not necessarily represent those of the Powergen Group.
Registered addresses:
Powergen UK plc, 53 New Broad Street, London, EC2M 1SL
Registered in England & Wales No. 2366970
Powergen Retail Limited, Westwood Way, Westwood Business Park,
Coventry CV4 8LG.
Registered in England and Wales No: 3407430
Telephone +44 (0) 2476 42 4000
Fax +44 (0) 2476 42 5432
|