Ora-00001 and triggers

I have a trigger that fires after tbl 1 col 9 update event.
the trigger references old as old new as new on tbl 1.
and proceeds to test old.value vs new.value
it's goal is to insert a row into tbl 2 which are values from tbl 1.
tbl 2 contains a unique constraint.
I am trying to trap the condition DUP_VAL_ON_INDEX within the trigger and "log" the key thats failing, but continue. In this case the trigger is a hidden procedure from a called procedure whos goal is to update tbl 1 col 9 with a date.
I have tryed this a number of ways.
any help would be appreciated.
tbl2 PK is a 6 part combo (julian_yr,julian_day,submit_typ,btch_num,id_num,adj_num)
CREATE OR REPLACE TRIGGER tbl2
AFTER UPDATE
ON tbl1
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
begin
if (:old.h_upld_dt is null and
:new.h_upld_dt is not null) then
if (:new.status_cd in ('EOK', 'MIS', 'DUP')) then
insert into tbl2
values (:new.julian_yr,
:new.julian_day,
:new.submit_typ,
:new.btch_num,
:new.id_num,
:new.adj_num,
sysdate, '', '', '');
end if;
end if;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
DBMS_OUTPUT.PUT_LINE ('tbl1 trigger into tbl2 failure: ' ||
:new.julian_day ||
:new.submit_typ ||
:new.btch_num ||
:new.id_num ||
:new.adj_num ||
sysdate);
null;
end;
/

there is always differnet ways to reach the goal.
I was able to return the exception dup_val_on_index from the trigger back to the initiating procedure then deal with the issue there, which seems to work well. More testing should confirm.
Thanks

