PARTITION BY REFERENCE: ORA-02266 when several relatives of foreign key

Bubble my problem down to a simple example, imagine providers of satellite TV, their programming packages, their clients and customers linking to packages.  Shouldn't be able to drop all data from a provider in one shot?

CREATE TABLE suppliers

(provider_name VARCHAR2 (20) NOT NULL)

CONSTRAINT providers_pk PRIMARY KEY (nom_de_fournisseur)

)

PARTITION BY LIST (provider_name) (PARTITION provider__dflt VALUES (DEFAULT))

/

CREATE TABLE programming

(programming_name VARCHAR2 (50) NOT NULL)

, provider_name VARCHAR2 (20) NOT NULL

CONSTRAINT programming_pk PRIMARY KEY (programming_name)

CONSTRAINT programming_fk1 FOREIGN KEY (nom_de_fournisseur)

REFERENCES (provider_name) providers

)

PARTITION BY REFERENCE (programming_fk1)

/

Subscribers of CREATE TABLE

(subscriber_name VARCHAR2 (50) NOT NULL)

, provider_name VARCHAR2 (20) NOT NULL

CONSTRAINT subscribers_pk PRIMARY KEY (subscriber_name)

CONSTRAINT subscribers_fk1 FOREIGN KEY (nom_de_fournisseur)

REFERENCES (provider_name) providers

)

PARTITION BY REFERENCE (subscribers_fk1)

/

CREATE TABLE subscriber_programming

(subscriber_name VARCHAR2 (50) NOT NULL)

, programming_name VARCHAR2 (20) NOT NULL

CONSTRAINT Subscriber_programming_pk

PRIMARY KEY (subscriber_name, programming_name)

CONSTRAINT subscriber_programming_fk1 FOREIGN KEY (subscriber_name)

Subscribers of REFERENCES (subscriber_name)

CONSTRAINT subscriber_programming_fk2 FOREIGN KEY (programming_name)

Programming REFERENCES (programming_name)

)

PARTITION BY REFERENCE (subscriber_programming_fk1)

/

ALTER TABLE SPLIT PARTITION provider__dflt values ("dishnetwork") suppliers

IN (provider_dishnetwork PARTITION, PARTITION provider__dflt)

UPDATE INDEX

/

INSERT INTO suppliers (provider_name)

VALUES ("dishnetwork")

/

INSERT INTO subscribers (subscriber_name, provider_name)

VALUES ('john doe', "dishnetwork")

/

INSERT INTO programming (programming_name, provider_name)

VALUES ('top200","dishnetwork")

/

ALTER TABLE DROP PARTITION provider_dishnetwork UPDATE INDEX providers

/

I have same INSERT in subscriber_programming; the above is sufficient to cause the latter to draw "ORA-02266: unique/primary keys in table referenced by foreign keys enabled". ""  Version information:

-Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

-With options for partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing

-Linux 2.6.32 - 279.11.1.el6.x86_64 #1 SMP Sat Sep 22 07:10:26 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

This simple demo is simply representative of course.  Our number of real paintings ~ 60, with hundreds of millions of records in a large number of tables, a tree FK covering several levels of depth, without the partition littered throughout key.  Given that the volume of data, we try hard to avoid executing DELETE, which is why I explore PARTITION migration BY reference.  The problem is not unlike the already-fixed Bug 9329773, but it is slightly different - especially that this variant is not resolved.  If there is no way that such a facility would never fly, you have any suggestions that would not involve changes to application code?  (For example, adding a partition to the tables key column kids won't fly, but I might be able to sell disabling constraints to developers.)

After much head striking, I found the trick, by https://jonathanlewis.wordpress.com/2006/12/10/drop-parent-partition/ .  The difference of Appendix A is bold: the NOVALIDATE on subscriber_programming_fk2 and the EXCHANGE/CREATE/DROP of programming_e.

CREATE TABLE suppliers

(provider_name VARCHAR2 (20) NOT NULL)

CONSTRAINT providers_pk PRIMARY KEY (nom_de_fournisseur)

)

PARTITION BY LIST (provider_name) (PARTITION provider__dflt VALUES (DEFAULT))

/

CREATE TABLE programming

(programming_name VARCHAR2 (50) NOT NULL)

, provider_name VARCHAR2 (20) NOT NULL

CONSTRAINT programming_pk PRIMARY KEY (programming_name)

CONSTRAINT programming_fk1 FOREIGN KEY (nom_de_fournisseur)

REFERENCES (provider_name) providers

)

PARTITION BY REFERENCE (programming_fk1)

/

Subscribers of CREATE TABLE

