Impdp replace with foreign keys

I tried an impdp with table_exists_action = replace

ORA-39120: table 'TABLENAME' may not be truncated, the data will be ignored. Error is:

ORA-02266: permit to unique/primary keys in table referenced by foreign keys

If I ADD instead of REPLACE, it will get new records, it also registers changed or deleted?

actually what I need is to retrieve data of a schema in a database to another database nightly:

System / * DIRECTORY = EXPORT schemas = SCHEMA_NAME table_exists_action = replace network_link = logfile = LOG.log DB_LINK

I added this setting

exclude the = REF_CONSTRAINT

He took care of my errors replace it with...

I don't like the constraints I just need the data...

Tags: Database

Similar Questions

  • Insert data into a database with foreign key...

    So I recently learned how to use oracle and am doing my first DB, I created the tables and added constraints, now I am trying to add data in my takes but I'm getting errors, below I listed all my tables, then the data im trying to insert followed by error messages. Please can somebody translate my error messages in plain English and tell me how to fix... Thank you

    Ollie!


    HERE'S OUR TABLES.

    CREATE TABLE 'ASSESMENT_TYPE '.
    (VARCHAR2 (15) 'ASSESMENT_TYPE',)
    VARCHAR2 (70) "ASSESMENT_DESCRIPTION."
    ENABLE 'ASSESMENT_TYPE_PK' CONSTRAINT PRIMARY KEY ('ASSESMENT_TYPE')
    )

    CREATE TABLE 'COURSES '.
    (NUMBER OF 'COURSE_NO',
    VARCHAR2 (30) "COURSE_NAME."
    DATE OF THE "COURSE_START_DATE."
    DATE OF THE "COURSE_END_DATE."
    NUMBER OF "TOTAL_UNITS."
    NUMBER OF "COURSE_COORDINATOR_STAFF_NO."
    NUMBER OF "TOTAL_COURSE_COST."
    NUMBER OF "THIRD_PARTY_SUPPLIER_NO."
    ACTIVATE THE KEY PRIMARY CONSTRAINT 'COURSE_PK' ('COURSE_NO'),
    "COURSE_CON_FK' FOREIGN KEY ('COURSE_COORDINATOR_STAFF_NO') CONSTRAINT
    ACTIVATE THE REFERENCE 'EMPLOYEE' ('EMPLOYEE_NO'),
    "THPARTY_SUPPLIER_FK' FOREIGN KEY ('THIRD_PARTY_SUPPLIER_NO') CONSTRAINT
    SELECT REFERENCES "THIRD_PARTY_SUPPLIER" ("THIRD_PARTY_SUPPLIER_NO")
    )

    CREATE TABLE 'COURSE_OUTCOME '.
    (VARCHAR2 (5) 'COURSE_OUTCOME',)
    VARCHAR2 (25) "COURSE_OUTCOME_DESCRIPTION."
    ENABLE 'COURSE_OUTCOME_PK' CONSTRAINT PRIMARY KEY ('COURSE_OUTCOME')
    )

    CREATE TABLE 'DEPARTMENT '.
    (NUMBER OF 'DEPARTMENT_NO',
    VARCHAR2 (50) "DEPARTMENT_NAME."
    VARCHAR2 (150) "DEPARTMENT_LOCATION."
    NUMBER OF "DEPT_MANAGER_NO."
    ACTIVATE THE KEY CONSTRAINT PRIMARY "DEPARTMENT_PK" ("DEPARTMENT_NO'),
    "DEPTMANNO_FK' FOREIGN KEY ('DEPT_MANAGER_NO') CONSTRAINT
    SELECT REFERENCES 'EMPLOYEE' ('EMPLOYEE_NO')
    )
    CREATE TABLE 'EDUCATIONAL_INSTITUTION '.
    (VARCHAR2 (100) 'SCHOOL_UNIVERSITY_NAME',)
    VARCHAR2 (200) "SCHOOL_UNIVERSITY_ADDRESS."
    ENABLE 'EDUCATIONAL_INSTITUTION_PK' CONSTRAINT PRIMARY KEY ('SCHOOL_UNIVERSITY_NAME')
    )
    CREATE TABLE 'EMPLOYEE '.
    (NUMBER OF 'EMPLOYEE_NO',
    VARCHAR2 (50) "EMPLOYEE_NAME"
    VARCHAR2 (150) "EMPLOYEE_ADDRESS."
    VARCHAR2 (50) "JOB_DESCRIPTION."
    'STATUS' VARCHAR2 (15).
    'START_DATE' DATE,
    NUMBER OF "SALARY_CODE."
    NUMBER OF "SUPERVISOR_EMPLOYEE_NO."
    NUMBER OF "DEPARTMENT_NO,"
    ACTIVATE THE KEY PRIMARY CONSTRAINT 'EMPLOYEE_PK' ('EMPLOYEE_NO'),
    "SALARYCODE_FK' FOREIGN KEY ('SALARY_CODE') CONSTRAINT
    ACTIVATE THE REFERENCE 'SALARY' ('SALARY_CODE'),
    "SUPEMNO_FK' FOREIGN KEY ('SUPERVISOR_EMPLOYEE_NO') CONSTRAINT
    ACTIVATE THE REFERENCE 'EMPLOYEE' ('EMPLOYEE_NO'),
    "EMDEPNO_FK' FOREIGN KEY ('DEPARTMENT_NO") CONSTRAINT
    ACTIVATE THE 'DEPARTMENT' ('DEPARTMENT_NO") REFERENCES
    )
    CREATE TABLE 'EMPLOYEE_COURSE_OUTCOME '.
    (NUMBER OF 'EMPLOYEE_NO',
    NUMBER OF "COURSE_NO."
    VARCHAR2 (5) "COURSE_OUTCOME_CODE."
    NUMBER OF "COURSE_EMPLOYEE_MARK."
    ACTIVATE 'EMPLOYEE_COURSE_OUTCOME_PK' CONSTRAINT PRIMARY KEY ('EMPLOYEE_NO', 'COURSE_NO'),
    "EM_FK' FOREIGN KEY ('EMPLOYEE_NO') CONSTRAINT
    ACTIVATE THE REFERENCE 'EMPLOYEE' ('EMPLOYEE_NO'),
    "EMPLOYEE_COURSE_FK' FOREIGN KEY ('COURSE_NO') CONSTRAINT
    ACTIVATE THE REFERENCE 'COURSES' ('COURSE_NO'),
    "EMPLOYEE_COURSE_OCODE_FK' FOREIGN KEY ('COURSE_OUTCOME_CODE') CONSTRAINT
    SELECT REFERENCES "COURSE_OUTCOME" ("COURSE_OUTCOME")
    )
    CREATE TABLE 'EMPLOYEE_COURSE_UNIT_OUTCOME '.
    (NUMBER OF 'EMPLOYEE_NO',
    NUMBER OF "COURSE_NO."
    NUMBER OF "UNIT_NO."
    VARCHAR2 (5) "UNIT_OUTCOME_CODE."
    NUMBER OF "EMPLOYEE_UNIT_MARK."
    ACTIVATE 'EMPLOYEE_CUO_PK' CONSTRAINT PRIMARY KEY ('EMPLOYEE_NO', 'COURSE_NO', 'UNIT_NO'),
    "EMPCU_FK' FOREIGN KEY ('EMPLOYEE_NO') CONSTRAINT
    ACTIVATE THE REFERENCE 'EMPLOYEE' ('EMPLOYEE_NO'),
    CONSTRAINT 'EMCU-FK' FOREIGN KEY ('UNIT_NO')
    SELECT REFERENCES 'UNIT' ('UNIT_NO')
    )
    CREATE TABLE 'EMPLOYEE_CRS_UNIT_ASSESMENT '.
    (NUMBER OF 'EMPLOYEE_NO',
    NUMBER OF "COURSE_NO."
    NUMBER OF "UNIT_NO."
    VARCHAR2 (15) "ASSESMENT_TYPE."
    NUMBER OF "EMPLOYEE_ASSESMENT_MARK."
    ACTIVATE A KEY PRIMARY ('EMPLOYEE_NO', 'COURSE_NO', 'UNIT_NO') CONSTRAINT 'EMPLOYEE_CRS_PK '.
    )
    CREATE TABLE 'EMPLOYEE_QUALIFICATION '.
    (NUMBER OF 'EMPLOYEE_NO',
    VARCHAR2 (5) "QUALIFICATION_TYPE."
    'SUBJECT' VARCHAR2 (20).
    NUMBER OF "QUALITY."
    VARCHAR2 (100) "SCHOOL_UNIVERSITY_NAME."
    VARCHAR2 (50) "AWARDING_BODY."
    NUMBER OF "DATE_QUALIFICATION_OBTAINED."
    TURN ON THE PRIMARY CONSTRAINT "EMPLOYEE_QUALIFICATION_CON_PK" ("EMPLOYEE_NO", "QUALIFICATION_TYPE", "SUBJECT").
    "DEPTNO_FK' FOREIGN KEY ('EMPLOYEE_NO') CONSTRAINT
    ACTIVATE THE REFERENCE 'EMPLOYEE' ('EMPLOYEE_NO'),
    "EMQUALREF_FK' FOREIGN KEY ('QUALIFICATION_TYPE') CONSTRAINT
    ACTIVATE THE REFERENCE 'QUALIFICATION_TYPE' ('QUALIFICATION_TYPE'),
    "SCHUNINAME_FK' FOREIGN KEY ('SCHOOL_UNIVERSITY_NAME') CONSTRAINT
    SELECT REFERENCES "EDUCATIONAL_INSTITUTION" ("SCHOOL_UNIVERSITY_NAME")
    )
    CREATE TABLE 'QUALIFICATION_TYPE '.
    (VARCHAR2 (5) 'QUALIFICATION_TYPE',)
    VARCHAR2 (25) "QUALIFICATION_DESCRIPTION."
    ENABLE 'QUALIFICATION_TYPE_PK' CONSTRAINT PRIMARY KEY ('QUALIFICATION_TYPE')
    )
    CREATE TABLE 'WAGES. "
    (NUMBER OF 'SALARY_CODE',
    NUMBER OF "SALARY_AMOUNT."
    ENABLE 'SALARY_PK' CONSTRAINT PRIMARY KEY ('SALARY_CODE')
    )
    CREATE TABLE 'THIRD_PARTY_SUPPLIER '.
    (NUMBER OF 'THIRD_PARTY_SUPPLIER_NO',
    VARCHAR2 (100) "THIRD_PARTY_NAME."
    VARCHAR2 (100) "THIRD_PARTY_CONTACT_NAME."
    ENABLE 'THIRD_PARTY_SUPPLIER_PK' CONSTRAINT PRIMARY KEY ('THIRD_PARTY_SUPPLIER_NO')
    )
    CREATE TABLE "UNIT".
    (NUMBER OF 'UNIT_NO',
    VARCHAR2 (30) "UNIT_NAME"
    NUMBER (7.2) "UNIT_COST"
    ENABLE 'UNIT_PK' CONSTRAINT PRIMARY KEY ('UNIT_NO')
    )
    CREATE TABLE 'UNIT_OUTCOME '.
    (VARCHAR2 (5) 'UNIT_OUTCOME_CODE',)
    VARCHAR2 (25) "UNIT_OUTCOME_DESCRIPTION."
    ENABLE 'UNIT_OUTCOME_PK' CONSTRAINT PRIMARY KEY ('UNIT_OUTCOME_CODE')
    )
    NOW, WE TRY TO ENTER DATA.

    insert into values used (0002, "Mitch Vaughan', '145 a Green Street', 'Administrator', 'Active', December 1, 2010", 1,1,1 ");

    insert into values used (0001, "Ollie Marriott", "12 the Ghetto Street', 'Administrator', 'Active', 2 December 2010", 2,2,1);

    insert into values employee (0003, "Tim Reynolds, '12 Shoebury Way', 'Cleaner', ' Inactive', December 2, 2000, 3,0002,3);

    insert into values used (0004, "Tom Watson", ' 90 Seymour Road","Data Analyst","Active", December 10, 2008", 4 000 104 ");

    insert into values used (0005, "Wajj is', 125 hamlet Court ', 'Clean', 'Active', September 15, 2007", 5 000 105 ");

    insert into values used (0006, "Nathan Mann', '33 a Bushey Hill Road', 'Receptionist', 'Active'", December 2, 2010 ", 6 000 406);

    insert into values used (0007, "Tim DeLong', ' 34 Buena Vista Drive", "Receptionist", "Active", December 21, 2010 ', 7, 1, 06);

    NOW WE'RE GETTING THESE ERROR MESSAGES.

    Connected.
    SQL > insert into values used (0002, "Mitch Vaughan', '145 a Green Street', ' has)
    dministrator ', 'Active»(, 1er décembre 2010', 1,1,1);
    insert into values used (0002, "Mitch Vaughan', '145 a Green Street', ' administrative)
    strator ', 'Active', 1 December 2010 "(, 1,1,1).
    *
    ERROR on line 1:
    ORA-02291: integrity constraint (ISAD2. SALARYCODE_FK) violated - parent key not
    found


    SQL >
    SQL > insert into values used (0001, 'Ollie Marriott', ' 12 Ghetto Road', ' SMA)
    made ', 'Active»(, 2 décembre 2010', 2,2,1);
    insert into values used (0001, 'Ollie Marriott', ' 12 Ghetto Road', ' Directors)
    Rator ', 'Active»(, 2 décembre 2010', 2,2,1)'.
    *
    ERROR on line 1:
    ORA-02291: integrity constraint (ISAD2. SALARYCODE_FK) violated - parent key not
    found


    SQL >
    SQL > insert into values used (0003, 'Tim Reynolds, 12 Shoebury way', ' Clea)
    NER ","inactive»(, 2 décembre 2000', 3,0002,3);
    insert into values used (0003, "Tim Reynolds', ' 12 Shoebury Way", "Cleaner")
    ("Inactive", 2 December 2000', 3,0002,3)
    *
    ERROR on line 1:
    ORA-02291: integrity constraint (ISAD2. SALARYCODE_FK) violated - parent key not
    found


    SQL >
    SQL > insert into values used (0004, 'Tom Watson", ' 90 Seymour Road', ' data one)
    nalyst ","Active»(, 10 décembre 2008', 4 000 104);
    insert into values used (0004, 'Tom Watson", ' 90 Seymour Road', ' data Analys)
    t ', 'Active', December 10, 2008 "(, 4 000 104).
    *
    ERROR on line 1:
    ORA-02291: integrity constraint (ISAD2. SALARYCODE_FK) violated - parent key not
    found


    SQL >
    SQL > insert into values used (0005, 'Wajj is', ' 125 hamlet Court', ' Clean)
    St ', 'Active»(, 15 septembre 2007', 5 000 105);
    insert into values used (0005, "Wajj is', 125 hamlet Court ', 'Clean',')
    Active ", September 15, 2007"(, 5 000 105).
    *
    ERROR on line 1:
    ORA-02291: integrity constraint (ISAD2. SALARYCODE_FK) violated - parent key not
    found


    SQL >
    SQL > insert into values used (0006, "Nathan Mann', '33 a Bushey Hill Road', ')
    Receptionist ', 'Active', December 2, 2010 "(, 6 000 406);
    insert into values used (0006, "Nathan Mann', '33 a Bushey Hill Road', ' Recep)
    tionist ', 'Active»(, 2 décembre 2010', 6 000 406)'.
    *
    ERROR on line 1:
    ORA-02291: integrity constraint (ISAD2. SALARYCODE_FK) violated - parent key not
    found


    SQL >
    SQL > insert into values used (0007, "Tim DeLong', ' 34 Buena Vista Drive," ' R)
    Eceptionist ', 'Active»(, 21 décembre 2010', 7, 1, 06);
    insert into values used (0007, "Tim DeLong', ' 34 Buena Vista Drive," ' Recept)
    ionist ', 'Active»(, 21 décembre 2010', 7, 1, 06)'.
    *
    ERROR on line 1:
    ORA-02291: integrity constraint (ISAD2. SALARYCODE_FK) violated - parent key not
    found


    SQL >


    PLEASE HELP ME UNDERSTAND THIS! / / /

    Sounds like you have a problem with your tables. It should not be necessary to insert a "preliminary" to the employee record, and then eventually complete.
    Should not be possible. In your case, it is, for all columns is NULL allowed, which is really bad.

    In your case, it is necessary because you have a circular reference;

    Department of references used, which refers to employee. If you really want it to be like that, one of them should be DEFERRABLE (search)

    You need to go through all your tables, you seem to have missed additional / more than one foreign key.
    I proposed (all) in NOT NULL columns. At least give some thoughts to each column;
    'Should I a value here'-> NOT NULL
    "Do I always have value here"-> NOT NULL
    If it is in each case, perhaps that this cvolumn is not at this table. This could be the case for DEPARTMENT_MANAGER, which would also solve your circular reference.

    Do not use the NUMBER with any precision. Many point for example, 'COURSE_NO' NUMBER will it means it's a flutter. For example, use Number (38), personally I use 'always' NUMBER (13) for identifiers - this will insert in a Java int.

    Also, give thoughts to CHECK constraints, probably, he does not give meaning have a negative salaray, and so on.

    A good practice is to first create all tables, then all primary keys and finally all foreign keys. That decouple the tables, so no specific order of creation is necessary.

    When these changes have been made, then start by inserting tables which do not reference other tables and then take it from there, one table at a time.

    Concerning
    Peter

    Edit: One last thing, I don't get the need for a TREATMENT table. Think you should get rid of it.

    Published by: Peter on April 26, 2011 14:53

  • First database with Oracle 12 c and Entity Framework 5: no foreign key in the EMD Associations

    We have an updated database implemented in Oracle 12 c R1. When attempting to reverse engineer the EMD of the DB using Visual Studio 2013 with ODAC 12 c Release 2 and Oracle developer Tools support all we get are entities with no association, despite multiple foreign keys defined in the database. There, of course, no navigation property in both entities. No error or warning messages are displayed and activate us the option "include foreign keys in the model columns.

    Does anyone have any idea why this might happen?

    If you use files PDB (pluggable database), there is a known bug (17474322) to generate an EDM with foreign keys in a PDB file. This is probably the question you are running in.

  • without using foreign key

    use jdev 11.1.1.4.0 using adfbc.

    today I work around with foreign key constrainst are in the db table. between parent-child relationship between two fields in a table.


    without using the dbconstraint.

    How can I use the parent child relationship.

    What mean average.

    without using the foregin db key constraint.

    When the deleted parent field means throw child error exists.

    How I can do without database constrainst.

    I guess that I have already spoken...
    http://download.Oracle.com/docs/CD/E15051_01/Web.1111/b31974/bcentities.htm#BABHFJFJ

  • SQL statement error INSERT The conflicted with the FOREIGN KEY constraint

    I recently installed a reporting for vmware vsphere software, but I get a SQL error. I opened a request for assistance with vmware, but so far they have not come up with a solution. The error is caused by: com.microsoft.sqlserver.jdbc.SQLServerException: instruction INSERT The conflicted with the FOREIGN KEY constraint 'FK_CB_VSM_NETWORK_VC_ID '. The conflict occurred in database 'VCChargebackVCC02', table "dbo." " CB_VSM_SERVER', column 'VC_ID '. I don't know a lot about SQL, so I'm lost in the extent of troubleshooting is concerned. If anyone has any ideas I'd love to hear them.

    SQL questions are better posed on Technet.  They are better equipped to manage the

    http://social.technet.Microsoft.com/forums/en-us/categories/

  • I have home premium Windows 7 with activation key. I replaced everything at the time of hard disk. I'm not able to activate Home premium Windows 7 please guide me

    I have home premium Windows 7 with activation key. I replaced everything at the time of hard disk. I am not able to install or upgrade Home premium Windows 7

    Have you tried to restart by phone?

    How to activate Windows 7 manually (activate by phone)
     
    1) click Start and in the search for box type: slui.exe 4
     
    (2) press the ENTER"" key.
     
    (3) select your "country" in the list.
     
    (4) choose the option "activate phone".
     
    (5) stay on the phone (do not select/press all options) and wait for a person to help you with the activation.
     
    (6) explain your problem clearly to the support person.
     
    http://support.Microsoft.com/kb/950929/en-us

  • Foreign key constraint, not recognized during the synchronization of data with the model dictionary

    Hello

    Data Modeler is a foreign key constraints do not recognize when synchronizing data with the model dictionary, although the foreign key is there (in the database that a data dictionary is read). I can't find any criterion when a foreign key is not recognized by the Data Modeler. Are there limits to the length of the attribute, or the number of columns in a foreign key, or other limitations which may lead to this behavior not to recognize a fk by Data Modeler? I have columns more than 32 characters. I compared with the fk is recognized by DM, but I can't find anything that indicates why it is not recognized.

    I wonder if someone also has constraints of foreign keys that are not recognized in the comparison of data bases and model?

    Thank you

    Robert

    Hi Robert,.

    Thanks for the comments, I logged a bug.

    Philippe

  • Application with no standardized and the stress of missing foreign key in database

    Hi all

    We bought Asset Tracking System of a local company. They developed in Oracle Developer Suite 6i Asset Tracking System and database is Oracle 10g in the Ms Windows environment.

    the database provided by the company had a problem. I send the company as below;

    1. There are issues of standardization in the data base.
    2. Foreign key constraints are missing.

    Please specify.

    the company responded below

    The solution provided is a product and not a custom solution.  We have already stated in our previous meetings that pack that your company is facing problems regarding performance, bugs, then we will bring the necessary technical support, which includes the software update, all bug fixes and access to assistance. your organization must be valid AMC contract with us.

    · We would like to inform you that the Application and the database are designed according to the standards. Customer consent we alter / change/view data or function, the guarantee or AMC spread during modification is cancelled. your organization absolves us of any other maintenance and support of the software.

    I just wonder what that should I replied for them? I convinced my management because they are mislead our management saying that they have their own STANDARDS, while not missing constraint Foreign Key is a MISTAKE.

    Please guide me and tell me your opinion as well. I really need it.

    Thank you.

    Simple.

    Do not. They won't understand. The only thing that they care for is their bonus.  They blame the software, they know the least: the database.

    You manage the database, they will be blaming you (and potentially you fire).

    You can't win this battle.

    I recommend that you start looking for another job.

    I have stayed here several times. All these consuiltancies have a very high rate of recovery of underpaid, junior developers who knows nothing, because they produce all disasters.

    The first thing to teach developers in these companies is of CTA (I don't spelling here, because it will be deleted, but it isn't a polite expression).

    Once they have learned to become Director of the project.

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

    Sybrand Bakker

    Senior Oracle DBA

  • Online syntax to create Foreign key with Alter Table statement

    I am a pretty meticulous reader. That being said, from the 4 texts that I read to start to learn SQL, I do not remember and do more that probably not, find a syntax online for the creation of a CF with the statement alter table.

    Just something I thought while I was reading.

    Is there a such syntax?

    And if so someone can give me direction on my code?

    ALTER table emp4 change employee_id key foreign employees of references (employe_id);

    It gives me the option error invalid alter table.

    Any idea would be appreciated.

    Thank you.

    rp0428 wrote:

    A foreign key is a constraint, you must use ADD CONSTRAINT.

    Thare is more than one way to skin a cat:

    SQL > create table tbl (id number, name varchar2 (10))
    2.

    Table created.

    SQL > alter table tbl adds (foreign key references emp (empno))
    2.

    Modified table.

    SQL > select constraint_name,.
    2 constraint_type
    3 from user_constraints
    4 where table_name = 'TBL '.
    5.

    CONSTRAINT_NAME C
    ------------------------------ -
    SYS_C0021920 R

    SQL > drop table tbl purge
    2.

    Deleted table.

    SQL > create table tbl (id number, name varchar2 (10))
    2.

    Table created.

    SQL > alter table tbl change (foreign key references emp (empno))
    2.

    Modified table.

    SQL > select constraint_name,.
    2 constraint_type
    3 from user_constraints
    4 where table_name = 'TBL '.
    5.

    CONSTRAINT_NAME C
    ------------------------------ -
    SYS_C0021921 R

    SQL >

    SY.

  • A table with two foreign keys

    Hi all

    I need to create a table (mytable) filled from 2 different tables, for example, table1 and table2

    When the rows of the table (mytable) comes from the first table (table1) columns in mytable (foreign key to the second table) are nulled, when they come (foreign key) column in the second table (table2)
    the first table) are cancelled as well.

    In terms of performance, architecture is valid, in other words, create a foreign key 2 on mytable and consequently, (the composite foreign key in this table are null according to whether they belong to the first or the second table)?

    Thanks in advance for any help

    I hope to clear

    As promised,

    mhouri.world > create table p as select * from all_users;
    
    Table created.
    
    mhouri.world > alter table p add constraint p_pk primary key (user_id);
    
    Table altered.
    
    mhouri.world > create table c (user_id references p, name varchar2(30));
    
    Table created.
    
    mhouri.world > select min(user_id),max(user_id) from p;
    
    MIN(USER_ID) MAX(USER_ID)
    ------------ ------------
               0           72                                                       
    
    mhouri.world > insert into c (user_id, name) values (0, 'test without index');
    
    1 row created.
    

    Thanks to the autonomous operation I simulates the effect of two users working on the same parent/child table

    (a) first of all, without any index covering the FK on the child table

    (b) second with a function based index on the FK column (note the desc clause in the definition of the index)

    (c) and finally with an index b-tree on the FK columns

    case (a)

    mhouri.world > declare
      2  pragma autonomous_transaction;
      3  begin
      4  delete from p where user_id = 72;
      5  commit;
      6  end;
      7  /
    declare
    *
    ERROR at line 1:
    ORA-00060: deadlock detected while waiting for resource
    ORA-06512: at line 4 
    
    mhouri.world > rollback;
    
    Rollback complete.
    

    case (b)

    mhouri.world > create index fbi_c_fk on c (user_id desc);
    
    Index created.
    
    mhouri.world > insert into c (user_id, name) values (0, 'test with fbi index');
    
    1 row created.
    
    mhouri.world > declare
      2  pragma autonomous_transaction;
      3  begin
      4  delete from p where user_id = 72;
      5  commit;
      6  end;
      7  /
    declare
    *
    ERROR at line 1:
    ORA-00060: deadlock detected while waiting for resource
    ORA-06512: at line 4 
    
    mhouri.world > rollback;
    
    Rollback complete.
    

    case (c)

    mhouri.world > create index btree_c_fk on c (user_id);
    
    Index created.
    
    mhouri.world > insert into c (user_id, name) values (0, 'test with b-tree index');
    
    1 row created.
    
    mhouri.world > declare
      2  pragma autonomous_transaction;
      3  begin
      4  delete from p where user_id = 72;
      5  commit;
      6  end;
      7  /
    
    PL/SQL procedure successfully completed.
    

    Only the index b-tree covered with success the threat of the deadlock in key foreign unidexed

    Best regards

    Mohamed Houri

  • foreign key with the apps table

    Hello world

    I created a custom table and I want to create a foreign key with per_all_people_f.

    Code:
    ALTER TABLE xxsshr.xxsm_sshr_hr_approver
    ADD CONSTRAINT fk_person_id
    FOREIGN KEY (person_id)
    REFERENCES HR. PER_ALL_PEOPLE_F (person_id)

    However, I get ora-00942: table or view does not exist.

    We use 11.5.10 and g 10 dB

    Thanks for any help...

    Elmer

    The XXSSHR account will need reference and select the privileges (and maybe others) on the PER_ALL_PEOPLE_F table. The ALTER TABLE statement must be run under the account XXSSHR after the above privileges are granted.

    HTH
    Srini

  • Need help with cause of foreign key

    Hi all

    Kindly help me to understand the scenario mentioned below...

    Please refer below

    I create a table of TabA as below with more details...
    SQL> create table TabA
      2  (cola  varchar2(10) not null,
      3   colb  number(19)   not null,
      4   colc  varchar2(1));

    Table created.

    SQL> alter table taba add constraint taba_pk primary key(cola, colb);

    Table altered.

    SQL> alter table taba add constraint taba_uq unique(colb);

    Table altered.

    SQL> create index taba_idx on taba(cola, colc);

    Index created.
    Now I create a TabB table as below
    SQL> create table tabb
      2  (colb number(19) not null,
      3   cold number(10) not null,
      4   cole number);

    Table created.


    SQL> alter table tabb add constraint tabb_pk primary key(colb, cold);

    Table altered.

    SQL> alter table tabb add constraint
      2  tabb_fk foreign key(colb) references taba(colb)
      3  deferrable initially deferred;

    Table altered.
    Now, let us drop the key foreiogn of TabB and Unique constraint created on Colb of TabB. And create a unique index on colb of TabA.
    SQL> alter table tabb drop constraint tabb_fk;

    Table altered.

    SQL> alter table taba drop constraint taba_uq;

    Table altered.

    SQL> create unique index taba_uq on taba(colb);

    Index created.
    Now, try to recreate the foreign key on ColB of TabB constraint...
    SQL> alter table tabb add constraint
      2  tabb_fk foreign key(colb) references taba(colb)
      3  deferrable initially deferred;
    tabb_fk foreign key(colb) references taba(colb)
                                              *
    ERROR at line 2:
    ORA-02270: no matching unique or primary key for this column-list
    This time, it's giving an error. Why this behaves like that.

    Please explain?

    As previously explained his checking no primary key, but the constraint of uniqueness on tabA.

    You can remove the primary key of tabA, but retain the unique constraint of tabA and then create the foreign key on tabB.

    It will create the foreign key

    SQL>drop table tabb;
    
    Table dropped.
    
    SQL>drop table taba;
    
    Table dropped.
    
    SQL>create table TabA
      2  (cola  varchar2(10) not null,
      3   colb  number(19)   not null,
      4   colc  varchar2(1)
      5  );
    
    Table created.
    
    SQL>alter table taba add constraint taba_uq unique(colb);
    
    Table altered.
    
    SQL>create table tabb
      2  (colb number(19) not null,
      3   cold number(10) not null,
      4   cole number
      5  );
    
    Table created.
    
    SQL>alter table tabb add constraint tabb_fk foreign key(colb) references taba(colb) deferrable initi
    ally deferred;
    
    Table altered.
    

    Concerning
    Arun

  • Control of foreign key with conditions

    Hello


    I describe my problem with an example.

    My child table is like this:
    code_child key
    2 p
    2 V
    3 R
    3 T
    4 E



    I need to check the foreign key (code_child) in 2 two different parents tables (code_parent1, code_parent2)

    Table 1 parent:
    _______________

    code_parent1
    --------
    S
    V

    Table 2 of the parent:
    _______________

    code_parent2
    --------
    R
    T
    E

    Maybe I should use forced complex but I don't understand how it works!

    Thank you

    Hello

    Simply create constraints (Type of Condition) and put a command like:
    (CT is my alias in the data target (child) store, must be the same inserted in the data store)

    There are
    (select 1
    of Parent_table_1 P1, P2 Parent_table_2
    where CT.code_child = P1.code_parent1
    and CT.code_child = P2.code_parent2)

    No sense?

  • creating tables with references to foreign keys that are not created tables

    I have several patterns to create and each diagram has several tables that reference the columns in each other as a foreign key. So I have to sort out them in the order. In other words, if table A has the foreign key of the Table B column can create B first and then A. are there - it was none I can create a first and then B, that would save a lot of time.

    Hello

    ORA - aff wrote:

    I have several patterns to create and each diagram has several tables that reference the columns in each other as a foreign key. So I have to sort out them in the order. In other words, if table A has the foreign key of the Table B column can create B first and then A. are there - it was none I can create a first and then B, that would save a lot of time.

    You can create A without the constraints of foreign key and then, once the B array has been created, use ALTER TABLE to add the constraints of foreigners has.

  • How to associate an index with a foreign key constraint

    I understand how to associate a primary key constraint or a Unique key constraint index...
    Yet I don't see how to associate the index of a foreign key constraint. Is this possible?

    Thank you
    Bob Larsen

    Hi Bob,

    In Data Modeler, physical model for Oracle primary and unique keys dialog boxes offer an Index field using, which is used to generate the 'using_index_clause' in the DDL for primary and Unique key constraints.
    However the Oracle Database DDL does not have the "using_index_clause" for Foreign Key constraints, thus Data Modeler does not provide this feature for foreign keys.

    So, you will need to create a separate Index that uses the same columns as the foreign key (using the index page of the table properties dialog box in the relational model).

    David

Maybe you are looking for

  • Rearrange photos in the flash player

    I copied and arranged a 80 photo album and moved to my flash drive. They are all there but are not arranged as I wanted. I can't move any photo in my flash drive. How can I rearrange the pictures flash drive?

  • World wide telescope download addin

    I ' am not having to locate and download the 'world wide telescope add-in' can you help me?

  • How can I anli memory of my computer

    How to erase the memory of my pc / or computer because it keeps me to go online and browse once as I could

  • C7280 periodically fails to print

    The C7280 ceased to print from my desktop again. It already happened and has been resolved by uninstalling and reinstalling the printer. First of all, I was never able to determine the causes of the failure. Second, the resettlement process has been

  • LR6 licening and installation of questions after you apply the updated

    Hellolast update installed yesterday afternoon. After reboot LR6 requests license key and connect to Adobe, since then, I am unable to use the product as it seems not to accept the button upgrade LR6 or he does not ask as it is usual for a previous k