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.

Tags: Database

Similar Questions

  • How to find the same column name in different tables in the same schema

    Hello

    I find the 'ename' column name in different tables in the same schema.

    Thank you
    Nr

    Hello

    Try this query

    Select column_name, table_name from user_tab_columns where column_name = 'ENAME ';

    Award points and end the debate, if your question is answered or mark if she was...

    Kind regards

    Lacouture.

  • Need to convert the Varchar2 column number for the extraction of data based on the range of values.

    Hello

    I have a ZIP column which is the Varchar2 data type, it has values such as 2345, 09485, 10900, 07110, 06534.

    I have to go look up records from the range of values for the ZIP column as between 00000 and 07500.

    Could you give a logic.

    Thank you.

    Hello

    I think you can use the following code:

    SELECT T.*

    OF t

    WHERE the to_number (ZIP) between TO_NUMBER('0000') and TO_NUMBER('07500')

    ;

    CGomes

  • 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

  • Get only the Varchar2 column channels

    Hello
    How can I extract only strings form varchar2 column type?
    I have data like below.

    25 - Abc xy
    233 - xyz jj
    x23A
    9 - dd
    5 - AAA (pp)

    I need the outputs (-also be deleted)

    ABC xy
    XYZ jj
    xA
    DD
    AAA (pp)


    Thank you
    Sujnan

    Maybe...

    API> WITH t AS (SELECT '25-Abc xy' AS col FROM DUAL
      2          UNION
      3          SELECT '233-xyz jj' FROM DUAL
      4          UNION
      5          SELECT 'x23A'  FROM DUAL
      6          UNION
      7          SELECT '9-dd'  FROM DUAL
      8          UNION
      9          SELECT '5-aaa(pp)'  FROM DUAL)
     10    SELECT TRANSLATE(col, '1234567890-', ' ') AS RES
     11    FROM t;
    
    RES
    ----------
    xyz jj
    Abc xy
    aaa(pp)
    dd
    xA
    
    Transcurrido: 00:00:00.93
    
  • on the acceleration of the reconstruction of a very large table 2d

    Basically, I got a table 2d 1024 x 1024 (fixed size). What I do:

    1. perform an FFT along each line (1024 times)-> it's fast

    2. I divided my big table in 8 subtables to take advantage of my 8 cores

    3. rebuild my table 2d 1024 x 1024-> it's slow

    To perform step 3, I used 'Building the table' vi but also I first initialized and used the vi "replace the sub-table". Unfortunately, it is still very slow. Someone could suggest me a way to speed up the 'reconstruction' of my 2d table, or do you have another solution to use all the cores without split my big table?

    Thank you very much.

    Hi Adrien,.

    Use a loop FOR parallel processing.

    Or imitate this automatism of LV using the DataValueReference to work on the same memory in different (loops FOR).

    This applies to LV2009 - you note the version of your LV...

  • Cannot resize the dialog box print too large

    When you try to print using Reader X, the print dialog box is huge and the 'OK' button extends above the bottom, making it inaccessible.  I tried to resize the print area, but the handles that appear around the edges will not adjust the size of the box.  In this case no matter the size of the player window with which I work.

    Someone else runs into this problem? No idea how to solve this problem?

    I use a screen resolution of 1024 x 768.

    Thank you.

    On computers with low resolution, such as 800 X 600, the print and Cancel buttons may be off the screen. The 10.1.3 free update for Reader and Acrobat addresses this issue. You can install this update automatically to in Reader and Acrobat. If you are unable to update at this time, do one of the following:

    • Drag the scroll bar on the right side of the print dialog box down to access keys.
    • To print, press enter or return.
    • To cancel, press ESC.

    This information has been made of article following the base of knowledge print issues. Acrobat, Reader 10.1.2 or later.

  • The analysis of the VARCHAR2 column data to extract information

    Hi guys,.

    Let me give the information of DB first:

    SQL > select * from v version $;

    BANNER

    --------------------------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    AMT for Solaris: release 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

    My problem is: the interface of the application sends a large chain in VARCHAR2 (4000 BYTES) field. The string it sends is a bit like this-


    <strong>Crit:</strong> Some text. <br><strong>Distinguished</strong> (points 3):Some comment text1. <blockquote> </blockquote><strong>Crit:</strong> Some other text.<br><strong>Distinguished</strong> (points 3):Some comment text2. <blockquote> </blockquote><strong>Crit:</strong> Some more text. <br><strong>Distinguished</strong> (points 3):Some comment text3. <blockquote> </blockquote><strong>Overall comments:</strong><br> Final text!!
    I want to analyze the text and put in separate columns. Number of writes: maybe more than 3; its 3 up there. But the basic structure is the same. What is the best way to analyze this in PL/SQL code? I want something like

    Table 1
    Crit                       Points           Comment
    Some text                3        Some comment text1.
    Some other text        3        Some comment text2.
    Some more text        3        Some comment text3.
    Table 2
    Overall comments
    Final text!!
    Let me know if you need more information.


    Thank you.

    It could be a few slightly neater ways to do it with the REGULAR expression functions, but this will do what ypu want to:

    TABLE 1:

    WITH t AS
    (SELECT 'Crit: Some text. 
    Distinguished (points 3):Some comment text1.
    Crit: Some other text.
    Distinguished (points 3):Some comment text2.
    Crit: Some more text.
    Distinguished (points 3):Some comment text3.
    Overall comments:
    Final text!!' string FROM dual) SELECT SUBSTR(REGEXP_SUBSTR(string,'Crit:[^<]+', 1, level), 15) "Crit", SUBSTR(REGEXP_SUBSTR(string,'points [^\)]+', 1, level), 8) "Points", SUBSTR(REGEXP_SUBSTR(string,'\):[^<]+', 1, level), 3) "Comments" FROM t CONNECT BY LEVEL <= (LENGTH(string) - LENGTH(REPLACE(string, 'Crit:')))/5

    TABLE2:

    WITH t AS
    (SELECT 'Crit: Some text. 
    Distinguished (points 3):Some comment text1.
    Crit: Some other text.
    Distinguished (points 3):Some comment text2.
    Crit: Some more text.
    Distinguished (points 3):Some comment text3.
    Overall comments:
    Final text!!' string FROM dual) SELECT SUBSTR(string, INSTR(string, '', -1) + 8, INSTR(string, '', -1) - INSTR(string, '', -1) - 8) "Overall", SUBSTR(string, INSTR(string, '
    ', -1) + 4) "Final" FROM t
  • Align the text of the varchar2 column data

    Hello

    It is in reference below thread:
    Re: Align the text of varchar2

    I think I should post my question in this forum, rather than General database,

    I created a table and inserted the same that in the thread that above, and when I said:
    Select ID, FILLED_TEXT(DESCRIPTION,30) FROM T;

    It does not show the data in the column as aligned in 30 word boundaries. I thought, that I would be able to resolve the issue with the help of the http://soft.buaa.edu.cn/oracle/bookshelf/Oreilly/prog2/ch11_02.htm link, but failed.

    Kindly help me more.

    Kind regards.

    Okay, so you're saying there is already a tags in the code to indicate where the line breaks are necessary, so a small adjustment of the data to include these tags and also the code...

    DROP TABLE test_data
    /
    CREATE TABLE test_data as
    select 1 as id, q'[For several days after leaving Nantucket, nothing above hatches was seen of Captain Ahab. The mates regularly relieved each other at the watches, and for aught that could be seen to the contrary, they seemed to be the only commanders of the ship; only they sometimes issued from the cabin with orders so sudden and peremptory, that after all it was plain they but commanded vicariously.<>Yes, their supreme lord and dictator was there, though hitherto unseen by any eyes not permitted to penetrate into the now sacred retreat of the cabin.]' as txt from dual union all
    select 2, q'[Every time I ascended to the deck from my watches below, I instantly gazed aft to mark if any strange face were visible; for my first vague disquietude touching the unknown captain, now in the seclusion of the sea, became almost a perturbation. This was strangely heightened at times by the ragged Elijah's diabolical incoherences uninvitedly recurring to me, with a subtle energy I could not have before conceived of. But poorly could I withstand them, much as in other moods I was almost ready to smile at the solemn whimsicalities of that outlandish prophet of the wharves.<> But whatever it was of apprehensiveness or uneasiness - to call it so - which I felt, yet whenever I came to look about me in the ship, it seemed against all warrantry to cherish such emotions. For though the harpooneers, with the great body of the crew, were a far more barbaric, heathenish, and motley set than any of the tame merchant-ship companies which my previous experiences had made me acquainted with, still I ascribed this - and rightly ascribed it - to the fierce uniqueness of the very nature of that wild Scandinavian vocation in which I had so abandonedly embarked. But it was especially the aspect of the three chief officers of the ship, the mates, which was most forcibly calculated to allay these colorless misgivings, and induce confidence and cheerfulness in every presentment of the voyage. Three better, more likely sea-officers and men, each in his own different way, could not readily be found, and they were every one of them Americans; a Nantucketer, a Vineyarder, a Cape man. Now, it being Christmas when the ship shot from out her harbor, for a space we had biting Polar weather, though all the time running away from it to the southward; and by every degree and minute of latitude which we sailed, gradually leaving that merciless winter, and all its intolerable weather behind us. It was one of those less lowering, but still grey and gloomy enough mornings of the transition, when with a fair wind the ship was rushing through the water with a vindictive sort of leaping and melancholy rapidity, that as I mounted to the deck at the call of the forenoon watch, so soon as I levelled my glance towards the taffrail, foreboding shivers ran over me. Reality outran apprehension; Captain Ahab stood upon his quarter-deck. End]' from dual
    /
    
    CREATE OR REPLACE FUNCTION wordwrap (p_txt IN VARCHAR2, p_linesize IN NUMBER) RETURN t_wordwrap_txt PIPELINED IS
      cursor cur_wordwrap(p_txt in varchar2) is
        select rn, txt
        from (
              select rownum as rn
                    ,trim(regexp_substr(p_txt,'.{1,'||p_linesize||'}( |$)',1,rownum)) as txt
              from dual
              connect by rownum <= ceil(length(p_txt)/p_linesize)+10
             )
        where txt is not null
        order by rn;
      v_txt varchar2(4000);
      v_length number := 0;
      v_paratxt varchar2(4000) := p_txt;
      v_paratxt_part varchar2(4000);
      v_pos number;
      v_srch varchar2(100) := '<>';
    begin
      loop
        exit when v_paratxt is null;
        v_pos := instr(v_paratxt,v_srch);
        v_paratxt_part := case when v_pos = 0 then v_paratxt else substr(v_paratxt,1,v_pos-1) end;
        v_paratxt := case when v_pos = 0 then null else trim(substr(v_paratxt,v_pos+length(v_srch))) end;
        for w in cur_wordwrap(v_paratxt_part)
        loop
          v_txt := w.txt;
          loop
            exit when length(v_txt) = p_linesize or instr(v_txt,' ') = 0;
            for i in 1..p_linesize-length(v_txt)
            loop
              v_txt := regexp_replace(v_txt,'([^ ]) ','\1  ',1,i);
            end loop;
          end loop;
          v_length := v_length + length(v_txt);
          if length(v_txt) > 0 then
            pipe row(v_txt);
          end if;
        end loop;
        if v_paratxt is not null then
          pipe row(''); -- new line before next part
        end if;
      end loop;
      return;
    end;
    /
    

    results...

    SQL> select test_data.id, x.column_value
      2  from test_data, table(wordwrap(test_data.txt,50)) x
      3  /
    
            ID COLUMN_VALUE
    ---------- ---------------------------------------------------
             1 For  several days after leaving Nantucket, nothing
             1 above  hatches was seen of Captain Ahab. The mates
             1 regularly  relieved each other at the watches, and
             1 for aught that could be seen to the contrary, they
             1 seemed to be the only commanders of the ship; only
             1 they  sometimes  issued from the cabin with orders
             1 so  sudden  and  peremptory, that after all it was
             1 plain     they    but    commanded    vicariously.
             1
             1 Yes,  their  supreme  lord and dictator was there,
             1 though  hitherto  unseen by any eyes not permitted
             1 to  penetrate  into  the now sacred retreat of the
             1 cabin.
             2 Every  time I ascended to the deck from my watches
             2 below,  I  instantly  gazed  aft  to  mark  if any
             2 strange  face  were  visible;  for  my first vague
             2 disquietude  touching  the unknown captain, now in
             2 the   seclusion   of  the  sea,  became  almost  a
             2 perturbation.  This  was  strangely  heightened at
             2 times    by   the   ragged   Elijah's   diabolical
             2 incoherences  uninvitedly  recurring to me, with a
             2 subtle  energy  I  could not have before conceived
             2 of.  But poorly could I withstand them, much as in
             2 other  moods  I  was  almost ready to smile at the
             2 solemn  whimsicalities  of that outlandish prophet
             2 of                   the                  wharves.
             2
             2 But   whatever   it  was  of  apprehensiveness  or
             2 uneasiness  -  to  call  it so - which I felt, yet
             2 whenever  I  came to look about me in the ship, it
             2 seemed  against  all  warrantry  to  cherish  such
             2 emotions.  For  though  the  harpooneers, with the
             2 great  body of the crew, were a far more barbaric,
             2 heathenish,  and  motley  set than any of the tame
             2 merchant-ship    companies   which   my   previous
             2 experiences  had  made me acquainted with, still I
             2 ascribed  this  - and rightly ascribed it - to the
             2 fierce  uniqueness of the very nature of that wild
             2 Scandinavian   vocation   in   which   I   had  so
             2 abandonedly  embarked.  But  it was especially the
             2 aspect  of  the  three chief officers of the ship,
             2 the  mates,  which was most forcibly calculated to
             2 allay   these  colorless  misgivings,  and  induce
             2 confidence  and  cheerfulness in every presentment
             2 of   the   voyage.   Three   better,  more  likely
             2 sea-officers  and  men,  each in his own different
             2 way,  could  not  readily  be found, and they were
             2 every  one  of  them  Americans;  a Nantucketer, a
             2 Vineyarder,  a  Cape  man. Now, it being Christmas
             2 when  the  ship  shot  from  out her harbor, for a
             2 space  we had biting Polar weather, though all the
             2 time running away from it to the southward; and by
             2 every  degree  and  minute  of  latitude  which we
             2 sailed,  gradually  leaving that merciless winter,
             2 and  all its intolerable weather behind us. It was
             2 one  of  those  less  lowering, but still grey and
             2 gloomy  enough  mornings  of  the transition, when
             2 with  a fair wind the ship was rushing through the
             2 water  with  a  vindictive  sort  of  leaping  and
             2 melancholy rapidity, that as I mounted to the deck
             2 at  the  call  of the forenoon watch, so soon as I
             2 levelled   my   glance   towards   the   taffrail,
             2 foreboding  shivers  ran  over  me. Reality outran
             2 apprehension;   Captain   Ahab   stood   upon  his
             2 quarter-deck.                                  End
    
    65 rows selected.
    
    SQL>
    
  • Reduce the space used on a large table

    11 GR 2, I have a table that uses up to 50 GB (almost 600 million lines) and increases by about 1 GB (8 million lines) per week. He arrived at a point where we can just continue to add disk space to solve the problem.

    There are two things we can do to reduce the amount of space: delete unnecessary lines and drop some deprecated columns.

    I'm not sure is:

    (a) is it too 'easy' that make the cuts/drops then ALTER TABLE TableName SHRINK the SPACE WATERFALL, or must he something else to do to actually free up space?

    (b) assuming that it's that easy, how overheads is needed - how much space (temporary) disk is necessary to achieve this?

    Narrowing of the space is going to be potentially very expensive. Essentially, Oracle will remove lines at the end of the table and insert them into the free space you created by removing the other lines. So you will potentially generate a ton of roll forward. Of course, you must activate the movement of the row in the first table. And the table must be in a tablespace SAMS.

    It requires no additional disk space, and it does not lock the table with the exception of a short period of time at the end of the operation.

    More details on the process of narrowing of the segments online.

    Justin

  • Combine the 2 columns in a single table

    Hello people.
    I have the following query:

    SELECT col1, COUNT (*)
    FROM table1
    WHERE ID = 10
    AND col1 IN (' a ',' B', 'C', d ', 'E', 'F', 'G', 'H', 'I')
    GROUP OF CUBE (col1);

    which generates:

    col1 COUNT (*)
    --------------- -----------------------
    A 7677
    B 25852
    A s
    D 176
    E 10
    F 127
    G 508
    H 6
    34357

    Now I have the same query with an additional condition (NR > 50):

    SELECT col1, COUNT (*)
    FROM table1
    WHERE ID = 10
    AND NR > 50
    AND col1 IN (' a ',' B', 'C', d ', 'E', 'F', 'G', 'H', 'I')
    GROUP OF CUBE (col1);

    Which generates:

    col1 COUNT (*)
    --------------- -----------------------
    A 4567
    B 14544
    A s
    D 16
    E 7
    F 105
    300 G
    F |
    19542

    I need to combine these 2 requests so I can get a report like this:

    col1 COUNT (*) COUNT (*)
    --------------- ----------------------- -----------------------
    A 4567 7677
    14544 25852 B
    1 1 C
    D 16 176
    7 10 E
    F 105 127
    G 300 508
    2 6 H
    19542 34357

    I tried something like:

    SELECT b.col1, COUNT (b.ID).
    (SELECT COUNT (d.ID)
    OF table1 d
    WHERE d.ID = 10
    AND d.NR > 50
    AND d.col1 IN (' a ',' B', 'C', d ', 'E', 'F', 'G', 'H', 'I')
    CUBE GROUP (d.col))
    Table 1 b
    WHERE b.ID = 10
    AND b.col1 IN (' a ',' B', 'C', d ', 'E', 'F', 'G', 'H', 'I')
    AND b.ID = d.ID?
    GROUP OF CUBE (b.VEHICLE_KIND_CL);

    but I can't get it to work.
    Any help will be much appreciated.

    Try:

    SELECT col1, COUNT(*) count_all, count(CASE WHEN nr > 50 THEN 1 END) count_over_fifty
    FROM   table1
    WHERE  ID=10
    AND    col1 IN ('A','B','C','D','E','F','G','H','I')
    GROUP BY CUBE(col1);
    
  • Resize the document with Tables

    I use InDesign CS6.

    I have more than 100 documents, with tables. I need to resize my documents 48 p 9 x 65 p 3 to the new small size 44 d 3 x 54 p 0.

    When resizing the document is it possible that tables will be will resize automatically also?

    New page in same proportions not same size of the original page size. So can not just scale the page more small.

    But you can scale a table if you to scale the block of text that appear in the table. Make the text frame exactly the same size as the table. Then hold down the Cmd/CTRL + SHIFT and scale the text block to a corner.

  • Need for clarification to varchar2 column

    I get xml that will be inserted in the local table messages
    It is, I don't really know the size of the incoming xml message data.
    Design of the structure of the table is now difficult.
    If I design the column in the table for column varchar2 with VARCHAR2 (4000) and if the message contains the value
    as 'SAM', 'GEORGE' (no more than 10 characters) then it does not seem good for the VARCHAR2 COLUMN (4000)
    Oracle does not create the table with VARCHAR2 (without specifying the size)

    Any suggestions?

    S

    There's no real difference if you use varchar2 (4000) or varchar2 (100). Apart from the obvious that you can store up to 4000 bytes, against only 100/characters multibyte.

    However, there are a few minor side effects. Few of them and a comparison of the performance is described here: http://arjudba.blogspot.de/2009/08/does-oversize-of-datatype-varchar2.html

    (1) the varchar2 column indexing 4000 could be a problem (the ora-01450 exceeded max key length).

    (2) the size of the table could be actually smaller for tables with many sparesly populated varchar2 4000 columns. I can't find the source for that at the moment, but it had to do with the way oracle reserves future space required for the column.

    (3) migration of rank is more likely to happen if the great texts are added (= update) later.

    (4) If you define a variable with % rowtype in the table, it will use more expensive space PGA

    (5) some tools like TOAD could get questions or need of more resources to operate on 4 k columns.

  • question of Style CSS for the adftable: column 10g

    I'm being aligned left the author column in this adf:table, but I can't make it work. The styleClass does not seem to work for her. I looked in the count, but because the styleClass is not applied, I can't work for this single column. Any suggestions?

    Thank you

    Andy
    <af:table rows="15"
                 banding="row" 
                 bandingInterval="1"
                 var="book"
                 id="currentImmunizationsTable"
                 width="900" 
                 value="#{backingbean.books}"
                 rendered="#{! empty backingbean.books}"
                 immediate="true">
      <af:column sortable="true"
                       sortProperty="author"
                       headerText="Author"
                       id="authorColumn"
                       formatType="icon"
                       gridVisible="true"
                       styleClass="column">
        <af:outputText value="#{book.author}"
                               id="authorText">
        </af:outputText>
      </af:column>
      ...
    </af:table>
    Published by: anotherhale on June 21, 2010 14:04

    Hello

    You can post your markup code all of the af:table? and if possible also expose the screenshot of disabled grid lines? This skin do you use? I don't remember any problem with af table grid lines

    Kind regards

    Branislav

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

Maybe you are looking for