Large partition table with the primary key referenced by several child tables

I tested this procedure and it works perfectly. Although when children tables refer to the key column, after execution of dbms_redefinition.finish_redef_table they all are referring to table exercised. In test I deal forced FK droped on tables children and recreated them. What could be the best way to do this in this scenario?

Thanks for all comments/opinions!

Are you sure? You should end up with the original FK constraint (disabled and renamed to have a prefix of $$ TMP) pointing to the staging table (which is of course the famous original table), and allowed a new constraint with the correct name, pointing to the new version of the table. so all you need to do to bring order to the top is to remove the constraint of renamed.

This running-in of the SCOTT schema clearly indicates:

create the table deptint in select * from dept where 1 = 2;

exec dbms_redefinition.start_redef_table (user, 'dept', 'deptint')

n number of var

exec dbms_redefinition.copy_table_dependents (user, "dept', 'deptint', DBMS_REDEFINITION.") CONS_ORIG_PARAMS, TRUE, TRUE, TRUE, TRUE,: n)

Print n

exec dbms_redefinition.finish_redef_table (user, 'dept', 'deptint')

Select CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME, user_constraints STATE;

Tags: Database

Similar Questions

  • Problems with the primary key of the query string

    Moving from asp to php, to work with David Power's book: The Essential Guide to Dreamweaver CS4 with CSS, AJAX, and PHP.  Recycling of my brain, so starting from scratch in the learning process.

    Everything was going perfectly until I tried to add the primary key of a record in a query string.  I compared my code with the example code for the book, and everything matches.  When previewing the page in my browser and hover over the link which must pass the main code on the next page, the query string does not appear correctly.  It shows user_id = but no figure shows, as it is supposed to.  www.webpage.com/update_user.php?user_id=

    Here is my code: (Please note, <>have been removed, as I was unable to find a way view the code in the correct way here (copy/paste was doesn't work do not, nor insert syntax))

    ? PHP {?}

    ? PHP echo $row_listUser ['family_name'];? PHP echo $row_listUser ["FirstName"];?

    ? PHP echo $row_listUser ['username'];?       ? PHP echo $row_listUser ["admin_priv"];?

    a href = "update_user.php? user_id =? php echo $row_listUser ['user_id'];?" "Edit / has

    a href = "delete_user.php? user_id =? php echo $row_listUser ['user_id'];?" ' Delete / has

    ? PHP} while ($row_listUser = mysql_fetch_assoc ($listUser));?

    Any ideas that could help me understand why this part does not in particular would be greatly appreciated.  Writing to the database worked perfectly, I see that there are numbers in the database as user_id, and it is defined as my primary key in the configuration database.  Such a simple process that is causing me headaches!

    Thank you

    You have the code to request a copy in your folder:

    $query_listUser = 'SELECT user_id, username, first_name, family_name, admin_priv from users ORDER BY family_name ASC';

    $listUser = mysql_query ($query_listUser, $connSCFDIR) or die (mysql_error ());

    $row_listUser = mysql_fetch_assoc ($listUser);

    $totalRows_listUser = mysql_num_rows ($listUser);

    $query_listUser = 'SELECT username, first_name, family_name, admin_priv from users ORDER BY family_name ASC';

    $listUser = mysql_query ($query_listUser, $connSCFDIR) or die (mysql_error ());

    $row_listUser = mysql_fetch_assoc ($listUser);

    The $listUser table will contain the results of the second query, which does not include the field user_id. delete the redundant code.

  • Problem with the primary key and indexes

    Hi all

    I'm looking a mess on one of our main tables.
    One of the developers here added an index on 3 columns in the table, thinking that it would speed up (not noticing that it had not a PK).

    Subsequently another developer has noticed there do not have a primary on key. So they added a touch of primry on the single column.

    The problem is that now the index created on 3 columns is bein used as the primary key index. As when the primary key is created a new index was not created.

    Is there anyway to get rid of this index/change it correct?

    This table is related to many many other tables, so when we tried to remove the index we could not due to the primary key and foreign key violations with other tables.

    Thanks in advance

    Oracle, as you found, is quite capable to use a column enformce multi index a single column primary key, as long as the pk column is the leader in the index. This should not cause performance issues for a search of PK and if the three indexed columns are often selected only may benefit from these types of queries.

    The only way to change that now, would be to drop all CF, drop and add the PK constraint and then add all the FK constraints. A long time and potentially dangerous (if you miss to add back of the FKs) endeavour. Certainly not worth the risk in my opinion.

    John

  • Problem with the primary key

    Hi all
    I have a table with the same data repeat 2 times. I mean that the lines are depating twice. so now, I create a primary key for the table. He throws me an error saying voilation key primary. I'll give you the clear script.

    create table employee)
    ID VARCHAR2 (4 BYTE) NOT NULL,
    First name VARCHAR2 (10 BYTE),
    VARCHAR2 (10 BYTE) last_name,
    START_DATE DATE,
    End_date DATE,
    Number (8.2) of salary.
    City VARCHAR2 (10 BYTE),
    Description VARCHAR2 (15 BYTE)
    )


    insert into employee values ('01', 'Jason', 'Martin', to_date('19960725','YYYYMMDD'), to_date('20060725','YYYYMMDD'), 1234.56, 'Toronto', 'Program');
    insert into employee values ('02', "Alison", "Mathews', to_date('19760321','YYYYMMDD'), to_date('19860221','YYYYMMDD'), 6661.78, 'Vancouver', 'Tester');
    insert into employee values ('03', 'James', 'Smith', to_date('19781212','YYYYMMDD'), to_date('19900315','YYYYMMDD'), 6544.78, 'Vancouver', 'Tester');
    insert into employee values ('04', 'Celia', 'Rice', to_date('19821024','YYYYMMDD'), to_date('19990421','YYYYMMDD'), 2344.78, "Vancouver", "Manager");
    insert into employee values ('05', 'Robert', 'Black', to_date('19840115','YYYYMMDD'), to_date('19980808','YYYYMMDD'), 2334.78, 'Vancouver', 'Tester');
    insert into employee values ('07', 'David', 'Larry', to_date('19901231','YYYYMMDD'), to_date('19980212','YYYYMMDD'), 7897.78, 'New York', 'Manager');
    insert into employee values ('06', 'Linda', 'Green', to_date('19870730','YYYYMMDD'), to_date('19960104','YYYYMMDD'), 4322.78, 'New York', 'Tester');
    insert into employee values ('08', 'James', 'Cat', to_date('19960917','YYYYMMDD'), to_date('20020415','YYYYMMDD'), 1232.78, 'Vancouver', 'Tester')
    insert into employee values ('07', 'David', 'Larry', to_date('19901231','YYYYMMDD'), to_date('19980212','YYYYMMDD'), 7897.78, 'New York', 'Manager');
    insert into employee values ('06', 'Linda', 'Green', to_date('19870730','YYYYMMDD'), to_date('19960104','YYYYMMDD'), 4322.78, 'New York', 'Tester');


    The table is now with 10 columns

    ID FIRST_NAME LAST_NAME START_DAT END_DATE SALARY CITY DESCRIPTION
    ---- ---------- ---------- --------- --------- ---------- ---------- ---------------
    Jason Martin 25 July 96 01 25 July 06 1234.56 Toronto programmer
    02 Alison Mathews 21 March 76 February 21, 86 6661.78 Vancouver Tester
    03 James Smith December 12, 78 March 15, 90 6544.78 Vancouver Tester
    04 Celia rice 24 October 82 21 April 99 2344.78 Vancouver Manager
    Robert Black 05 January 15, 84 8 August 98 2334.78 Vancouver Tester
    Linda Green 06 July 30, 87 January 4, 96 4322.78 tester of New York
    Manager of New York 07 David Larry 31 December 90 February 12, 98 7897.78
    08 James Cat 17-AUG-96 April 15 02 1232.78 ester of Vancouver


    Create a primary key for the table

    "Employee to ALTER TABLE PRIMARY KEY (ID, First_Name, Last_Name, start_date, end_date,
    Salary, city, Description); »

    I get error voilation primary key

    IS IT POSSIBLE TO CREATE THE KEY PRIMARY ON THE TABLE WITH ON THE DELETION OF THE DATA?
    Is IT POSSIBLE CREATING PRIMARY KEY USING 'GROUP BY' FUNCTION or OTHER FUNCTIONS?

    Published by: user11872870 on September 23, 2010 17:41

    Primary key columns cannot contain NULL values. If you tried to create a primary key constraint, you will get an error like this:

    ERROR at line 1:
    ORA-01449: column contains NULL values: cannot alter to NOT NULL
    

    However, you can add a unique constraint by doing something like the following:

    ALTER TABLE test ADD CONSTRAINT test_unq UNIQUE (column1, column2);
    

    I still wonder why you take the approach you take. I have a vague feeling that're missing us the key pieces of information to recommend the correct solution.

  • Reinstall windows on the larger hard drive with the product key, but not drive. PC was custom and retailer out of business.

    It is my mother's computer.  She is 90 and is unwilling to learn a new OS.  I want to reinstall XP on a hard disk that has 300 GB and is already installed in the E drive.  His original hard drive is 40 GB and 35 are in use.  I have the original Windows product key but not the windows CD.  the retailer who has built and sold this pc is out of business.  What is the best way to achieve this?

    You can borrow a retail XP CD from a friend of yours and activate it using your product key.

    Just make sure that if your key is for home then get XP Home etc.

  • validate the primary key

    If the user enters two combination should trigger the error

    For example I testcode table with the primary key is combination of code1, code2, if use enter the same value for both two code I have to raise error am in jdeveloper 11.1.1.7.0

    see this

    Zeeshan Baig blog: define the constraints of unique keys for Non-primary key attributes ADF-British Colombia

    http://www.gabrielsideras.com/2010/09/28/ADF-unique-key-validation/

    http://www.databaseskill.com/1654786/

  • Add the primary key in edit control

    I have an existing table with the primary key. It is created by the following command...

    CREATE TABLE CUST_MSTR)
    CUST_NO VARCHAR2 (10) PRIMARY KEY,.
    FNAME VARCHAR2 (25).
    MNAME VARCHAR2 (25).
    LNAME VARCHAR2 (25).
    DATE OF DOB_INC,
    VARCHAR2 (25) BUSY.
    PHOTO VARCHAR2 (25).
    VARCHAR2 (25) SIGNATURE.
    PANCOPY VARCHAR2 (1).
    FORM60 VARCHAR2 (1)
    );


    Now, I changed the design. My primary key is composed of CUST_NO and FORM60. I want to change the table using alter command.

    How can I do this using the ALTER command?

    I tried the following, but it does not work


    SQL > ALTER TABLE CUST_MSTR
    2 DROP PRIMARY KEY;

    Modified table.

    SQL > DESC CUST_MSTR
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    CUST_NO VARCHAR2 (10)
    FNAME VARCHAR2 (25)
    MNAME VARCHAR2 (25)
    LNAME VARCHAR2 (25)
    DATE OF DOB_INC
    VARCHAR2 (25) BUSY
    PHOTO VARCHAR2 (25)
    SIGNATURE VARCHAR2 (25)
    PANCOPY VARCHAR2 (1)
    FORM60 VARCHAR2 (1)

    SQL > ALTER TABLE CUST_MSTR
    2 ADD PRIMARY KEY (FORMULA 60, CUST_NO);
    ADD A PRIMARY KEY (FORMULA 60, CUST_NO)
    *
    ERROR on line 2:
    ORA-00907: lack of right parenthesis

    You can add any number of constraints, but there can be only one primary key.

  • See the primary key

    I have a form on a report and the primary key is not visible. In its place in the column is the button change. How do we guarantee that the primary key is visible as well as change the button?

    jclarke,

    There are two ways to do it. If you hold the button change then the best thing to do is to remove the 'link' information associated with the primary key column (remember / note the details for the next step) so that it displays normally.

    Then go to the page report attributes and in the menu on the right tasks, select 'add column link '. Configure it as the column ID is.

    Kind regards
    Dan

    http://danielmcghan.us
    http://sourceforge.NET/projects/tapigen
    http://sourceforge.NET/projects/plrecur

    You can reward this answer by marking as being useful or correct ;-)

  • Need to create a new line in the table with the same data as the primary key, but new PK

    Hello gurus,

    I have a table with a column as a primary key, I need to create a new row in the table, but with the same data in one of the lines, but with different primary keys, focus a double row with key primary diferent...

    Any ideas of how it can be done without much complication?

    Thanks in advance for your answer.

    Agress,
    Karim idrissi

    user9970447 wrote:
    Hello gurus,

    I have a table with a column as a primary key, I need to create a new row in the table, but with the same data in one of the lines, but with different primary keys, focus a double row with key primary diferent...

    Any ideas of how it can be done without much complication?

    Thanks in advance for your answer.

    Agress,
    Karim idrissi

    something like

    insert into mytable values ('literal for new pk',
                                           select non-pk-1,
                                                    non-pk-2,
                                                    non-pk-n
                                           from mytable
                                           where pk-col = 'literal for existing pk')
    
  • Another user changed the row with a primary key oracle.jbo.Key]

    I see many discussions about this error, but still cannot understand the difficulty that I need in my scenario.

    I am an Oracle Developer and completely new to ADF, please bear with me.

    I use JDeveloper 11.1.1.9.0

    My scenario:

    Creates an object editable view (UVO) with sub selects in the query, which is from several db tables.

    Creating a table using the UVO

    When I try to update a field in the table, and then click the validate, I get the error message:

    Another user changed the row with a primary key oracle.jbo.Key]

    Can someone explain in what scenarios I see this error and how do I solve this problem?

    Try the viewObject execution after validation and reQueryOnCommit set to true

    For details see - binary: a reason more for "Houston-25014: another user has modified the line containing oracle.jbo.Key primary key '

    Ashish

  • Comparison of the data of several rows in a table - based on the primary key

    Currently I have a select statement that returns hundreds of records.  Each returned record is linked to A NUMBER of ORDER this order number has a recipe.  (a bit like a cooking recipe).  Each recipe has many records in the database related to this order number and records should be compared to records in a table that bind to a specific primary key...  (I have already developed the logic to isolate what PK I need).  If all these records that are returned by the select statement below does not match all the records containing PK in the table below, I need to get the next PK and compare all these recordings for select statements return.

    See below for a better understanding. Need a good example detailed on how to solve my problem here.

    Just to help you understand:

    Each element of the recipe is 3 parts (side, ref_des, part_number).  1 single recipe can have several parts (where the part_number), and each of these pieces should be placed on the lower side or top of the Board that is there "side" comes into play.  Same thing with Ref_Des.

    What is going on

    Select statement returns the RECIPE of ORDER NUMBER A.  There will be multiple records returned by this query.

    Select the Return statement:

    • Side
    • Ref_Des
    • Part_Number

    Example of return:

    B c17 75145-2

    T f14 89242-8

    B s12 45123-3

    etc,

    In general - what I need to do:

    There is a table called AUTO_RECIPE_DETAILS.  I take all of the records returned by the select query above and compare for each record in this table relating to the recipe 30319-000001.  30319-000001 a number of records.  It is the primary key for a whole recipe as seen above.  This primary key is bound the number of data records in this table.  The comparison is to see if all records under RECIPE_NAME 30319 -000001 match all the records returned by the select statement.

    IF IT DOES NOT MATCH: recover the following recipe in this table below 30319 -000002 and make the same comparison.

    Here's a perfect example of what the table looks like: (AUTO_RECIPE_DETAILS)


    RECIPE_NAME SIDE REF_DES PART_NUM

    -30319-000001 C16 87595-1 B

    -30319-000002           T B14 74150-4

    -30319-000001 T B14 34251-2          

    -30319-000001            T F24 84180-7

    -30319-000002 T B12 13710-8          



    It is the solution to my original question.  By this thread, it's the right answer and I hope this helps someone who is trying to compare two arrays element-by-element.  In the end, the advice given in this thread were correct and I will be using all of your suggestions and the scrapping of this.  Thank you everyone for your help though.

    FOR index_p IN pid_recipe. FIRST... pid_recipe. LAST

    LOOP

    Result WHEN the OUTPUT = 1;

    FOR index_d IN details_recipe. FIRST... details_recipe. LAST

    LOOP

    IF (pid_recipe (index_p). SIDE = details_recipe (index_d). SIDE)

    AND (pid_recipe (index_p). REF_DES = details_recipe (index_d). REF_DES)

    AND (pid_recipe (index_p). PART_NUM = details_recipe (index_d). PART_NUM)

    THEN

    EXIT;

    ON THE OTHER

    DBMS_OUTPUT. Put_line("IT WAS NOT a MATCH");

    result: = 1;

    EXIT;

    END IF;

    END LOOP;

    END LOOP;

    DBMS_OUTPUT. Put_line('LOOP OUT');

  • need to based on the primary key of different table 2 foreign key constraint

    I'm using Oracle 11.2.0.3.

    I have 2 table invl with invl_pk as primary key and org with org_pk as the primary key.

    In the third table entity_list, I have entity_pk that can be indvl_pk or org_pk.   How can I create this constraint?

    Thanks for your time.

    Hello

    Assuming that your model is correct, then what you describe is a normal type of ER modeling construction known as a relationship of the CRA. It is characterized by an entity with two or more links that are mutually exclusive to each other (XOR). A typical example may be where a person entity and an entity of the Organization relate both to a bank account entity, but a bank account can only be used by a person or an organization in a mutually exclusive way. In order to serve this on a diagram, an arc is drawn between effective relationships on the side of the child, where the name of a relationship of the CRA.

    Google will be of multiple examples and explanations.

    In a perspective of physical databases, this can be implemented in general in two different ways.

    1. assuming that all parents in the relationship of the CRA have identical PK, that is to say, a number that is generated, the child may have a FK of the same type and an entity of type column that defines what entity the FK is. The advantage of this is that it is a bit more compact and is expandable without schema changes if you want to add more relationships. The downside of this is that the CF cannot be defined at the database level and will build on the code to be executed or both in the application and the database as a trigger.

    2. regardless of types PK for parent entities, the child has a separate optional FK appropriate for each relationship in the arc. Each FK is defined at the database level while maintaining the exclusivity of relationships, a constraint is defined on the table that prevents several FK being filled for a given instance. This can be a little messier that there must be a (column/s) FK for each relationship in the arc, but the relationship may be limited to the level of the object database with the help of FK constraints and a check constraint. This could also be considered to be more technically correct implementation.

    Hope this helps

    André

  • modifies an existing large partitioned table to automatically add the partitions

    Hello world

    According to me, it is not possible to modify an existing large partitioned table, to add partitions automatically as you insert it into this one. What would be the best way to do this? Dbms_redefinition? DEC + copy dependant rename?

    Any ideas?

    Thank you.

    current version:
    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
    With partitioning, Real Application Clusters, Automatic Storage Management, OLAP,.
    Options of Data Mining and Real Application Testing

    >
    According to me, it is not possible to modify an existing large partitioned table, to add partitions automatically as you insert it into this one. What would be the best way to do this? Dbms_redefinition? DEC + copy dependant rename?

    Any ideas?
    . . .
    I guess what I'm looking for is
    ALTER TABLE XXX INTERVAL DEFINED (NUMTOYMINTERVAL(1,'MONTH'));

    The following problem, I see is my required interval varies 01 hours of daylight at the time month 01 day 01 01 of the following month.
    >
    The best way to do it is to change your way of thinking.

    Do not be afraid to break the Oracle actually trying things. Just ALTER the table.

    drop table part_test cascade constraints;
    
    create table part_test(id number, entry_date date)
    partition by range (entry_date)
    (
    partition old_years values less than (to_date('01/01/2013 01:00:00', 'mm/dd/yyyy hh24:mi:ss')),
    partition jan_2013 values less than (to_date('02/01/2013 01:00:00', 'mm/dd/yyyy hh24:mi:ss'))
    )
    
    insert into part_test values(1, to_date('01/01/2013 00:00:00', 'mm/dd/yyyy hh24:mi:ss'));
    
    insert into part_test values(2, to_date('01/01/2013 02:00:00', 'mm/dd/yyyy hh24:mi:ss'));
    
    alter table part_test set interval(numtoyminterval(1,'MONTH')); 
    
    insert into part_test values(2, to_date('02/01/2013 02:00:00', 'mm/dd/yyyy hh24:mi:ss'));
    
    SQL> set serveroutput on
    SQL> select partition_name, high_value
      2  from dba_tab_partitions
      3  where table_name = 'PART_TEST';
    
    PARTITION_NAME
    ------------------------------
    HIGH_VALUE
    --------------------------------------------------------------------------------
    
    OLD_YEARS
    TO_DATE(' 2013-01-01 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
    
    JAN_2013
    TO_DATE(' 2013-02-01 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
    
    SYS_P225
    TO_DATE(' 2013-03-01 01:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
    
    SQL>
    

    Note the limit of the score for SYS_P225 that was created? It includes the same ' time 1' of the highest range partition that existed before the ALTAR.

  • exp/imp with sequential primary key table.

    Hello

    I have a general question about EXP/IMP a table with primary key sequence. I need exp rows in this table of 11g DB and their imp to 9i DB. This table is the same on 11g and 9i. Table 11g is updated daily. I want to import lines which are the only new records to 9i to expedite the process. As this main table of the key is sequential, I intend to export with where table_key > N, N is the max of last importing table_key and then proceed to import on this dump file. Don't you see any problem doing it this way?
    Your expertise is greatly appreciated!

    Hello

    I have no problem at all.
    If you do not forget to use the 9i export tool, then you should be OK
    Also a full table export and import with ignore = Yes will ignore the records that violate the primary key and import only new records.
    However, it is not a very clean way to do it.

    Success!
    FJFranken

  • dynamically find the primary key of a table

    Hello

    How can I see (dynamically) participating in a primary key table columns?

    Let's imagine that we have a procedure receives the name of the table as a parameter:
    PROCEDURE delete_record (table_name IN VARCHAR2)
    The procedure is to delete a record in the table 'table_name '.
    -- g_record is a global variable containing the values of the record that should be deleted.
    l_sql_statement := 'DELETE FROM ' || table_name || ' WHERE ' || primarykey_col_1 || '=' || g_record.col_1;
    
    EXECUTE IMMEDIATE l_sql_statement;
    So, how do I see the columns that make up the primary key, perhaps, somehow the using the description of the table?

    Thank you!

    You can use the ALL_CONSTRAINTS in combination with views ALL_CONS_COLUMNS to retrieve this information (there are also views DBA_ and USER_ as well). Here is a sample of SQL that you could use:

    SELECT  COLUMN_NAME
    FROM    ALL_CONSTRAINTS         AC
    JOIN    ALL_CONS_COLUMNS        ACC     ON ACC.TABLE_NAME       = AC.TABLE_NAME
                                           AND ACC.CONSTRAINT_NAME  = ACC.CONSTRAINT_NAME
    WHERE   CONSTRAINT_TYPE = 'P'
    AND     ACC.TABLE_NAME  = table_name
    

    I wonder however this method because it seems unorthodox. Could you provide a reason for this kind of implementation?

Maybe you are looking for

  • New phone

    We just upgraded my son of 5 Apple to a 6 Apple and the clerk at Verizon was not able to transfer photos and contacts to the new phone. He worked on his previous upgrades. How can we find all his info?

  • "Remember passwords" no longer works

    Tools | Opts | S | Remember password is checked.Tools | Opts | S | Saved passwords appear old info password (password that had bee changed for a long time).Nothing in privacy is set to clear the passwords...

  • visa usb communication in bulk - several end points

    Hi all I'll put up a spectrometer optics USB2000 + ocean and want to use visa instead of the dll that I had with the spectrometer (I had a lot of stability problems, moreover, this is not supported by the ocean optics and I won't have to pay for the

  • MSN Money portfolio investments Total

    How can I change the value of '0 '?

  • is there a remote desktop when you are connected to Windows Storage Server GUI

    original title: GUI of Windows Storage Server My apologies if this is a silly question. -What is the interface provided through office remotely when you connect to Windows Storage Server 2008 the typical Windows GUI? Thank you!