Can this be done: copy sent messages from Sent Items from an OCS user on one db to another OCS user on another db?
Yes, i know it's weird but this is the task. So, does anyone know how to?
I've created a dblink between the 2 dbs but when i try mail_messages.copy_messages i get the following error:
ORA-22160: element at index  does not exist
ORA-06512: at "ES_MAIL.ES_FOLDER_API", line 2456
ORA-06512: at "ES_MAIL.ES_FOLDER_API", line 2484
ORA-06512: at "ES_MAIL.MAIL_FOLDER", line 1019
ORA-06512: at line 29
what is your objective Irina? it might help in suggesting a solution.
is the second db a live OCS instance? is it a "mirror" of the first system or completely different structure? are you trying to do compliance (outgoing mail) archiving or is this meant to be some kind of DR or backup system?
The solution that Oracle offers is no good for us cause the users have to access the archive by a button click, so i am trying to replicate user accounts in term of emails and folder structure.
Irina, I don't think the mail api is not really designed for that. To do things at the database level, you might want to look at streams to pump all changes over to an archive database.
However one thing to bear in mind is that if you are capturing changes in the user's mail folder then you do not have an authoritative record of all mail (just an archive of what actually made it into their folders (e.g. if they choose not to keep a sent copy, then you will not have it in your archive).
For this reason, true compliance archiving usually aims to intercept the smtp delivery process (either as an intermediate gateway or plugin to a gateway .. google for such products).
you would normally do this at your corporate smtp gateway. unfortunately, I don't believe you can internally intercept/hook the OCS smtp process with 100% reliability (e.g. via a trigger), so I'd suggest you look at external smtp solutions if you really need compliance archiving.
Thank you for your suggestion but i found my solution. The mail api was designed for exactly that, but not the public ones...so i'm using the api's the application actually uses when a user copies a mail message in a shared folder. And it works.
So thank you for your input but i found what i was searching for.