After alter on database Trigger

I have a trigger of database that fires "after alter on database' and sent me an email so that I can take certain administrative measures. In this trigger, I see some system as variables:
ora_dict_obj_type, ora_dict_obj_name, ora_sysevent
I try to limit my trigger for email me only when the ALTER event is when someone is adding a column or dropping a column. However, I found that ora_sysevent is always equal to "ALTER" even for events such as enabling/disabling of the constraints. I want only the email to send when someone is adding or removing a column.

Is there a system variable that I can use to find out if the event ALTER has been adding or dropping a column?
CREATE OR REPLACE TRIGGER TTMS.altered_ttmsdb_tabs_trigger
AFTER ALTER ON database
DECLARE
  PSENDER VARCHAR2(200);
  PRECIPIENT VARCHAR2(200);
  P_CC_RECIPIENT VARCHAR2(200);
  P_BCC_RECIPIENT VARCHAR2(200);
  PSUBJECT VARCHAR2(200);
  PMESSAGE VARCHAR2(6000);
  auditTable_ind varchar2(1);
  BEGIN
  
    select nvl(count(table_name),0)
    into auditTable_ind
    from all_triggers
    where substr(trigger_name,1,9) = upper('tr_audit#')
    and table_name=ora_dict_obj_name;

    if auditTable_ind > 0 then
      INSERT INTO altered_tabs
      VALUES
      (ora_dict_obj_type, ora_dict_obj_name, SYSDATE, user, ora_sysevent);
      PSENDER := '[email protected]';
      PRECIPIENT := '[email protected]';
      P_CC_RECIPIENT := '[email protected]';
      P_BCC_RECIPIENT := '[email protected]';
      PSUBJECT := 'TTMS Audit - Altered Audit Table Alert - Action Required';
      PMESSAGE := ora_dict_obj_name||' was altered on '||sysdate||' by '||user||'.  Please rebuild the audit index immediately.';
      TTMS.SEND_MAIL ( PSENDER, PRECIPIENT, P_CC_RECIPIENT, P_BCC_RECIPIENT, PSUBJECT, PMESSAGE );
    end if;
  END;
/

It is a collection of strings (although most DDL will be short enough to be represented in a single item in the collection). There is an example of using this in the documentation

sql_text ora_name_list_t;
stmt VARCHAR2(2000);
...
n := ora_sql_txt(sql_text);
FOR i IN 1..n LOOP
 stmt := stmt || sql_text(i);
END LOOP;
INSERT INTO event_table ('text of triggering statement: ' || stmt);

Just to point out, however, please make sure that you are not re - reinventing the wheel for something you can do with the audit of the actual database.

Justin

Tags: Database

