home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / datatl25.zip / DCTDSGN.Z / EWSQDMSG.QRY < prev    next >
Text File  |  1997-09-11  |  3KB  |  100 lines

  1. #NAME#
  2. DA_DB2390StoragegroupUsage
  3. #DESCRIPTION#
  4. The DB2/390 storage group impact analysis query returns the the databases, tablespaces and indexspaces which use the storage group.
  5.  
  6. View type: DAQDB2390Storagegroup
  7.  
  8. Modifications:
  9. This query uses a UNION to produce a more compact result table. Change the search criteria of the storage group name using the = (equals), IN or LIKE elements in each SQL WHERE clause.     
  10.  
  11. #MODIFIED#
  12.  
  13. #VERSION#
  14.  
  15. #SQL STATEMENT#
  16. SELECT DISTINCT
  17.   s.db2390Storagegroup,
  18.   s.inRelationalSystem..relationalSystem,
  19.   s.inPhysicalDesign..db2390PhysicalDesign,
  20.   'Database' as objectType,
  21.   o.db2390Database as usedByObject,
  22.   0 as partitionNumber
  23. FROM OUTER
  24.   DAQDB2390Storagegroup s,
  25.   (s.usedByDatabase) o,
  26.   PartView p
  27. WHERE
  28.   s.db2390Storagegroup LIKE '<>%' AND
  29.   o.db2390Database=p.baseName AND
  30.   p.partType='DSRMRDDatabase'
  31. UNION
  32. SELECT DISTINCT
  33.   s.db2390Storagegroup,
  34.   s.inRelationalSystem..relationalSystem,
  35.   s.inPhysicalDesign..db2390PhysicalDesign,
  36.   'Tablespace' as objectType,
  37.   o.db2390Tablespace as usedByObject,
  38.   0 as partitionNumber
  39.   FROM OUTER
  40.   DAQDB2390Storagegroup s,
  41.   (s.usedByTablespace) o,
  42.   PartView p
  43. WHERE
  44.   s.db2390Storagegroup LIKE '<>%' AND
  45.   o.db2390Tablespace=p.baseName AND
  46.   p.partType='DSRMRDTablespace'
  47. UNION
  48. SELECT DISTINCT
  49.   s.db2390Storagegroup,
  50.   s.inRelationalSystem..relationalSystem,
  51.   s.inPhysicalDesign..db2390PhysicalDesign,
  52.   'Tablespace Partition' as objectType,
  53.   o.db2390Tablespace as usedByObject,
  54.   s.tsPartNumber as partitionNumber
  55.   FROM OUTER
  56.   DAQDB2390Storagegroup s,
  57.   (s.usedByPartTablespace) o,
  58.   PartView p
  59. WHERE
  60.   s.db2390Storagegroup LIKE '<>%' AND
  61.   o.db2390Tablespace=p.baseName AND
  62.   p.partType='DSRMRDTablespace'
  63. UNION
  64. SELECT DISTINCT
  65.   s.db2390Storagegroup,
  66.   s.inRelationalSystem..relationalSystem,
  67.   s.inPhysicalDesign..db2390PhysicalDesign,
  68.   'Index' as objectType,
  69.   o.db2390Index as usedByObject,
  70.   0 as partitionNumber
  71.   FROM OUTER
  72.   DAQDB2390Storagegroup s,
  73.   (s.usedByIndex) o,
  74.   PartView p
  75. WHERE
  76.   s.db2390Storagegroup LIKE '<>%' AND
  77.   o.db2390Index=p.baseName AND
  78.   p.partType='DSRMRDIndex'
  79. UNION
  80. SELECT DISTINCT
  81.   s.db2390Storagegroup,
  82.   s.inRelationalSystem..relationalSystem,
  83.   s.inPhysicalDesign..db2390PhysicalDesign,
  84.   'Index Partition' as objectType,
  85.   o.db2390Index as usedByObject,
  86.   s.idxPartNumber as partitionNumber
  87.   FROM OUTER
  88.   DAQDB2390Storagegroup s,
  89.   (s.usedByPartIndex) o,
  90.   PartView p
  91. WHERE
  92.   s.db2390Storagegroup LIKE '<>%' AND
  93.   o.db2390Index=p.baseName AND
  94.   p.partType='DSRMRDIndex'
  95. ORDER BY
  96.   1 ASC,
  97.   5 ASC,
  98.   4 ASC;
  99.   
  100.