Primary Key Constraint missing in Oracle Standard Tables OE_ORDER_HEADERS_ALL

Dear Legends,
In our Production and Test Environment R12.1.3 HP-UX 64bit While checking some of the constraints and doing for an ALTER Table add foreign key we came to know that the HEADER_ID primary constraint(OE_ORDER_HEADERS_ALL_PK) is missing for the table OE_ORDER_HEADERS_ALL. May I know the ways that I can check how and when this change could be happened? and How to prevent this in future?
Thanks,
Karthik

Please log a SR with Oracle support since this is concerning your production instance.
http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_object?c_name=OE_ORDER_HEADERS_ALL&c_owner=ONT&c_type=TABLE
May I know the ways that I can check how and when this change could be happened?
If audit is enabled you can find out, otherwise it may not be easy to tell how/when (search the forum for auditing docs) -- Ask Oracle support for their feedback on this as well.
and How to prevent this in future?
- Establish auditing options (you would also need to consider the impact on the performance then)
- Access to the database should be limited to the DBAs only.
- If you don't trust your DBA, fire him/her
Thanks,
Hussein

Similar Messages

  • Can we have more than one primary key constraint to a Oracle Table?

    Hi,
    Can we have more than one primary keys to a single table in oracle? ( Not the composite key)
    Please somebody answer..
    Regards,
    Alaka

    811935 wrote:
    Can we have more than one primary keys to a single table in oracle? ( Not the composite key)
    In principle a table can have multiple keys if you need them. It is a very strong convention that just one of those keys is designated to be "primary" but that's just a convention and it doesn't stop you implementing other keys as well.
    Oracle provides two uniqueness constraints for creating keys: the PRIMARY KEY constraint and the UNIQUE constraint. The PRIMARY KEY constraint can only be used once per table whereas the UNIQUE constraint can be used multiple times. Other than that the PRIMARY KEY and UNIQUE constraints serve the same function (always assuming the column(s) they are applied to are NOT NULL).

  • Materialized View - does not contain a primary key constraint

    I am trying to create materialized view. I gone through the MV wizard creation. Added 2 columns (foo_column, foo_pk) of the table and have a simple select statement (Select foo_column from foo_dim). Also created a primary key contrainst and refencing the primary key (FOO_PK) of the dimension.
    I am getting the following error:
    ORA-12014: table 'FOO_DIM' does not contain a primary key constraint

    It was solved. The table that I am querying has to have a primary key defined before creating a materialized view.

  • Altering Primary Key constraint on a table i Oracle 10G

    Hi All,
    Can anyone tell me how to alter a primary key constraint on any table. My concern is that, suppose i have a table called 'Employee' where only 'EmployeeName' is added as a primary ket constaint. Now i want to alter this P.K. constarint to add 'EmployeeName' and 'DateOfBirth' as a primary key. Can anyone suggest me how can i achieve that? Any help will be highly appreciated.

    hi,
    you need to drop the constraint and recreate it.
    SQL> conn scott/tiger@alpspso
    Connected.
    SQL> create table test (id number constraint id_pk primary key,name varchar(30));
    create table test (id number constraint id_pk primary key,name varchar(30))
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    SQL> create table test_table (id number constraint id_pk primary key,name varchar(30))
    Table created.
    SQL> alter table test_table modify constraint id_pk primary key(id,name);
    alter table test_table modify constraint id_pk primary key(id,name)
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    SQL> alter table test_table modify constraint id_pk(id,name);
    alter table test_table modify constraint id_pk(id,name)
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    SQL> alter table test_table modify primary key(id,name);
    alter table test_table modify primary key(id,name)
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    SQL> alter table drop constraint id_pk;
    alter table drop constraint id_pk
    ERROR at line 1:
    ORA-00903: invalid table name
    SQL> alter table test_table drop constraint id_pk;
    Table altered.
    SQL> alter table test_table add constraint id_pk primary_key(id,name);
    alter table test_table add constraint id_pk primary_key(id,name)
    ERROR at line 1:
    ORA-00902: invalid datatype
    SQL> alter table test_table add constraint id_pk primary key(id,name);
    Table altered.
    Regards.
    Navneet

  • ORA-12014 table does not contain a primary key constraint

    Hi
    I have some existing Materialised Views I am trying to redeploy through OWB as its now our standard tool.
    The existing code has
    CREATE MATERIALIZED VIEW .......
    .REFRESH ON DEMAND WITH ROWID AS
    SELECT *
    FROM apps.fafg_assets
    When I create in OWB you only put the select statement, there is nowhere to put the 'with rowid ' part hence I get the following error on deployment;
    ORA-12014: table 'FAFG_ASSETS' does not contain a primary key constraint
    I cannot put a primary key on this table though so how do I get around this in OWB? Like I say writing the MV in PL/SQL putting the 'with rowid' bit makes it work?
    Thanks

    Hi...
    I believe you'll need a PK so Oracle will know how to update the MV. Is there any particular reason for you not having a PK in FAFG_ASSETS table? As an alternative, you may want to create a new column in this table and having a table trigger/sequence populating this column.
    But It looks like you are using EBS, so, I don't know if you can add new columns to tables.
    See if this thread can help you:
    Re: ORA-12014: table 'XXX' does not contain a primary key constraint
    Regards,
    Marcos

  • Primary key constraint for index-organized tables or sorted hash cluster

    We had a few tables dropped without using cascade constraints. Now when we try to recreate the table we get an error message stating that "name already used by an existing constraint". We cannot delete the constraint because it gives us an error "ORA-25188: cannot drop/disable/defer the primary key constraint for index-organized tables or sorted hash cluster" Is there some sort of way around this? What can be done to correct this problem?

    What version of Oracle are you on?
    And have you searched for the constraint to see what it's currently attached to?
    select * from all_constraints where constraint_name = :NAME;

  • ORA-12014: table 'DBA' does not contain a primary key constraint

    Hai
    when implementing basic replication i got the below error.
    ORA-12014: table 'DBA' does not contain a primary key constraint
    I was wondering primary key is enable at remote table
    Any idea about this
    Regards
    mohan
    I am giving below example
    AT master site
    global_names=false in init.ora file
    sql>create table dba(no number primary key);
    table created
    and create snapshot log
    sql>create snapshot log on m1;
    materilized view created
    AT SNAPSHOT SITE
    1.Create service using net8 stiring name like n1
    2.create database link
    sql>create public database link m3 connect to system identified by manager using 'n1';
    Database link created.
    3.when creating snapshot site i got below error
    SQL> create snapshot snap1 refresh fast start with sysdate next sysdate+1/(24*60
    *60) as select * from dba@m3;
    create snapshot snap1 refresh fast start with sysdate next sysdate+1/(24*60*60)
    as select * from dba@m3
    ERROR at line 1:
    ORA-12014: table 'DBA' does not contain a primary key constraint

    Hello,
    Please repost this question in the appropriate section of the Discussion Forum.
    This forum is for general suggestions and feedback about the OTN site.
    You can also use our new offering called OTN Service Network:
    For Oracle Advice/Minimal Support (fee based) on the Oracle Database Server, Oracle9i Application Server Containers for J2EE (OC4J), Oracle9i JDeveloper, Reports, Forums, SQL*Plus, and PL/SQL, please go to: http://www.oracle.com/go/?&Src=912386&Act=45
    For customers with paid support (Metalink) please go to:
    http://www.oracle.com/support/metalink
    Regards,
    OTN

  • Create a materized view without primary key constraint on the base table?

    Hi
    I tried to create a materized view but I got this error:
    SQL> CREATE MATERIALIZED VIEW TABLE1_MV REFRESH FAST
    START WITH
    to_date('04-25-2009 03:00:13','MM-dd-yyyy hh24:mi:ss')
    NEXT
    sysdate + 1
    AS
    select * from TABLE1@remote_db
    SQL> /
    CREATE MATERIALIZED VIEW TABLE1_MV REFRESH FAST
    ERROR at line 1:
    ORA-12014: table 'TABLE1' does not contain a primary key constraint.
    TABLE1 in remote_db doesn't have a primary key constraint. Is there anyway that I can create a materized view on a base table which doesn't have a primary key constraint?
    Thanks
    Liz

    Hi,
    Thanks for your helpful info. I created a materialized view in the source db with rowid:
    SQL> CREATE MATERIALIZED VIEW log on TABLE1 with rowid;
    Materialized view log created.
    Then I created a MV on the target DB:
    CREATE MATERIALIZED VIEW my_schema.TABLE1_MV
    REFRESH FAST
    with rowid
    START WITH
    to_date('04-25-2009 03:00:13','MM-dd-yyyy hh24:mi:ss')
    NEXT
    sysdate + 1
    AS
    select * from TABLE1@remote_db
    SQL> /
    CREATE MATERIALIZED VIEW my_schema.TABLE1_MV
    ERROR at line 1:
    ORA-12018: following error encountered during code generation for
    "my_schema"."TABLE1_MV"
    ORA-00942: table or view does not exist
    TABLE1 exists in remote_db:
    SQL> select count(*) from TABLE1@remote_db;
    COUNT(*)
    9034459
    Any clue what is wrong?
    Thanks
    Liz

  • Remove the primary key constraint and add new primar key to the table.

    Hi all,
    We had a design plan to remove a primary from the table on column X(VARCHAR) and add a new primary key on column Y(sequence)(dimensional table). Instead, I am planning to create a unique index on the column Y (I am referring column Y in my Fact table).
    I am using the column Y while joining the dimensional and fact table. Now, my question is.
    Is the retrieval will be faster if I make column Y as primary key or Is it the performance same if I create a unique index on it ?
    Note: Both column X and Y in dimension table are unique and not null. Don't want to alter the existing system hence want to create unique index .
    Please suggest.
    Thanks and Regards
    Nagaraja Akkivalli

    When you define a column as Primary key column you give certain information to Oracle that i can use when accessing that table. And similarly when you say a column as Unique Key column you give certain details to oracle that i can use when accessing that table.
    So it is up to you to decide if the what that column is meant to do. And decide based on that.
    For example a Unique column can have NULL values. But a primary key cannot have NULL value. This piece of information can be critical to oracle to generate the best plan.

  • Large table, primary key constraint

    I have migrated a table from 8i to 9i that is over 300 million rows. I migrated the the table to a 9i database without constraints or indexes.
    I have successfully created a composite index of two columns, t1 varchar2(512), t2 varchar2(32). This index took nearly 16 hours to create.
    I am now trying to create a primary key based on that index with the following sql:
    alter table table1
    add constraint table1_t1_t2_pk primary key(t1,t2)
    using index table1_t1_t2_idx
    nologging
    This process has taken over 24 hours and is well into the second day. Studio reports it will take an additional 15 hours to create.
    My questions are these?
    1. Is my syntax okay?
    2. I thought that by creating a primary key on an existing index, that another index is not being created. I thought it would be faster this way. Why is it taking a lot longer to create then the index it is based upon?
    3. Is there a more efficient method (other than parallel query) to create this index/constraint on such a large table? What happens when I go production and need to recreate this index if I have a failure. I have never had to do this before. I can't be down for 48 hours to create an index. What other alternatives do I have?
    The table is partit[i]Long postings are being truncated to ~1 kB at this time.

    Is INDEX table1_t1_t2_idx UNIQUE? If it's not that might explain why building the primary key constraint takes longer.
    I think the USING INDEX clause with an existing index is intended mainly for different UNIQUE constraints to share the same index. In your situation I think you would be better off just building the primary key constraint.
    Cheers, APC

  • How add primary key constraint to already existing table with data

    I want apply primary key constraint to already existing table with data
    is there any command or way to do

    Alternatively, assuming you want to ensure uniqueness in your primary key column you can do this:
    alter table <table name> add constraint <cons name> primary key (col1,col2) exceptions into <exception_table>
    If the altter table statement fails this will populate the EXCEPTIONS table with the rows that contain duplicate values for (col1,col2).
    You will need to run (or get a DBA to run) a script called UTLEXCPT.SQL (which will be in the $ORACLE_HOME/rdbms/admin directory) if you don't already have an EXCEPTIONS table.
    Cheers, APC

  • Unable to enforce Primary Key constraint with my code

    Hi Guys
    I have a table that contains 2 columns: code and description (defined as not null). I am using oracle forms 10g, if I inset a new row both the columns: code and description should have data e.g. code: 001 and description: Main Store...
    So on forms I have an on-update trigger on block level that handles the error messages but if the user has to update the description this trigger blocks him because the value for the code i.e. 001 is already on the database but if I remove the piece of code (the first IF block on my code together with a cursor and the entire declaration section)then the primary key constraint is violated: the code is as follows:
    declare
    v_store_code store_types.code%type;
    cursor store_codes is
    select a.code
    from store_types a
    where a.code = :b1.code;
    begin
    open store_codes;
    fetch store_codes into v_store_code;
    if ( store_codes%found ) then
    Message('The Store Code you have entered already exists on the Store_Types table, please enter another code!');
    Message('The Store Code you have entered already exists on the Store_Types table, please enter another code!');
    close store_codes;
    raise form_trigger_failure;
    end if;
    close store_codes;
    if :b1.code is not null and :b1.description is null then
         message('If the Store Code has been captured, then the Store Description must be captured!');
         message('If the Store Code has been captured, then the Store Description must be captured!');
    raise form_trigger_failure;
    end if;
    if :b1.description is not null and :b1.code is null then
         message('If the Store Description has been captured, then the Store code must be captured!');
         message('If the Store Description has been captured, then the Store code must be captured!');
         raise form_trigger_failure;
    end if;
    exception
              when others then
                   message(sqlerrm);
                   raise form_trigger_failure;
    end;
    My main intention here is: the user should be able to update the description field and save the changes without violating primary key on the column: code ...... please help me guys...

    ICM
    Sir as far I could understand , your problem is that your wanna allow the end users to update the Store_description , and Store_code..
    So on forms I have an on-update trigger on block level that handles the error messages but if the user has to update the description this trigger blocks him because the value for the code i.e. 001 is already on the databaseif it's right then why don't you have unique key constraints Store_description?
    alter the tables and apply unique key constraint...
    and no need to write this code
    f :b1.code is not null and :b1.description is null then
    message('If the Store Code has been captured, then the Store Description must be captured!');
    message('If the Store Code has been captured, then the Store Description must be captured!');
    raise form_trigger_failure;
    end if;because as you mentioned
    code and description (defined as not null)if they are already under not null constraints then no need to handle this in coding..
    he/she must be able to change the description and save the changes without affecting the code i.e.:Sir I think updation in records can only be performed when the forms is in query mode e.g execute query, have all/desired records and then make changes
    (1)description is in unique key constraint it can't be duplicated ..
    (2)code is PK it can never be duplicated...
    for this I would suggest you to have a update button on forms , when-button-pressed trigger sets property of block (update_allowed, property_true);
    and check the code of unique key violation code from oracle form's help , when that error code raise up you can show those message
    Message('The Store Code you have entered already exists on the Store_Types table, please enter another code!');
    Message('The Store Code you have entered already exists on the Store_Types table, please enter another code!');I hope it could do something for you
    thanks
    regards:
    usman noshahi

  • Violation of PRIMARY KEY constraint

    Hello,
    I have the following table in my oracle database :
    create table FLTRPTDATA
    esn VARCHAR2(10) default 'ALL' not null,
    periodid NUMBER not null,
    yearid NUMBER default 2007 not null,
    reportid NUMBER not null,
    entryid NUMBER not null,
    operatorid VARCHAR2(30) default 'XXX' not null,
    param1 VARCHAR2(200),
    param2 VARCHAR2(200),
    param3 VARCHAR2(200),
    param4 VARCHAR2(200),
    param5 VARCHAR2(200),
    param6 VARCHAR2(200),
    param7 VARCHAR2(200),
    param8 VARCHAR2(200),
    param9 VARCHAR2(200),
    param10 VARCHAR2(200),
    acid VARCHAR2(8) default 'ALL' not null
    and also have a composite primary key for the table as follows :
    add constraint PK_FLTRPTDATA primary key (ESN, PERIODID, YEARID, REPORTID, ENTRYID, OPERATORID, ACID)
    using index
    So I expect that I can only insert a new row into the table if the combination of values for ESN,PERIODID,YEARID,REPORTID,ENTRYID,OPERATORID and ACID are unique.
    I am running some software that inserts new rows into the table (via an INSERT SQL statement).
    When the software runs, it inserts a certain number of rows, but then stops when inserting one of the rows with a Violation of PRIMARY KEY constraint 'PK_FLTRPTDATA'. Cannot insert duplicate key in object 'fltRPTDATA' error.
    This implies that the row being inserted contains values for the composite key columns that are NOT unique. However, when I look at the data it fails to insert, I can see that there are NO rows in the table for this combination of column values.
    If I then try to MANUALLY insert the same row myself (via my own SQL statement in SQL Developer), the row is inserted with no error.
    When I run the software, the first thing it does is delete any rows in the table that it will subsequently insert, so there cannot be any duplicate entries in the table before the inserts take place. I have run the SQL statement that does the deletion myself manually, and it does delete all of the relevant rows.
    I have checked the code (I am not the author), and I cannot see anything that would cause the same INSERT to be executed twice.
    I have checked the log file generated by the software, and the INSERT is only attempted once (according to the log).
    I don't understand why the insert fails when I run the software, and I am wondering if anyone can shed any light on the issue? Has anyone seen this scenario before where you get a PRIMARY KEY constraint violation on a composite key, where the data being inserted IS unique?
    Thanks for any help and apologies if this is in the wrong forum,
    Jason.

    >
    I don't understand why the insert fails when I run the software, and I am wondering if anyone can shed any light on the issue? Has anyone seen this scenario before where you get a PRIMARY KEY constraint violation on a composite key, where the data being inserted IS unique?
    >
    One way to find those records would be to create and use a dml error log table. Then those records would get logged to the log table and would not prevent the insert of the valid records.
    See Loading Tables in the DBA Guide
    http://docs.oracle.com/cd/E11882_01/server.112/e17120/tables004.htm#InsertDMLErrorLogging
    Then you can examine the records in the log table and see why they were rejected.

  • Modify a primary key constraint

    Hi,
    I'm starting with oracle, and I have two doubts that can't handle after searching on the internet.
    1º It's possible to make an ALTER TABLE of a CONSTRAINT DEFAULT?. Maybe you think that the question should be in another way like this: Does oracle database take the default condition as a constraint?. As long as I know, doesn't do that.
    2º It's possible, with an ALTER TABLE, to MODIFY a CONSTRAINT of a PRIMARY KEY, to add another more field?
    I've been searching on the internet, but I didn't find a clear answer. I'm using oracle 10g express edition.
    Thank you very much.
    P.D.:Sorry for my english it's not very good.

    #2 - You can not 'add a column to the primary-key constraint of a table' with a single ALTER, but you can drop and re-create the primary key constraint (including the additional column).
    13:25:26> create table t1 (a number primary key, b number, c number );
    Table created.
    Elapsed: 00:00:00.09
    13:25:46> alter table t1 drop primary key;
    Table altered.
    Elapsed: 00:00:00.06
    13:25:47> alter table t1 add primary key (a,b);
    Table altered.
    Elapsed: 00:00:00.09But you will not be able to drop the primary key of an index-organized table.
    13:25:47> create table t2 (a number primary key, b number, c number ) organization index;
    Table created.
    Elapsed: 00:00:00.03
    13:25:59> alter table t2 drop primary key;
    alter table t2 drop primary key
    ERROR at line 1:
    ORA-25188: cannot drop/disable/defer the primary key constraint for
    index-organized tables or sorted hash cluster
    Elapsed: 00:00:00.00
    13:25:59> #1 - I'm not sure I understand your question , but you can alter a table's column to have a default. This is not a 'constraint', but a default. It only has effect when you perform an insert which does not include that column.
    13:31:23> alter table t1 modify (c default 3.14);
    Table altered.
    Elapsed: 00:00:00.04
    13:31:24> insert into t1 (a,b,c) values (1,2,3);
    1 row created.
    Elapsed: 00:00:00.01
    13:31:24> insert into t1 (a,b,c) values (4,5,NULL);
    1 row created.
    Elapsed: 00:00:00.00
    13:31:24> insert into t1 (a,b) values(6,7);
    1 row created.
    Elapsed: 00:00:00.01
    13:31:24> select * from t1;
             A          B          C
             1          2          3
             4          5
             6          7       3.14
    3 rows selected.
    Elapsed: 00:00:00.18

  • DISABLE primary key constraint

    Hello,
    let me know whats meaning by this....
    Here, it creates a primary key and disable it... So whats the purpose of doing this...
    (defines and disables an integrity constraint)
    Constraint is DISABLED. is it in VALIDATE state / NO-VALIDATE state)
    CREATE TABLE emp (
    empno NUMBER(5) PRIMARY KEY DISABLE, . . . ;
    ALTER TABLE emp
    ADD PRIMARY KEY (empno) DISABLE;
    Thanks
    Edited by: Zerandib on Nov 12, 2008 6:47 AM

    Having just done this this morning, let me have a go at explaining one possible use for this feature:
    I am bulk-loading some data into a table. I know that some of the rows in that data duplicates other rows, and that I need to clean out those duplicates.
    The quickest way of detecting duplicates I know of is to attempt to switch on a primary or unique key constraint and have the duplicate records written out to an EXCEPTIONS table. Therefore, I create my loading table with a primary key constraint DISABLED, so that I can actually perform the data load which I know will violate the constraint. If I'd created it enabled, which is the default, the bulk load would never be able to insert anything into the table, after all. When the load is finished, I do this:
    alter table bulk_load enable constraint bulk_load_pk exceptions into exceptions;...and then I can use other techniques to use the new contents of the EXCEPTIONS table to work out which rows from the BULK_LOAD table to delete to clear out the duplicates.
    All constraints when first created are in the enabled validate state, unless you specify otherwise. If you miss out the validate/novalidate keyword, in other words, your constraint will be created as VALIDATE.
    Hope that helps a little.

Maybe you are looking for

  • Booklet printing in InDesign 5

    How do I print a specific spread from booklet printing in InDesign 5?

  • Problem with inserting two BLOBs into a table using setBinaryStream

    DBMS 9.2.0.1.0, Oracle JDBC driver 10.1.0.2.0 The following code insert in one INSERT two BLOBs into two columns using PreparedStatement.setBinaryStream(). When the size of the of at least one blob exceeds some limit (? 2k, 4k ?), the values are swap

  • Writing the file using Write to SGL and reading the data using Read from SGL

    Hello Sir, I have a problem using the Write to SGL VI. When I am trying to write the captured data using DAQ board to a SGL file, I am unable to store the data as desired. There might be some problem with the VI which I am using to write the data to

  • How to retrieve all files in a given directory?

    Hi all, I am a newbie to Java. I have to retrieve all files in a given directory. The names of the files are not known to me. Only the name of the directory is known. How can I retrieve and read all those files? Gary

  • Verizon Yahoo mail

    Up until yesterday I had no problems collecting and sending my mail from my Yahoo Verizon mail account. I know it's been answered be for but I'm still having no luck. I'm missing something. Could some one post the setup directions again? MacBook Pro