(subscriber_name VARCHAR2 (50) NOT NULL)

, provider_name VARCHAR2 (20) NOT NULL

CONSTRAINT subscribers_pk PRIMARY KEY (subscriber_name)

CONSTRAINT subscribers_fk1 FOREIGN KEY (nom_de_fournisseur)

REFERENCES (provider_name) providers

)

PARTITION BY REFERENCE (subscribers_fk1)

/

CREATE TABLE subscriber_programming

(subscriber_name VARCHAR2 (50) NOT NULL)

, programming_name VARCHAR2 (20) NOT NULL

CONSTRAINT Subscriber_programming_pk

PRIMARY KEY (subscriber_name, programming_name)

CONSTRAINT subscriber_programming_fk1 FOREIGN KEY (subscriber_name)

Subscribers of REFERENCES (subscriber_name)

CONSTRAINT subscriber_programming_fk2 FOREIGN KEY (programming_name)

Programming (programming_name) NOVALIDATE REFERENCES

)

PARTITION BY REFERENCE (subscriber_programming_fk1)

/

ALTER TABLE SPLIT PARTITION provider__dflt values ("dishnetwork") suppliers

IN (provider_dishnetwork PARTITION, PARTITION provider__dflt)

UPDATE INDEX

/

INSERT INTO suppliers (provider_name)

VALUES ("dishnetwork")

/

INSERT INTO subscribers (subscriber_name, provider_name)

VALUES ('john doe', "dishnetwork")

/

INSERT INTO programming (programming_name, provider_name)

