Forums  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Member List  Search  FAQ  Ticket List  Log Out

 

Updated SQL Scripts

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Archiving & Fax] >> GFI MailArchiver >> Updated SQL Scripts Page: [1]
Login
Message << Older Topic   Newer Topic >>
Updated SQL Scripts - 2.Nov.2005 8:17:00 PM   
PACEGMBH

 

Posts: 62
Joined: 23.Mar.2005
From: DE - Berlin
Status: offline
Hi There,

please be so kind and support me with new SQL scripts, which enable me to delete messages by ID, subject (or part of subject) and address.
I suppose the old scipts not to work anymore with the new dB structure.

Tanks,

John
Post #: 1
RE: Updated SQL Scripts - 3.Nov.2005 2:56:00 AM   
Rodion

 

Posts: 834
Joined: 15.Nov.2004
Status: offline
Uncomment the required section, modify the values and execute using SQL Query Analyser

code:
declare @tbl table
(id int)

-- filter messages to be deleted by date
/*
insert into @tbl
select id from arc where [date]<'2005-09-20'
*/

-- filter messages to be deleted by subject
/*
insert into @tbl
select id from arc where full_subject like 'xx%'
*/

-- filter messages to be deleted by email (sender/recipient)
/*
insert into @tbl
select id from arc_add where email='test@testdomain.com'
*/

-- filter messages to be deleted by owner (use objectGuid from Active Directory)
/*
insert into @tbl
select id from arc_owners inner join arc_users on arc_owners.usrid=arc_users.usrid
where [name]='d0fba5f09c43be41ba93dcea92767204'
*/

-- filter messages to be deleted by message-id
/*
insert into @tbl
select id from arc where message_id = '<001201c5bdeb$182a3270$3200a8c0@testdomain.com>'
*/

delete from arc_sources where id in (select id from @tbl)
delete from arc_bodies where id in (select id from @tbl)
delete from arc_att where id in (select id from @tbl)
delete from arc_add where id in (select id from @tbl)
delete from arc_owners where id in (select id from @tbl)
delete from arc where id in (select id from @tbl)

delete from arc_threads
where NOT EXISTS(select id from arc where thread_id=arc_threads.thread_id)

The code above is not supported by GFI Software Ltd. Use and modify at your own risk

(in reply to PACEGMBH)
Post #: 2
RE: Updated SQL Scripts - 22.Feb.2006 12:58:50 PM   
tpatch

 

Posts: 36
Joined: 16.Feb.2005
From: NJ
Status: offline
Will this still work?  Or can you please provide an update?  Thanks.

(in reply to Rodion)
Post #: 3
RE: Updated SQL Scripts - 22.Feb.2006 6:51:25 PM   
Rodion

 

Posts: 834
Joined: 15.Nov.2004
Status: offline
Yes, it works

_____________________________

Best regards

Rodion Denisyuk
GFI Software Ltd

(in reply to tpatch)
Post #: 4
RE: Updated SQL Scripts - 28.Apr.2006 5:08:10 AM   
jippyuk

 

Posts: 11
Joined: 28.Apr.2006
Status: offline
Hi there, great post, and looks like its going to be able to do a lot of what I was worrying about when it came to removing stuff from the SQL 2k DB

I have a query though if anyone is around (tried to direct to Rodion but not accepting PM :)

Basically...... What i would LIKE to do (if possible) is to say...

Search through the DB... if there is an email which has been sent from fred@happy.com to jerry@happy.com to delete it from the database, regardless of date size subject etc.

Now i saw the line which read.

insert into @tbl
select id from arc_add where email='email@'

The problem with this i THINK is that it will nuke EVERY occurance of this email address mail from the datbabase correct? so all the 1000000000s of mail that have been sent by that email address to any user on our system, which ever archived mailbox it was stored in, will get nuked.

Now if i wanted to delete all mails which had come from a certain users mailbox when archived... I believe I would use the AD GUID which I think i can obtain if i dig around a little, thats fine, however, in regards to the query above, i take it there must be an AND statement i can chuck in with this query so that both the sender and the recipient values have to be matched for it to be removed from the database.

Thanks in advance if your able to shed light on this.

Regards

JP Bonello

(in reply to Rodion)
Post #: 5
RE: Updated SQL Scripts - 28.Apr.2006 6:13:43 AM   
Rodion

 

Posts: 834
Joined: 15.Nov.2004
Status: offline
Hi
 
You can use the field 'type' from the arc_att table. It's value is translated as following:
FROM-0, TO-1, CC-2, EFROM-3 (envelope send), ETO-4 (envelope to/bcc)

insert into @tbl
select id from arc where 
exists (select id from arc_add where id=arc.id and email='fred@happy.com' and type in (0,3)) 
and 
exists (select id from arc_add where id=arc.id and email='jerry@happy.com' and type in (1,2,4))


The code above is not supported by GFI Software Ltd. Use and modify at your own risk

_____________________________

Best regards

Rodion Denisyuk
GFI Software Ltd

(in reply to jippyuk)
Post #: 6
RE: Updated SQL Scripts - 28.Apr.2006 6:17:51 AM   
jippyuk

 

Posts: 11
Joined: 28.Apr.2006
Status: offline
You Rodion are a legend!!

Just what I'm looking for, and a quick response too. I will try this in a bit!! Much thanks.

I suggest Sticky'ing this thread as a lot of new users to your software are very likely to want to know how to remove items from the SQL DB, is this going to be hardcoded into future releases possibly?

JP

< Message edited by jippyuk -- 28.Apr.2006 6:20:05 AM >

(in reply to Rodion)
Post #: 7
Page:   [1]
All Forums >> [Archiving & Fax] >> GFI MailArchiver >> Updated SQL Scripts Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts