Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TRUNCATE SYS.AUD$

babylonJun 6 2007 — edited Jun 7 2007
Hi
I've created table system.aud_$$ (copy of sys.aud$). Than i created scheduled job, whitch once per day iserts data from sys.aud$ in to system.aud_$$ table.
Than job execute truncate table sys.aud$.

Code:
...
begin
insert into system.aud_$$
(
select system.seq.nextval, SESSIONID, ENTRYID, STATEMENT,
TIMESTAMP#, USERID, USERHOST,
TERMINAL, ACTION#, RETURNCODE,
OBJ$CREATOR, OBJ$NAME, AUTH$PRIVILEGES,
AUTH$GRANTEE, NEW$OWNER, NEW$NAME,
SES$ACTIONS, SES$TID, LOGOFF$LREAD,
LOGOFF$PREAD, LOGOFF$LWRITE, LOGOFF$DEAD,
LOGOFF$TIME, COMMENT$TEXT, CLIENTID,
SPARE1, SPARE2, OBJ$LABEL,
SES$LABEL, PRIV$USED, SESSIONCPU,
NTIMESTAMP#, PROXY$SID, USER$GUID,
INSTANCE#, PROCESS#, XID,
AUDITID, SCN, DBID,
SQLBIND, SQLTEXT, sysdate
from sys.aud$);
begin
execute immediate 'truncate table sys.aud$';
end;
commit;
end;
...

Do i have all records on system.aid_$$, or is it possible to miss some records when job is inserting record to table and after that execute truncate sys.aud$?

If exist better solution for automatic copy sys.aud$ to differnt schema and truncate sys.aud$ pleas let me know.
Thanks
Stojc
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 5 2007
Added on Jun 6 2007
7 comments
7,888 views