[OCI DWH][SQL] Across All NetApp Qtree File Shares In Your Estate, How Many Are Single Protocol, How Many Are Multi-protocol?

Just a quickie to answer the titular question. Or put in other words, how many qtrees just have one access protocol (CIFS or NFS), and how many qtrees have two access protocols (CIFS and NFS)?

SELECT `Protocol Count`,count(*) FROM(
  SELECT qtreeId,count(*) AS 'Protocol Count' FROM(
    SELECT DISTINCT qtreeId,protocol FROM nas_share AS n
    JOIN nas_file_share AS f ON f.id = n.fileShareId
    JOIN storage AS s ON s.id = n.storageId
    WHERE s.model LIKE 'FAS%' OR s.model LIKE 'AFF%'
  ) AS t0
  GROUP BY qtreeId
) AS t1
GROUP BY `Protocol Count`

What if the question was:

Q: Across my NetApp estate, how many TB are used by qtrees with CIFS, CIFS&NFS, NFS protocols?

SELECT
    `Protocols`
  , FLOOR(SUM(`QtUsedTB`)) AS QtUsedTB
FROM(
  SELECT
      f.qtreeId
    , GROUP_CONCAT(DISTINCT n.protocol) AS 'Protocols'
    ,  qt.usedCapacityMB/(1024*1024) AS 'QtUsedTB'
  FROM nas_share AS n
  JOIN nas_file_share AS f ON f.id = n.fileShareId
  JOIN storage AS s ON s.id = n.storageID
  JOIN qtree AS q ON q.id = f.qtreeId
  JOIN quota AS qt ON qt.qtreeId = q.id
  WHERE s.model LIKE 'FAS%' OR s.model LIKE 'AFF%'
  GROUP BY f.qtreeId
) AS t0
GROUP BY `Protocols`

Note: With the above of course qtree quotas need to be enabled to track the qtree usage (so it won't include any DR.)


Comments