VALUES ('top200","dishnetwork")

/

INSERT INTO subscriber_programming (subscriber_name, programming_name)

VALUES ('john doe', "top200")

/

CREATE TABLE programming_e AS

SELECT * PROGRAMMING WHERE 0 = 1

/

ALTER TABLE programming

Provider_dishnetwork WITH TABLE programming_e SWAP PARTITION

/

DROP TABLE programming_e

/

ALTER TABLE DROP PARTITION provider_dishnetwork UPDATE INDEX providers

/

Tags: Database

Similar Questions

  • CFTransaction, several inserts and foreign keys

    Here is the joke of what I want to do

    < cfset commitit = yes >
    < cftransaction action = start >
    < cftry >
    < cfquery >
    making my first insertion on the main table - primary key is the unique sequence number
    < / cfquery >
    < cfquery >
    do my next insertion in the second, but it has a foreign key to the intial insert constraint
    < cfquery >
    < cfquery >
    do my next insertion in the third table, but it has a foreign key to the intial insert constraint
    < cfquery >
    < cfcatch >
    < commitit = no >
    Rollback
    < / cfcatch >
    If commitit = yes
    commit the changes
    endif
    < / cftry >
    < / cftransaction >
    Problem is when I try to insert the record in the second table, the first record (parent) is not here because no validation has yet arrived. I get a foreign key error. I want to do within a transaction so that I can do a restore if there are questions. Is it possible to do in a cftransaction?

    I want to thank you all for your answers. The code I had was OK. I kept changing the code for serialization, because it makes sense in this case. I needed to get back to the basics - my definition of foreign key was in trouble. Thanks to you all.

  • Is a foreign key MUST have a UNIQUE or PK column as a reference?

    First I tried, from what I saw Yes it must be Unique or PK. Secondly, I am pretty sure that I read somewhere where there are PK or unique. Thirdly, I checked oradocs and other pages, the thing ends, I owe an answer

    Constraint foreign key (also called a constraint referential integrity) designates a column as a foreign key and establishes a relationship between this foreign key and a primary or unique key specified, called the referenced key.


    This implies, but does not explicitly specify that it MUST be a PK or a SINGLE.


    Basically I want a simple yes/no answer just to give me some peace of mind. I don't want to waste any time, but changes to the oracle from time to time, and I'd rather have a confirmation from someone with more knowledge/experience.


    Thank you!

    Yes.

    This same document you are referencing tells you what are the rules for the creation of a foreign key.

    Data integrity

    Foreign key constraints

    Whenever two tables have one or more common columns, Oracle database can apply the relationship between the two tables with a foreign key, also called a referential integrity constraint constraint. The constraint requires that for each value in the column on which the constraint is defined, the value in the other specified that another table and column must match. An example of a referential integrity rule is that an employee may work for only one Department.

    Table 5-2 lists the terms associated with referential integrity constraints.

    Table 5-2 referential integrity constraint conditions

    Term Definition

    Foreign key

    The column or set of columns included in the constraint definition that refers to a key that is referenced. For example, the department_id column employees is a foreign key that refers to the department_id column of departments .

    Foreign keys can be described as several columns. However, a composite foreign key must refer to a primary or unique key with the same number of columns and the same types of data.

    The value of the foreign keys can be either the primary or unique key value referenced or be null. If any column of a composite foreign key is null, then the portions not null the key do not match any corresponding part of a parent key.

    Referenced key

    The unique key or the primary key of the table referenced by a foreign key. For example, the department_id column departments is the key referenced to the department_id column of employees .

    Table dependent or child

    The table containing the foreign key. This table is based on the values present in the primary or unique key referenced. For example, the employees table is a child of departments .

    Referenced or the parents table

    The table that is referenced by the foreign key of the child table. It is the key to this table reference that determines whether specific inserts or updates are allowed in the child table. For example, the departments table is a parent of employees .

    The first three terms defined in the table EXPLICITLY State references to the 'core' or 'unique' keys to the parent.

    The doc also refers to the Application Developer Guide:

    Maintaining the integrity of the data in Database Applications

    Foreign key references a primary key by default

    If the list of columns is not included in the REFERENCES option when you set a FOREIGN KEY constraint (simple or composite column), then Oracle database assumes that you want to reference the primary key of the specified table. You can also explicitly specify the columns to reference the table parent in parentheses. Oracle database checks automatically to check this list of column refers to a primary or unique to the parent table key. If it isn't, an informative error is returned.

    That the entire paragraph is as explicitly as it gets.

    No list of columns? Oracle then checks for a primary key.

    There is a list of columns? Then Oracle 'control to verify this list of column made reference to a primary or unique key'...

  • Unwrapping names of foreign key in relational model

    Hello

    In the process of the engineer to the relational model, foreign keys get automatically wrapped. Is there somewhere a (preferably) parameter to avoid this problem? Or a function in a single step? Currently, I have to select each name and make it wider, which is very tedious. And they run again after another engineer to the relational model.

    If there is no option, I would ask for an improvement allow this. Thank you very much.

    Robert

    Sorry, a step is missing - 2.1 close design (after registration)

    Basically when I say save design, close it and open it, that can be applied to the model itself - save, close, load - from browser

    Philippe

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

    Hello
    I'm trying to delete data from a table by dropping a partition. I've identified all the child tables by running the following command.

    Select "select count (*) from ' |" table_name |' where employee_id = 100; »
    of dba_constraints
    where constraint_type = 'R '.
    and r_constraint_name in
    (select constraint_name from dba_constraints
    where constraint_type in ('P', 'U') and table_name =' EMPLOYEE);


    "SELECTCOUNT (*) OF | TABLE_NAME | "WHEREEMPLOYEE_ID_ID = 100; »
    -----------------------------------------------------------------------------------------------
    Select count (*) in the PT_ORDERS where employee_id = 100;
    Select count (*) in the PT_DEP where employee_id = 100;
    Select count (*) in the PT_SKILLSET where employee_id = 100;

    I dropped the score for number 100 in all child tables. The count (*) select returns 0 rows for each of the foregoing.

    When I try to run the command on the EMPLOYEE table, below I get ' ORA-02266: unique/primary keys in table referenced by foreign keys enabled.

    Drop partition ALTER table EMPLOYEE EMP_ID_100;

    I don't see why I am unable to give up this partition now because it is data child present in any of the referenced tables. Any suggestions or help on this would be greatly appreciated.

    Thank you.

    RGS,
    Rob

    You must first disable foreign key constraints and delete the partition. Deletion of lines or a fall in childs partitions do not work in this case
    as you have the overall dependence:


    SQL > create table scott.t (x int primary key, int y)
    2 partition by (list (y)
    3 values p_1 (1) partition, partition values p_2 (2))
    4.

    Table created.

    SQL > create table scott.t_c (x int references scott.t (x), int y)
    2 partition by (list (y)
    3 values p_1 (1) partition, partition values p_2 (2))
    4.

    Table created.

    SQL > insert into scott.t values (1,1)
    3 N

    1 line of creation.

    SQL > insert into scott.t values (2,2)
    3 N

    1 line of creation.

    SQL > insert into scott.t_c values (1,1)
    3 N

    1 line of creation.

    SQL > insert into scott.t_c values (2,2)
    3 N

    1 line of creation.

    SQL > commit;

    Validation complete.

    SQL > alter table scott.t_c drop partition p_2.

    Modified table.

    SQL > alter table scott.t drop partition p_2.
    ALTER table drop partition p_2 scott.t
    *
    ERROR on line 1:
    ORA-02266: permit to unique/primary keys in table referenced by foreign keys

    SQL > select constraint_name from dba_constraints
    2 where owner = 'SCOTT' and constraint_type = 'P '.
    3 and table_name = 't';

    CONSTRAINT_NAME
    ------------------------------
    SYS_C0011058

    SQL > select constraint_name from dba_constraints
    2 where owner = 'SCOTT' and constraint_type = 'R '.
    3 and r_constraint_name = "SYS_C0011058";

    CONSTRAINT_NAME
    ------------------------------
    SYS_C0011059

    SQL > alter the constraint to disable scott.t_c table SYS_C0011059;

    Modified table.

    SQL > alter table scott.t drop partition p_2.

    Modified table.

    SQL > alter table scott.t_c enable novalidate constraint SYS_C0011059;

    Modified table.

    I guess you should consider options such as partitioning Referencial (with some restrictions).

    Best wishes
    Dmitry.

  • get ORA-01403: when it should not

    Hello, I apologize in advance for my spelling, name (takes 6 hours to change) and the headaches you migth get, however,.
    I bring you the following code and test results:
    -----------------------------------------------------------
    -The procedure that throws the error.
    -----------------------------------------------------------
    create or replace
    procedure P_COLEGAS(x in number) as
    ctipo varchar2(20);
    asd varchar2(20);
    
    cursor curnombre is
    select nombre from unidad,elemento where (elemento.id_elem=unidad.id_elem and unidad.tipo=ctipo and elemento.ciudad=asd);
    
    begin
    select unidad.tipo, elemento.ciudad into ctipo,asd from unidad,elemento where unidad.id_elem=x and elemento.id_elem=x;
    for blah in curnombre loop
    DBMS_OUTPUT.PUT_LINE('nombre unidad: '||blah.nombre||' ');
    end loop;
    end;
    -what i get when executing the procedure-
    Error que empieza en la línea 1 del comando:
    exec p_colegas(19)
    Informe de error:
    ORA-01403: no data found
    ORA-06512: at "BD00.P_COLEGAS", line 9
    ORA-06512: at line 1
    01403. 00000 - "no data found"
    *Cause:
    *Action:
    -----------------------------------------------------------
    -the real problem-
    -----------------------------------------------------------
    in the case of this procedure I had to write
    (1)
    select unidad.tipo into ctipo from unidad where unidad.id_elem=x;
    (2)
    select elemento.ciudad into asd from elemento where elemento.id_elem=x;
    Instead the single query I wrote, we get the following:
    (1) wonderful works, gets only error when there is no match for x.
    (2) throws the error that I was before.

    However when I do the following query in the spreadsheet and run it:
    (3)
    select elemento.ciudad from elemento where elemento.id_elem=x;
    I get what I expect to get 1 row 1 column. (Yes it has data)
    Note: (3) the only difference is that I remove the clause, and x is the same number that I used when I run the procedure.

    -----------------------------------------------------------
    --------------------the question------------------------
    -----------------------------------------------------------
    Why in the procedure, the failure of the (2) query to retrieve the data, the same which data the query (3) doesn't fail to pick up?
    I get ORA-01403, when I shouldn't?
    is there a work around for this problem?

    -----------------------------------------------------------
    --------------------what i try------------------------------
    -----------------------------------------------------------
    Nestled the request with its own handle exception error, get the same results, a few screenshots of the error with a different treatment.

    used tool: sql developer

    ----------
    -Example of data-
    ----------
    tested the procedure with the following sample data in a new workspace, make the same mistake.
    --------------------------------------------------------
    --  DDL for Table ELEMENTO
    --------------------------------------------------------
    
      CREATE TABLE "ELEMENTO" 
       (     "ID_ELEM" NUMBER, 
         "CIUDAD" VARCHAR2(20), 
         "TIPO" CHAR(1), 
         "X" NUMBER, 
         "Y" NUMBER, 
         "FECHAHORA_CREACION" TIMESTAMP (6)
       ) ;
    /
    --------------------------------------------------------
    --  DDL for Table UNIDAD
    --------------------------------------------------------
    
      CREATE TABLE "UNIDAD" 
       (     "ID_ELEM" NUMBER, 
         "PORCENTAJE_SALUD" NUMBER, 
         "NOMBRE" VARCHAR2(20), 
         "TIPO" VARCHAR2(20)
       ) ;
    /
    REM INSERTING into ELEMENTO
    SET DEFINE OFF;
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (12,'Infernalia','U',10,10,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (15,'Infernalia','U',10,7,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (19,'Infernalia','U',15,9,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (23,'Infernalia','U',16,8,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (27,'Infernalia','C',15,10,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (52,'Humania','U',26,10,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (58,'Humania','U',24,9,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (62,'Humania','U',27,11,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (64,'Humania','C',25,8,to_timestamp('22-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (78,'GruntVille','U',47,32,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (84,'GruntVille','U',42,28,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (89,'GruntVille','U',43,29,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (91,'GruntVille','C',44,37,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (29,'Infernalia','C',16,7,to_timestamp('12-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    Insert into ELEMENTO (ID_ELEM,CIUDAD,TIPO,X,Y,FECHAHORA_CREACION) values (90,'GruntVille','U',49,36,to_timestamp('29-NOV-20 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM'));
    REM INSERTING into UNIDAD
    SET DEFINE OFF;
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (12,100,'Grang','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (15,100,'Krout','Médico');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (19,100,'Warf','Obrero');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (23,100,'Puaj','Obrero');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (52,100,'Marcelus','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (58,100,'Claudius','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (62,100,'Arturius','Obrero');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (78,100,'Klaknot','Médico');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (84,100,'Staisht','Médico');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (89,100,'Bjorkson','Soldado');
    Insert into UNIDAD (ID_ELEM,PORCENTAJE_SALUD,NOMBRE,TIPO) values (90,100,'Sknot','Médico');
    --------------------------------------------------------
    --  Constraints for Table ELEMENTO
    --------------------------------------------------------
    
      ALTER TABLE "ELEMENTO" ADD CONSTRAINT "ELEMENTO_CHK1_TIPO" CHECK (TIPO IN ('U', 'C')) ENABLE;
     
      ALTER TABLE "ELEMENTO" ADD CONSTRAINT "ELEMENTO_PK" PRIMARY KEY ("ID_ELEM") ENABLE;
     
      ALTER TABLE "ELEMENTO" MODIFY ("ID_ELEM" NOT NULL ENABLE);
     
      ALTER TABLE "ELEMENTO" MODIFY ("CIUDAD" NOT NULL ENABLE);
     
      ALTER TABLE "ELEMENTO" MODIFY ("TIPO" NOT NULL ENABLE);
     
      ALTER TABLE "ELEMENTO" MODIFY ("X" NOT NULL ENABLE);
     
      ALTER TABLE "ELEMENTO" MODIFY ("Y" NOT NULL ENABLE);
     
      ALTER TABLE "ELEMENTO" MODIFY ("FECHAHORA_CREACION" NOT NULL ENABLE);
    /
    --------------------------------------------------------
    --  Constraints for Table UNIDAD
    --------------------------------------------------------
    
      ALTER TABLE "UNIDAD" MODIFY ("ID_ELEM" NOT NULL ENABLE);
     
      ALTER TABLE "UNIDAD" MODIFY ("PORCENTAJE_SALUD" NOT NULL ENABLE);
     
      ALTER TABLE "UNIDAD" MODIFY ("NOMBRE" NOT NULL ENABLE);
     
      ALTER TABLE "UNIDAD" MODIFY ("TIPO" NOT NULL ENABLE);
     
      ALTER TABLE "UNIDAD" ADD CONSTRAINT "UNIDAD_PK" PRIMARY KEY ("ID_ELEM") ENABLE;
    /
    --------------------------------------------------------
    --  Ref Constraints for Table ELEMENTO
    --------------------------------------------------------
    
    --------------------------------------------------------
    --  Ref Constraints for Table UNIDAD
    --------------------------------------------------------
    
      ALTER TABLE "UNIDAD" ADD CONSTRAINT "UNIDAD_ELEMENTO_FK1" FOREIGN KEY ("ID_ELEM")
           REFERENCES "ELEMENTO" ("ID_ELEM") ENABLE;
     
    /
    Edited by: 975362 04:47 12/06/2012

    Published by: BluShadow on December 6, 2012 12:51
    addition of {noformat}
    {noformat} tags for readability of code/data.  Please read {message:id=9360002} and learn to do this yourself in future.
    
    Edited by: 975362 on 06-12-2012 05:44 AM
    added example data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    This is because you use X as the parameter to the procedure, and X is a column in the table :)

    So use a table alias in the query or use another name for the parameter.

    Published by: ascheffer on December 6, 2012 15:04

  • ORA-39250 - when it provides the TBS guidelines transportable export version parameter.

    Try to expdp/impdp transportable tablespace of source 11.2.0.1.0 - 64-bit RedHat to destination 11.1.0.6.0 - 64-bit RedHat 5.6 5.6.

    Getting ORA-39250 when providing the version parameter:

    expdp userid = "system / *' directory = mon_repertoire transport_tablespaces = some_tbs_to_export = some_tbs_dumpfile.dmp log = some_tbs_dumpfile.log version = 11.1" dumpfile

    Export: Release 11.2.0.1.0

    Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

    Connected to: Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
    With partitioning, OLAP, Data Mining and Real Application Testing options
    ORA-39001: invalid argument value
    ORA-39250: use the version to downgrade a portable work is not supported

    How to export this transportable tablespace to agree to import in the 11.1.0.6.0?

    Connected to: Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
    With partitioning, OLAP, Data Mining and Real Application Testing options
    ORA-39001: invalid argument value
    ORA-39250: use the version to downgrade a portable work is not supported

    How to export this transportable tablespace to agree to import in the 11.1.0.6.0?

    My source also version 11.2.0.1.0.

    11 GR 1 binary material allows to connect to the database of GR 11, 2.

    House of 11 GR 1 matter of export and

    $expdp system/***@11gR2_db = mon_repertoire transport_tablespaces = some_tbs_to_export dumpfile directory = some_tbs_dumpfile.dmp log = some_tbs_dumpfile.log

    See also * compatibility and New features when transporting Tablespaces with export and import [291024.1 ID] *.

    Published by: CKPT on 20 March 2012 21:07

  • When several pages are open, I want to see a thumbnail image of the page hot description

    When several pages are open, I want to see a thumbnail image of the page to warm an edit summary description

    You can get an overview of all the tabs opened using the functionality of the tab groups.

    You can see a miniature of a tab preview when you place your cursor on it using the extension of the scope of the tab.

  • GETVPN and regeneration of the keys when several members of the Group leave at the same time

    He did not specify how the key servers respond when several members of the group start simultaneously. For example, if 3 members leave the same group, made the key manager sends three keys (KEK, TEK) and only the last will be available for future connections? Or the key manager optimizes the regeneration of the keys and sends only a single key?

    Thank you

    Stone,

    On himself, he is not uncertain. You can retrieve the session memory keys (not impossible but difficult).

    I guess what you are looking for is a red button to clear the SAs on all devices?

    In this case:

    http://www.Cisco.com/en/us/docs/iOS-XML/iOS/sec_conn_getvpn/configuration/15-2mt/sec-get-VPN.html#GUID-6267F36C-094F-483F-A1CA-735D39484364

    Specifically "clear members ks gdoi crypto now."

    There is a particular risk that you thought?

    M.

  • ORA-1403 when change the type of file to APEX_APPLICATION_TEMP_FILES browser storage

    Hi all

    I'm new to APEX.  I use APEX 5.0 and try in site APEX Oracle using load data wizard to download the csv file.

    I managed to download data when the browser file storage type is obsolete WWV_FLOW_FILES.

    However, when I change the type of storage of Table APEX_APPLICATION_TEMP_FILES, system will prompt ORA-1403 when I click 'Next' to the Source of data loading page.

    Exception logging: Sqlerrm: ORA-01403: no Backtrace data: ORA-06512: at the "APEX_050000.WWV_FLOW_DATA_UPLOAD", line 564 ORA-06512: to the "APEX_050000.WWV_FLOW_PROCESS_NATIVE", line 975 ORA-06512: at the "APEX_050000.WWV_FLOW_PROCESS_NATIVE", line 1172 ORA-06512: to the 'APEX_050000.WWV_FLOW_PLUGIN', line 2017 ORA-06512: at the "APEX_050000.WWV_FLOW_PROCESS", line 188

    Someone able to guide how to diagnose this problem?

    Thank you, Dorothy

    DorothySG wrote:

    I'm new to APEX.  I use APEX 5.0 and try in site APEX Oracle using load data wizard to download the csv file.

    I managed to download data when the browser file storage type is obsolete WWV_FLOW_FILES.

    However, when I change the type of storage of Table APEX_APPLICATION_TEMP_FILES, system will prompt ORA-1403 when I click 'Next' to the Source of data loading page.

    Exception logging: Sqlerrm: ORA-01403: no Backtrace data: ORA-06512: at the "APEX_050000.WWV_FLOW_DATA_UPLOAD", line 564 ORA-06512: to the "APEX_050000.WWV_FLOW_PROCESS_NATIVE", line 975 ORA-06512: at the "APEX_050000.WWV_FLOW_PROCESS_NATIVE", line 1172 ORA-06512: to the 'APEX_050000.WWV_FLOW_PLUGIN', line 2017 ORA-06512: at the "APEX_050000.WWV_FLOW_PROCESS", line 188

    Someone able to guide how to diagnose this problem?

    It's bug #21478903: error when changing from APEX_APPLICATION_TEMP_FILES to download files

    Use the deprecated option for now.

  • Partitioning of reference - application always accesses all partitions

    I followed the instructions to Oracle Database 11g: new features for developers and DBAS Top | Partitioning on reference partitioning and actually tried this example. If you do not want to read the details of the example here is the SQL code of two tables:

    create table customers

    (

    cust_id key primary number.

    cust_name varchar2 (200),

    side varchar2 (1) not null

    )

    list partition (side)

    (

    values of pA score ("A"),

    pB of partition values ('B')

    );

    create table sales

    (

    sales_id number primary key,

    cust_id number not null,

    sales_amt number,

    constraint fk_sales_01

    foreign key (cust_id)

    customer references

    )

    benchmark score (fk_sales_01);

    I've added a few values:

    Insert into Z_CUSTOMERS (CUST_ID, CUST_NAME, RATING) Values (1, 'John', 'A');

    Insert into Z_CUSTOMERS (CUST_ID, CUST_NAME, RATING) Values (2, 'Ben', 'B');

    Insert into Z_SALES (SALES_ID, CUST_ID, SALES_AMT) Values (10, 1, 200);

    Insert into Z_SALES (SALES_ID, CUST_ID, SALES_AMT) Values (20, 2, 500);

    Insert into Z_SALES (SALES_ID, CUST_ID, SALES_AMT) Values (30, 2, 900);

    Insert into Z_SALES (SALES_ID, CUST_ID, SALES_AMT) Values (40, 2, 250);

    COMMIT;

    Now, my understanding of the reference partitioning power comes from the fact that I run a query such as:

    Select * from z_sales where cust_id in (select cust_id in z_customers where the rating = 'A');

    It must cover a single partition in z_sales and z_customers. However, the execution plan indicates the following:

    Plan

    SELECT STATEMENT ALL_ROWSCost: 6 bytes: 108 cardinality: 2

    6 NESTED LOOPS

    Cost 4 NESTED LOOPS: cardinality of 6 bytes: 108: 2

    2 PARTITION REFERENCES all THE cost: 4 bytes: 156 cardinality: 4 Partition #: 3 Partitions accessed #1-#2

    1 TABLE ACCESS FULL TABLE ARIBA_STAR2. Z_SALES cost: 4 bytes: 156 cardinality: 4 Partition #: 3 Partitions accessed #1-#2

    3 INDEX UNIQUE INDEX (SINGLE) ARIBA_STAR2 SCAN. SYS_C003391336 cost: cardinality 0: 1

    TABLE 5 ACCESS BY INDEX ROWID TABLE ARIBA_STAR2 OVERALL. Z_CUSTOMERS cost: 1 bytes: cardinality 15: 1 Partition #: 6 Partitions accessed #1

    Two partitions in z_sales are presented.

    In fact, I tried this on the application I support (with tables of course) and it seems to have the same problem: all partitions are accessible.

    Any ideas on what I'm doing wrong here?

    Thank you!

    You are not the full story. There is an overall index, according to the execution you plan posted. In any case, works OK for me:

    SQL > select * from v version $;

    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    AMT for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    SQL > explain the plan for
    2 Select * from sales where cust_id in (select cust_id from customers where the rating = 'A')
    3.

    He explained.

    SQL > select * from table (dbms_xplan.display);

    PLAN_TABLE_OUTPUT
    ---------------------------------------------------------------------------------------------------------
    Hash value of plan: 864604532

    ---------------------------------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |
    ---------------------------------------------------------------------------------------------------
    |  0 | SELECT STATEMENT |           |    2.   108.    5 (0) | 00:00:01 |       |       |
    |  1.  SIMPLE LIST OF PARTITION.           |    2.   108.    5 (0) | 00:00:01 |     1.     1.
    |  2.  NESTED LOOPS |           |    2.   108.    5 (0) | 00:00:01 |       |       |
    |  3.    TABLE ACCESS FULL | CUSTOMERS |    1.    15.    3 (0) | 00:00:01 |     1.     1.
    |*  4 |    TABLE ACCESS FULL | SALES |    2.    78.    2 (0) | 00:00:01 |     1.     1.
    ---------------------------------------------------------------------------------------------------

    PLAN_TABLE_OUTPUT
    ---------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):
    ---------------------------------------------------

    4 - filter ("CUST_ID" ="CUST_ID")

    Note
    -----
    -dynamic sample used for this survey (level = 2)

    20 selected lines.

    SQL >

    SY.

  • Is it possible to download a file google html to reference his website when your host his businesscatalist

    Is it possible to download a file google html to reference his website when your host his businesscatalist and the site build with muse

    Please refer to a similar debate here:

    https://forums.Adobe.com/message/5940490

    Thank you

    Sanjit

  • URGENT, URGENT - "APP-FND-01926, WHEN-LOGON-CHANGED, ORA-06508" when trying

    Hi all;

    When I try to open forms I have this error:

    "APP-FND-01926, WHEN-LOGON-CHANGED, ORA-06508" when trying to connect.

    Anyone have idea?

    Thank you

    Double wire...

    URGENT, URGENT - "APP-FND-01926, WHEN-LOGON-CHANGED, ORA-06508" when trying
    URGENT, URGENT - "APP-FND-01926, WHEN-LOGON-CHANGED, ORA-06508" when trying

  • Drop partition without disabling the foreign key

    Hi all

    I have a table parent and child.

    Parent table

    create the table parent_1
    (identification number,
    create_date date,
    Constraint parent_1_pk001 PRIMARY KEY (id))
    PARTITION OF RANGE (create_date)
    INTERVAL (NUMTODSINTERVAL(1,'DAY'))
    (PARTITION parent_1_part VALUES LESS THAN (January 1, 2010 '));

    Child table
    create the table child_1
    (identification number,
    create_date date,
    Constraint child_1_fk001 FOREIGN KEY (id)
    REFERENCES parent_1 (id))
    PARTITION OF RANGE (create_date)
    INTERVAL (NUMTODSINTERVAL(1,'DAY'))
    (PARTITION create_date_part VALUES LESS THAN (January 1, 2010 '));


    I have problems to delete partition.
    Parent_1
    1 JULY 26, 12
    2 JULY 26, 12

    Child_1
    1 JULY 26, 12

    ALTER drop partition table CHILD_1 SYS_P274;
    table altered CHILD_1.

    ON THE PARENT PARTITION A FALL
    ALTER drop partition table parent_1 SYS_P273;

    Error report:
    SQL error: ORA-02266: unique/primary keys in table referenced by foreign keys enabled
    02266 00000 - "unique/primary keys in table referenced by foreign keys enabled.
    * Cause: An attempt was made to truncate a single table or
    primary keys referenced by foreign keys in another table.
    Other unauthorized trades are a drop/truncate partition a
    partitioned table or an ALTER TABLE EXCHANGE PARTITION.
    * Action: Before performing the operations described above, the table, disable the
    constraints foreign key in other tables. You can see what
    constraints are making reference to a table by issuing the following
    command:
    SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME = 'tabnam ';


    PLEASE KNOW IF THERE IS A WAY TO THE PARENT PARTITION DROP WITHOUT TOGGLE FOREIGN CONSTRAINTS


    Thank you
    SQL Error: ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    02266. 00000 - "unique/primary keys in table referenced by enabled foreign keys"
    *Cause: An attempt was made to truncate a table with unique or
    primary keys referenced by foreign keys enabled in another table.
    Other operations not allowed are dropping/truncating a partition of a
    partitioned table or an ALTER TABLE EXCHANGE PARTITION.
    *Action: Before performing the above operations the table, disable the
    foreign key constraints in other tables. 
    

    You can do until you disable the foreign key constraint

    http://jonathanlewis.WordPress.com/2006/12/10/drop-parent-partition/

    Hope this helps

    Mohamed Houri
    www.hourim.WordPress.com

  • 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.

Maybe you are looking for

  • 6 envy: envy defective hinges

    I bought a portable Envy Touch 15 months ago (3 months warranty) the hinge is defective and cracks and splits from the bottom panel whenever I open the screen. I've already sent it to repair a few months after I bought it. But then it breaks again...

  • Why my program crashes on Agilent E8361A NWA?

    I try to run the software Labview 8.5.1, but when I send some commands to the Agilent E8361A Network Analyzer.  GPIB data not synchronize properly, how to understand where is the problem?

  • Cannot open hidden flles dxb & wab

    I received a response to my question, but I can not always open hidden files. Robert Clarkxt

  • Windows Update loop on my Windows Vista computer on HP G70 laptop.

    For the past month, every time windows update trys to start, my computer becomes real slow.  I check the Task Manager and find that 50% of the processor of my PC is busy.   By trail and error, I've always found that the task WUPFSVC works always at t

  • Not on the incorrect user name or password error message no match.

    Can start with no problem but on my desk is an error box indicating... username and password do not match... you used...Have found nothing so far is not working do not, but it's annoying to see this, whenever I connect...I would like to attach the sc