Auditing tables..
Hi Experts,
Could anyone help me with the following issue.
we are trying to implement the "audit feature" on a table. what is the best way to do the audit? (keep track of all the changes in the table)
This is what we are doing..
Main_table
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
audit_table
ad_action (whether it is insert,update or delete)
ad_time (time)
ad_user (whos is the user)
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
and i have a trigger on the "main_table" like this
CREATE OR REPLACE TRIGGER Main_table_AIUD after
insert or update or delete on Main_table for each row
begin
declare
ljn_action varchar2(3);
begin
if inserting then
ljn_action := 'INS';
elsif updating then
ljn_action := 'UPD';
else
ljn_action := 'DEL';
end if;
if inserting then
insert into audit_table
ad_action,
ad_time,
ad_user,
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
values
ljn_action
,sysdate
,nvl(v('APP_USER') ,USER)
:new.id,
:new.first_name,
:new.last_name,
:new.dob,
:new.hire_date,
:new.created_date,
:new.created_by,
:new.updated_date,
:new.updated_by
elsif updating then
insert into audit_table
ad_action,
ad_time,
ad_user,
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
values
ljn_action
,sysdate
,nvl(v('APP_USER') ,USER)
:old.id,
:old.first_name,
:old.last_name,
:old.dob,
:old.hire_date,
:old.created_date,
:old.created_by,
:old.updated_date,
:new.updated_by
else
insert into audit_table
ad_action,
ad_time,
ad_user,
id
first_name
last_name
dob
hire_date
created_date
created_by
updated_date
updated_by
values
ljn_action
,sysdate
,nvl(v('APP_USER') ,USER)
:old.id,
:old.first_name,
:old.last_name,
:old.dob,
:old.hire_date,
:old.created_date,
:old.created_by,
:old.updated_date,
:new.updated_by
end if;
end;
end;
/For "Insert" and "Delete" as i need to capture all the elements my code would be ok.
But for "update" how can i capture only the columns that got changed? and put it in the audit table
so next time if i go to the audit table i can clearly see that these elements got changes.
Is there any better way to do this?
Please let me know
Thanks
Yeah for tracking OLD and NEW values you have to write a trigger.
Your trigger code seems fine except a few quirks.
You audit_table should contain two fields against each column of the main table. e.g. for first_name column in main_table there should be two fields old_firstname and new_firstname in the audit_table.
And then each section of trigger (inserting, updating, deleting) insert both :OLD and :NEW values to the table. In case of INSERT there will be no :OLD values so just insert NULL and in case of DELETE there will be no :NEW values so insert NULL. But in case of UPDATE its important to track both :NEW and :OLD.
and if you track both NEW and OLD values in the trigger and put them in the audit_table then you no longer need to identify which columns are changed. You can figure that later on when you query the audit_table, any fields where OLD and NEW values are same was not updated.
If you still want to check which column was changed in the trigger, refer to Himanshu Kandpal's post above.
And you probably don't need this code in the trigger:
if inserting then
ljn_action := 'INS';
elsif updating then
ljn_action := 'UPD';
else
ljn_action := 'DEL';
end if;You can Just use the values 'DEL','INS' and 'UPD' where appropriate instead of the ljn_action variable.
Similar Messages
-
How to maintain previous and record count in audit table in SQL Server 2008 r2?
Hi Experts ,
Situation :
in our database we are having few of stored procedures which will drop and recreates the tables and it is scheduled on weekly basis. when this job will run all the stored procedures will drop all the tables and recreate. Now we need to create one table which
will maintain history of the records.
my table structure is listed below
TableName CurrentReocrdCount CurrentExecutionDate PreviousReordCount PreviousExurtiondate
TEST 1000 2014-03-30 NULL NULL
Test 1500 2014-04-10 1000 2014-03-30
Test 2000 2014-04-11 1500 2014-04-10
How do i achive this .
franklinsentilYou need to create audit tables for these. The table will be populated by COUNT value inside stored procedure. Each time it clears the main table and fills new data and also logs count details to audit tables. You can use COUNT(*) to get count value
and GETDATE function to get current execution value.
So proc will look like
CREATE PROC procname
@param....
AS
--step to drop existing table
IF OBJECT_ID('tablename') IS NOT NULL
DROP TABLE <table name>
--step to fill new table
SELECT ...
INTO TableName
FROM
--Audit table fill step
INSERT AuditTable (TableName,CurrentRecordCount,CurrentExecdate,PrevRecordCount,PrevExecDate)
SELECT TOP 1 'TableName',(SELECT COUNT(*) FROM tableName),GETDATE(),CurrentRecordCount,CurrentExecDate
FROM AuditTable
ORDER BY CurrentExecDate DESC
UNION ALL
SELECT 'TableName',(SELECT COUNT(*) FROM tableName),NULL,NULL
WHERE NOT EXISTS (SELECT 1 FROM AuditTable)
GO
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Fetching SSIS error message into Audit table using SP
Hi Experts,
I want to fetch SSIS Error Info along with Task Name into Audit table 'Error_Info' column. This is nvarchar(max) datatype, i wrote below Stored Procedure for this (Column names passing dynamically in SP)
CREATE PROC [dbo].[usp_AuditErrorHandler]
@AuditTableName nvarchar(MAX)
,@Audit_Status nvarchar(100)
,@Audit_ErrorDescription sql_variant
,@Audit_PkgEnd_dttm nvarchar(100)
,@task sql_variant
,@errordescription sql_variant
,@Audit_ID nvarchar(10)
,@LogID INT
AS
BEGIN
DECLARE @STRQuery NVARCHAR(MAX)
SET @STRQuery = '
UPDATE '+@AuditTableName+'
SET '+@Audit_Status+' = ''Failed''
,'+@Audit_PkgEnd_dttm+' = GETDATE()
,'+@Audit_ErrorDescription+' = ''Task['+ @task +']:'+@errordescription +'''
WHERE ' +@Audit_ID+ ' = ' + CAST(@LogID AS NVARCHAR)
The above procedure is working fine in SSMS and inserting complete error info into table, but when i am executing thru SSIS Pkg i am getting error like
"[Execute SQL Task] Error: Executing the query "exec usp_AuditErrorHandler ?,?,?,?,?,?,?,?" failed with the following error: "Incorrect syntax near '@P1'.". Possible failure reasons: Problems with the query, "ResultSet"
property not set correctly, parameters not set correctly, or connection not established correctly."
So, i tot of checking with string lenght and modifed the code by adding left () to @errordescription as below.
UPDATE '+@AuditTableName+'
SET '+@Audit_Status+' = ''Failed''
,'+@Audit_PkgEnd_dttm+' = GETDATE()
,'+@Audit_ErrorDescription+' = ''Task['+ @task +']:'+LEFT(@errordescription ,100)+'''
WHERE ' +@Audit_ID+ ' = ' + CAST(@LogID AS NVARCHAR)
Here, it is inserting till 119 chars, if i give more than 119 chars pkg is failing with above error.
I want to get insert Complete error info into the column.
Can anybody suggest on this??
Thanks in advance !!!Thanks Arthur for the response, i have tried with the Sql_Variant data type also, here procedure itself not creating and throwing below error.
"The data types nvarchar(max) and sql_variant are incompatible in the add operator."
This is the procedure i am using to fetch error info into Audit table.
ALTER PROC [dbo].[usp_AuditErrorHandler]
@AuditTableName nvarchar(MAX)
,@Audit_Status nvarchar(100)
,@Audit_PkgEnd_dttm nvarchar(100)
,@Audit_Task_ErrorCode nvarchar(100)
,@Audit_ErrorDescription SQL_VARIANT
,@errorcode nvarchar(max)
,@task SQL_VARIANT
,@errordescription SQL_VARIANT
,@Audit_ID nvarchar(10)
,@LogID INT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @STRQuery SQL_VARIANT
BEGIN TRY
SET @STRQuery = '
UPDATE '+@AuditTableName+'
SET '+@Audit_Status+' = ''Failed''
,'+@Audit_PkgEnd_dttm+' = GETDATE()
,'+@Audit_Task_ErrorCode+' = '''+@errorcode+'''
,'+@Audit_ErrorDescription+' = ''Task['+ @task +']:'+ @errordescription +'''
(Error is giving in this line)
WHERE ' +@Audit_ID+ ' = ' + CAST(@LogID AS NVARCHAR)
EXEC (@STRQuery)
END TRY
Below is the Audit Table Schema -
Trigger problem -- can't insert the same data into audit table
Sir/Madam,
I'm trying to use insert trigger with a 'long raw' datatype data for my audit purpose. Each time, the data of original table can be inserted correctly. While the trigger for audit table in which it contains almost the same data as original would failed. The error messages are some thing like following:
java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
ORA-06512: at "CORPSEC.TI_ARCHIVE_PDF", line 9
ORA-04088: error during execution of trigger 'CORPSEC.TI_ARCHIVE_PDF'
If the column with 'long raw' datatype is taken out, then there is no error at all. I'm using Oracle 8i 8.1.6 for Windows NT and suspect there is bug in PL/SQL execution.
The following are SQL text for the trigger:
CREATE OR REPLACE TRIGGER "CORPSEC"."TI_ARCHIVE_PDF" AFTER INSERT ON "ARCHIVE_PDF" FOR EACH ROW DECLARE
LOG_SEQ_NO NUMBER;
BEGIN
SELECT AUDIT_SEQ.NEXTVAL INTO LOG_SEQ_NO FROM DUAL
insert into ad_archive_pdf (DOC_TITLE,PDF_FILENAME,CONTENT,DOC_DESC,AUDIT_REF_NO,AUDIT_DATE,AUDIT_MODE,AUDIT_BY)
values (:new.DOC_TITLE,:new.PDF_FILENAME,:new.CONTENT,:new.DOC_DESC,LOG_SEQ_NO,sysdate,'I',:new.created_by);
END;
Any help on this. Thank in advance.
Best regards,
RuijieSee here for a discussion of how to incorporate LONG datatypes into triggers:
http://asktom.oracle.com/pls/ask/f?p=4950:8:635439::NO::F4950_P8_DISPLAYID -
Query based on main table and audit table
Hi,
I had created auditing on some table. Values might not change and if they changed, it should be stored in audit table.
I want to get the values in the table a on real time basis, like dimentions in datawarehouse.
Trying to write a query based on table a and aud_a to get point-in-time or values at anytime in the past.
Something like
SELECT *
FROM a (table_name)
WHERE effective_from >= $DATE_TO_QUERY
AND effective_to < $DATE_TO_QUERY
How to get this kind of query .
Please help. ( Table structure for table a and audit table aud_a and trigger aud_tg_a given below)
Giving code as follows.
main table a
create table a
( val1 number,
val2 number,
update_by varchar2(30),
date_updated date);
creare auidt table aud_a
create table aud_a
( "AUDIT_SEQ" NUMBER,
"AUDIT_TRAN_ID" NUMBER,
"AUDIT_PROG_ID" VARCHAR2(30 BYTE),
"AUDIT_TERMINAL" VARCHAR2(16 BYTE),
"AUDIT_REASON" VARCHAR2(30 BYTE),
"AUDIT_ACTION" CHAR(1 BYTE),
"AUDIT_ACTION_BY" VARCHAR2(20 BYTE),
"AUDIT_ACTION_DT" DATE,
val1 number,
val2 number,
updated_by varchar2(30),
date_updated date);
trigger on table a to populate aud_a
CREATE OR REPLACE TRIGGER aud_tg_a AFTER
INSERT OR
DELETE OR
update on a
for each row
declare
v_time_now DATE;
v_terminal VARCHAR2(16);
v_tran_id NUMBER;
v_prog_id VARCHAR2(30);
V_reason VARCHAR2(30);
BEGIN
v_time_now := sysdate;
v_terminal := userenv('TERMINAL');
v_tran_id := 1;
v_prog_id := 'test';
v_reason := 'AUDIT';
IF inserting THEN
INSERT
INTO a
audit_seq,
AUDIT_tran_id,
AUDIT_prog_id,
AUDIT_reason,
AUDIT_terminal,
AUDIT_action_by,
AUDIT_action_dt,
AUDIT_action ,
val1,
val2,
updated_by,
date_updated
VALUES
s_audit_no.nextval,
v_tran_id,
v_prog_id,
v_reason,
v_terminal,
USER,
v_time_now,
'I' ,
:new.val1,
:new.val2,
:new.updated_by,
:new.date_updated
elsif deleting THEN
INSERT
INTO a
audit_seq,
AUDIT_tran_id,
AUDIT_prog_id,
AUDIT_reason,
AUDIT_terminal,
AUDIT_action_by,
AUDIT_action_dt,
AUDIT_action ,
us_agy_backed_id,
industry_subgroup,
comments,
updated_by,
date_updated
VALUES
s_audit_no.nextval,
v_tran_id,
v_prog_id,
v_reason,
v_terminal,
USER,
v_time_now,
'D' ,
:old.val1,
:old.val2,
:old.comments,
:old.updated_by,
:old.date_updated
elsif updating THEN
INSERT
INTO a
audit_seq,
AUDIT_tran_id,
AUDIT_prog_id,
AUDIT_reason,
AUDIT_terminal,
AUDIT_action_by,
AUDIT_action_dt,
AUDIT_action ,
us_agy_backed_id,
industry_subgroup,
comments,
updated_by,
date_updated
VALUES
s_audit_no.nextval,
v_tran_id,
v_prog_id,
v_reason,
v_terminal,
USER,
v_time_now,
'U' ,
:new.val1,
:new.val2,
:new.updated_by,
:new.date_updated
END IF;
END;
-------------------------Hi hoek,
I am not able to use Oracle's audit functionality becuase I need to trap some changes in particular tables and then rebuild query if required.
Thanks for your suggestion though.
Regards,
Milind -
How to access to audit tables in Oracle Content DB version 10.2.0.0.1
Hello,
Could someone tell me please how to access to Oracle Content DB audit tables as:
ODMZA_RAWAUDITEVENT
ODMZA_AUDITEVENTPROPERTY
ODMZA_AUDITEVENT
ODMZA_AUDITOPTYPE
ODMZA_AUDITTARGETCLASS
ODM_INTERMEDIAAUDIO
ODM_AUDITINGCONFIGURATION
ODM_AUDITTYPEENTRY
ODM_AUDITSPECIFICATION
ODM_AUDITTYPELIST
ODM_AUDITTARGETSPEC
Could you tell me the way to view all these audits logs?
Which interface should I have?
Thanks for your help.
AlexHi
Yes you can directly apply path set 10.2.0.4
Note 839187 - Oracle 10.2.0: Applying patch set/patches/patch collection
Regards
Uday -
How to populate SQL Text in auditing table?
Hi,
Only modifying the 'AUDIT_TRAIL' .ora parameter is enough to popoulate SQL text?
Plz reply,if you have any concerns.
Thanks,Hi,
>>I gone through few documents to enable SQL_TEXT in audit table,it says Changing the . ora parameter to 'DB_EXTENDED' is enough to populate SQL text.
That's right. The exact SQL statement executed by the user and the bind variables used with the SQL are collected in the audit trail when the initialization parameter AUDIT_TRAIL is set to DB_EXTENDED. The DB or TRUE value will not populate the SQLTEXT and SQLBIND columns of the AUD$ table.
Cheers
Legatti -
Update audit table trigger by a column
Have a need to update a audit table when a specific column data has been updated\deleted\inserted on table T1 . The column is Grade_complete.
My first thought was to create an instead of trigger since the form was based on the table (T1) view
( CREATE OR REPLACE TRIGGER "AI_T1" AFTER INSERT OR UPDATE OF grade_complete ON T1........) but then I realized with instead of , I can't create a trigger with a update of . Can anyone give me some suggestions on how to resolve this ? There got to be something easy that I am just not getting it now.
Thanks.
WanJure, Roel;
Thanks for the reply.
I have no permission to create triggers on the table so instead of being used. when ran the following statement , I am getting "ORA-25004: WHEN clause is not allowed in INSTEAD of triggers. Have tried if statement to no avail. Can anyone help ?
create or replace trigger ioft_test
instead of insert or update or delete on T1
referencing old as old new as new for each row
when nvl(new.grade_complete, 0) != nvl(old.grade_complete, -1)
declare
v_seq number;
begin
insert statemetn here
end; -
Is it possible to records another machine ip addree in audit table
Hai
I have written system event trigger,it records username, ip address and time in audit table when user logged on database , The database reside on xx machine ( 10.0.0.88 ipaddess ). Is it possible to records another machine ip addree in audit table while accessing database from another machine?
example we have another database on xxx machine (10.0.0.2 ip address),when accessing database from xxx(10.0.0.2) to xx (10.0.0.88),the xxx node ip address will be stored in audit table?.
Thanks in advance
Regards
mohan
CREATE OR REPLACE TRIGGER On_Logon
AFTER LOGON
ON database
declare
db_name VARCHAR2(50);
addr varchar2(80);
x varchar2(20);
begin
db_name := ora_database_name;
select utl_inaddr.get_host_address into x from dual;
if ( ora_sysevent ='LOGON')
then x:=utl_inaddr.get_host_address;
insert into log1
select ora_sysevent,ora_login_user,ora_database_name,utl_inaddr.get_host_address,sysdate
from dual;
end if;
end;
SQL> select * from log1;
OPERATION USERNAME DATABASE IP_ADDR TIME
LOGON MOHAN1 ISOLA6.US.ORACLE.COM 10.0.0.88 11-APR-02
Based on system events trigger how to find out which user from which machine (ip address) accesing database?
example:
CREATE OR REPLACE TRIGGER On_Logon
AFTER LOGON
ON database
declare
db_name VARCHAR2(50);
addr varchar2(80);
x varchar2(20);
begin
db_name := ora_database_name;
select utl_inaddr.get_host_address into x from dual;
if ( ora_sysevent ='LOGON')
then x:=utl_inaddr.get_host_address;
insert into log1
select ora_sysevent,ora_login_user,ora_database_name,utl_inaddr.get_host_address,sysdate
from dual;
end if;
end;
SQL> select * from log1;
OPERATION USERNAME DATABASE IP_ADDR TIME
LOGON MOHAN1 ISOLA6.US.ORACLE.COM 10.0.0.88 11-APR-02Providing you're on 8i+ this will give you the IP address from which th eclient is connected:
SELECT sys_context('userenv', IP_ADDRESS) FROM dual;
Bear in mind that many network applications assign IP Addresses dynamically, so depending on how your network is segmented, the same machine can have very different IP addresses from day to day. If this is just an internal system you're auditing then you might find this call more useful:
SELECT sys_context('userenv', TERMINAL) FROM dual;
This returns the network's ID for the machine, and this is non-varying (unless network admin change it explicitly - but why would they?). This call is also available in the older, deprecated USERENV function:
SELECT userenv('TERMINAL') FROM dual;
rgds, APC -
Our Production system is suffering performance issues which we attribute to the large volume of records in the audit tables. We want to implement an archival solution to alleviate this, which would involve transferring older audit records to a separate database. To achieve this, we need to write SQL queries against the <app>DATAAUDIT and <app>TASKAUDIT tables in the HFM database. We are aware that we need to join other tables to see descriptions, e.g. <app>SCENARIODESC. We have also deduced the translation of Activity Codes from "HFMAuditExtractSchemaDefs.xml", which accompanies the HFM Audit Extract Utility.
Unfortunately, there are some things which we do not know how to translate:
1) Period (lPeriod) on the <app>DATAAUDIT table, e.g. 67108869 but need to show "Jun" etc.
2) User (ActivityUserId) on the <app>TASKAUDIT table, e.g. -329543984
3) Module (strModuleName) on the <app>TASKAUDIT table, e.g. #@RID@#19
Can anyone advise how we should translate these pieces of data in order to give similar results to those seen on the Data Audit and Task Audit screens in Workspace?1.) Period - I'm not sure where this is coming from, but I'm pretty confident it is not sitting in the database which I find odd. I want to find this as well, but haven't had any free time to search around, sorry.
2.) User - This one I can help you with.
--Get Task Item Data by Hour for a given day by user
select datepart(HOUR, cast(endtime-2 as smalldatetime)), count(activitycode) from <APP_NAME>_task_audit where activitycode in (1,4,6,8,9,12,14,15,16,21,23,44) and cast(endtime-2 as smalldatetime) between '2011-12-7 00:00:00' and '2011-12-7 23:59:59' and ActivityUserID in (select lUserID from HSV_ACTIVITY_USERS where sUserName = '<USER_NAME>') group by datepart(HOUR, cast(endtime-2 as smalldatetime))In the sample SQL Query above, I am looking for all of the task audit activity (for the specified tasks) for a specific user by hour. The part of the query you want to focus on is
and ActivityUserID in (select lUserID from HSV_ACTIVITY_USERS where sUserName = '<USER_NAME>')The ActivityUserID in the task audit table will match up to the lUserID field in the HSV_ACTIVITY_USERS table. sUserName will be the actual text username. Depending on how you are configured, the name may look like johndoe or johndoe@Native Directory or johndoe@AD, etc. If you query that table, you'll figure it out pretty quickly.
3.) Module ID. I can only partially assist on this one.
This is not also in the HFM database. I suspected it might be floating in workspace; however, can't really find it there either.
I can tell you a couple things though....
#@RID@# Is just a placeholder for Resource ID. The important part is the number behind it. If you do a search on your folders for @RID@, you'll get one hit where it is defined as a constant, but that is it. (I was hoping a file search would reveal a table of the ID's; however, I wasn't that lucky). There is probably a table of values that correspone somewhere, but I haven't found it.
If you do a distinct select, you'll see there's not too many ...
select distinct strmodulename from <APP_NAME>_task_audit#@RID@#10
#@RID@#13
#@RID@#14
#@RID@#16
#@RID@#18
#@RID@#23
#@RID@#30
#@RID@#32
#@RID@#4294967295
#@RID@#45
#@RID@#46
#@RID@#49
#@RID@#52
#@RID@#58
#@RID@#59
#@RID@#65
#@RID@#66
#@RID@#67
#@RID@#68
#@RID@#69
#@RID@#7
#@RID@#9
HyperionReports
How can you determine these values?
The quick and dirty way would be to run a Task Audit Extract for a given date range as this will reveal the Module Name.
Then execute a SQL Query on the Task Audit Table for the same data range. You could then match up the records and deduce the values.
--Get Task Items by Date Range
select (select sUserName from HSV_ACTIVITY_USERS where lUserID = ActivityUserID) as UserName, ActivityCode, ServerName, AppName, cast(StartTime-2 as smalldatetime), cast(EndTime-2 as smalldatetime), strDescription, strModuleName from <APP_NAME>_task_audit where cast(endtime-2 as smalldatetime) between '2011-12-7 00:00:00' and '2011-12-7 23:59:59' order by endtime ascOnce you determine the values, I would create a table in your database to hold them so that you could use them in future queries. I would also recommend you do the same with the activitycodes. -
I want to know is there anyway we can capture wb_rt tables in mapping. This are runtime audit tables in owb. Is there any documentation where I can get the description of this tables.
What I want to do is to get infor from audit tables to get the row count from previous mapping run and compare before loading the final target.
I am new to owb and I want to know is there any process in owb or process flow to check before loading into target like checking how many rows were loaded into staging and is it equal to no. of rows after transformation.
Is anyone doing this kind of consistency checks in there ETL process. Any kind of info will be helpful
Thnakshttp://download-east.oracle.com/docs/cd/B31080_01/doc/owb.102/b28225/toc.htm
in the second chapter -
Audit- Not laoding Audit data into Audit tables
Hi ,
Audit data not loading into audit tables in my XI3.1 SP4Environament.
Audit data base is in SQL SERVER 2008 R2
where Audit database congigured , audit events enabled properly.
and also log files creating without any errors also
Please help me ..
Edited by: Reddeppa Konduru on Nov 9, 2011 11:31 AM
Edited by: Reddeppa Konduru on Nov 9, 2011 12:31 PMI am getting below error
bsystem_impl.cpp:2651: TraceLog message 1
2011/11/09 03:22:47.071|>>|A| |13664|9368| |||||||||||||||assert failure: (.\auditsubsystem_impl.cpp:2651). (false : Next event id value should be greater than the current one, check the auditee packing events code). -
Modifying OWB audit tables?
One option we are exploring on a new project is using the OWB audit tables/views as control tables to facilitate extracting changed data from the source system.
For example
Extract all data from source table x where update_date > (select max(start_time) from all_rt_audit_map_runs where map_name = y and run_status = 'COMPLETE')
I am no terribly keen on the idea. Has anyone done this in the past? Would you consider this standard practice? I'd prefer to maintain our own control table(s).
One problem I see is that (especially in dev/testing environments) it would call for situations where there needs to be manual modification of the data in OWB audit tables, which may lead to the data in them becoming corrupt. Would updating things like start_time, end_time and run_status be an acceptable development practice? I just think that once you start updating a table like all_rt_audit_map_runs it becomes very difficult to keep corresponding tables like ALL_RT_AUDIT_STEP_RUNS also accurate.
Would appreciate others thoughts on the matter.I'd suggest maintaining your own tables, they are then in your control, there is no guarantee that the OWB audit tables will be in the same format in future releases.
-
Recover data in XML audit table
Oracle 11gR1 rhel5 64 bti
Hi all,
I was wondering if anyone knows how we can recover data that is captured in an XML audit table?
thanks.Ok, It looks like I misunderstood the request.
Here is what management would like me to do.
Say there is a table X and we update a row in that table. Now that change (UPDATE) has been captured by an audit table, whose structure looks like the following:
CREATE TABLE FPRCHR.AUDIT_TRAIL
AUDIT_TRAIL_RID NUMBER CONSTRAINT NN_AUDIT_TRAIL_PK NOT NULL,
AUDIT_TIMESTAMP TIMESTAMP(6),
ACTION VARCHAR2(30 BYTE),
TABLE_OWNER VARCHAR2(30 BYTE),
TABLE_NAME VARCHAR2(30 BYTE),
USERNAME VARCHAR2(64 BYTE),
ROW_KEY SYS.XMLTYPE,
OLD_ROW SYS.XMLTYPE,
NEW_ROW SYS.XMLTYPE
TABLESPACE FPRCHRDAT01
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 80K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
LOGGING
NOCOMPRESS
XMLTYPE ROW_KEY STORE AS CLOB
( TABLESPACE FPRCHRDAT01
ENABLE STORAGE IN ROW
CHUNK 16384
PCTVERSION 10
NOCACHE
INDEX (
TABLESPACE FPRCHRDAT01
STORAGE (
INITIAL 80K
NEXT 1
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
STORAGE (
INITIAL 80K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
LOB (SYS_NC00010$) STORE AS
( TABLESPACE FPRCHRDAT01
ENABLE STORAGE IN ROW
CHUNK 16384
PCTVERSION 10
NOCACHE
INDEX (
TABLESPACE FPRCHRDAT01
STORAGE (
INITIAL 80K
NEXT 1
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
STORAGE (
INITIAL 80K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
XMLTYPE OLD_ROW STORE AS CLOB
( TABLESPACE FPRCHRDAT01
ENABLE STORAGE IN ROW
CHUNK 16384
PCTVERSION 10
NOCACHE
INDEX (
TABLESPACE FPRCHRDAT01
STORAGE (
INITIAL 80K
NEXT 1
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
STORAGE (
INITIAL 80K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOCACHE
NOPARALLEL
MONITORING;
However, we realised that the update was incorrect and needs to be undone. So we want to take the change that was captured in the audit trail table (which would be in the old_row column) for table X and insert that back into table X. Keeping in mind that the row is an XML row.
How could I do that?
Thanks. -
To whom it may concern,
The Lob Name column in the WB Audit Table now stores mapping names with double quotes, in prior versions the double quotes were used only in Lob Name column belonging to detail tables. Is this a permanent change?
Thanks,
AlHi Georg
In order to view the contents of the view you have to execute the set_workspace procedure (for each session):
BEGIN
OWBSYS.WB_WORKSPACE_MANAGEMENT.SET_WORKSPACE('<workspace>','<workspace_owner>');
END;
Best regards,
Bruno
Maybe you are looking for
-
My Artwork Albums are not showing up at all on my iTouch!
but it shows up on my computer, what should I do? I all ready restarted my iTouch and it still didn't work, help please!
-
Fields only on the last page of a report
Hello everybody, I have a report region1, the report can contain many records thus I will have to paginate it.... In the same page, I must have another region2 with some fields on it, but theses fields must appear only on the last page of my report,
-
Back ground execution of t.code with variant !!
Hi Team, I need excute the Z transaction code ( which is assigned to to stnadard program). How can i execute this transaction in back ground with the given specified variant. (program should be executed for every 5 mts). Regards Badari T
-
How to create a program in alv.
Hi Experts, I am new to Alv programming. I am learning alv programming myself.I dont know anything about that. so can u please guide me how to create an alv program. give some documents to learn about alv.i ve searched it but i could not find any sub
-
I have successfully created a cool Spry drop down menu but am wondering if it is ready for primetime. I tried it using IE 5 and Netscape 7.1. It is broken in those browsers. Dont a lot of people still use these older browsers? What should I do?