05-13-2014 09:45 AM
Hi all,
I am not a SQL guys so sorry if this is a easy task, but i just havent' learned to writte SQL scripts. I need to come up with a query to list all the archives that have zero items in them. We probably have 1000's and i would like to get those cleaned up and removed. So is it possible to run a SQL query to list out all of the archives with zero itmes?
Thanks
DG
Solved! Go to Solution.
05-13-2014 10:03 AM
This is probably the easiest query, would need to be run on each vault store.
So change EVVSYourVaultStore_1 to the database name of your vault store
SELECT A.ArchiveName "Archive Name", R.VaultEntryID "Archive ID", AP.ModifiedDate "Last Modified", AP.HighestIndexSeqNo "Highest Index Num", AP.ArchivedItems "Archived Items" FROM EnterpriseVaultDirectory.dbo.Archive A, EnterpriseVaultDirectory.dbo.Root R, EVVSYourVaultStore1_1.dbo.ArchivePoint AP WHERE AP.ArchivePointId = R.VaultEntryID AND R.RootIdentity = A.RootIdentity AND AP.ArchivedItems = 0
05-13-2014 10:03 AM
This is probably the easiest query, would need to be run on each vault store.
So change EVVSYourVaultStore_1 to the database name of your vault store
SELECT A.ArchiveName "Archive Name", R.VaultEntryID "Archive ID", AP.ModifiedDate "Last Modified", AP.HighestIndexSeqNo "Highest Index Num", AP.ArchivedItems "Archived Items" FROM EnterpriseVaultDirectory.dbo.Archive A, EnterpriseVaultDirectory.dbo.Root R, EVVSYourVaultStore1_1.dbo.ArchivePoint AP WHERE AP.ArchivePointId = R.VaultEntryID AND R.RootIdentity = A.RootIdentity AND AP.ArchivedItems = 0
05-13-2014 10:12 AM
Jesus thanks for the quick reply. So if my mailbox vault store databases name is evmailboxvault the script would look like this correct?
SELECT A.ArchiveName "Archive Name",
R.VaultEntryID "Archive ID",
AP.ModifiedDate "Last Modified",
AP.HighestIndexSeqNo "Highest Index Num",
AP.ArchivedItems "Archived Items"
FROM EnterpriseVaultDirectory.dbo.Archive A,
EnterpriseVaultDirectory.dbo.Root R,
evmailboxvault.dbo.ArchivePoint AP
WHERE AP.ArchivePointId = R.VaultEntryID
AND R.RootIdentity = A.RootIdentity
AND AP.ArchivedItems = 0
05-13-2014 10:15 AM
yup, you can run this query to find out the name of the databases too.
Just use the DatabaseDSN Name, and replace EVVSYourVaultStore1_1 with the name of the Database returned from this query
USE EnterpriseVaultDirectory SELECT VaultStoreName, DatabaseDSN, SQLServer FROM VaultStoreEntry ORDER BY VaultStoreName
05-13-2014 10:27 AM
Thank you sir!
05-13-2014 10:30 AM
Would there be a way to add the archive name in also?
05-13-2014 10:33 AM
Nevermind found it. Thanks again for all your help.
05-14-2014 07:47 AM
why is that the archive mailbox got 0 items ?
05-14-2014 08:15 AM
05-14-2014 04:59 PM
Cool, so in this case it can be deleted safely from the Vault Admin Console one by one ?