DBMS_FGA & DML statements

Hello


I was able to set up and configure FGA in my database and get my SQLs get connected in DBA_FGA_AUDIT_TRAIL. However my requirement is to put the DML statements from the front of the table triggers.
When I run an insert/update/delete statement against a table say i.e. EMP.  I would llike to see education performed in the front insert/update / deletion of the respective table triggers.  But even after configuration FGA i.e of Audit policy for the EMP table I am unable to get all records if inserted in DBA_FGA_AUDIT_TRAIL when I ask this view BEFORE the trigger Update of the table

How to get my DML statement or clause of the DML where atleast in my before triggers. Please help in this regard.

I went through the links and documents below, but none of that speaks my requirment.

The notes that I have visited.

http://download.Oracle.com/docs/CD/B19306_01/network.102/b14266/cfgaudit.htm#i1011302

Metalink notes

10g: Fine grain auditing (Doc ID 266896.1()
How to use DBMS_FGA with a complex audit_condition (include/exclude multiple users) (Doc ID 832856.1()

Thanks in advance

I make my own comments of Nicolas - it doesn't make much sense to check if an UPDATE statement updates of each row in the table.

If you don't want to verify such a thing (it being understood that it is almost certainly a bad idea), the classical approach would be to have
-A BEFORE level trigger UPDATE statement which has initialized a collection
-A BEFORE the UPDATE to the row-level trigger who populated the collection (i.e. Add the primary key for each update of the collection line)
-AFTER level trigger UPDATE statement which compared the number of rows affected number of rows in the table

If you want to get the SQL statement that caused an audit event to end grain, you are probably looking for

SYS_CONTEXT( 'USERENV', 'CURRENT_SQL')

But trying to use it to determine if each row is updated in the way you mentioned sounds even worse than three trigger approach.

Justin

Tags: Database

Similar Questions

  • I have the table of 3 columns A, B, C. I want to store the sum of columns A B in the C column without using the DML statements. Can anyone help please how to do. ?

    I have the table of 3 columns A, B, C. I want to store the sum of columns A B in the C column without using the DML statements. Can anyone help please how to do. ?

    11.1 and especially you have virtual column

    SQL> create table t
      2  (
      3     a number
      4   , b number
      5   , c generated always as (a+b) virtual
      6  );
    
    Table created.
    
    SQL> insert into t (a, b) values (1, 2);
    
    1 row created.
    
    SQL> select * from t;
    
             A          B          C
    ---------- ---------- ----------
             1          2          3
    

    Before that, a front insert - trigger

    SQL> create table t
      2  (
      3     a number
      4   , b number
      5   , c number
      6  );
    
    Table created.
    
    SQL> create or replace trigger t_default before insert on t for each row
      2  begin
      3    :new.c := :new.a+:new.b;
      4  end;
      5  /
    
    Trigger created.
    
    SQL> insert into t (a, b) values (1, 2);
    
    1 row created.
    
    SQL> select * from t;
    
             A          B          C
    ---------- ---------- ----------
             1          2          3
    
  • transactions and failure of DML statement

    Hello

    Say I have 10 DML statements as part of my operation and the 9th one fails (and I have no to autocommit).

    Is it possible to have an exception that deals with this and 10th instruction and allow the validation of the transaction, or the whole operation should be cancelled?

    Thank you.

    Your session will automatically rollback the statement failed. All prior statements remain uncommitted. What you do then, it's up to you.

  • Procedure with the DML statements that insert values from 1 to 100 in only one table and it is matching word equivalent in the other

    Can someone help me create a procedure with the DML statements that insert values from 1 to 100 in a table "abc" and the procedure must connect the numbers into words in another table "xyz" without doing a commit explicitly. "."

    Currently on trial...

    SQL > create table abc (num number);

    Table created.

    SQL > create table xyz (num varchar2 (100));

    Table created.

    SQL > ed
    A written file afiedt.buf

    1. insert all
    2 values of 1 = 1 then in abc (num) (l)
    3 when the values of 1 = 1 then in xyz (num) (to_char (to_date(l,'j'), 'jsp'))
    4 * Select the level from dual connect by level<=>
    SQL > /.

    200 rows created.

    And the result...

    SQL > select * from abc;

    NUM
    ----------
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    ..
    ..
    ..
    98
    99
    100

    100 selected lines.

    SQL > select * from xyz;

    NUM
    ----------------------------------------------------------------------------------------------------
    one
    two
    three
    four
    five
    six
    seven
    eight
    nine
    ten
    Eleven
    twelve
    ..
    ..
    ..
    98
    Nineteen eighty
    Cent

    100 selected lines.

  • 12 c call Webservice JDeveloper get "SQL string is not a DML statement" as a SQLException exception

    Hi guys,.

    I developed a java class to access the database using the OracleDataSource class and run a SQL query with a select statement. It works very well. I have built a wrapper class and as a Web service. I get "SQL string is not a DML statement" as a SQLException exception when I run as a Web service, but it works very well as an application.

    No idea why I get this error? Not sure why WebSercie is having a problem while this works as an application.

    Thank you and best regards,

    Srini Mel

    Solved the problem by myself.

    The first release "SQL string is not a DML statement" is due to an additional line (pstmt2.executeUpdate ()) in the code.

    Second question, receives not the query response is due to bad user input. I walked into 13.21651 instead of 31.21651.

    Thank you!

    Srini

  • Insertion of a DML statement as string in a table column


    Hello

    Is there a way I can insert a dml statement (such as "update a SET COL1 = 10") in a table column using a procedure or a function.

    I can do it by simply running an INSERT statement. But how can I do with a proc or function without getting an error "Cannot perform a DML operation inside a query"

    Please advice

    Hello

    937454 wrote:

    In fact, it can be done through a procedure. I was trying to see if I can do this with a function.

    Of course, you can do so via a function; you just can not call this function of a SQL statement.

    If the function returns a VARCHAR2, then you could call it like this:

    DECLARE

    foo VARCHAR2 (100);

    BEGIN

    foo: = fun_a;

    END;

    or like this:

    BEGIN

    dbms_output.put_line (fun_a);

    END;

  • PLS-00435: without LINKING DML statement to BULK cannot be used

    My requirement

    I dynamically create a staging table my_stg and then fill it out. Seems simple, but do not know why I get this error

    create table gtest4 (myid varchar2 (10), mykey varchar2 (10));


    create table gtest5 (myid varchar2 (10), mykey varchar2 (10));

    insert into gtest4 values (1.3);


    insert into gtest4 values (2.7);

    insert into gtest5 values (5,3);

    insert into gtest5 values (1, 7);

    commit;


    / * Formatted on 2012/01/27 17:52 (trainer more v4.8.8) * /.
    CREATE OR REPLACE PROCEDURE px
    IS
    RecType (RECORD IS of TYPE)
    MyID VARCHAR2 (100),
    MyKey VARCHAR2 (100)
    );

    TYPE tabtype IS rectype TABLE
    INDEX OF DIRECTORY;

    REC tabtype;
    News sys_refcursor;
    BEGIN
    EXECUTE IMMEDIATE ' create table my_stg (myid varchar2 (100), mykey varchar2 (100)) ';

    Heart OPEN FOR "select a.myid, b.mykey
    gtest4 a, gtest5 b
    where a.mykey = b.mykey';

    LOOP
    News FETCH
    COLLECTING LOOSE rec LIMIT 500;

    FORALL I IN 1... recomm. COUNTY
    EXECUTE IMMEDIATE "insert into my_stg (myid, mykey) values (rec (i) .myid,
    Rec (i). MyKey)';
    OUTPUT WHEN heart % NOTFOUND;
    END LOOP;
    END;
    /


    I compile the above proc and get

    PLS-00435: without LINKING DML statement to BULK cannot be used

    the reason why I put in run is immediate because the my_stg table does not exist, it is created on the fly

    Maybe

    INSERT INTO my_stg (myid, mykey, id_seq)
    VALUES (rec1(i), rec2(i). sequence.nextval);
    

    Concerning

    Etbin

  • How to get the last DML statement in each block

    Hello

    How can I get the latest DML statements in each block.
    As SYSTEM. LAST_QUERY returns the last select statement, I need to get the last Insert/Update/Delete statement
    in each block.

    Thanks in advance

    Rizly

    Rizly,

    You can use the GET_BLOCK_PROPERTY to get the last query executed on this block.

         MESSAGE(GET_BLOCK_PROPERTY('', LAST_QUERY));
    

    Kind regards

    Manu.

    If this answer is useful or appropriate, please mark. Thank you.

  • Run simultaneously multiple dml statements.

    Hi all
    I have an obligation to perform multiple dml instructions at the same time. I tried to do this using dbms_job, in vain.
    I planned 3 dbms_job at the same time. Each task has a bulk insert statement, inserting into a single target table. Kick off 3 jobs, but there was almost a minute apart.
    Is there another way to do this?

    You can launch 3 separate SQL more sessions, but how run you dml statements at the same exact time?

    My desktop computer, here's how I would do:

    Create a batch back file (for example runall.cmd) that looks like this:

    Start some_command.cmd
    Start some_command.cmd
    Start some_command.cmd

    Then double-click it. This will lauch some_command.cmd in 3 separate sessions. Each will be launched but will not wait to complete before starting the next.

    In the batch file, some_command.cmd, you can have everything you want. But it will probably take sqlplus.exe with command line options (one of them a .sql script).

    That's how I used "Parallelization DIY" of Tom Kite. But I would normally have a parameter (such as a range or something) to keep the LMD are mutually exclusive.

  • Why this parallel DML statement is not run as fast as DBMS_PARALLEL_EXECUTE?

    Hello

    I'm on the database Oracle Enterprise Edition, Linux RH 11.2.0.3. I have a pl/sql function that accepts a sdo_geometry (essentially an object with a few varrays), round each number in one of the varrays and retransmits the object.  Here is a version of the function, simplified slightly for brevity:

    create or replace round_coordinates (p_geometry in sdo_geometry, p_round_factor in numbers)

    return sdo_geometry parallel_enable

    is

    sdo_geometry v_geometry: = p_geometry;

    v_ordinates sdo_ordinate_array;

    Start

    v_ordinates: = p_geometry.sdo_ordinates;

    for me in v_ordinates.first... loop of v_ordinates. Last

    v_ordinates (i): = round (v_ordinates (i), p_round_factor);

    end loop;

    Return sdo_geometry (v_geometry.sdo_gtype, v_geometry.sdo_srid, v_geometry.sdo_point, v_geometry.sdo_elem_info, v_ordinates);

    end round_coordinates;

    /

    I need to perform this function as an update DML on hundreds of millions of sdo_geometry objects and according to my estimates it will take weeks.  So, I want to run in parallel.

    The data is in a bunch of tables, some with lines of k ~ 100 more with millions of people.  My preference is to browse the tables and run an update such as:

    Update < table > set geometry = round_coordinates (geometry);

    But I would like to operate in parallel, so I thought that I would allow the DML parallel to the session with

    ALTER session enable parallel dml.

    ALTER table < table > parallel;

    , and then run the update by: Update / * + parallel * / < table > set geometry = round_coordinates (geometry);

    When I do that, I can see a v$ px_session 16 parallel slaves are bent and the plan of the explanation is the following:

    ------------------------------------------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |    TQ | IN-OUT | PQ Distrib.

    ------------------------------------------------------------------------------------------------------------------

    |   0 | UPDATE STATEMENT.             | 10000 |   468K |    43 (0) | 00:00:01 |        |      |            |

    |   1.  UPDATE | SMALL_10000 |       |       |            |          |        |      |            |

    |   2.   COORDINATOR OF PX |             |       |       |            |          |        |      |            |

    |   3.    PX SEND QC (RANDOM). : TQ10000 | 10000 |   468K |    43 (0) | 00:00:01 |  Q1 00 | P > S | QC (RAND) |

    |   4.     ITERATOR BLOCK PX |             | 10000 |   468K |    43 (0) | 00:00:01 |  Q1 00 | ISSUE |            |

    |   5.      TABLE ACCESS FULL | SMALL_10000 | 10000 |   468K |    43 (0) | 00:00:01 |  Q1 00 | SVCP |            |

    ------------------------------------------------------------------------------------------------------------------

    But the update statement on my test data set does not any more quickly - it takes a few seconds more series that suggests General fresh extra expectations for the management of parallel slaves that's happened, but they did not have the query run faster.


    I tried to use the dbms_parallel_execute with the create_chunks_by_rowid option package and parallel_level = 16 With that I get at the end just over 1/16th of the time that it takes to run in series!

    That's fine, so I have the option dbms_parallel_execute, but I would like to understand why the query with the parallel flag does not expedite things.

    Any ideas?

    Thank you

    John

    It may be that the call to the PL/SQL function slows down things. Did you think to do in pure SQL?

    Here is an example:

    update test_sdo tsd
       set tsd.geometry.sdo_ordinates =
           (select cast(collect(round(t2.column_value)) as sdo_ordinate_array)
              from test_sdo t1
                  ,table(t1.geometry.sdo_ordinates) t2
             where t1.id = tsd.id)
    

    Post edited by: PaulHorth

    BTW: You can parallelize the query part of the SQL but not updating, it's documentation:

    "Parallel DML can be done on tables with columns object provided that the columns of the object are not accessible."

  • Trigger to make a difference on the DML statements

    Hello

    I use a trigger on a table:

    Here is the Code:

    CREATE or REPLACE TRIGGER test001
      AFTER INSERT OR UPDATE OR DELETE ON tabletest001
      FOR EACH ROW WHEN (new.org = 43) 
    
    DECLARE
         .....
    BEGIN
    
    IF DELETING THEN 
         INSERT INTO TEMP001 VALUES(.....);
    END IF;
    
    IF INSERTING THEN 
         ...
    END IF;
    
    IF UPDATING THEN 
         .....
    END IF;    
    EXCEPTION
        WHEN OTHERS THEN
              ....
    END;
    

    When the trigger is called to remove the operating instructions inside

    IF DELETING THEN 
         INSERT INTO TEMP001 VALUES(.....);
    END IF;
    

    may not have performed. It is a simple insert statement on a temporary table.

    While his work very well for surgery Update and Delete and respective statements are also get executed.

    Help, please.

    Possible cause: a DELETE event trigger is not 'new', then the condition values "WHERE (new.org = 43)" is never true.

  • The DML statements of audit

    Dear all,

    Use

    SQL> select * from v$version;
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    
    

    I have an obligation to check all DML operations on a particular schema as

    1. DML operation pulled what program such as Toad, sqlplus, sqldeveloper. (except the JDBC connection, connection of thin client, weblogic)

    2. type of DML INSERT, DELETE, UPDATE operation.

    3. date & time

    4. username oracle, OS username (if possible)

    Please offer me if there is no procedure, package, tools to audit over operation.

    Thanks and greetings

    Saami

    Dear all,

    Above the problem has been resolved by closed and restart the session of the user "rubikonsuper" .

    Even though the audit command has executed and managed after the session is restarted only effects it has.

    Thank you & best regards

    Saami

  • encrypt/decrypt in Oracle Forms BEFORE you call an SP or the database DML statement

    Hello.  I'm working on an application where we need to encrypt information before it is sent to the database.  I know that the database has a great set of stored procedures to manage the encryption and decryption.  The only challenge here is the fact that I would need to send information unencrypted in the database "in the clear".  Ideally, I would like to encrypt the information in the form and send it to the database.  On recovery, recover the information and then have the application forms decipher encrypted information.

    Whoever did this as a package within a PLL without all calls to a package DBMS_?

    Thank you

    BradW

    OK, I think I have the solution.  We are going to import a java class that we create to do this for us.  We then import it in forms in a library of PLL.  Problem solved!

    Nice little intro to importing Java can be found here:

    Java in Oracle Forms without beans and pluggable Java components

  • Name of the dictionary database to get last modified time and date of DML statement?

    How can I know the table is finally updated the date and time? There must be a data dictonary table, please let me know the name of this table.

    Another way to find this info for 10 g + dbs is:

    Select max (ora_rowscn), scn_to_timestamp (max (ora_rowscn)) table.

  • dml execution 2 statements at a time with the help of execute immediate

    I would like to run 2 DML statements at a time with the help of execute immediate usefulness,.

    ex:

    update employee set ename = 'Chantal' where eno = 123;
    Update dept set dname = 'IT' where dno = 345;

    I want the two statement to execute at a time, but I don't want to use any loop as well.

    Thanks in advance

    You can use:

    execute immediate 'begin update employee set ename='jagadeesh' where eno=123; update dept set dname='IT' where dno=345; end;';
    

    Although updates will always run one after the other.

    If you want the simultaneous treatment, then you need to use DBMS_JOB and DBMS_SCHEDULER to plan both work to run to run each of the statements independently.

Maybe you are looking for