Similar Messages

  • ORA-00001 and ORA-06512 error on  DBMS_WM.ResolveConflicts

    We are getting unique constraint error in Production Database. We are able to merge most of the workspaces with no issues. One workspace is givign errors on merge.
    Here is the code
    begin
    dbms_wm.gotoworkspace('denialletterspoc_onmzpulp');
    dbms_wm.setdiffversions('denialletterspoc_onmzpulp','LIVE');
    dbms_wm.SetConflictWorkspace('denialletterspoc_onmzpulp');
    commit;
    DBMS_WM.BeginResolve('denialletterspoc_onmzpulp');
    DBMS_WM.ResolveConflicts(
    workspace => 'denialletterspoc_onmzpulp',
    table_name => 'MCM_MESSAGE',
    where_clause => ' id in (8403026,10134822,8259485,8259488,8426289,8426287,10186643,8426288) ',
    keep => 'CHILD'
    exception when others then
    DBMS_WM.RollbackResolve('denialletterspoc_onmzpulp');
    raise;
    end;
    ORA-00001: unique constraint (T2.MCM_MESSAGE_PK) violated
    ORA-06512: at line 16
    I looked at the date in XXX_lt tables and it does not look suspecious. Please help us understand
    ORA-00001 and ORA-06512 error.
    Amit Gangwar

    Hi, Ben
    Our OWM_VERSION is 10.2.0.4.3.
    I tried disable and enable constraint MCM_MESSAGE_PK. But didn't fix our issue.
    Split where clause from " id in (...) " syntax to " id = ... " syntax will reduce performance heavily. And I did some test that " id in (...) " syntax works well in our dev env.
    I opened our trace file and get below plsql block. When I perform it get same error with our original codes. Please notice the part of "forall wm_indx in WM_rowids.first .. WM_rowids.last execute immediate 'begin insert into T2.MCM_MESSAGE_lt ... ...", error occurred here. But if I change the "forall" syntax to normal " for ... loop" syntax then no error here. Can you give me some advice or suggestion?
    DECLARE
    WM_rowids wmsys.lt_ctx_pkg.rowidTabType;
    WM_rowids_vt wmsys.lt_ctx_pkg.rowidTabType;
    WM_curver wmsys.lt_ctx_pkg.int_tab;
    WM_vtRow wmsys.lt_ctx_pkg.int_tab;
    WM_nextver wmsys.lt_ctx_pkg.nextver_tab;
    WM_found integer := 0;
    BEGIN
    dbms_wm.gotoworkspace('denialletterspoc_onmzpulp');
    dbms_wm.setdiffversions('denialletterspoc_onmzpulp','LIVE');
    dbms_wm.SetConflictWorkspace('denialletterspoc_onmzpulp');
    /* update the auxilliary table of snapshots */
    /* These are rows in the current version that have already been resolved once */
    update T2.MCM_MESSAGE_aux st
    set (snapShotChild, snapShotParent, versionParent) =
    (select p.WM_childds, p.WM_parentds, p.WM_parentver
    from T2.MCM_MESSAGE_pkc p
    where p.ID = st.ID),
    value = '0',
    wm_opcode = 'CC'
    where st.versionChild = 614
    and (ID) in (select ID
    from T2.MCM_MESSAGE_pkc p
    where (id in (8403026,
    10134822,
    8259485,
    8259488,
    8426289,
    8426287,
    10186643,
    8426288)));
    select distinct WM_ridchild bulk collect
    into WM_rowids
    from T2.MCM_MESSAGE_pkc
    where (id in (8403026,
    10134822,
    8259485,
    8259488,
    8426289,
    8426287,
    10186643,
    8426288))
    and WM_childver != 614;
    if (WM_rowids.first is not null) then
    WM_found := 1;
    forall wm_indx in WM_rowids.first .. WM_rowids.last
    update T2.MCM_MESSAGE_lt
    set retireTime = wmsys.owm_9ip_pkg.activeTimeForDML,
    nextver = wmsys.lt_ctx_pkg.getNextVer(nextver,
    614,
    version,
    'denialletterspoc_onmzpulp',
    'CRS_LEAF',
    22)
    where rowid = WM_rowids(wm_indx)
    returning wmsys.lt_ctx_pkg.getCurNextVer bulk collect into WM_nextver;
    /* These are the rows that have not yet been resolved after the latest BeginResolve */
    forall wm_indx in WM_rowids.first .. WM_rowids.last execute immediate
    'begin insert into T2.MCM_MESSAGE_lt(ID,DPS_APPLICATION_ID,TYPE_ID,NAME,PRIVILEGED,CAMPAIGN_ID,TEXT,FILE_NAME,GRAPHIC_WIDTH,GRAPHIC_HEIGHT,DESCRIPTION,ACTIVE,INCLUDE_IN_LIBRARY,MESSAGE_FILTER_ID,OP_USER_ID,OP_WORKSPACE,OP_TIME,version,createtime,retiretime,nextver,delstatus,ltlock)
    (select t1.ID,t1.DPS_APPLICATION_ID,t1.TYPE_ID,t1.NAME,t1.PRIVILEGED,t1.CAMPAIGN_ID,t1.TEXT,t1.FILE_NAME,t1.GRAPHIC_WIDTH,t1.GRAPHIC_HEIGHT,t1.DESCRIPTION,t1.ACTIVE,t1.INCLUDE_IN_LIBRARY,t1.MESSAGE_FILTER_ID,t1.OP_USER_ID,t1.OP_WORKSPACE,t1.OP_TIME,614, wmsys.owm_9ip_pkg.activeTimeForDML, null,:1, sign(delstatus)*(abs(delstatus)+1),
    wmsys.lt_ctx_pkg.checkngetlock(''C'', t1.ltlock, t1.nextver, ''denialletterspoc_onmzpulp'', 0,
    ''MODIFY'', t1.version, t1.delstatus, 0, 1)
    from T2.MCM_MESSAGE_lt t1
    where t1.rowid = :2); end;'
    using WM_nextver(wm_indx),
    WM_rowids(wm_indx)
    end if;
    if (WM_found = 1) then
    wmsys.lt_ctx_pkg.update_modified_tables('T2',
    'MCM_MESSAGE',
    614,
    'denialletterspoc_onmzpulp',
    22);
    end if;
    if (WM_found = 1) then
    forall wm_indx in WM_rowids.first .. WM_rowids.last
    delete from T2.MCM_MESSAGE_aux
    where (ID) in (select ID
    from T2.MCM_MESSAGE_lt
    where rowid = WM_rowids(wm_indx))
    and childState = 'denialletterspoc_onmzpulp';
    end if;
    /* now insert new syncing information about these rows */
    execute immediate 'insert into T2.MCM_MESSAGE_aux (
    select ID,
    p.WM_childstate, p.WM_parentstate,
    p.WM_childds, 614, p.WM_parentds, p.WM_parentver, ''0'',''CC''
    from T2.MCM_MESSAGE_pkc p
    where ( id in (8403026,10134822,8259485,8259488,8426289,8426287,10186643,8426288) ) )';
    END;
    Thanks
    Amos

  • Rerunning script (DML and DDL) without ora-00001 and ora-00955 errors

    What is the best way to write a DML and DDL script so that it can be run multiple times without these ORA errors:
    ORA-00955: name is already used by an existing object
    ORA-00001: unique constraint (JILL.SYS_C00160247) violated
    I have just joined a product development company using SQL Server as there primary database. They have just completed a port to Oracle.
    Their product release upgrades (given to clients) include sql scripts with database changes (structure and data). They require that the client be able to rerun the scripts more than once with no errors. In SQL Server, the accomplish it this way.
    For DDL:
    if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MyTab]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    Begin
         CREATE TABLE [dbo].[MyTab] (
              [ID]int IDENTITY(1,1),
              [InvID] uniqueidentifier not null
    For DML:
    IF NOT EXISTS (SELECT 1 FROM [dbo].[mytab] WHERE [Name] = 'Smith' and [ID] = 3)
    BEGIN
    INSERT INTO [dbo].[mytab]
    ([ID] ,[Name]
    VALUES (3,'Smith')
    END
    I am tasked with duplicating this logic on the Oracle side. The only way I can think of so far is using plsql and checking for existence before every insert and create statement. The other options I thought of cannot be used in this case
    - "whenever sqlerror continue" - gives the same response for all errors. True errors should stop the code, so this is too risky.
    - "log errors into ... reject limit unlimited" on the insert - I thought this was my best solution until I found out that it doesn't support lobs.
    Do you know of any more elegant (and more efficient) solution other than plsql cursors to check for existence before running each insert/create?
    Any suggestions would be greatly appreciated.

    select table_name from user_tables will give you the table exist or not.
    all_tables/dba_tables
    http://download.oracle.com/docs/cd/B14117_01/server.101/b10755/statviews_1190.htm#i1592091

  • Skip ora-00001 and continue?

    Hi,
    I need to perform an update on a table like this:
    update myTable
    set myColumn = ltrim(myColumn, '0'); --trim all leading zeros
    I wnat this to perform on every row where it does not conflict with my unique constraint. I do not want to disable the constrataint because then I will end up with dupplicate records.
    Is it possible to create a script where the query executes on all rows where it does not conflict with any constrain? ...and simpy skip the confliction-rows?
    Thanks!
    (Oracle 10g)

    how shall i wite the query if I want to take the myOtherColumn into consideration? Following version should capture all possibilities (also when the trimmed pk is already there):
    SQL>  create table mytable (mycolumn, myothercolumn, mysecondothercolumn)
    as
    -- select '1', 'x' , 'y' from dual union all
    select '01', 'x' , 'y' from dual union all
    select '001', 'x', 'y2' from dual
    Table created.
    SQL>  alter table mytable add constraint mytable_pk primary key (mycolumn, myothercolumn)
    Table altered.
    SQL>  select * from mytable
    MYC M MY
    01  x y
    001 x y2
    2 rows selected.
    SQL>  update mytable t1
       set mycolumn = ltrim (mycolumn, '0')
    where rowid in (select max (rowid)
                       from mytable t2
                       group by ltrim (mycolumn, '0'),myothercolumn
                     having count (ltrim (mycolumn, '0')) > 1)
        and not exists (select null from mytable t2 where t2.mycolumn = ltrim(t1.mycolumn,0) and t1.myothercolumn=t2.myothercolumn)
    1 row updated.
    SQL>  select * from mytable
    MYC M MY
    01  x y
    1   x y2
    2 rows selected.

  • ORA-00001 When I try and create an interactive query/report

    Interactive report in APEX 3.2
    I have a query like this that does a country lookup
    based on the physical address and the mailing address.
    The query executes fine through SQL plus but when I try and create
    an interactive report I get
    ORA-00001: unique constraint (APEX_030200.WWV_FLOW_WORKSHEET_COLUMNS_UK2) violated
    Here's the query
    select     "TAX_VENDORS"."VENDOR_ID" as "VENDOR_ID",
         "TAX_VENDORS"."VENDOR_NAME" as "VENDOR_NAME",
         "TAX_COUNTRY"."ABBREVIATION" as "ABBREVIATION",
         "TAX_COUNTRY_1"."ABBREVIATION" as "ABBREVIATION"
    from     "TAX_COUNTRY" "TAX_COUNTRY_1",
         "TAX_COUNTRY" "TAX_COUNTRY",
         "TAX_VENDORS" "TAX_VENDORS"
    where "TAX_VENDORS"."PHYSICAL_COUNTRY"="TAX_COUNTRY"."TAX_COUNTRY_ID"
    and     "TAX_VENDORS"."MAILING_COUNTRY"="TAX_COUNTRY_1"."TAX_COUNTRY_ID"
    I've narrowed it down to the double lookup if you will of the country for the
    mail/physical address.
    Is this not allowed? Is there a work around?

    Thanks Tony
    A closer look at the constraint reveals this - so maybe it's seeing the TAX_COUNTRY_ID twice I would guess where the alias is not accounted for.
         CONSTRAINT "WWV_FLOW_WORKSHEET_COLUMNS_UK2" UNIQUE ("WORKSHEET_ID", "DB_COLUMN_NAME")
    Your query yielded me the same result
    select TV.VENDOR_ID as VENDOR_ID,
    TV.VENDOR_NAME as VENDOR_NAME,
    TC.ABBREVIATION as ABBREVIATION,
    TC_1.ABBREVIATION as ABBREVIATION
    from TAX_VENDORS TV
    JOIN TAX_COUNTRY TC ON (TV.PHYSICAL_COUNTRY = TC.TAX_COUNTRY_ID)
    JOIN TAX_COUNTRY TC_1 ON (TV.MAILING_COUNTRY=TC_1.TAX_COUNTRY_ID)

  • How to avoid: ORA-01403 no data found AND ORA-00001

    Hi,
    below my code:
    CREATE TABLE TAB_TO_EM
      EM_NUMBER           VARCHAR2(32),
      NAME_FIRST       VARCHAR2(32),
      NAME_LAST        VARCHAR2(32),
      MAILBOX            VARCHAR2(32)
    ALTER TABLE TAB_TO_EM
    ADD (CONSTRAINT PK_EM_NUMBER PRIMARY KEY (EM_NUMBER));
    CREATE TABLE EM
      EM_ID            VARCHAR2(32),
      EM_NUMBER           VARCHAR2(32),
      NAME_FIRST       VARCHAR2(32),
      NAME_LAST        VARCHAR2(32),
      EMAIL            VARCHAR2(32)
    ALTER TABLE EM
    ADD (CONSTRAINT PK_EM_ID PRIMARY KEY (EM_ID));THE PRIMARY KEY EM_ID COMES FROM THE TAB_TO_EM TABLE LINKED IN THIS WAY:
    NAME_LAST||'_'||SUBSTR(NAME_FIRST,1,3)||'_'||SUBSTR(EM_NUMBER,-2)
    I created this procedure to insert a new EM_NUMBER into EM table:
    CREATE OR REPLACE PROCEDURE INS_NEW_RECORD IS
    ERR_NUM                          NUMBER;
    ERR_MSG                          VARCHAR2(300);
    V_COUNT                          NUMBER;
    V_EM_ID                          VARCHAR2(64);
          CURSOR A IS
          SELECT A.EM_NUMBER, A.NAME_FIRST, A.NAME_LAST, A.MAILBOX
          FROM TAB_TO_EM A;
    BEGIN
          FOR CUR_A IN A
      LOOP
                 SELECT COUNT(*)
                 INTO V_COUNT
                 FROM EM2 B
                 WHERE B.EM_NUMBER=CUR_A.EM_NUMBER;
                 IF V_COUNT = 0 THEN
                 -- here insert a new record
                              INSERT INTO EM2 (EM_ID, EM_NUMBER, NAME_FIRST,NAME_LAST, EMAIL)
                              VALUES (CUR_A.NAME_LAST||'_'||SUBSTR(CUR_A.NAME_FIRST,1,3)||SUBSTR(CUR_A.EM_NUMBER,-2),
                              CUR_A.EM_NUMBER, CUR_A.NAME_FIRST,CUR_A.NAME_LAST, CUR_A.MAILBOX);
                 END IF;
      END LOOP;
    END INS_NEW_RECORD;Example of my table:
    Insert into TAB_TO_EM
       (EM_NUMBER, NAME_FIRST, NAME_LAST, MAILBOX)
    Values
       ('22333', 'AAAA', 'BBBB', 'XXXX');
    Insert into TAB_TO_EM
       (EM_NUMBER, NAME_FIRST, NAME_LAST, MAILBOX)
    Values
       ('11222', 'AAAA', 'BBBB', 'XXXX');
    Insert into TAB_TO_EM
       (EM_NUMBER, NAME_FIRST, NAME_LAST, MAILBOX)
    Values
       ('00122', 'AAAA', 'BBBB', 'XXXX');
    commit;
    execute INS_NEW_RECORD;
    ORA-00001: ORA-00001: unique constraint violated (PK_EM_ID)
    ORA-06512: a "INS_NEW_RECORD", line 25
    ORA-06512: a line 2I tried to modify my procedure:
    CREATE SEQUENCE AFM.SEQ_EM_ID
      START WITH 1
      MAXVALUE 999999999999999999999999999
      MINVALUE 1
      NOCYCLE
      NOCACHE
      ORDER;
    IF V_COUNT = 0 THEN
           --verify duplicate pkey
                 SELECT (NAME_LAST||'_'||SUBSTR(NAME_FIRST,1,3)||SUBSTR(EM_NUMBER,-2))
                 INTO V_EM_ID
                 FROM EM B
                 WHERE (NAME_LAST||'_'||SUBSTR(NAME_FIRST,1,3)||SUBSTR(EM_NUMBER,-2)) = (CUR_A.NAME_LAST||'_'||SUBSTR(CUR_A.NAME_FIRST,1,3)||SUBSTR(CUR_A.EM_NUMBER,-2))
                 AND ROWNUM=1;
                 IF V_EM_ID = (CUR_A.NAME_LAST||'_'||SUBSTR(CUR_A.NAME_FIRST,1,3)||SUBSTR(CUR_A.EM_NUMBER,-2)) THEN
                          INSERT INTO EM2 (EM_ID, EM_NUMBER, NAME_FIRST,NAME_LAST, EMAIL)
                          VALUES (CUR_A.NAME_LAST||'_'||SUBSTR(CUR_A.NAME_FIRST,1,3)||SUBSTR(CUR_A.EM_NUMBER,-2)||'_'||SUBSTR ('000' || SEQ_EM_ID.NEXTVAL, -3),
                          CUR_A.EM_NUMBER, CUR_A.NAME_FIRST,CUR_A.NAME_LAST, CUR_A.MAILBOX);
                 ELSE
                              INSERT INTO EM2 (EM_ID, EM_NUMBER, NAME_FIRST,NAME_LAST, EMAIL)
                              VALUES (CUR_A.NAME_LAST||'_'||SUBSTR(CUR_A.NAME_FIRST,1,3)||SUBSTR(CUR_A.EM_NUMBER,-2),
                              CUR_A.EM_NUMBER, CUR_A.NAME_FIRST,CUR_A.NAME_LAST, CUR_A.MAILBOX);
                 END IF;
          END IF;
    execute INS_NEW_RECORD;
    ORA-01403 no data foundI'd like to create a stored procedure with these conditions:
    IF em_id is duplicate insert new em_id= (CUR_A.NAME_LAST||'_'||SUBSTR(CUR_A.NAME_FIRST,1,3)||SUBSTR(CUR_A.EM_NUMBER,-2)||'_'||SUBSTR ('000' || SEQ_EM_ID.NEXTVAL, -3)
    ELSE em_id= (CUR_A.NAME_LAST||'_'||SUBSTR(CUR_A.NAME_FIRST,1,3)||SUBSTR(CUR_A.EM_NUMBER,-2)
    How can I write my procedure correctly?
    Thanks in advance!

    1) What are you expecting this piece of code to do?
                 SELECT COUNT(*)
                 INTO V_COUNT
                 FROM EM B
                 WHERE B.EM_NUMBER=CUR_A.EM_NUMBER;My answer would be that i expect it to do nothing (unless i've misunderstood what you're doing up until now). You are making a new type of key in the EM table by frankensteining data elements from your tab_to_em table, so i would expect that code to always return 0. By the way, that's what we have a dup_val_on_index catch for, no need to read the table, you try your insert, if you dup a value, you take appropriate action.
    I guess the best way to proceed based on what you've provided would be 2 SQL statements.
    1) insert records where you cannot find a match in the target table
    2) insert records where you CAN find a match in the target table
    INSERT INTO EM (EM_ID, EM_NUMBER, NAME_FIRST,NAME_LAST, EMAIL)
    select
      A.NAME_LAST||'_'||SUBSTR(A.NAME_FIRST,1,3)||SUBSTR(A.EM_NUMBER,-2),
      A.EM_NUMBER,
      A.NAME_FIRST,
      A.NAME_LAST,
      A.MAILBOX
    from tab_to_em a
    where not exists
      select null
      from em b
      where b.NAME_LAST||'_'||SUBSTR(b.NAME_FIRST,1,3)||SUBSTR(b.EM_NUMBER,-2) = a.em_number
    INSERT INTO EM (EM_ID, EM_NUMBER, NAME_FIRST,NAME_LAST, EMAIL)
    select
      A..NAME_LAST||'_'||SUBSTR(A..NAME_FIRST,1,3)||SUBSTR(A..EM_NUMBER,-2)'_'||SUBSTR ('000' || SEQ_EM_ID.NEXTVAL, -3),
      A.EM_NUMBER,
      A.NAME_FIRST,
      A.NAME_LAST,
      A.MAILBOX
    from tab_to_em a
    where exists
      select null
      from em b
      where b.NAME_LAST||'_'||SUBSTR(b.NAME_FIRST,1,3)||SUBSTR(b.EM_NUMBER,-2) = a.em_number
    );This comes with the caveat that what you are doing is a REALLY bad idea. Really really really bad idea.
    The baddies are
    1) your choice for a 'primary key'
    2) using a sequence and then substring it
    3) this is from a business perspective, storing the same person multiple times!
    Now, i don't know your system or requirements, but i am speaking in general terms here, this seems like a all around bad idea and i would suggest you revisit the design.

  • Ora-00604 and ora-00001 when deploying mapping

    Hi,
    I have a problem when I want to deploy a mapping. I get the following errors: ora-00604 'error occurred at recursive SQL level 1' and ora-00001 'unique constraint violated (SYS.I_SOURCE1)'.
    I'm using owb 11.1.0.7.0.
    Can anybody help me to solve this?

    user9033344 wrote:
    Hi,
    I have a problem when I want to deploy a mapping. I get the following errors: ora-00604 'error occurred at recursive SQL level 1' and ora-00001 'unique constraint violated (SYS.I_SOURCE1)'.
    I'm using owb 11.1.0.7.0.
    Can anybody help me to solve this?Oracle Support.

  • Ora-06512  and ora-00001

    when our developer tries to insert few records in a table
    it throws error
    ora-00001 & ora-06512,
    when i tried to disable or drop the constraint indicated in the error 0ra-06512
    it throws ora-02431 - constraint not existing
    please guide us to solve this error.
    santhanam.

    I agree with Centinul, you probably do not want to get rid of the uniquenes enforced on the column. Better to find out why the developer is inserting duplicate records and fix that, or, if it is possible that you might get duplicate records in production, then develop a method of handling the error that properly meets your business needs.
    The ORA-00001 error can come from 3 sources. A PK constraint, a unique constraint and a unique index without a formal constraint.
    SQL> create table t (id number);
    Table created.
    SQL> create unique index t_unq on t(1d);
    Index created.
    SQL> insert into t values (1);
    1 row created.
    SQL> insert into t values (1);
    insert into t values (1)
    ERROR at line 1:
    ORA-00001: unique constraint (OPS$ORACLE.T_UNQ) violatedDropping the constraint t_unq is not possible, I would need to drop the index. But I wouldn't, since in the vast majority of cases, the requirement for uniqueness is a business requirement, and not something put in to anoy developers.
    John

  • Ora-00001 error occured while upgrading 10.2.0.4 to 11.2.0.3

    Hi all,
    I am facing 'ora-00001: Unique constraint(SYSMAN.MGMT_PRIV_GRANTS_PK) violated' while upgrading 10.2.0.4 database to 11.2.0.3 using DBUA. Need urgent help in resolving this.
    Thanks
    Sandeep

    Hi srini,
    Yes, all the actions required by pre-upgrade tool are performed.
    In our case dbua related logs are present in $ORACLE_BASE/cfgtoollogs/dbua/logs folder.
    Files under this folder are:
    1.) sqls.log 2.) trace.log
    Last 100 lines from trace.log file
    [Thread-52] [ 2012-10-24 13:59:01.749 GMT+05:30 ] [Util.<init>:95] Util Instance created.
    [Thread-52] [ 2012-10-24 13:59:01.762 GMT+05:30 ] [OracleHome.getVersion:889] OracleHome.getVersion called. Current Version: null
    [Thread-52] [ 2012-10-24 13:59:01.768 GMT+05:30 ] [InventoryUtil.getOUIInvSession:347] setting OUI READ level to ACCESSLEVEL_READ_LOCKLESS
    [Thread-52] [ 2012-10-24 13:59:01.769 GMT+05:30 ] [OracleHome.getVersion:908] Homeinfo /nhi2/app/oracle11g/product/11.2.0/dbhome_1,7
    [Finalizer thread] [ 2012-10-24 13:59:01.822 GMT+05:30 ] [Util.finalize:126] Util: finalized called for oracle.ops.mgmt.has.Util@a360a36
    [Finalizer thread] [ 2012-10-24 13:59:01.822 GMT+05:30 ] [Util.finalize:126] Util: finalized called for oracle.ops.mgmt.has.Util@1700170
    [Thread-52] [ 2012-10-24 13:59:01.960 GMT+05:30 ] [OracleHome.getVersion:936] OracleHome.server.getVersion Version: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:01.960 GMT+05:30 ] [OracleHome.getVersion:957] Current Version From Inventory: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:01.960 GMT+05:30 ] [OracleHome.getVersion:889] OracleHome.getVersion called. Current Version: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:01.961 GMT+05:30 ] [OracleHome.getVersion:957] Current Version From Inventory: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:01.961 GMT+05:30 ] [CommonUtils.createPasswordFile:604] calling new orapwd for 11.1 or higher
    [Thread-52] [ 2012-10-24 13:59:01.963 GMT+05:30 ] [OsUtilsBase.execProg:2183] beginning execProg with input array.
    [Thread-52] [ 2012-10-24 13:59:02.046 GMT+05:30 ] [OsUtilsBase.execProg:2220] finished execProg with input array. Status:0
    [Thread-52] [ 2012-10-24 13:59:02.046 GMT+05:30 ] [OracleHome.initOptions:1236] Initializing Database Options with for dummy sid=DBUA5901749 using initfile=/nhi2/app/oracle11g/product/11.2.0/dbhome_1/dbs/initDBUA5901749.ora using pwdfile=/nhi2/app/oracle11g/product/11.2.0/dbhome_1/dbs/orapwDBUA5901749
    [Thread-52] [ 2012-10-24 13:59:02.047 GMT+05:30 ] [OracleHome.getVersion:889] OracleHome.getVersion called. Current Version: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:02.047 GMT+05:30 ] [OracleHome.getVersion:957] Current Version From Inventory: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:02.047 GMT+05:30 ] [OracleHome.getVersion:889] OracleHome.getVersion called. Current Version: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:02.047 GMT+05:30 ] [OracleHome.getVersion:957] Current Version From Inventory: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:02.047 GMT+05:30 ] [OracleHome.getVersion:889] OracleHome.getVersion called. Current Version: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:02.048 GMT+05:30 ] [OracleHome.getVersion:957] Current Version From Inventory: 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:02.048 GMT+05:30 ] [SQLPlusEngine.getCmmdParams:222] m_home 11.2.0.3.0
    [Thread-52] [ 2012-10-24 13:59:02.048 GMT+05:30 ] [SQLPlusEngine.getCmmdParams:223] version > 112 true
    [Thread-52] [ 2012-10-24 13:59:02.048 GMT+05:30 ] [SQLEngine.getEnvParams:555] Default NLS_LANG: AMERICAN_AMERICA.AL32UTF8
    [Thread-52] [ 2012-10-24 13:59:02.049 GMT+05:30 ] [SQLEngine.getEnvParams:565] NLS_LANG: AMERICAN_AMERICA.AL32UTF8
    [Thread-52] [ 2012-10-24 13:59:02.049 GMT+05:30 ] [SQLEngine.initialize:325] Execing SQLPLUS/SVRMGR process...
    [Thread-52] [ 2012-10-24 13:59:02.087 GMT+05:30 ] [SQLEngine.initialize:362] m_bReaderStarted: false
    [Thread-52] [ 2012-10-24 13:59:02.090 GMT+05:30 ] [SQLEngine.initialize:366] Starting Reader Thread...
    [Thread-52] [ 2012-10-24 13:59:02.227 GMT+05:30 ] [OracleHome.initOptions:1248] executing: startup nomount pfile='/nhi2/app/oracle11g/product/11.2.0/dbhome_1/dbs/initDBUA5901749.ora'
    [Thread-52] [ 2012-10-24 13:59:29.944 GMT+05:30 ] [OracleHome.initOptions:1259] executing: select parameter from v$option where value='TRUE'
    [Thread-52] [ 2012-10-24 13:59:29.966 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Partitioning is ON
    [Thread-52] [ 2012-10-24 13:59:29.967 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Objects is ON
    [Thread-52] [ 2012-10-24 13:59:29.967 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Advanced replication is ON
    [Thread-52] [ 2012-10-24 13:59:29.967 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Bit-mapped indexes is ON
    [Thread-52] [ 2012-10-24 13:59:29.967 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Connection multiplexing is ON
    [Thread-52] [ 2012-10-24 13:59:29.967 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Connection pooling is ON
    [Thread-52] [ 2012-10-24 13:59:29.967 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Database queuing is ON
    [Thread-52] [ 2012-10-24 13:59:29.968 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Incremental backup and recovery is ON
    [Thread-52] [ 2012-10-24 13:59:29.968 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Instead-of triggers is ON
    [Thread-52] [ 2012-10-24 13:59:29.968 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Parallel backup and recovery is ON
    [Thread-52] [ 2012-10-24 13:59:29.968 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Parallel execution is ON
    [Thread-52] [ 2012-10-24 13:59:29.968 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Parallel load is ON
    [Thread-52] [ 2012-10-24 13:59:29.968 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Point-in-time tablespace recovery is ON
    [Thread-52] [ 2012-10-24 13:59:29.969 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Fine-grained access control is ON
    [Thread-52] [ 2012-10-24 13:59:29.969 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Proxy authentication/authorization is ON
    [Thread-52] [ 2012-10-24 13:59:29.969 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Change Data Capture is ON
    [Thread-52] [ 2012-10-24 13:59:29.969 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Plan Stability is ON
    [Thread-52] [ 2012-10-24 13:59:29.969 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Online Index Build is ON
    [Thread-52] [ 2012-10-24 13:59:29.972 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Coalesce Index is ON
    [Thread-52] [ 2012-10-24 13:59:29.972 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Managed Standby is ON
    [Thread-52] [ 2012-10-24 13:59:29.972 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Materialized view rewrite is ON
    [Thread-52] [ 2012-10-24 13:59:29.973 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Database resource manager is ON
    [Thread-52] [ 2012-10-24 13:59:29.973 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Spatial is ON
    [Thread-52] [ 2012-10-24 13:59:29.973 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Export transportable tablespaces is ON
    [Thread-52] [ 2012-10-24 13:59:29.973 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Transparent Application Failover is ON
    [Thread-52] [ 2012-10-24 13:59:29.973 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Fast-Start Fault Recovery is ON
    [Thread-52] [ 2012-10-24 13:59:29.974 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Sample Scan is ON
    [Thread-52] [ 2012-10-24 13:59:29.974 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Duplexed backups is ON
    [Thread-52] [ 2012-10-24 13:59:29.974 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Java is ON
    [Thread-52] [ 2012-10-24 13:59:29.974 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option OLAP Window Functions is ON
    [Thread-52] [ 2012-10-24 13:59:29.974 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Block Media Recovery is ON
    [Thread-52] [ 2012-10-24 13:59:29.974 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Fine-grained Auditing is ON
    [Thread-52] [ 2012-10-24 13:59:29.975 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Application Role is ON
    [Thread-52] [ 2012-10-24 13:59:29.975 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Enterprise User Security is ON
    [Thread-52] [ 2012-10-24 13:59:29.975 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Oracle Data Guard is ON
    [Thread-52] [ 2012-10-24 13:59:29.975 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option OLAP is ON
    [Thread-52] [ 2012-10-24 13:59:29.975 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Basic Compression is ON
    [Thread-52] [ 2012-10-24 13:59:29.976 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Join index is ON
    [Thread-52] [ 2012-10-24 13:59:29.976 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Trial Recovery is ON
    [Thread-52] [ 2012-10-24 13:59:29.976 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Data Mining is ON
    [Thread-52] [ 2012-10-24 13:59:29.976 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Online Redefinition is ON
    [Thread-52] [ 2012-10-24 13:59:29.976 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Streams Capture is ON
    [Thread-52] [ 2012-10-24 13:59:29.977 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option File Mapping is ON
    [Thread-52] [ 2012-10-24 13:59:29.977 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Block Change Tracking is ON
    [Thread-52] [ 2012-10-24 13:59:29.977 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Flashback Table is ON
    [Thread-52] [ 2012-10-24 13:59:29.977 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Flashback Database is ON
    [Thread-52] [ 2012-10-24 13:59:29.977 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Transparent Data Encryption is ON
    [Thread-52] [ 2012-10-24 13:59:29.978 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Backup Encryption is ON
    [Thread-52] [ 2012-10-24 13:59:29.978 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Unused Block Compression is ON
    [Thread-52] [ 2012-10-24 13:59:29.978 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Result Cache is ON
    [Thread-52] [ 2012-10-24 13:59:29.978 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option SQL Plan Management is ON
    [Thread-52] [ 2012-10-24 13:59:29.978 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option SecureFiles Encryption is ON
    [Thread-52] [ 2012-10-24 13:59:29.979 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Real Application Testing is ON
    [Thread-52] [ 2012-10-24 13:59:29.979 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Flashback Data Archive is ON
    [Thread-52] [ 2012-10-24 13:59:29.979 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option DICOM is ON
    [Thread-52] [ 2012-10-24 13:59:29.992 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Active Data Guard is ON
    [Thread-52] [ 2012-10-24 13:59:29.992 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Server Flash Cache is ON
    [Thread-52] [ 2012-10-24 13:59:29.992 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Advanced Compression is ON
    [Thread-52] [ 2012-10-24 13:59:29.992 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option XStream is ON
    [Thread-52] [ 2012-10-24 13:59:29.993 GMT+05:30 ] [OracleHome.initOptions:1265] Database Option Deferred Segment Creation is ON
    [Thread-52] [ 2012-10-24 13:59:29.993 GMT+05:30 ] [OracleHome.initOptions:1269] executing: select version from v$timezone_file
    [Thread-52] [ 2012-10-24 13:59:29.997 GMT+05:30 ] [OracleHome.initOptions:1275] Timezone file version is 14
    [Thread-52] [ 2012-10-24 13:59:31.019 GMT+05:30 ] [SQLEngine.done:2189] Done called
    [Thread-52] [ 2012-10-24 13:59:31.020 GMT+05:30 ] [OsUtilsBase.deleteFile:1863] OsUtilsBase.deleteFile: /nhi2/app/oracle11g/product/11.2.0/dbhome_1/dbs/initDBUA5901749.ora
    [Thread-52] [ 2012-10-24 13:59:31.034 GMT+05:30 ] [OsUtilsBase.deleteFile:1863] OsUtilsBase.deleteFile: /nhi2/app/oracle11g/product/11.2.0/dbhome_1/dbs/orapwDBUA5901749
    [Thread-52] [ 2012-10-24 13:59:31.042 GMT+05:30 ] [OracleHome.initOptions:1316] Diag cleanup /nhi2/app/oracle11g/product/11.2.0/dbhome_1/log/diag/rdbms/dbua5901749
    [Thread-52] [ 2012-10-24 13:59:31.564 GMT+05:30 ] [OracleHome.initOptions:1324] Database Options queried: 60
    [Thread-52] [ 2012-10-24 13:59:31.564 GMT+05:30 ] [CompManager.setLoggingDirForDB:6992] Create logging folder for database=baan
    [Thread-52] [ 2012-10-24 13:59:31.565 GMT+05:30 ] [CompManager.createUniqueDirs:6953] create createUniqueDirs logging folder=/nhi2/app/oracle11g/cfgtoollogs/dbua/baan/upgrade
    [Thread-52] [ 2012-10-24 13:59:31.566 GMT+05:30 ] [CompManager.createUniqueDirs:6965] create createUniqueDirs logging folder=/nhi2/app/oracle11g/cfgtoollogs/dbua/baan/upgrade1
    [Thread-52] [ 2012-10-24 13:59:31.574 GMT+05:30 ] [CompManager.createUniqueDirs:6973] create SUCCESS for folder=/nhi2/app/oracle11g/cfgtoollogs/dbua/baan/upgrade1
    Thanks,
    Sandeep Vadlamudi

  • Problem with Roles and Triggers

    I'm having a strange problem with Roles and Triggers in Oracle. It's a little difficult to describe, so bear with me...
    I'm trying to create a trigger that inserts records into a table belonging to a different user/owner. Of course, the owner of this trigger needs rights to insert records into this other table. I find that if I add these rights directly to the owner of the trigger, everything works okay and the trigger compiles successfully.
    However, if I first create a Role and grant the "insert" rights to it, and then assign this role to the owner of the trigger, the trigger does not compile successfully.
    To illustrate this, here's an example script. I'm using Oracle 10g Release 2...
    -- Clean up...
    DROP TABLE TestUser.TrigTable;
    DROP TABLE TestUser2.TestTable;
    DROP ROLE TestRole;
    DROP TRIGGER TestUser.TestTrigger;
    DROP USER TestUser CASCADE;
    DROP USER TestUser2 CASCADE;
    -- Create Users...
    CREATE USER TestUser IDENTIFIED BY password DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP" QUOTA UNLIMITED ON "USERS";
    CREATE USER TestUser2 IDENTIFIED BY password DEFAULT TABLESPACE "USERS" TEMPORARY TABLESPACE "TEMP" QUOTA UNLIMITED ON "USERS";
    CREATE TABLE TestUser.TrigTable (TestColumn VARCHAR2(40));
    CREATE TABLE TestUser2.TestTable (TestColumn VARCHAR2(40));
    -- Grant Insert rights on TestTable to TestRole...
    CREATE ROLE TestRole NOT IDENTIFIED;
    GRANT INSERT ON TestUser2.TestTable TO TestRole;
    -- Add TestRole to TestUser. TestUser should now have rights to INSERT on TestTable
    GRANT TestRole TO TestUser;
    ALTER USER TestUser DEFAULT ROLE ALL;
    -- Now, create the trigger. This compiles unsuccessfully...
    CREATE TRIGGER TestUser.TestTrigger AFTER INSERT ON TestUser.TrigTable
    BEGIN
    INSERT INTO TestUser2.TestTable (TestColumn) VALUES ('Test');
    END;
    When I do a "SHOW ERRORS;" after this, I get:
    SQL> show errors;
    Errors for TRIGGER TESTUSER.TESTTRIGGER:
    LINE/COL ERROR
    2/3 PL/SQL: SQL Statement ignored
    2/25 PL/SQL: ORA-00942: table or view does not exist
    SQL>
    As I said above, if I just add the Insert rights directly to TestUser, the trigger compiles perfectly. Does anyone know why this is happening?
    Thanks!
    Adrian

    Hi Raghu,
    If the insert rights exist only on TestRole, and TestRole is assigned to TestUser, I can do the INSERT statement you suggest with no problems if I just execute it from SQLPlus (logged in as TestUser).
    The question is, why does the same INSERT fail when it's inside the trigger?

  • ORA-00001 - unique constraint violation when upgrading 10g EUL

    Hi,
    I am trying to upgrade my Discoverer 4i to Discoverer 10g.
    When I log into 10g, it prompts me to upgrade the EUL. After making the right back up of my 4i EUL, I continue with the upgrade.
    During the upgrade, I am hit with this error:
    Database error: ORA-00001 unique constraint (EUL_HRMS.EUL5_FOL_UK_1) violated.
    I understand that this happens when user tries to insert an already existing value into a column defined as unique. However, I am not sure on how to resolve it.
    Can anyone please advice.
    Thanks in advance!
    Regards,
    Harpreet Sidhu

    Hi Rod,
    I've run the queries and these are the results. Each query returned one row.
    1. SELECT FROM EUL_HRMS.EUL5_DOC_FOLDERS*
    FOL_ID     100057
    FOL_NAME     ROOT
    FOL_DEVELOPER_KEY     ROOT
    FOL_DESCRIPTION     
    FOL_EU_ID     100000
    FOL_PARENT_ID     
    FOL_USER_PROP2     
    FOL_USER_PROP1     
    FOL_ELEMENT_STATE     0
    FOL_CREATED_BY     EUL_HRMS
    FOL_CREATED_DATE     19-Jun-09
    FOL_UPDATED_BY     EUL_HRMS
    FOL_UPDATED_DATE     19-Jun-09
    NOTM     0
    2. SELECT EU_ID, EU_SECURITY_MODEL, EU_USE_PUB_PRIVS, EU_ROLE_FLAG
    FROM EUL_HRMS.EUL5_EUL_USERS
    WHERE EU_USERNAME = 'PUBLIC'
    EU_ID     3000
    EU_SECURITY_MODEL     0
    EU_USE_PUB_PRIVS     1
    EU_ROLE_FLAG     0
    Thanks!

  • ORA-00001: unique constraint @ impdp with table_exists_action=truncate

    Hi everybody
    I can't understand why my data pump import execution with parameter TABLE_EXISTS_ACTION=TRUNCATE returned ORA-00001 (unique constraint violation), while importing schema tables from a remote database where the source tables have the same unique constraints as the corresponding ones on the target database.
    Now my question is "If the table would be truncated, why I get unique constraint violation when inserting records from a table where the same unique constraint is validated?
    Here are the used parameter file content and the impdp logfile.
    parfile
    {code}
    DIRECTORY=IMPEXP_LOG_COLL2
    CONTENT=DATA_ONLY
    NETWORK_LINK=PRODUCTION
    PARALLEL=1
    TABLE_EXISTS_ACTION=TRUNCATE
    EXCLUDE=STATISTICS
    {code}
    logfile
    {code}
    Import: Release 10.2.0.1.0 - Production on Gioved� 22 Ottobre, 2009 15:33:44
    Copyright (c) 2003, 2005, Oracle. All rights reserved.
    Connesso a: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    FLASHBACK automatically enabled to preserve database integrity.
    Starting "IMPEXP"."PROVA_REFRESH_DBCOLL": impexp/********@dbcoll SCHEMAS=test_pump LOGFILE=test_pump.log parfile=refresh_dbcoll.par JOB_NAME=prova_refresh_dbcoll
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 523 MB
    ORA-31693: Table data object "TEST_PUMP"."X10000000_TRIGGER" failed to load/unload and is being skipped due to error:
    ORA-00001: unique constraint (TEST_PUMP.SYS_C00726627) violated
    ORA-31693: Table data object "TEST_PUMP"."X10000000_BASIC" failed to load/unload and is being skipped due to error:
    ORA-00001: unique constraint (TEST_PUMP.SYS_C00726625) violated
    Job "IMPEXP"."PROVA_REFRESH_DBCOLL" completed with 2 error(s) at 15:34:04
    {code}
    Thank you
    Bye Alessandro

    I forgot to read the last two lines of the documentation about TABLE_EXISTS_ACTION where it says:
    "TRUNCATE cannot be used on clustered tables or over network links."
    So it seems that it ignored the clause for the use of NETWORK_LINK and unreasonably opted for an APPEND action instead of throwing an error to highlight the conflicting parameters in the used configuration.
    Bye Alessandro

  • ORA-00001: unique constraint (REMEDY.SYS_C001727

    Hi: I have a simple table with a primary key (ENTRYID). All other fields are just fields with no constraints. When I try to insert records, for some records I get the above error. The table does not already have this record.
    INSERT INTO REMEDY.VITALEXCEPTION (ENTRYID, CUSTID, DEVICENAME, INTERFACE, EXCEPTION, DURATION, TIME)
    VALUES ('jvis2rspm01.S0/0/0_FMS:65999591 NA:3836400887 TERM:cmny83bbf/20351BDU1182798445', 'fxms', 'jvis2rspm01', 'S0/0/0_FMS:65999591 NA:3836400887 TERM:cmny83bbf/20351', 'BDU', 5476, 1182792934);
    INSERT INTO REMEDY.VITALEXCEPTION (ENTRYID, CUSTID, DEVICENAME, INTERFACE, EXCEPTION, DURATION, TIME)
    ERROR at line 1:
    ORA-00001: unique constraint (REMEDY.SYS_C001727) violated
    Could someone help.
    Thanks
    Ray

    hi,
    can you post the table structure?
    I suspect that ENTRYID has lesser length than the actual value and in effect the value has been truncated for some reason.
    The primary key value is too long, maybe creating a surrogate key would help.
    J

  • ORA-00001 - Unique Constraint on R5TRANSLINES

    Hello,
    I get the following error when i am inserting into R5TRANSLINES "2009-06-23 14:44:51,698 DEBUG [com.dstm.mp.MPDBException] **!!Error Code:|1|, Msg:|ORA-00001: unique constraint (REMPLOY.R5PRIK_TRL) violated"
    I have a flex trigger in the system which is envoked when inserting parts into my warehouse:
    Declare
    cursor c_palletparts( pallet varchar2) is
    select obj_part from r5objects
    where
    obj_parent = pallet;
    v_pallet varchar2(255);
    v_evtcode varchar2(255);
    v_transcode varchar2(255);
    v_line number :=0;
    v_store varchar2(255);
    v_trltype varchar2(4);
    v_trlrtype varchar2(4);
    v_trlio number;
    v_bin VARCHAR2(15);
    v_binin VARCHAR2(15);
    ncounter number;
    cur_message varchar2(200);
    begin
    select trl_part, trl_trans, trl_line into v_pallet, v_transcode, v_line from r5translines
    where rowid = :rowid;
    select count(*) into ncounter from r5objects where obj_code = v_pallet and obj_class = 'PALLET';
    if ncounter = 1 then
    select trl_part, trl_trans, trl_line, trl_store, trl_type, trl_rtype, trl_io, trl_bin into v_pallet, v_transcode, v_line, v_store, v_trltype, v_trlrtype, v_trlio, v_binin
    from r5translines
    where trl_trans = v_transcode
    and trl_line = v_line;
    IF v_trlrtype = 'RECV' THEN
    update r5objects set obj_store = v_store where obj_code = v_pallet;
    UPDATE R5PROPERTYVALUES SET PRV_VALUE = v_store WHERE prv_code = v_pallet||'#*' AND PRV_PROPERTY = 'RMP231' AND PRV_RENTITY = 'OBJ';
    END IF;
    -- update r5parts set par_byasset = '+' where par_code = v_pallet;
    for r_palletparts in c_palletparts(v_pallet) loop
    IF v_trlrtype = 'I' then
    select count(*) into ncounter from r5stock
    where sto_part = r_palletparts.obj_part
    and sto_store = v_store
    and sto_part_org = '*';
    IF ncounter = 0 then
    INSERT INTO R5STOCK (STO_PART, STO_STORE, STO_STOCKTAKE, STO_QTY, STO_CONSIGNMENT, STO_PART_ORG, STO_PRICETYPE, STO_ONDEMAND, STO_REPAIRQTY, STO_VENDORQTY, STO_SHOPQTY, STO_REPAIRTYPE, STO_REPSTOCKMETHOD, STO_REPAUTOASSIGN, STO_LABELDEFAULT)
    VALUES (r_palletparts.obj_part, v_store, SYSDATE, 1, '-', '*', 'A', '-', 0, 0, 0, '-', '-', '-', 0);
    END IF;
    select count(*) into ncounter from r5binstock
    where bis_part = r_palletparts.obj_part
    and bis_store = v_store
    and bis_part_org = '*';
    IF ncounter = 0 then
    INSERT INTO R5BINSTOCK(BIS_PART, BIS_STORE, BIS_BIN, BIS_LOT, BIS_QTY, BIS_PART_ORG, BIS_REPAIRQTY)
    VALUES (r_palletparts.obj_part, v_store, '*', '*', 1, '*', 0);
    END IF;
    select min(bis_bin) into v_bin from r5binstock
    where bis_part = r_palletparts.obj_part
    and bis_store = v_store
    and bis_part_org = '*';
    update r5binstock set bis_qty = 1 where bis_part = r_palletparts.obj_part
    and bis_store = v_store
    and bis_bin = v_bin;
    else
    update r5objects set obj_store = v_store where obj_code = r_palletparts.obj_part;
    -- UPDATE R5PROPERTYVALUES SET PRV_VALUE = v_store WHERE prv_code = r_palletparts.obj_part||'#*' AND PRV_PROPERTY = 'RMP231' AND PRV_RENTITY = 'OBJ';
    IF r_palletparts.obj_part NOT IN ('X') THEN
    cur_message := r_palletparts.obj_part||'|'||v_trltype||'|'||v_store||'|'||ncounter;
    -- raise_application_error(-20000,cur_message);
    END IF;
    v_bin := v_binin;
    end if;
    v_line := v_line + 1;
    insert into r5translines
    (trl_trans,trl_type, trl_rtype, trl_line, trl_date,
    trl_part, trl_lot, trl_bin, trl_store, trl_price,
    trl_qty, trl_io, trl_part_org)
    values
    (v_transcode, v_trltype, v_trlrtype, v_line, sysdate,
    r_palletparts.obj_part, '*', v_bin, v_store, 0,
    1, v_trlio, '*' );
    end loop;
    end if;
    Exception
    when no_data_found then
    Null;
    end;
    Can someone please tell me how to make this key unique.
    Many Thanks
    Chris

    Hi,
    You can create rule for truncate using below:
    BEGIN
    DBMS_RULE_ADM.CREATE_RULE(
    rule_name => 'TRUNCATE_RULE',
    condition => '(:ddl.get_object_owner() = ''HR'' AND ' ||
    ':ddl.get_object_name() = ''TEST'') AND ' ||
    ':ddl.get_command_type() = ''TRUNCATE TABLE'' ');
    END;
    Thanks,
    Reena

  • (Error) ORA-00001: unique constraint (WHSE_DBA.PK_DELPHI_TRANS_FACT) violat

    I have a stored proc which runs every night. The stored proc is giving a unique constraint violation.
    (Error) ORA-00001: unique constraint (WHSE_DBA.PK_DELPHI_TRANS_FACT) violated.
    Any idea about how to debug this.

    I want to create an error table on the stored proc shown below. I know I have to add something in the exceptions. Can anyone give me the commands and where to add it.
    CREATE OR REPLACE PROCEDURE WHSE_DBA.DM_LD_DELPHI_TRANS_FACT
    IS
    -- VARIABLE DECLARATIONS
    LAST_LOAD_DATE                   DATE;
    INSERTCOUNT                 NUMBER:=0;
    -- LOGGING VARIABLES AND CONSTANTS
    TARGETTABLE                 CONSTANT VARCHAR2(20):='DELPHI_TRANS_FACT';
    MSGUNKNOWNERR               CONSTANT VARCHAR2(20):='Error';
    NBRIGNOREERR                CONSTANT NUMBER:=12541;
    DEFDATE                     CONSTANT DATE:='01-OCT-2006';
    ERRDESCRIPTION              VARCHAR2(255);
    V_DELPHI_TRANS_TOTAL            NUMBER;
    V_DELPHI_TRANS_FACT_TOTAL   NUMBER;
    BEGIN
    -- LOOK UP LAST LOADED RECORD
    SELECT NVL(MAX(SNAPSHOT_DATE),DEFDATE)
    INTO LAST_LOAD_DATE
    FROM DELPHI_TRANS_FACT;
    -- * LOAD ALL DIMENSION TABLES
    -- BUDGET_YR_DIMENSION
    INSERT INTO BUDGET_YR_DIMENSION (BUDGET_YEAR, SNAPSHOT_DATE)
    (SELECT DISTINCT BUD_YR, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM BUDGET_YR_DIMENSION
    WHERE BUDGET_YEAR=OUTER.BUD_YR));
    -- EFF_DATE_DIMENSION
    INSERT INTO EFF_DATE_DIMENSION (PAID_FIS_YEAR, PAID_QTR, EFFECTIVE_DATE, SNAPSHOT_DATE)
    (SELECT DISTINCT CVT_DATE_TO_FISCAL_YEAR(EFF_DT), PD_QTR, EFF_DT, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM EFF_DATE_DIMENSION
    WHERE EFFECTIVE_DATE=OUTER.EFF_DT));
    -- PROC_DATE_DIMENSION
    INSERT INTO PROC_DATE_DIMENSION (PROCESS_DATE, SNAPSHOT_DATE)
    (SELECT DISTINCT PROC_DT, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM PROC_DATE_DIMENSION
    WHERE PROCESS_DATE=OUTER.PROC_DT));
    -- ORG_DIMENSION
    INSERT INTO ORG_DIMENSION (ORG,COST_CTR,SNAPSHOT_DATE)
    (SELECT DISTINCT ORG, CC_CD, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM ORG_DIMENSION
    WHERE ORG=OUTER.ORG));
    -- BPAC DIMENSION
    INSERT INTO BPAC_DIMENSION (BPAC, AFC_CD, PE_CODE, SNAPSHOT_DATE)
    (SELECT DISTINCT BPAC, AFC_CD, PE, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM BPAC_DIMENSION
    WHERE BPAC=OUTER.BPAC));
    -- FUND DIMENSION
    INSERT INTO FUND_DIMENSION (FUND,APPROP_CD,LIM_CD,SNAPSHOT_DATE)
    (SELECT DISTINCT FUND, APPROP_CD, APPLIM_CD, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM FUND_DIMENSION
    WHERE FUND=OUTER.FUND));
    -- OBJ_CD_DIMENSION
    INSERT INTO OBJ_CD_DIMENSION (OBJ_CD,SNAPSHOT_DATE)
    (SELECT DISTINCT OC_CD, SYSDATE
    FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM OBJ_CD_DIMENSION
    WHERE OBJ_CD=OUTER.OC_CD));
    -- GLA DIMENSION
    INSERT INTO GLA_DIMENSION (GLA_CD,SNAPSHOT_DATE)
    (SELECT DISTINCT GLA, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM GLA_DIMENSION
    WHERE GLA_CD=OUTER.GLA));
    -- PROJECT_TASK_DIMENSION
    INSERT INTO PROJECT_TASK_DIMENSION (PROJECT_NO,TASK_NO,SNAPSHOT_DATE)
    (SELECT DISTINCT PROJ_NBR, TASK_NBR, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM PROJECT_TASK_DIMENSION
    WHERE PROJECT_NO=OUTER.PROJ_NBR
      AND TASK_NO=OUTER.TASK_NBR));
    -- TRANS_DESC_DIMENSION
    INSERT INTO TRANS_DESC_DIMENSION (DESCRIPTION,SNAPSHOT_DATE)
    (SELECT DISTINCT DESCR, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM TRANS_DESC_DIMENSION
    WHERE DESCRIPTION=OUTER.DESCR
    AND OUTER.DESCR IS NOT NULL));
    -- SUPPLIER_DIMENSION
    INSERT INTO SUPPLIER_DIMENSION (SUPPLIER_NAME, SNAPSHOT_DATE)
    (SELECT DISTINCT VENDOR_NAME, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM SUPPLIER_DIMENSION
    WHERE SUPPLIER_NAME=OUTER.VENDOR_NAME));
    -- DELPHI_INV_DIMENSION
    INSERT INTO DELPHI_INV_DIMENSION (INVOICE_NO, SNAPSHOT_DATE)
    (SELECT DISTINCT INV_NO, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM DELPHI_INV_DIMENSION
    WHERE INVOICE_NO=OUTER.INV_NO));
    -- DELPHI_PO_DIMENSION
    INSERT INTO DELPHI_PO_DIMENSION (PO_NO, SNAPSHOT_DATE)
    (SELECT DISTINCT PO_NO, SYSDATE FROM DELPHI_TRANS OUTER
    WHERE NOT EXISTS
    (SELECT 1
    FROM DELPHI_PO_DIMENSION
    WHERE PO_NO=OUTER.PO_NO));
    -- TEMPORARILY DISABLE KEY FOR FASTER LOADING
    DB_MISC.PRO_EXE_DDL('ALTER TABLE DELPHI_TRANS_FACT DISABLE CONSTRAINT PK_DELPH_TRANS_FACT');
        -- MOVE DATA INTO TABLE
         INSERT INTO DELPHI_TRANS_FACT (BPAC_KEY, ORG_KEY, FUND_KEY, OBJ_CD_KEY, GLA_KEY,
         EFF_DATE_KEY, PROC_DATE_KEY, PROJECT_TASK_KEY, BUDGET_YR_KEY, DELPHI_TRANS_DESC_KEY,
         BALANCE, COMMIT_AMT, UDO_AMT, AEU_AMT, AEP_AMT, OBLIGATION_AMT, SNAPSHOT_DATE,
         SUPPLIER_KEY, DELPHI_INV_KEY, DELPHI_PO_KEY)
         (SELECT BPAC_KEY, ORG_KEY, FUND_KEY, OBJ_CD_KEY, GLA_KEY, EFF_DATE_KEY, PROC_DATE_KEY,
         PROJECT_TASK_KEY, BUDGET_YR_KEY, TRANS_DESC_KEY, SUM(BAL), SUM(COMMIT_AMT), SUM(UDO_AMT),
         SUM(AEU_AMT), SUM(AEP_AMT), SUM(OBLIGATION_AMT), MAX(SYSDATE), SUPPLIER_KEY, DELPHI_INV_KEY,
         DELPHI_PO_KEY
         FROM BPAC_DIMENSION, ORG_DIMENSION, FUND_DIMENSION, OBJ_CD_DIMENSION, GLA_DIMENSION,
        EFF_DATE_DIMENSION, PROC_DATE_DIMENSION, PROJECT_TASK_DIMENSION, BUDGET_YR_DIMENSION,
         TRANS_DESC_DIMENSION, DELPHI_TRANS,     SUPPLIER_DIMENSION, DELPHI_INV_DIMENSION, DELPHI_PO_DIMENSION
         WHERE DELPHI_TRANS.SNAPSHOT_DATE>LAST_LOAD_DATE
         -- JOIN WITH BPAC_DIMENSION
        AND DELPHI_TRANS.BPAC=BPAC_DIMENSION.BPAC
         -- JOIN WITH ORG_DIMENSION
         AND DELPHI_TRANS.ORG = ORG_DIMENSION.ORG
         -- JOIN WITH FUND_DIMENSION
         AND DELPHI_TRANS.FUND = FUND_DIMENSION.FUND
         -- JOIN WITH OBJ_CD_DIMENSION
         AND DELPHI_TRANS.OC_CD=OBJ_CD_DIMENSION.OBJ_CD
         -- JOIN WITH GLA_DIMENSION
         AND  DELPHI_TRANS.GLA=GLA_DIMENSION.GLA_CD
         -- JOIN WITH EFF_DATE_DIMENSION
         AND DELPHI_TRANS.EFF_DT=EFF_DATE_DIMENSION.EFFECTIVE_DATE
         -- JOIN WITH PROC_DATE_DIMENSION
         AND DELPHI_TRANS.PROC_DT=PROC_DATE_DIMENSION.PROCESS_DATE
         -- JOIN WITH PROJECT_TASK_DIMENSION
         AND (DELPHI_TRANS.PROJ_NBR=PROJECT_TASK_DIMENSION.PROJECT_NO
         AND DELPHI_TRANS.TASK_NBR=PROJECT_TASK_DIMENSION.TASK_NO)
         -- JOIN WITH BUDGET_YR_DIMENSION
         AND DELPHI_TRANS.BUD_YR=BUDGET_YR_DIMENSION.BUDGET_YEAR          
         -- JOIN WITH  TRANS_DESC_DIMENSION
         AND DELPHI_TRANS.DESCR=TRANS_DESC_DIMENSION.DESCRIPTION
         -- JOIN WITH SUPPLIER_DIMENSION
         AND DELPHI_TRANS.VENDOR_NAME=SUPPLIER_DIMENSION.SUPPLIER_NAME
         -- JOIN WITH DELPHI_PO_DIMENSION
         AND DELPHI_TRANS.PO_NO=DELPHI_PO_DIMENSION.PO_NO
         -- JOIN WITH DELPHI_INV_DIMENSION
         AND DELPHI_TRANS.INV_NO=DELPHI_INV_DIMENSION.INVOICE_NO
         GROUP BY BPAC_KEY, ORG_KEY, FUND_KEY, OBJ_CD_KEY, GLA_KEY, EFF_DATE_KEY, PROC_DATE_KEY,
         PROJECT_TASK_KEY, BUDGET_YR_KEY,TRANS_DESC_KEY, SUPPLIER_KEY, DELPHI_INV_KEY, DELPHI_PO_KEY);
    -- COUNT AFFECTED RECORDS
    INSERTCOUNT:=0+SQL%ROWCOUNT;
    -- RE-ENABLE KEY CONSTRAINT
    DB_MISC.PRO_EXE_DDL('ALTER TABLE DELPHI_TRANS_FACT ENABLE VALIDATE CONSTRAINT PK_DELPH_TRANS_FACT');
    -- STORE RESULTS OF OPERATION
    IF INSERTCOUNT>0 THEN
      DB_MISC.LOGFAILURE_EX('none', 'none', INSERTCOUNT||' new records loaded successfully.', TARGETTABLE, 'DM_LD_DELPHI_TRANS_FACT', FALSE);
    END IF;
    --- COMPARE BALANCE TOTAL FROM DELPHI_TRANS TABLE AND DELPHI_TRANS_FACT TABLE
    SELECT SUM(BAL) INTO V_DELPHI_TRANS_TOTAL
    FROM DELPHI_TRANS ;
    SELECT SUM(BALANCE) INTO V_DELPHI_TRANS_FACT_TOTAL
    FROM DELPHI_TRANS_FACT ; 
    VALIDATE_LOAD(V_DELPHI_TRANS_TOTAL,V_DELPHI_TRANS_FACT_TOTAL); 
    -- EXCEPTION HANDLING ROUTINES * * * * * * * * * * * * * * * * * * * * * *
    EXCEPTION
        WHEN OTHERS THEN
          ROLLBACK;
          IF SQLCODE!=NBRIGNOREERR THEN
            ERRDESCRIPTION:=SQLERRM;
            -- CALL ROUTINE TO PROCESS ERROR
            DB_MISC.LOGFAILURE_EX('none', 'none', ERRDESCRIPTION, TARGETTABLE, 'DM_LD_DELPHI_TRANS_FACT', TRUE);
            COMMIT;
          END IF;
    -- END EXCEPTION HANDLING ROUTINES * * * * * * * * * * * * * * * * * * * * * *
    END

Maybe you are looking for

  • Error message when launch Photoshop CS5

    Every time I launch Photoshop CS5, I get the following error message: "One or more files in the Adobe Application Support folder, necessary for running Photoshop, are missing.  Please run the Photoshop installer and re-install Photoshop." Re-installi

  • TS1702 I can't download apps it says they are not available how do I fix this?

    I can't download apps it says they are not available how do I fix this?

  • Can a 2012 Mac Pro use a 2012 27in iMac as a primary display?

    Greetings all, I am trying to spec out a trade show configuration. It will have a Mac Pro, A couple iMacs, a few Macbook Pros and a couple iPads. What I need to know is if one of the iMacs can serve as the display for the Mac pPro. The money is not a

  • Restore of backed up EFS files

    Hello, we recently started to use EFS encryption on our file server. thats works ok, as well as the windows server backup, however when i go to restore an encrypted efs file via the console for the backup, i get a restore error.... "File recovery cou

  • Help in game purchase not working

    every time i try to buy something in game i get a message saying the transaction cant happen and it just sends me to support what do i do?