Similar Questions

  • Database trigger can not see the package global variable after assign in my form

    Hello

    I faced the problem with the trigger and the package variable global using the form designer

    first of all, I get the local IP address machine using WEBUTIL in triggering of the PREFORM and initialize my global package variable by ' Client_Info_Pkg.Set_IP_Address (WEBUTIL_CLIENTINFO.» GET_IP_ADDRESS); ", then I tried to make the DML operation in my form and at the same time I trigger database also uses the package global variable of" Client_Info_Pkg.Gand_IP_Address; "to read in the package, and then insert it into the audit table


    The question this database trigger may not feel the initialization "Client_Info_Pkg.Set_IP_Address (WEBUTIL_CLIENTINFO. GET_IP_ADDRESS)' I did in triggering of the PREFORM and I used to wonder if oracle create new session to run this trigger so he can't see my boot or what?!. .

    the package

    CREATE OR REPLACE PACKAGE Client_Info_Pkg

    Global_IP_Address VARCHAR2 (100);

    FUNCTION Get_IP_Address RETURN VARCHAR2;

    PROCEDURE Set_IP_Address (p_Machine_Name IN VARCHAR2);

    END Client_Info_Pkg;

    /

    CREATE OR REPLACE PACKAGE BODY Client_Info_Pkg

    FUNCTION Get_IP_Address RETURN VARCHAR2 IS

    BEGIN

    RETURN Global_IP_Address;

    END;

    PROCEDURE Set_IP_Address (p_IP_Address IN VARCHAR2) IS

    BEGIN

    Global_IP_Address: = p_IP_Address;

    END;

    END Client_Info_Pk

    relaxation

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

    CREATE OR REPLACE TRIGGER RUNERP.FO_DOC_TYPES_L_T

    BEFORE INSERT OR UPDATE OR DELETE ON FO_DOC_TYPES

    REFERRING AGAIN AS NINE OLD AND OLD

    FOR EACH LINE

    BEGIN

    IF THE INSERTION

    RUN IMMEDIATELY ' INSERT INTO FO_DOC_TYPES_LOG

    VALUES ("I",: DOC_TYPE_ID,: DOC_TYPE_VALUE,: DOC_TYPE_NAME,: Vip_Address' HELP: NEW.) DOC_TYPE_ID,: NEW. DOC_TYPE_VALUE,: NEW. DOC_TYPE_NAME, Client_Info_Pkg.Get_IP_Address;

    END IF;

    IF THE UPDATE CAN

    RUN IMMEDIATELY ' INSERT INTO FO_DOC_TYPES_LOG

    VALUES ("U",: DOC_TYPE_ID,: DOC_TYPE_VALUE,: DOC_TYPE_NAME,: Vip_Address) "USING: NEW." DOC_TYPE_ID,: NEW. DOC_TYPE_VALUE,: NEW. DOC_TYPE_NAME, Client_Info_Pkg.Get_IP_Address;

    END IF;

    IF REMOVE THEN

    RUN IMMEDIATELY ' INSERT INTO FO_DOC_TYPES_LOG

    VALUES ("D",: DOC_TYPE_ID,: DOC_TYPE_VALUE,: DOC_TYPE_NAME,: Vip_Address) "USING: NEW." DOC_TYPE_ID,: NEW. DOC_TYPE_VALUE,: NEW. DOC_TYPE_NAME, Client_Info_Pkg.Get_IP_Address;

    END IF;

    END;

    /

    Thanks in advance

    I solved my problem by using the CONTEXT object, Michael thank you for your interest.

  • AFTER LOGON ON DATABASE

    Hello

    I have create a trigger to kill the unwanted remote sessions to help AFTER logon ON DATABASE.

    But the session is killed after about 30 seconds. Until the time ' select distinct username, status from v$ session; "reflecting the situation as inactive instead of 'KILLED '.

    Once the State takes the session killed get immediately terminated.

    I can understand if the status is killed and waiting for a period of time as it will only mark he shot and async... killés the session in a few seconds.

    but I'm not able to follow why it shows almost 30 second INACTIVE status.

    Thank you

    Ajay

    Hello

    You should not need to kill just raise an exception in the logon trigger that will kick to it-see this example on asktom

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:3236035522926

    See you soon,.

    Rich

  • Database trigger to get the value of Variable forms... How... ??

    Hello

    I have a global varibale in a form having a block of the base table. I created a trigger on the base table data after deletion/update, it will include all the updates/delete lines in the Table of Trail.

    I want to insert this global variable (which is available in the form) in the Trail Table as well as all other values of the record with the database trigger. But this global variable is available in the form not available in the database trigger. How to pass this variable to database trigger...


    Help, please...
    Thank you and best regards.

    Hello

    Package variables are specific session.

    If user1 is
    PAK_TEST.lv_user = 'user1'
    In the other schema user2
    PAK_TEST.lv_user will always be the null value.

    Locking won't, if you commit records using the trigger.
    Kind regards
    Franck

  • Capture a custom in my form of database trigger exception

    Hello. I have a database trigger on my Base Table with a custom exception that will trigger an error ORA-20000 in my form. "" My problem is that an error window appears reading "FRM-40735: WHEN BUTTON PRESSED triggered trigger unhandled exception ORA-20000. I try to capture the ORA-20000 in the trigger ON ERROR below code, but it does not work. I could catch the FRM-40735, but I really want to catch the ORA-20000 specifically. Is it possible to do both? At the end of the day, I want to replace my own message personalized as shown below. Any help would be appreciated. Thank you.
    DECLARE 
      Alert_Message  VARCHAR2(200) := NULL;
      MSG_Num        NUMBER        := ERROR_CODE; 
      MSG_Txt        VARCHAR2(80)  := ERROR_TEXT; 
      MSG_Typ        VARCHAR2(3)   := ERROR_TYPE; 
    BEGIN 
      IF MSG_Num NOT IN( 0, 40100, 20000 ) THEN          --replace with bad errcodes
        Alert_Message := (MSG_Typ||'-'||to_char(MSG_Num)||':'||MSG_Txt);
        Call_Alert.The_Error(Alert_Message); 
      ELSIF MSG_Num IN( 0 ) THEN          --replace with custom error messages to override the default messages
        Alert_Message := ('Custom Message Here');
        Call_Alert.The_Error(Alert_Message);     
      ELSIF MSG_Num IN( 20000 ) THEN          --replace with custom error messages to override the default messages
        Alert_Message := ('ORA-20000 - Bundle_Update_PC trigger failure on the Bundle table');
        Call_Alert.The_Error(Alert_Message);     
      END IF; 
    if error_code =  40735 Then
     if dbms_error_code = -20001 THEN
      Alert_Message ...
     end if;
    ....
    
  • user name of the user who runs an Apex application in a database trigger

    Hello

    I need to fill a field of the audit in a trigger of database with the username of the user who runs an Apex application.
    In Oracle forms, I would have used the keyword "USER", I tried to use
    the word 'USER' in my trigger, but it is up to the user "APEX_PUBLIC_USER". I guess
    all users get connected as long as 'APEX_PUBLIC_USER' at a certain level.

    Can someone tell me how I can get the real of the user connected to the application of the Apex of a database trigger?

    I thank in advance for any assistance.

    Might want this in addition:

    nvl(v('APP_USER'), user)
    

    Since the database has no notion of the Apex, if you never update/insert/etc ' ing outside a session of Apex, v() will return a null value. That may be fine for your needs, but if your column is not nullable, it will throw an error.

    Just something to consider.

  • Can not find the trace file after "alter database backup controlfile to trace;" on the RDBMS 11.2.0.3

    Hello

    I use a database on RDBMS 11.2.0.3. Connected as sys and run

    SQL > alter database backup controlfile to trace;

    Database altered.

    view the USER_DUMP_DEST parameter.

    VALUE OF TYPE NAME

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

    user_dump_dest string D:\app\oracle\diag\rdbms\pears

    dev\pearsdev\trace

    Looking at the track record, there is no trace file? What am I missing?

    Thank you

    Mathias

    Confirm with:

    SQL > dir D:\APP\ORACLE\CONTROLFILE the host. TXT

  • Invalid procedure after alter table add < column >

    Hello Experts,

    I was faced with a situation where I add a column in a table that is used in a procedure, immediately after the addition of the new procedure associated with this table column becomes invalid.

    Can someone explain please know why this happens.

    Database version:-11.2.0.4.

    I was faced with a situation where I add a column in a table that is used in a procedure, immediately after the addition of the new procedure associated with this table column becomes invalid.

    Can someone explain please know why this happens.

    Yes - the Oracle documentation explains this. I found this doc with a simple search of "column, add the oracle 11g invalid procedure.

    http://docs.Oracle.com/CD/B28359_01/server.111/b28318/dependencies.htm#CHDJIIFC

    Table 6-2 , shows how objects are affected by changes to other objects upon which they depend.

    Table 6-2 operations affects this object status

    Operation Where the status of dependent objects

    ALTERTABLEtableADDcolumn

    INVALIDWhen:

    • Uses of the object (except a view)-dependent SELECT * on table .
    • Dependent object uses table %rowtype .
    • Dependent object performs INSERT on table without specifying a list of columns.
    • Dependent object references table in the query that contains a join in SQL.
    • Dependent object references table in the query that refers to a PL/SQL variable.

    Otherwise, no change.

    Read the WHOLE ARTICLE and see if it does not have to explain your problem.

  • How Controlfile SNA remain synchronized after moving the database with the cold backup

    Hello DBAs,

    I doubt that:

    Every time you pass a cold backup database. We create a new controlfile with new locations of data/redologs etc.

    And then we execute "create controlfile reuse...". noresetlogs...; "to create the controlfile.

    After that, we will open the database as > > alter database open;

    Now the question is:

    We are able to open the database without clause "resetlogs.

    Here, we create a new controlfile so SNA to controlfile will not be synchronized with the SCN of the datafile and redo the file.

    Please let me know how the new controlfiles' SNA is synchronized with the data file and redofile and wea are able to open the database without resetlogs clause.

    Oracle: 11.2.0.4

    OS: Linux

    If your cold backup also includes online redo logs, a RESETLOGS is not necessary.

    The controlfile is created if it does not have a SNA, it reads the data file headers the YVERT database. For a cold backup, all the headers of data file are consistent.  (This is also the reason why a RECOVERY is not required).

    Hemant K Collette

  • Database trigger error

    Hello
    Version 10204

    I have a 3rd party application that do the following steps:
    1. create an empty table on the fly with the name of dynamics that change.
    2. fill in the table with the records
    3. create an INDEX on the table
    4 collect statistics on the INDEX

    As you can see because there are no statistics on the oracle of the table uses dynamic sampling.

    I would like to get the index and then creating using DB TRIGGER to create statistics on the table.

    I started to write the following trigger and get an error as follows:

     
    SQL> CREATE OR REPLACE TRIGGER SYSTEM.UNICA_STATS 
      2  after create 
      3  ON DATABASE 
      4  DECLARE 
      5  p_host VARCHAR2(512); 
      6  sql_text ora_name_list_t; 
      7  stmt VARCHAR2(2000); 
      8  n number; 
      9  BEGIN 
    10     n := ora_sql_txt(sql_text); 
    11     FOR i IN 1..n LOOP 
    12       stmt := stmt || sql_text(i); 
    13     END LOOP; 
    14         IF (ora_sysevent='CREATE'  and upper(stmt) like '%CREATE INDEX UAC_%' ) THEN 
    15             declare 
    16                v_tab_name  varchar2(50); 
    17             begin 
    18             SELECT TABLE_NAME 
    19             into v_tab_name 
    20             FROM   DBA_INDEXES 
    21             WHERE OWNER = 'CM' 
    22             AND   INDEX_NAME =ora_dict_obj_name; 
    23    --         DBMS_OUTPUT.PUT_LINE('V_TAB_NAME='||V_TAB_NEME); 
    24             RAISE_APPLICATION_ERROR(-20000, 'rAISED BY YOAV!'); 
    25             end; 
    26         END IF; 
    27  END; 
    28  / 
    
    Warning: Trigger created with compilation errors. 
    
    SQL> sho err 
    Errors for TRIGGER SYSTEM.UNICA_STATS: 
    
    LINE/COL ERROR 
    -------- ----------------------------------------------------------------- 
    15/12    PL/SQL: SQL Statement ignored 
    17/19    PL/SQL: ORA-00942: table or view does not exist 
    But:
     
    SQL> SELECT TABLE_NAME 
      2  FROM   DBA_INDEXES 
      3  WHERE OWNER = 'CM' 
      4  and rownum=1; 
    
    TABLE_NAME 
    ------------------------------ 
    UNC_ACCLEAN_FCHID_FAILS 
    Any advice?

    Thank you

    Solomon-

    Excellent point. I was copying just that of the original poster and I did not stop even to think about it.

    Justin

  • HAVE fast acquisition after the signal from trigger-DI

    Hello world

    the work of the VI I train is basically very simple:

    There are 8 analog inputs, which need to be given reading a entry digital-trigger after.

    Parameters: frequency of sampling per channel: 2 ms/s, number of samples per channel: 1024

    This acquisition is very often repeated (1000 x +). So I put the trigger and the part of reading inside a while loop. The task initialization happens before this loop and the task is closed later.

    The problem that I have is the speed! The acquisition itself (1024 samples/channel to 2 ms/s/channel) should (in theory) be done in the ~0.5ms but actually lasts longer...

    My goal is to make the process: trigger-> acquisition in 2ms. He is currently, reliable with a rate of repetition of 15ms. ~

    Do you know the guy in any way to increase the speed? I played a bit with manually set size of buffer and initialize a task dedicated for the trigger itself. The two does not improve it.

    Hardware DAQ-I'm by train is USB6366 and a system of SMU with a PXIe6368 inside.

    I don't really know where this quite simple line, time is lost...

    Best regards and thanks,

    Michael

    Hello mschoeff,

    If I understand you correct you want to retrigger the acquisition. Then you must

    Configure the trigger outside all loop and use the node property to enable the trigger.

    Here is an explanation:

    Support for redeclenchables tasks on X Series multifunction data acquisition cards

    It may be useful

  • PLS-00049: bad bind variable in the database trigger

    Hi all

    If the POSTAL code table has no matching records, the trigger must create a new record for the given value of the zipper before you add a new record to the STUDENT table

    SQL > CREATE TABLE student

    (

    zip VARCHAR2 (5).

    student_id NUMBER,

    created_by VARCHAR2 (10),

    CREATED_DATE DATE,

    Modified_By VARCHAR2 (10),

    MODIFIED_DATE DATE

    );

    SQL > CREATE TABLE zip code

    (

    zip VARCHAR2 (5).

    zip_ID NUMBER,

    created_by VARCHAR2 (10),

    CREATED_DATE DATE,

    Modified_By VARCHAR2 (10),

    MODIFIED_DATE DATE

    );

    SQL > CREATE VIEW student_v

    AS

    SELECT *.

    OF the student;

    Created view.

    SQL > CREATE OR replace TRIGGER student_ins

    instead of INSERT ON student_v

    FOR EACH LINE

    DECLARE

    v_zip VARCHAR2 (5);

    BEGIN

    BEGIN

    SELECT zip

    IN v_zip

    ZIP CODE

    WHERE zip =: NEW.zip;

    EXCEPTION

    WHEN no_data_found THEN

    INSERT INTO postal code

    (zip,

    zip_ID,

    created_by,

    CREATED_DATE,

    Modified_By,

    MODIFIED_DATE)

    VALUES (: NEW.zip,)

    : NEW.zip_id-> not commented

    USER,

    SYSDATE,

    USER,

    SYSDATE);

    END;

    INSERT INTO student

    (zip,

    student_id,

    created_by,

    CREATED_DATE,

    Modified_By,

    MODIFIED_DATE)

    VALUES (: NEW.zip,)

    : NEW.student_id,.

    USER,

    SYSDATE,

    USER,

    SYSDATE);

    end;

    Decline: Trigger created with compilation errors.

    SQL > show error

    Errors for STUDENT_INS TRIGGER:

    LINE/COL ERROR

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

    19/21 PLS-00049: bad connection variable ' NEW. ZIP_ID'

    SQL > ed

    CREATE or replace TRIGGER student_ins

    instead of INSERT ON student_v

    FOR EACH LINE

    DECLARE

    v_zip VARCHAR2 (5);

    BEGIN

    BEGIN

    SELECT zip

    IN v_zip

    ZIP CODE

    WHERE zip =: NEW.zip;

    EXCEPTION

    WHEN no_data_found THEN

    INSERT INTO postal code

    (zip,

    zip_ID,

    created_by,

    CREATED_DATE,

    Modified_By,

    MODIFIED_DATE)

    VALUES (: NEW.zip,)

    -: NEW.zip_id, -> replace commented with NULL

    NULL,

    USER,

    SYSDATE,

    USER,

    SYSDATE);

    END;

    INSERT INTO student

    (zip,

    student_id,

    created_by,

    CREATED_DATE,

    Modified_By,

    MODIFIED_DATE)

    VALUES (: NEW.zip,)

    : NEW.student_id,.

    USER,

    SYSDATE,

    USER,

    SYSDATE);

    end;

    SQL > /.

    SQL > insert into student_v (zip) values('111');

    1 line of creation.

    SQL > select * from student_v

    2.

    ZIP STUDENT_ID CREATED_BY CREATED_D MODIFIED_B MODIFIED_

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

    111 APPS APPS APRIL 3, 14 3 APRIL 14

    SQL > select * from student

    2.

    ZIP STUDENT_ID CREATED_BY CREATED_D MODIFIED_B MODIFIED_

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

    111 APPS APPS APRIL 3, 14 3 APRIL 14

    SQL > select * from zip code

    2.

    ZIP ZIP_ID CREATED_D MODIFIED_B MODIFIED_ CREATED_BY

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

    111 APPS APPS APRIL 3, 14 3 APRIL 14

    You wrote trigger on the table of the student. So in the trigger, only the columns of this table must be offered for example: NEW.zip.

    Since zip_id is not part of this table, the: NEW.zip_id must always generate the error.

    insert into student_v (zip) values('111');

    In the above statement, you can only provide the value for the column zip but not zip_id. Therefore, the: NEW.zip_id is not available in the trigger. Must extract this value in the sequence after it is created.

    for example

    create the test of the order;

    INSERT INTO postal code

    (zip,

    zip_ID,

    created_by,

    CREATED_DATE,

    Modified_By,

    MODIFIED_DATE)

    VALUES (: NEW.zip,)

    test.nextval,

    NULL,

    USER,

    SYSDATE,

    USER,

    SYSDATE);

  • modify the INSTANCENAME parameter after the backup database

    Hello

    our primary database is configured as follows:

    SQL > show parameter db_name;
    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    db_name string prod01


    SQL > show the INSTANCENAME parameter
    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    instance_name string prod01

    the corresponding backup database is configured as:

    SQL > show parameter db_name;
    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    db_name string prod01


    SQL > show the INSTANCENAME parameter
    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    instance_name string stbyprod01

    Now, the standby database must be enabled. Later, I want to change the stbyprod01 to prod01 INSTANCENAME parameter.

    The question now is: what does take to change the INSTANCENAME parameter? In fact the database pending will be

    already be activated and be considered and treated as a stand-alone database. The former primary database will be used no more.

    I would like to do the following:

    SQL > create pfile = 'initprod01.ora' of spfile;

    SQL > shutdown immediate;

    Oracle # > change the pfile file and change the stbyprod01 to prod01 INSTANCENAME parameter

    SQL > startup;

    SQL > create spfile = 'spfileprod01.ora' of pfile;

    SQL > shutdown immediate;

    SQL > startup;

    That should be all - from my point of view (I know that LISTENER.) ORA and TNSNAMES. ORA should be modified, too).

    If someone has already experiences with the INSTANCENAME parameter change but sees some additional configurations: Please let me know!

    Rgds

    Jan

    1. you can use "alter system set instance_name" to change the value of the instance name.

    2. you must do the following to activate the standby database (NOTE:-this is only for the activation of the backup database and not the passage to digital database)

    1 startup nomount

    2. change the base of Mount Eve.

    3. change the database activate the database pending.

    4. change the database open.

  • When to use it: old.value &: new.value and when to use after and before in trigge

    Hi all

    I have a base table and a table of newspaper. Whenever I insert values in the base table can immediately update the table of the journal with some of the columns in the base table. To do this, I wrote the code. It looks like this:

    CREATE OR REPLACE
    Temp_log_track RELAXATION
    AFTER INSERT OR DELETE ON temp_list_cmpgn_hist_dtl
    FOR EACH LINE
    DECLARE
    v_partition_name varchar2 (20);
    v_num_records varchar2 (20);
    BEGIN
    v_partition_name: = to_char (: new .campaign_start_date, "YYYYMM");
    SELECT v_num_records FROM list_campaign WHERE program_id = num_records: new.program_id
    AND program_child_id =: new.program_child_id;
    IF the insertion
    INSERT INTO temp_list_cmpgn_bkup_log
    (campaign_start_date, load_date, program_child_id, program_id, partition_name, num_records)
    VALUES (: new .campaign_start_date,: new.load_date,: new.program_child_id,: new.program_id,)
    "list_cmpgn_" | (v_partition_name, v_num_records);
    DBMS_OUTPUT. PUT_LINE ('INSERTED');
    ON THE OTHER
    DELETE FROM temp_list_cmpgn_bkup_log
    WHERE program_child_id =: old.program_child_id / * AND campaign_start_date =: old.campaign_start_date AND load_date =: old.load_date
    AND program_id =: old.program_id
    AND nom_partition = 'list_cmpgn_ ' | v_partition_name AND num_records = v_num_records * /;
    END IF;
    EXCEPTION
    WHILE OTHERS THEN
    DBMS_OUTPUT. Put_line ('Error');
    END;

    (1.) I am able to insert values into the table of the journal whenever I insert values in the base table, but I'm not able to delete the values in the table of the newspaper whenever delete is performed on the base table.
    2.) when to use it: OLD.value and: NEW.value?
    (3.) when to use AFTER and when to use BEFORE?

    As sb90275, you should really use the actual dates, no strings, in your query. You can use the TO_DATE function to convert a date string, i.e.

    DELETE FROM table_name
     WHERE program_id = :1
       AND program_child_id = :2
       AND load_date = to_date( '30-NOV-84', 'DD-MON-RR' )
       AND campaign_start_date = to_date( '20-NOV-85', 'DD-MON-RR' )
    

    If you store data in LOAD_DATE or CAMPAIGN_DATE where the component "hour" is something else that at midnight, you would need to TRUNC (load_date) or TRUNC (campaign_start_date).

    If you look at the error stack, you'll see that the error is thrown to line 6 of your relaxation. Line 6 of your trigger is the statement

    SELECT num_records
      INTO v_num_records
      FROM list_campaign
     WHERE program_id = :new.program_id
       AND program_child_id = :new.program_child_id; 
    

    If you delete data, there is none: new.program_id or: new.program_child_id. Both values are NULL. This means that the SELECT statement retrieves no data, which means he raises an ORA-01403 error. I don't know why you do this query in the first place. You may delete it. Maybe you should do inside the INSERT IF statement. Maybe you need to change to select the COUNT (*) BOF the: old.program_id and: old.program_child_id if you are deleting lines.

    Justin

  • Data synchronization after restoring the database to the Source or target

    Hi DBAs,

    I've implemented replication unidirectional flow at the level of transactional database to the database schema (excluding some tables). It works very well without any problems after doing the tuning of flow with the help of health check scripts. My question is if some reasons, if I have to recover to the level of the database on the database Source then I need rebuild flows from scratch? Database size is close to 2 TB and after recovery, even using the pump data at the same time, it could take hours and also the source won't be available even after the recovery (data pump running job - if the source is online, then I was getting ORA-01555 errors and work was not).

    Please notify by above circumstances what is the best way to re - synchronize data between the source and target.

    Thank you
    -Samar-

    I would export of the datadict (build) once again, just to avoid any MVDD, something to do directly after the restoration of the DB,.
    because I'm not sure from the perception of this restoration DB in terms of DBID. Have you checked in rman if source db is considered to be the epitome?

    Then restart what are the messages in the target error queues. I think that you will have problems to move the first_scn
    due to differences on some YVERT in source/target system.logmnr_restart_ckpt$. system will think it has holes.
    You may need to manually remove a bunch of lines to allow the flow to jump on the fate of the YVERT
    that have been sent and are not present in the source system.logmnr_restart_ckpt$

Maybe you are looking for