CSsize_profiling_mssqlserver.sql 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. -- Licensed Materials - Property of IBM
  2. --
  3. -- BI and PM: CM
  4. --
  5. -- (C) Copyright IBM Corp. 2008, 2014
  6. --
  7. -- US Government Users Restricted Rights - Use, duplication or disclosure
  8. -- restricted by GSA ADP Schedule Contract with IBM Corp.
  9. -- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. -- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. select count(*) as "total number of objects" from CMOBJECTS;
  12. select c.NAME as "class name", count(*) as "number of objects"
  13. from CMOBJECTS o, CMCLASSES c
  14. group by o.CLASSID, c.CLASSID, C.NAME
  15. having c.CLASSID=o.CLASSID
  16. order by c.NAME;
  17. select c.NAME as "class name", count(*) as "number of secured objects"
  18. from CMOBJECTS o, CMCLASSES c, CMPOLICIES p
  19. where o.CMID=p.CMID and p.POLICIES is not null
  20. group by o.CLASSID, c.CLASSID, C.NAME
  21. having c.CLASSID=o.CLASSID
  22. order by c.NAME;
  23. select count(*) as "Total number of outputs",
  24. SUM(cast(coalesce(DATALENGTH(DATAPROP),0) as bigint)) as "Total size of outputs" from CMDATA
  25. where DATAPROP is not NULL;
  26. select count(*) as "Outputs under 10KB" from CMDATA
  27. where DATAPROP is not NULL and DATALENGTH(DATAPROP) < 10240;
  28. select count(*) as "Outputs 10KB - 100KB" from CMDATA
  29. where DATALENGTH(DATAPROP) >= 10240 and DATALENGTH(DATAPROP) < 102400;
  30. select count(*) as "Outputs 100KB - 1MB" from CMDATA
  31. where DATALENGTH(DATAPROP) >= 102400 and DATALENGTH(DATAPROP) < 1048576;
  32. select count(*) as "Outputs 1MB - 10MB" from CMDATA
  33. where DATALENGTH(DATAPROP) >= 1048576 and DATALENGTH(DATAPROP) < 10485760;
  34. select count(*) as "Outputs 10MB-100MB" from CMDATA
  35. where DATALENGTH(DATAPROP) >= 10485760 and DATALENGTH(DATAPROP) < 104857600;
  36. select count(*) as "Outputs 100MB-1GB" from CMDATA
  37. where DATALENGTH(DATAPROP) >= 104857600 and DATALENGTH(DATAPROP) < 1073741824;
  38. select count(*) as "Outputs > 1GB" from CMDATA
  39. where DATALENGTH(DATAPROP) >= 1073741824;
  40. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.SPEC),0) as bigint)) as "Total size of specifications"
  41. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS7 p
  42. where o.CMID=p.CMID and p.SPEC is not NULL
  43. group by o.CLASSID, c.CLASSID, C.NAME
  44. having c.CLASSID=o.CLASSID
  45. order by c.NAME;
  46. select count(*) as "Specifications < 10KB" from CMOBJPROPS7
  47. where SPEC is not NULL and DATALENGTH(SPEC) < 10240;
  48. select count(*) as "Specifications 10KB - 100KB" from CMOBJPROPS7
  49. where DATALENGTH(SPEC) >= 10240 and DATALENGTH(SPEC) < 102400;
  50. select count(*) as "Specifications 100KB - 1MB" from CMOBJPROPS7
  51. where DATALENGTH(SPEC) >= 102400 and DATALENGTH(SPEC) < 1048576;
  52. select count(*) as "Specifications > 1MB" from CMOBJPROPS7
  53. where DATALENGTH(SPEC) >= 1048576;
  54. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.SPEC),0) as bigint)) as "Total size of specifications"
  55. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS34 p
  56. where o.CMID=p.CMID and p.SPEC is not NULL
  57. group by o.CLASSID, c.CLASSID, C.NAME
  58. having c.CLASSID=o.CLASSID
  59. order by c.NAME;
  60. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.SPEC),0) as bigint)) as "Total size of specifications"
  61. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS43 p
  62. where o.CMID=p.CMID and p.SPEC is not NULL
  63. group by o.CLASSID, c.CLASSID, C.NAME
  64. having c.CLASSID=o.CLASSID
  65. order by c.NAME;
  66. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.SPEC),0) as bigint)) as "Total size of specifications"
  67. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS66 p
  68. where o.CMID=p.CMID and p.SPEC is not NULL
  69. group by o.CLASSID, c.CLASSID, C.NAME
  70. having c.CLASSID=o.CLASSID
  71. order by c.NAME;
  72. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.RELATED),0) as bigint)) as "Total size of specifications"
  73. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS14 p
  74. where o.CMID=p.CMID and p.RELATED is not NULL
  75. group by o.CLASSID, c.CLASSID, C.NAME
  76. having c.CLASSID=o.CLASSID
  77. order by c.NAME;
  78. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.SPEC),0) as bigint)) as "Total size of specifications"
  79. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS63 p
  80. where o.CMID=p.CMID and p.SPEC is not NULL
  81. group by o.CLASSID, c.CLASSID, C.NAME
  82. having c.CLASSID=o.CLASSID
  83. order by c.NAME;
  84. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.SPEC),0) as bigint)) as "Total size of specifications"
  85. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS42 p
  86. where o.CMID=p.CMID and p.SPEC is not NULL
  87. group by o.CLASSID, c.CLASSID, C.NAME
  88. having c.CLASSID=o.CLASSID
  89. order by c.NAME;
  90. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.SPEC),0) as bigint)) as "Total size of specifications"
  91. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS68 p
  92. where o.CMID=p.CMID and p.SPEC is not NULL
  93. group by o.CLASSID, c.CLASSID, C.NAME
  94. having c.CLASSID=o.CLASSID
  95. order by c.NAME;
  96. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.SPEC),0) as bigint)) as "Total size of specifications"
  97. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS56 p
  98. where o.CMID=p.CMID and p.SPEC is not NULL
  99. group by o.CLASSID, c.CLASSID, C.NAME
  100. having c.CLASSID=o.CLASSID
  101. order by c.NAME;
  102. select c.NAME as "class name", count(*) as "Total number of specifications", SUM(cast(coalesce(DATALENGTH(p.SPEC),0) as bigint)) as "Total size of specifications"
  103. from CMOBJECTS o, CMCLASSES c, CMOBJPROPS57 p
  104. where o.CMID=p.CMID and p.SPEC is not NULL
  105. group by o.CLASSID, c.CLASSID, C.NAME
  106. having c.CLASSID=o.CLASSID
  107. order by c.NAME;
  108. select count(*) as "Total number of models" from CMOBJPROPS7
  109. where CMODEL is not NULL;
  110. select count(*) as "Models < 10KB" from CMOBJPROPS7
  111. where DATALENGTH(CMODEL) < 10240;
  112. select count(*) as "Models 10KB - 100KB" from CMOBJPROPS7
  113. where DATALENGTH(CMODEL) > 10240 and DATALENGTH(CMODEL) < 102400;
  114. select count(*) as "Models 100KB - 1MB" from CMOBJPROPS7
  115. where DATALENGTH(CMODEL) > 102400 and DATALENGTH(CMODEL) < 1048576;
  116. select count(*) as "Models > 1MB" from CMOBJPROPS7
  117. where DATALENGTH(CMODEL) > 1048576;
  118. create table #CMPROFILE (CMID int, CLASSID int, NOBJECTS bigint)
  119. insert into #CMPROFILE (CMID, CLASSID, NOBJECTS)
  120. SELECT o.PCMID, p.CLASSID, count(*) from CMOBJECTS o left outer join CMOBJECTS p on o.PCMID=p.CMID
  121. where p.CLASSID = 1 or p.CLASSID=17 or p.CLASSID=12 or p.CLASSID=9
  122. group by o.PCMID, p.CLASSID
  123. select c.NAME as "object class", pr.NOBJECTS as "number of children", count(*) as "number of objects"
  124. from #CMPROFILE pr left outer join CMCLASSES c on pr.CLASSID=c.CLASSID
  125. group by c.NAME, pr.NOBJECTS
  126. order by c.NAME, pr.NOBJECTS;
  127. select TYPE as "schedule type", count(*) "number of schedules"
  128. from CMOBJPROPS2 where ACTIVE=1 and TYPE is not NULL
  129. group by TYPE;
  130. insert into #CMPROFILE (CMID, CLASSID, NOBJECTS)
  131. SELECT o.PCMID, p.CLASSID, count(*) from CMOBJECTS o left outer join CMOBJECTS p on o.PCMID=p.CMID
  132. where p.CLASSID = 55 and o.CLASSID = 57 or o.CLASSID=17
  133. group by o.PCMID, p.CLASSID
  134. select c.NAME as "object class", pr.NOBJECTS as "number of children", count(*) as "number of objects"
  135. from #CMPROFILE pr left outer join CMCLASSES c on pr.CLASSID=c.CLASSID
  136. group by c.NAME, pr.NOBJECTS
  137. order by c.NAME, pr.NOBJECTS;
  138. select count(*) as "Number of empty policies" from CMPOLICIES
  139. where DATALENGTH(POLICIES) = 0;
  140. select count(*) as "Policies 1-127 bytes" from CMPOLICIES
  141. where DATALENGTH(POLICIES) >= 1 and DATALENGTH(POLICIES) <= 127;
  142. select count(*) as "Policies 128-255 bytes" from CMPOLICIES
  143. where DATALENGTH(POLICIES) >= 128 and DATALENGTH(POLICIES) <= 255;
  144. select count(*) as "Policies 256-511 bytes" from CMPOLICIES
  145. where DATALENGTH(POLICIES) >= 256 and DATALENGTH(POLICIES) <= 511;
  146. select count(*) as "Policies 512-1023 bytes" from CMPOLICIES
  147. where DATALENGTH(POLICIES) >= 512 and DATALENGTH(POLICIES) <= 1023;
  148. select count(*) as "Policies 1K-2K" from CMPOLICIES
  149. where DATALENGTH(POLICIES) >= 1023 and DATALENGTH(POLICIES) <= 2047;
  150. select count(*) as "Policies 2K-4K" from CMPOLICIES
  151. where DATALENGTH(POLICIES) >= 2048 and DATALENGTH(POLICIES) <= 4095;
  152. select count(*) as "Policies 4K-6K" from CMPOLICIES
  153. where DATALENGTH(POLICIES) >= 4096 and DATALENGTH(POLICIES) <= 6143;
  154. select count(*) as "Policies 6K-8K" from CMPOLICIES
  155. where DATALENGTH(POLICIES) >= 6144 and DATALENGTH(POLICIES) <= 8191;
  156. select count(*) as "Policies > 8K" from CMPOLICIES
  157. where DATALENGTH(POLICIES) > 8192;
  158. select count(*) as "Archive queue size" from CMARCHIVEQUEUE;
  159. select count(*) as "Delete queue size" from CMDELETEQUEUE;
  160. drop table #CMPROFILE