Add a column to a large table

I have a big table with lots of data.
Users of this table in real-time, it's Production environment, users must not be disconnected from the database, table, Production environment is expected to remain working, the installation of the new column must be silent and without impact on the whole of the system somehow.
I need to edit/change the table by adding a column.
What bad could happen if I run this alter statement?
It may lock all rows in the table for a long time and the users will make mistakes?

Published by: CharlesRoos on August 12, 2010 22:52

That's why professional organizations have maintenance windows.

What's going to happen
ALTER table requires an exclusive lock on the object in the datadictionary.
If the table is accessed you will not get this lock.

If you get this lock, no one can access the table.

-------------
Sybrand Bakker
Senior Oracle DBA

Tags: Database

Similar Questions

  • How to add the column to the compressed table

    Hi gurus,

    Can someone help me how to add a column to compressed tables


    Thanks in advance

    The only difference is if added column has a default value. In this case:

    SQL> create table tbl(id number,val varchar2(10))
      2  /
    
    Table created.
    
    SQL> insert into tbl
      2  select level,lpad('X',10,'X')
      3  from dual
      4  connect by level <= 100000
      5  /
    
    100000 rows created.
    
    SQL> select bytes
      2  from user_segments
      3  where segment_name = 'TBL'
      4  /
    
         BYTES
    ----------
       3145728
    
    SQL> alter table tbl move compress
      2  /
    
    Table altered.
    
    SQL> select bytes
      2  from user_segments
      3  where segment_name = 'TBL'
      4  /
    
         BYTES
    ----------
       2097152
    
    SQL> alter table tbl add name varchar2(5) default 'NONE'
      2  /
    alter table tbl add name varchar2(5) default 'NONE'
                        *
    ERROR at line 1:
    ORA-39726: unsupported add/drop column operation on compressed tables
    
    SQL> alter table tbl add name varchar2(5)
      2  /
    
    Table altered.
    
    SQL> update tbl set name = 'NONE'
      2  /
    
    100000 rows updated.
    
    SQL> commit
      2  /
    
    Commit complete.
    
    SQL> select bytes
      2  from user_segments
      3  where segment_name = 'TBL'
      4  /
    
         BYTES
    ----------
       7340032
    
    SQL> select compression from user_tables where table_name = 'TBL'
      2  /
    
    COMPRESS
    --------
    ENABLED
    
    SQL> alter table tbl move compress
      2  /
    
    Table altered.
    
    SQL> select bytes
      2  from user_segments
      3  where segment_name = 'TBL'
      4  /
    
         BYTES
    ----------
       2097152
    
    SQL> 
    

    SY.

  • I can add a column to an existing table with the data.

    Hello

    I'm working on
    The Version of database: Oracle 9i

    I can add a column to an existing table that already has data with below given command.

    ALTER TABLE table_name
    ADD the definition of the column_name column;

    Kind regards
    John

    Add to that:

    If your new column is NOT "null", you need the task in 3 steps:

    1. Add the column without a NOT NULL constraint
    2. the default value of the new column added.
    3. Add the NOT NULL constraint in the new column.

    concerning
    AJ

  • Resize the VARCHAR2 column on a large table

    Hello

    I need to resize a column VARCHAR2 with a large table (several hundred million lines).
    The column will be reduced from VARCHAR2 (40) to VARCHAR2 (50).
    Please check if someone has idea, will be this column resizing take a lot of time or a lot of resources that the table is highly accessible.
    Thank you.

    Kind regards
    Tarman.

    This should be an update of the dictionary: so it should very quickly because the existing data will not be changed.

    See http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:1542606219593 #1956714100346356542.

  • Oracle BPM 12.2.1 workspace how to add additional columns to the DB table tasklist

    Hi all

    I need to add some required columns to the table from the list of tasks (for example, activity and status of the activity referred to in the task line), I decompiled adflibTaskListTaskflow.jar and found a class named TaskModel.class in this package: oracle.bpel.worklistapp.tasklist.beans.model, if decompile you this class, you can see that at the table from the list of tasks, data are expressed here by using ITaskQueryService now how more columns may add other tables or is there another easier solution?

    Hi Hadi,

    You can add columns to your table of task list in the workspace by changing the current view, or even create a new (more and icons in pencil). The situation of activity is available in the list of columns.

    You can also add columns to the list view based on flexfields tasks that you create.

    If you manually change the adflibTaskListTaskflow.jar you can have problems in the future given that libraries can change between versions and of course are not recommended to do.

    I have add columns to the list of tasks, and at that time here, we have created a list of custom task based on BPM Middleware. If you follow this method, you will have complete freedom to show what you want.

  • Add the column to an existing table-based user-defined type

    Hello guys,.
    I am compiling my function that returns a type defined by the user based on an existing table. Throughout the process of initialization so my query returns an additional column - SCORE (1). Here is my package:

    create or replace
    PACKAGE STAFF_AGENCY_PKG AS

    TYPE TYPE_SEEKER_TABLE IS TABLE OF THE DRAW. SEEKER % ROWTYPE;
    FUNCTION GET_SEEKERS (IN_KEYWORD IN VARCHAR2)
    TYPE_SEEKER_TABLE RETURN PIPELINE;

    END STAFF_AGENCY_PKG;
    -------

    create or replace
    STAFF_AGENCY_PKG PACKAGE BODY
    AS

    FUNCTION GET_SEEKERS (IN_KEYWORD IN VARCHAR2)
    TYPE_SEEKER_TABLE RETURN PIPELINE
    IS
    R_TBL TYPE_SEEKER_TABLE; -to return
    BEGIN
    FOR R IN)
    SELECT Seeker.SEEKER_ID,
    Seeker.FIRSTNAME,
    Seeker.LASTNAME,
    Seeker.NATIONALITY,
    Seeker.ISELIGIBLE,
    Seeker.BIRTHDATE,
    Seeker.ISRECIEVEEMAILS,
    Seeker.HIGHESTDEGREE,
    Seeker.ETHNICITY,
    Seeker.GENDER,
    Seeker.ISDISABILITY,
    Seeker.DISABILITY,
    Seeker.CV,
    Seeker.PASSWORD,
    Seeker.PREFFERED_CITY,
    SEEKER. E-mail
    SEEKER. JOB_PREFERENCES_ID,
    SCORE (1)
    THE APPLICANT Seeker
    WHERE CONTAINS (CV, ' < query >)
    < textquery lang 'grammar' = 'context' = > ' |
    GET_RELATED_CATEGORIES (IN_KEYWORD) |
    ' < / textquery >
    < score datatype = "INTEGER" / >
    (< / query > ', 1) > 0
    )
    LOOP
    PIPE ROW (R); -Error (38,10): PLS-00382: expression is of the wrong type
    END LOOP;
    RETURN;

    END GET_SEEKERS;
    END STAFF_AGENCY_PKG;

    How do I change my user type to be sufficient?

    Oracle version 11.2.0.1.0
    Thanks in advance!

    >
    How do I change my user type to be sufficient?
    >
    You will need to create two new TYPEs. The one who has all the columns of the draw. The REQUESTOR table and the new column SCORE, then a TYPE which is an array of the first type.

    See example 12-22 using a Pipelined Table function for a Transformation in the PL/SQl language reference

    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/tuning.htm#i53120

    Here's the first part

    -- Define the ref cursor types and function
    CREATE OR REPLACE PACKAGE refcur_pkg IS
      TYPE refcur_t IS REF CURSOR RETURN employees%ROWTYPE;
      TYPE outrec_typ IS RECORD (
        var_num    NUMBER(6),
        var_char1  VARCHAR2(30),
        var_char2  VARCHAR2(30));
      TYPE outrecset IS TABLE OF outrec_typ;
     FUNCTION f_trans(p refcur_t)
          RETURN outrecset PIPELINED;
    END refcur_pkg;
    /
    
    CREATE OR REPLACE PACKAGE BODY refcur_pkg IS
      FUNCTION f_trans(p refcur_t)
       RETURN outrecset PIPELINED IS
        out_rec outrec_typ;
        in_rec  p%ROWTYPE;
      BEGIN
    

    Change

      TYPE outrec_typ IS RECORD (
        var_num    NUMBER(6),
        var_char1  VARCHAR2(30),
        var_char2  VARCHAR2(30));
      TYPE outrecset IS TABLE OF outrec_typ;
    

    to include all the columns you need. Unfortunately, you have to manually list all the columns in the draw. The REQUESTOR table. If you think you need this same structure in other places you must create them as SQL types instead of PL/SQL types.

    This example should be enough to show you how to modify your code to do something similar.

  • Add physical column in advance in the physical layer without using import

    Hi Experts,

    Is it possible to add new physical column in the physical layer in advance if you already knew that this new physical column is added to the OLAP table in the future?


    Thank you

    Hello
    Yes you can do it. Make sure you use the same column in the report once you add the column to the OLAP table.

    check if useful/correct...

    Thank you
    prassu

  • Add the large table column

    All-

    I have my data (20 columns of ~ 700 000 lines) stored in a binary file and I would like to add a timestamp to each row of data.  I intend to use the sampling with the number of samples to add the time at which the sample was recorded in data.  I have read the data (~ 700 000 samples) and use a grand for a table 1 d with the same number of rows of data and then insert the 1 column in the largest table that has my data.  However, this seems to take a lot of time and I am looking for a faster/more simpler way. Significant NY, I mean the vi works for about 20 min before me give up and stop it.  I posted a PNG of the block diagram.  Any help will be much appreciated.

    Thank you

    Chris

    Hi humada,.

    Try this...

  • change the column type of data in large tables

    Hello

    I have a very large table 3 TB and 97 scores and I need to extend the size of a column. This operation can take a long time and I'm afraid that it will block some SQL operations. What is the recommended way to do this? Can I use alter column? Should I add the column, copy values, delete the former and rename it?

    Kind regards

    Nestor Boscan

    Because you widen the column, all existing values are guaranteed to fit the new size. This should happen fairly quickly. If you were however decrease the size of a column, each value must be checked first before the DOF could complete to check it might all go in the smaller space. Change the alter table is a great value.

    If these fields are variable length (number, varchar2), then the space doesn't have to be 'reserved' for future data. Oracle will take care of the future inserts or updates of larger data as usual. If you increase a fixed length as a CHAR data type, then it is another story.

  • How to add the column to the table of QSqlDatabase if does not exist

    Hello

    I have an app World and want to update to include more features.

    To do this I need to add more columns in an existing database table created using QSqlDatabase, someone knows how to do this please?

    Tim

    Hi, you can use ALTER TABLE

    http://www.w3schools.com/SQL/sql_alter.asp

  • ORA-39726: operation column add/drag not supported on compressed tables

    Hello

    I have an error of the object.

    {noformat}

    SQL > select table_name, compression from dba_tables where owner = 'USER1' and table_name = "TABLE1_LT";

    TABLE_NAME COMPRESS
    ---------------------- --------
    TABLE1_LT DISABLED

    SQL > exec dbms_wm. DisableVersioning ('user1.table1', force = > true, ignore_last_error = > true);
    Dbms_wm BEGIN. DisableVersioning ('user1.table1', force = > true, ignore_last_error = > true); END;
    *
    ERROR on line 1:
    ORA-20231: table "User1. Table1' failed during
    DisableVersioning. Error:
    ORA-39726: operation column add/drag not supported on compressed tables
    ORA-06512: at "WMSYS.LT", line 9360
    ORA-06512: at line 1


    SQL > select sql_str in the all_wm_vt_errors;
    ALTER TABLE USER1. DROP COLUMN LTLOCK TABLE1_LT

    {noformat}

    How can I check, it's a table really compressed or OWM not in?

    Hello

    This is the right way to determine whether a table enabled version uses compression.  It could be another property table or tablespace that causes the same error will be triggered.  It is difficult to know exactly without the full table DDL.  If the dba_tables query was ACTIVE for this column, the inner workings of the Workspace Manager would have to set as unused column instead of a fall that could have prevented this error.  This behavior has been updated in 12 c to always define the column as unused anyway.  As a on 11.2.0.3, you can use ignore_last_error to jump the abandonment of all columns of metadata (version, nextver, delstatus, ltlock and createtime/retiretime if history is used).  Then when DisableVersioning is complete, you can issue the unused column from the game DDL manually for each of the columns.

    Kind regards

    Ben

  • Add a column in the Table lead RN

    Hello

    In a standard page, there is a searchRN, and on this basis, the data from the table ahead are met. I want to add another column of this table in advance. The original Version has the required column, so I just map the attribute and the instance.

    If she wasn't a table in advance, I would have, but for table in advance, it looks different. Any approach step by step would be really useful.

    Appl Version: 12.1.3

    Thank you

    Region of table in advance, create a new item. Type of item would be the column.
    create 2 new items under the newly added column. 1 is the column header and a second would be messagestyledtext.

    Kind regards
    RAM

  • Paragraph style by default when you add rows/columns of the table

    Hello

    I use InDesign CC and whenever I add a new row in the table or a column, that paragraph for these lines styles are in default in the styles I won't use. They are actually failed to really big styles title so I don't just add lines 3 and 4 and my table is out of the page. None of the surrounding cells, columns or lines contain the ID styles is emphasizing the use.


    How can I set the default style for a new row in the table or column?

    Thank you

    Paul.

    Hi, thanks for the help guys. I tried your suggestions but I always had the same problem. However I noticed that when the model documents have been opened there were styles by default selected in all the style panels. It seemed that it was these styles by default selected which were applied to new rows in the table.

    I opened the templates and all the panels style [none] or [standard paragraph], then saved the document.

    This solves the problem because no style is now applied when rows are added.

  • How to add a column at the end of the table of the already designed the document... ?

    Hello

    I am writing a javascript to add a column at the end of the table in the Indesign document. using our plug-in, we have created the Indesign document.

    Each table I want to add an extra column at the end. Is it possible... ? Please help me if anyone has the idea in this regard.

    Thank you

    Vimala L

    Hi Vimala,

    Please try the JS code below, copy the following code will add the new column in each table last column after.

    var myTable = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    
    for(i=0; i
    

    THX,

    csm_phil

  • Add new columns to iExpense Table of Adv. finished Non-Employee Information

    I have a requirement where in I need to add three columns to the table in iExpense DetailsPG at the table of the advanced non-employee information (GuestTableRN). I was able to add three areas through customization (I know that this can be done by extending the CO, but tried through customization)

    If there was DFFs, it would have been easy, but there is no DFFs.

    I created a table with the columns attendee_line_id and report_line_id that are also in the oie_attendees_all table. Then next created the necessary business components, first OS based on the table custom and then expanded the VO on the page, ExpAttendeesVO and also added the custom to the VO EO.

    I put the code in the java VoImpl extended to insert or delete lines and moved these files on the server, insert data into the table manually. The data is displayed in the three new Non-employee table columns. I was able to update the existing data on the details page. But I can't do an insert or delete it from the page.

    I need suggestions on how to address this issue.

    Thank you
    Kishore

    Hi Kishore,

    You cannot update two tables using an EO (even if you extended it). What I propose is to write PLSQL API and call that could insert data into your custom table. Another option is to write a trigger on your table planted (on insert) and check for certain key conditions based on which you can insert data into your custom table.

    Concerning
    Sumit

Maybe you are looking for

  • can I use my own background of start page in firefox?

    ICAN, I use my own background of start page in firefox as I can to the opera? See photo

  • PKI / CAC certificate number

    The CAC authentication has been enabled, and Firefox see certificates. When you go to a site that requires this identification, the box appears and a certificate can be selected. The setting for "security.remember_cert_checkbox_default_setting:" has

  • Noise electric high height on Satellite L650

    Hi guys,. I bought a computer laptop satellite L650 and right of the day 2, I noticed there is a noise of great height (you can check the link http://www.youtube.com/watch?v=5XLiejMy5Ns) comes from somewhere under the touchpad when you browse the int

  • Removal of the BIOS on Satellite Pro M10

    Hi all Just a quick question, havnt cast an eye at the moment, but no one knows if the bios chip can be removed easily from the motherboard M10 or it is welded? Thank you. :)

  • Presario cq61: do not know the admin password

    Hi all trying to get past the password admin on a 2nd hand machine tried many things off here do anything mo deactivation code is 58009990 someone can help thnx