Pages

Friday, June 1, 2012

How to find Count of items archived per Archive

 
If you ask me ‘How to find count of item archived since certain dates & archived by a specific archiving task? Oh! its not that easy, I would say. But I always feel that there is a solution for each question!
As far I know the only possible way through we can achieve this goal is by writing a SQL query, below query will help you to find ‘number of items’ and ‘Size of items’ archived into a specific store from each Exchange server/task. You have to change the Vault Store DB name and desired date before running this query.

SELECT ESE.ExchangeComputer "Exchange Server", 
       COUNT(S.IdTransaction) "Items Archived",
       SUM(S.ItemSize)/1024 "Size of Items (MB)"
FROM   EnterpriseVaultDirectory.dbo.ExchangeMailboxEntry EME,
       EnterpriseVaultDirectory.dbo.ExchangeMailboxStore EMS,
       EnterpriseVaultDirectory.dbo.ExchangeServerEntry ESE,
       yourVaultStore.dbo.ArchivePoint AP,
       yourVaultStore.dbo.Saveset S
WHERE  S.ArchivePointIdentity = AP.ArchivePointIdentity
  AND  AP.ArchivePointId = EME.DefaultVaultId
  AND  EME.MbxStoreIdentity = EMS.MbxStoreIdentity
  AND  EMS.ExchangeServerIdentity = ESE.ExchangeServerIdentity 
  AND  S.ArchivedDate BETWEEN '2012-03-01' AND '2012-03-15'
GROUP BY ESE.ExchangeComputer
Result looks like below,

  image
Second query which provides report for task and you have to provide ‘task name’, Database Name and the number of days from today you want report. This example shows ‘-10’ that means this query will give you a result for last 10 days.
Note that, this query you have to run against each store if you have users distributed across different stores and the task is same.
SELECT CE.ComputerName "EV Server",
       T.Name "Task Name",
       ESE.ExchangeComputer "Exchange Server",
       COUNT(s.IdTransaction) "Items Archived"
FROM  EnterpriseVaultDirectory.dbo.ExchangeMailboxEntry EME,
      EnterpriseVaultDirectory.dbo.ExchangeMailboxStore EMS,
      EnterpriseVaultDirectory.dbo.ExchangeServerEntry ESE,
      EnterpriseVaultDirectory.dbo.ArchivingRetrievalTask ART,
      EnterpriseVaultDirectory.dbo.Task T,
      EnterpriseVaultDirectory.dbo.ComputerEntry CE,
      yourVaultStore.dbo.ArchivePoint AP,
      yourVaultStore.dbo.Saveset S
WHERE S.ArchivePointIdentity = AP.ArchivePointIdentity
  AND AP.ArchivePointId = EME.DefaultVaultId
  AND EME.MbxStoreIdentity = EMS.MbxStoreIdentity
  AND EMS.ExchangeServerIdentity = ESE.ExchangeServerIdentity
  AND ART.ExchangeServerEntryId = ESE.ExchangeServerEntryId
  AND ART.TaskEntryId = T.TaskEntryId
  AND T.ComputerEntryId = CE.ComputerEntryId
  AND T.TaskType = 0
  AND T.Name = 'Exchange Mailbox Archiving Task name'
  AND S.ArchivedDate > DATEADD(d, -10, getDate())
GROUP BY CE.ComputerName, T.Name, ESE.ExchangeComputer


Result looks like,
image

2 comments:

  1. I got this error:

    Msg 207, Level 16, State 1, Line 17
    Invalid column name 'ExchangeServerIdentity'.

    ReplyDelete
  2. Hi,
    same error as AlbertWT. ExchangeSeverIdentity is not a column of the ExchangeMailboxStore table. This should be the error. Could you please correct the query? It's really useful if working...

    ReplyDelete