cancel
Showing results for 
Search instead for 
Did you mean: 

SQL query required

GTK
Level 6

Hi

is it possible to run a SQL query that will show all archives that have been created in the past week? for reporting purposes we would like to know how many archives are being created weekly/monthly

 

We are on EV8 sp5

 

thanks

1 ACCEPTED SOLUTION

Accepted Solutions

TonySterling
Moderator
Moderator
Partner    VIP    Accredited Certified

No, the information you want isn't contained in the EnterpriseVaultDirectory database, hence the need to run the query against the vault stores. 

View solution in original post

10 REPLIES 10

TonySterling
Moderator
Moderator
Partner    VIP    Accredited Certified

This one from JW3 might work:

https://www-secure.symantec.com/connect/forums/sql-query-will-list-all-archives-oldest-item-sentreceived-date-based-creation-date-oldest-e-m#comment-9145441

SELECT  A.ArchiveName "Archive Name",
        AP.CreatedDate "Archive Created",
        AP.ModifiedDate "Archived Last Modified",
        MIN(S.IdDateTime) "Oldest Sent/Received Item",
        MAX(S.IdDateTime) "Newest Sent/Received Item",
        MIN(S.ArchivedDate) "Oldest Archived Item",
        MAX(S.ArchivedDate) "Newest Archived Item"
FROM    EnterpriseVaultDirectory.dbo.Archive A,
        EnterpriseVaultDirectory.dbo.Root R,
        EVVSYourVaultStore_01.dbo.ArchivePoint AP,
        EVVSYourVaultStore_01.dbo.Saveset S
WHERE   A.RootIdentity = R.RootIdentity
  AND   R.VaultEntryId = AP.ArchivePointId
  AND   AP.ArchivePointIdentity = S.ArchivePointIdentity
  AND   A.ArchiveName = 'My User'
GROUP BY A.ArchiveName, AP.CreatedDate, AP.ModifiedDate

GTK
Level 6

hi Tony

I dont have the name of a specific user. We are a large org with almost 100k archives. Ideally i want to be able to run a report weekly to see how many users were enabled for EV. does EV make a note of archive creaiton date for users ?

 

thanks

AndrewB
Moderator
Moderator
Partner    VIP    Accredited

you could add another clause to the WHERE statement like:

 

AND AP.CreatedDate >= DATEADD(day, -7, CURRENT_TIMESTAMP)

GTK
Level 6

ok that works.. but how can i run this against all vault stores at once instead of the 20 or so we have. I just want to run this report once and not 20 times

 

thanks

Vinoth_Siva1
Level 2
Partner Accredited

Hi GTK,

To have a complete report on all archive created in all VaultStore:

Use the query by swapping the VS DB name by yours.

Use "--VS DB name here--"

SELECT  A.ArchiveName "Archive Name",
        Cast(AP.CreatedDate as date) "Archive Created",
        Cast(AP.ModifiedDate as date) "Archived Last Modified",
        Cast(MAX(S.IdDateTime) as date) "Newest Sent/Received Item",
        Cast(MAX(S.ArchivedDate) as date) "Newest Archived Item"
FROM    EnterpriseVaultDirectory.dbo.Archive A,
        EnterpriseVaultDirectory.dbo.Root R,
        "--VS DB name here--".dbo.ArchivePoint AP,
        "--VS DB name here--".dbo.Saveset S
WHERE   A.RootIdentity = R.RootIdentity
  AND   R.VaultEntryId = AP.ArchivePointId
  AND   AP.ArchivePointIdentity = S.ArchivePointIdentity
GROUP BY A.ArchiveName, AP.CreatedDate, AP.ModifiedDate

This query must be executed against each Vaultstore database.

GTK
Level 6

Ideally i dont want to run against each vault store as we have a lot and the report would take ages to generate. Currently if i use this SQL query it gives me all enabled users for EV

 

use enterprisevaultdirectory

select exchangecomputer from exchangeserverentry

select

ESE.ExchangeComputer,

EME.mbxdisplayname,

EME.mbxalias,

EME.mbxNTuser,

EME.LegacyMBxDN

from exchangemailboxentry EME

inner join exchangeserverentry ESE on ESE.exchangeserveridentity=EME.exchangeserveridentity

where mbxarchivingstate = 1

order by EME.ExchangeServerIdentity, EME.MbxNTUser

 

Can this not be amended to include a date value to determine archive date creation ?

TonySterling
Moderator
Moderator
Partner    VIP    Accredited Certified

No, the information you want isn't contained in the EnterpriseVaultDirectory database, hence the need to run the query against the vault stores. 

Vinoth_Siva1
Level 2
Partner Accredited

Please find here the new SQL query to get every archive from each VS DB:

(You can tweak it a little to add the type to differeciate between PF/FSA/mailbox ....)

######## START ########

Declare @variable table
        (        
        ID int IDENTITY(1,1) PRIMARY KEY,
        vsDB nvarchar(32)
        )

create table ##list
        (
        archivename varchar(max),
        creation date,
        modified date,
        Newest_Sent_Received_Item date,
        Newest_Archived_Item date
        )
insert into @variable  
select DatabaseDSN from EnterpriseVaultDirectory.dbo.VaultStoreEntry

Declare @db nvarchar(32),
            @Query      NVARCHAR(MAX)


Declare @i int
select   @i = min(ID) from @variable
Declare @max int
select   @max = max(ID) from @variable


While    @i <= @max
begin
select   @db=(select vsDB from @variable where ID=@i)
--
set @Query =N'insert into ##list
SELECT  A.ArchiveName "Archive Name",
        Cast(AP.CreatedDate as date) "Archive Created",
        Cast(AP.ModifiedDate as date) "Archived Last Modified",
        Cast(MAX(S.IdDateTime) as date) "Newest Sent/Received Item",
        Cast(MAX(S.ArchivedDate) as date) "Newest Archived Item"
FROM    EnterpriseVaultDirectory.dbo.Archive A,
        EnterpriseVaultDirectory.dbo.Root R,
        ' + @db + '.dbo.ArchivePoint AP,
        ' + @db + '.dbo.Saveset S
WHERE   A.RootIdentity = R.RootIdentity
  AND   R.VaultEntryId = AP.ArchivePointId
  AND   AP.ArchivePointIdentity = S.ArchivePointIdentity
GROUP BY A.ArchiveName, AP.CreatedDate, AP.ModifiedDate'
EXEC sp_executesql @Query
--
set @i=@i + 1
end


select * from ##list
drop table     ##list

--there's no need to drop the table if you want to keep it. But drop it before running this query again.

######## END ########

 

Regards,

Vinoth Siva

GTK
Level 6

thanks for the help guys but looks like EV cant do what i am after

AndrewB
Moderator
Moderator
Partner    VIP    Accredited

what about getting this information from the provisioning reports?