HowTo archive several Partitions of the Table to a new table?

We have a very big_table partitioned on the TRAN_DATE column per month.

PARTITION 'P200310' VALUES LESS THAN (TO_DATE (' 2003-11-01 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS ',' NLS_CALENDAR = GREGORIAN '))
+.. +
+.. +
+.. +
PARTITION "P201008" VALUES LOWER THAN (TO_DATE (' 2010-09-01 00:00:00 ', 'SYYYY-MM-DD HH24:MI:SS', ' NLS_CALENDAR = GREGORIAN ' "))

We wanted sheet music archive (consolidated) "P200812" "P200811" "P200810"... and below in a new_table.

I tested the "swap partition" method but the docs I found offers with one partition is going to a single table, such as:

P200812-> table1
P200811-> table2
etc...
etc...
so, I end up with multiple partitions at several tables... not what we wanted.

I think a merger of all the partitions P200812 and below in a single partition and make the Exchange. What is the quickest way?

Any help or pointers will be greatly appreciated.

Thank you.

Edited by: joey_p May 14, 2010 12:45 AM
create new_table as select * from big_table where 1=2;  -- create an empty, non-partitioned table
alter new_table nologging;
alter session enable parallel dml;
insert /*+ APPEND PARALLEL (n 2) */ into new_table n
select /*+ PARALLEL (b 2) */ * from big_table partition (first_partition_name);
commit;
insert /*+ APPEND PARALLEL (n 2) */ into new_table n
select /*+ PARALLEL (b 2) */ * from big_table partition (second_partition_name);
commit;
alter table big_table truncate partition (first_partition_name);
alter table big_table truncate partition (second_partition_name);
alter table big_table merge partition ....

TRUNCATE and MERGE orders that you would do once you have verified that all the data has been copied to the new table. (and, preferably, after a BACKUP was taken, because integration into new_table was made without redoing loggging.

Hemant K Collette
http://hemantoracledba.blogspot.com

Tags: Database

Similar Questions

  • Column of type BLOB in own tablespace in partition in the table, tablespace to move

    Hi all

    First off I use Oracle Database 11.2.0.2 on AIX 5.3.

    We have a table is partitioned on a monthly basis.

    In this table, there is a partition (BOTTOM), this lower score is 1.5 TB in size thanks to a BLOB column called (ATTACHMENT).

    The rest of the table is not large, about 30 GB, it's the BLOB column that uses all the space.

    The lower part is in its own default tablespace (DefaultTablespace), the BLOB column in the lower score is also in its own tablespace (TABLESPACE_LOB) - 1.5 to

    I was invited in order to free up space by moving the TABELSPACE_LOB (from the low partition) to a data archive, confirming the data is there and then remove the lower score of the production.

    I do not have enough free space (or time) make an expdp, I think not only its doable with data so much.

    CREATE TABLE tablename
    (
      xx                          VARCHAR2(14 BYTE),          
      xx                          NUMBER(8),    
      xx         NUMBER,
      ATTACHMENT   BLOB,
      xx             DATE,
      xx             VARCHAR2(100 BYTE),
      xx                     INTEGER,
    )
    LOB (ATTACHMENT) STORE AS (
      TABLESPACE  DefaultTablespace
      ENABLE      STORAGE IN ROW
    NOCOMPRESS
    TABLESPACE DefaultTablespace
    RESULT_CACHE (MODE DEFAULT)
    
    
    PARTITION BY RANGE (xx)
    ( 
      PARTITION LOWER VALUES LESS THAN ('xx')
        LOGGING
        COMPRESS BASIC
        TABLESPACE DefaultTablespace
        LOB (ATTACHMENT) STORE AS (
          TABLESPACE  TABLESPACE_LOB
          ENABLE      STORAGE IN ROW
    )
    
    ...>>
    
    

    My idea was to take a table, excluding the attachment column datapump, export using external tables.

    Then to create the table on the database archive 'with' the attachment column.

    Import data only, as I understand that if you use a dump file that has too many columns Oracle he will manage, I hope it will work the other way around.

    Then on the production, make the TABLESPACE_LOB read-only and move it to the new file system.

    It's a little more complicated that a normal gesture of tablespace because of how the table is split.

    Any advice would be much appreciated.

    I was thinking about an approach as:

    SWAP PARTITION allows to separate the partition of the table

    • Create a non-partitioned table which is otherwise identical in structure to tablename (nonpart_tablename)
    • ALTER TABLE TableName LOWER WITH nonpart_tablename SWAP PARTITION

    Move the segment of the table at TABLESPACE_LOB, or to a different tablespace on its own. It is, as you say, only 30 GB and I think (but not strongly enough to go forward without testing/validation on a smaller scale) that the displacement of the segment of the table in this way does not disrupt the LOB segment, as long as you don't say MOVE LOB.

    • ALTER TABLE nonpart_tablename MOVE TABLESPACE TABLESPACE_LOB

    Now the TABLESPACE_LOB tablespace is self-contained and you can make it transportable.

  • Delete several partitions in the physical model

    Hi all

    I don't know if anyone has the same need for me, if this is maybe because I don't know how to do something which is already being implemented.

    Anyway, my question is:

    How can I remove multiple partitions (400) both from the same table in the physical model?

    I choose the partitions, but the popup does not work, I can press the button Delete in the toolbar, but don't participate in anything.

    I imported my data dictionary, a scheme with several tables that have lots of partitions and I'm not interested to save these partitions.

    When I try to generate the DDL generates all partitions and I don't want the DDL with thousands of scores on the inside.

    the number of tables with partitions is not so high but isn't comfortable to go one by one by selecting the partitions and deleting the object (400 times in one table),

    I can change the table to say that is not partitioned and all partitions will disappear but I so need to again change the table and include the fields for partitions and partition, not useful,

    Another option would be to select when importing, if I want to import only a single partition for each table

    but I do not know is at the end there just because I think only delete partitions with a single operation should be sufficient, at least for me

    Thanks in advance

    Hello

    I connected an improvement on that request.

    An approach that could help is to use the dialog box compare models to control which partitions are imported.  However, this feature is available in version 4.1 (EA1 and ai2).

    If you have something in your model before making your import (for example a fictitious Table), the dialog box compare models will be displayed after the import.

    In tree compare models, if you expand the node of a Table with partitions, it will appear a range Partitions, the node list Partitions or Partitions to hash.  If you uncheck this node, the subordinate entries for all the individual partitions will become selected, and they will not be included when you use the merge button.

    If you have many Partitioned Tables and you want to do this for all Partitions of your range (for example), you can move from tree to table in the dialog box view to compare, and then change the option SET to the range Partition Type (top-right) and then use the button to deselect all (upper-left) to deselect all Partitions of the range.

    David

  • How can I search and return several items from the table quickly (like Matlab find)?

    Hi, I'm a pretty experienced Labview programmer, and I've always wondered if there is a way to quickly search for pictures on several items that meet the selection criteria, equivalent to the Matlab find command.  While my inability to do in Labview has always annoyed me, I now have an application that requires this capability and I need to find a solution.

    Is the fastest way I've found to do this in labview to perform comparisons on the data vectors, then use the Boolean value that results from vector to analyze the table using a loop and shift registers.  I enclose an extract vi a analysis comparative vi to one of the simple searches that I need to do.  On my laptop, this research takes about 600 ms.  In comparison, the equivalent in Matlab:

    newArray=oldArray(find(oldArray(:,4)./oldArray(:,2)>1.5),;

    runs in about 1.2ms.  So, the way I am doing this in Labview is only 400 times slower

    Needless to say, I need to make these types of research many times, and these additional 599 ms start to add up pretty quickly!

    Thanks for your help,

    Aaron

    Hi Aaron,

    the slow part is probably "build group" of the node in the loop.

    Try this:

    Define an array the same size as the input data (or simply uses a copy of it) and the wire that to the shift register. Keep a counter of lines found in the loop. Use IndexArray and ReplaceArraySubset for the loop to move rows found at the beginning of the table (overwrite the 'bad' lines). After the loop simply ReshapeArray the number of found lines...

    Sorry, don't have LV (2009) on hand for editing your snippet.

  • Adding new partition in the table are

    Hello

    Oracle 9i
    Windows 2003 operating system

    The main entry/exit table is one of the base tables that has a large number of records and a very high success rate, and to avoid poor performance that may occur in such cases, Oracle Table partitioning technique has been examined in the early stages of the implementation of the system.

    Unfortunately, the technique used to divide data based on the year of the transaction considered the year 2010 as the last specific partition, so all records created after this year is gathered in a single partition and this may cause poor performance in the years to come.

    Are required to add another 10 partitions; up to the year 2020 taking into account that the downtime should be close to zero.

    Ground:

    According to my knowledge

    for this, so we can create a new table with the same columns and add required 10 more partitions, and if we take 2 scenarios like

    export/imp
    insertion in the new table select * from < table > old

    What is the best, and if we take exp/imp, if her take a few hours of time to complete a task... what will happen for the updates as insert, update, and delete in this time what will be the impact on the import... I mean if all committed tarnscations... These tarnscations automatically add to the table are not.

    Please tell me what is the best and the tarnscations should not effect... pls tell me how excatly we can complete the task.

    Concerning
    873393

    In my script, I have a DROP TABLE because I'll put up a reproducible demonstration. I can run the script repeatedly and regenerate the same demo data!
    In your environment you would not fall off the table!
    To simplify the demo for you: IGNORE the DROP TABLE command. Pretend it does not exist.

    Hemant K Collette

  • Topics in several places in the table of contents

    Hi all

    I was wondering if it is possible to insert a topic more than once in the Table of contents? This is probably a strange request, but the problem occurred because I imported a manual written in Word, but the part of it contains information already in the RoboHelp project. I was wondering if I could erase the information duplicated in favor of a link to what was already there?

    Thanks in advance for your suggestions.

    See you soon,.

    darkagn

    Stone of right: the table of contents will be get synchronized with the trial (up and down) that he meets. However, you can use redirect pages to work around this problem.

    1 create a new topic (and name it target_topic_name_redirect.htm as a visual cue for yourself). The title is the same in the topic title target (which is the name that will appear in the table of contents).

    2 remove all text in the topic in WYSIWYG mode (leaving a blank page).

    3 al ' TrueCode, add this line to the other META tags (in any place).

    4 drag and drop the redirection page to where you want the TOC.

    Note: A value of 0 (zero) is the duration time (none) and this topic will be displayed before the redirection to the topic target. If you prefer to make this available to the viewer redirection, you can increase it to, say, 8 or 10 and provide a text like "pick up this section of the"Configuration"section. Please wait a moment. »

    Good luck
    Leon

  • Refresh a specific partition of the table, materialized


    DB version 11.2.0.3 Linux

    We have several views partitioned materlialized. Partitioning key is the principal. We want to update partition independently, for example to update all partitions of materialized view for principal GB (e.g. the principal refresh GB only although there are also other partitions belonging to other mndators which are obsolete).

    Is it possible to refresh only the partitions? I am aware of the track changes of partition but I think / know that it is possible to update a specific partition.

    We have several views partitioned materlialized. Partitioning key is the principal. We want to update partition independently, for example to update all partitions of materialized view for principal GB (e.g. the principal refresh GB only although there are also other partitions belonging to other mndators which are obsolete).

    Is it possible to refresh only the partitions? I am aware of the track changes of partition but I think / know that it is possible to update a specific partition.

    Non - Oracle update process not to refresh a specific partition.

    But there is a work around if you manage refreshes him yourself.

    WARNING - This is NOT for the faint of heart. I do not recommend the use of the approach unless it is absolutely necessary. Make sure you understand all of the issues involved before using this technique of production.

    Basically, you:

    1. create a partitioned table pre-built to found the MV on

    2. create a MV using the pre-built table

    3. create a regular work/temp table with the same structure as the MV

    4. fill the temp/work table with new data of the partition (updated)

    5. run an EXCHANGE PARTITION of work/temp with the 'specific' partition table you want to update

    Arup Nanda has a text with a very simple example of how the process works. You will need to modify it for your use case.

    http://Arup.blogspot.com/2010/04/online-MATERIALIZED-view-complete.html

  • Move the partition of the table and get ORA-14006: invalid partition name

    I'm using oracle 11.2.0.4 and I am trying to move a partitioned table to one tablespace to another.  I checked may times and I have the correct table name and the name of the partition.  However, I get the error ora-14006.

    Can see everything what could be the problem?

    SQL > ALTER TABLE GWPROD. QRY_TES_ROLLINGCUREDITS MOVE PARTITION 201112 TABLESPACE GW_PROD_T2 PARALLEL (DEGREE 4) NOLOGGING;

    ALTER TABLE GWPROD. QRY_TES_ROLLINGCUREDITS MOVE PARTITION TABLESPACE GW_PROD_T2 PARALLEL (DEGREE 4) NOLOGGING 201112

    *

    ERROR on line 1:

    ORA-14006: invalid partition name

    Thanks in advance.

    Names that begin with numbers are not legal partition names. A fool created by placing them between double quotes. You will need to do the same.

  • Several partitions on the hard drive

    I have a few questions.

    1 could you help me understand the different partitions that are on my hard drive.

    a. healthy 600 MB (recovery Partition)

    b. 300 MB Healthy (EFI System Partition)

    c. Acer (C)

    d. 18 GB Healthy (recovery Partition)

    2. If I wanted to maintain the ability to retrieve from the hard drive, which, if not all partitions are needed to stay healthy.

    I like being redundant and I created a flash drive to back up my drivers and applications and also a flash drive to a factory restore.

    Thank you

    Hi whatrymes,

    the entire score is required in the case of a HARD drive failure:

    (a) main Windows recovery partition, those are the same files that you have on the USB boot recovery media where windows fails to boot from the HARD drive

    (b) EFI http://en.wikipedia.org/wiki/EFI_System_partition

    (c) your system partition is

    (d) it is necessary to re - install windows to factory default install Acer/windows files

    If you want to be "bullet proof", I suggest:

    (1) check if the BIOS can read and boot from your USB recovery media (sometimes not expensive pen USB cannot be recognized)

    (2) make a system image on an external HARD drive or a big USB pen:
    http://www.TomsHardware.com/news/how-to-make-system-image-backup, 26542.html

    in the worst case of total failure of the HARD drive, you can change your HARD disk, use the support of USB to start recovery and re - install of the system image backup.

  • Referring to several items in the tables

    I'm experimenting with a q / a Flash application. TextField shows a question. Another inputfield is lower for answering. By responding with a text, a sentence not formulated may be correct, but not according to the code. In this case, I want to write many different versions of the response. Questions come from a table. Another painting shows the answer.

    For example

    questions of the var: Array = new Array;

    issues [0] = ('how many cars');

    answer: Array = new Array;

    answer [0] = ("one", "1", "One", "ONE")

    The case:

    In a function where an if statement expected the inputfield to have the right answer, how to write the code?

    Example:

    (...) function send (MouseEvent) {}

    If (inputField is?) {}

    else {trace ("wrong")}

    }

    Posted by phone, my computer with the actual code has no internet... Must have downloaded the code that I know...

    What you are looking for is perhaps

    If (answers [currentQuestionNum] .indexOf (inputField.text) >-1) {}

    something

    } else {}

    trace ('wrong');

    }

  • Divide the data into several lines in the table

    Hello

    I use apex of Oracle 10 g 3.2.

    I have a requirement like this.

    I have a table like TableA

    Col1 Col2
    90 1
    91 1:2:3
    92 3

    I want the data as

    Col1 Col2
    90 1
    91 1
    91 2
    91 3
    92 3

    How to do this?

    Thank you

    Published by: user13305573 on August 3, 2010 20:16
    with
       your_data as
    (
       select 90 as col1, '1'  as col2      from dual union all
       select 91, '1:2:3'   from dual union all
       select 92, '3'       from dual
    )
    select
       y.col1,
       regexp_substr(y.col2, '[^:]+', 1, t1.column_value) as col2
    from
       your_data y,
     13     table(cast(multiset(select level from dual connect by  level <= length (regexp_replace(y.col2, '[^:]+'))  + 1) as sys.OdciNumberList)) t1
     14  /
    
                  COL1 COL2
    ------------------ -----
                    90 1
                    91 1
                    91 2
                    91 3
                    92 3
    
    5 rows selected.
    
    Elapsed: 00:00:00.05
    ME_XE?select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    
    5 rows selected.
    
    Elapsed: 00:00:00.03
    ME_XE?
    
  • Create index partition in the partition table tablespace

    Hello

    I am running a work custom that

    * Creates a tablespace by day
    * Creates the daily table partition in the created tablespace
    * Removes the days tablepartition X
    * Removes the storage space for this partition of X + 1 day.

    The work above works perfectly, but it has problems with the management of the index for these partitioned tables. In the old database (10g - single node), all indexes and partitions exist in a BIG tablespace and when I imported the table creation script in the new database, I changed all the partitions table & index to go in their respective space.

    For example:

    Table_name... Nom_partition... Index_Part_name... Tablespace_name
    ============...================............====================...........=================
    TABL1... TABL1_2012_07_16... TABL1_IDX_2012_07_16... TBS_2012_07_16
    TABL1... TABL1_2012_07_15... TABL1_IDX_2012_07_15... TBS_2012_07_15


    But now, when the job is run, it creates the index in the tablespace TBS_DATA default.

    Table_name... Nom_partition... Index_Part_name... Tablespace_name
    ============...================.............====================...........=================
    TABL1... TABL1_2012_08_16... TABL1_IDX_2012_08_16... TBS_DATA
    TABL1... TABL1_2012_08_15... TABL1_IDX_2012_08_15... TBS_DATA


    I can issue alter index rebuild to move the index to its tablespace default, but how can I make sure that the index is created in the designated tablespace?

    NOTE: the partition/tablespace management work that I run only creates the partition of the table and not the index.


    The new env is a cluster of CARS of 2 nodes 11 GR 2 on Linux x86_64.


    Thanks in advance,
    aBBy.

    try something like this

    ALTER table tab_owner.tab_name add the partition v_new_part_nm
    values less (to_date('''|| v_new_part_dt_formatted ||'') ((', "DD-MON-YYYY)) tablespace ' | part_tbs
    update the index (ind1_name (partition ind_partition_name tablespace ind_part_tbs)
    ind2_name (partition tablespace ind_part_tbs ind_partition_name))
    ;

  • Table partitioned using the hash partition

    I need to create the table using hash partition and need to specify the number of partitions (for example, 32)
    1. How/where to specify the number of partitions? I checked under "partitioning" tab of the properties of the table, but "system partition" is disabled.
    2. What is the difference between the hash by quantity vs Hash of the list of partitions and which should I use?

    Hello

    To do this, you must set the Partition Type to HASH BY QUANTITY. Then, tab Tablespaces part of hash, you can set the quantity field on HashP to the number of partitions.

    Ownership of the system partition is only enabled if the type of partitioning SYSTEM.
    Hash partition list allows you to add entries in hash Partitions of the Table nsud Partition to set each individual partition.

    David

  • Limit the number of partitions of a table can have

    Hello

    It has been a while I think about a simple method and the best solution to a performance problem in my application. Benefiting from the table partitioning seems a simpler approach. It involves tiny my application code changes and more, it keeps the logic of global application 100% intact. However, sometimes the number of required partitions can grow to more than 500 thousand. I know another application implementation of partitions that 50 thousand for one of his paintings. I wonder if Oracle recommends or puts a limit to a number of partitions of the table can have. How does that limit, if it exists, varies so each of my partition table contains only a small amount of data. say, no more than 2 thousand records each of size 1 KB. What are the important considerations to keep in mind while creating the huge number of partitions of a table?

    All entries on this would be a great help.


    Thank you
    EXISTING


    PS: versions of Oracle 10 g from to consider.

    Published by: Olivia on December 30, 2009 09:46

    Published by: Olivia on December 30, 2009 09:50

    Hello

    Please visit the following link.

    Maximum number of partitions?

    Concerning

  • Partition on existing Tables

    Hello

    I want to archive a database due to too much data into DB everymonth, so I have to delete the records from the previous month, which is about 4 million.

    Can someone give me idea to delete records as soon as possible. My opinion is to create the partition on the table and drop the partition once he becomes older.
    But if I want to introduce the partition then I have to create a partition in an existing table. So please give me the best way to introduce the partition of the existing table.

    It would really help that may suggest meanings.

    Thank you

    Spengler

    Here is an example

    CREATE TABLE my_table (
      id           NUMBER,
      description  VARCHAR2(50),
      create_date date
    )PARTITION BY RANGE (create_date)
    (PARTITION id_id0 VALUES LESS THAN (TO_DATE('26/08/2009', 'DD/MM/YYYY')) TABLESPACE users,
     PARTITION id_id1 VALUES LESS THAN (TO_DATE('27/08/2009', 'DD/MM/YYYY')) TABLESPACE users,
     PARTITION id_id2 VALUES LESS THAN (TO_DATE('28/08/2009', 'DD/MM/YYYY')) TABLESPACE users,
     PARTITION id_id3 VALUES LESS THAN (TO_DATE('29/08/2009', 'DD/MM/YYYY')) TABLESPACE users,
    PARTITION id_id4 VALUES LESS THAN (TO_DATE('30/08/2009', 'DD/MM/YYYY')) TABLESPACE users,
    PARTITION id_max  VALUES LESS THAN  (MAXVALUE) TABLESPACE users);
    

    -Insert the sample data

     INSERT INTO my_table  VALUES (0, 'ZERO',sysdate);
    INSERT INTO my_table  VALUES (1, 'One',sysdate+1);
    INSERT INTO my_table  VALUES (2, 'Two',sysdate+2);
    INSERT INTO my_table  VALUES (3, 'Three',sysdate+3);
    INSERT INTO my_table  VALUES (4, 'Four',sysdate+4);
    COMMIT;
    

    -You can run these queries to check the output.

    select * from my_table;
    select * from my_table partition(id_id0);
    select * from my_table partition(id_id1);
    select * from my_table partition(id_id2);
    select * from my_table partition(id_id3);
    select * from my_table partition(id_id4);
    select * from my_table partition(id_max);
    

    -Split partition

    ALTER TABLE my_table SPLIT PARTITION id_max AT (TO_DATE('01/09/2009', 'DD/MM/YYYY'))
    INTO (PARTITION id_id5 TABLESPACE users,PARTITION id_max TABLESPACE users);
    

    -Insert data into the new partition

    INSERT INTO my_table  VALUES (5, 'FIVE',sysdate+5);
    commit;
    

    -check

    select * from my_table partition(id_id5);
    

Maybe you are looking for