How to use "exchange partition" as performance trick?

Hi,
having a partitioned table in Oracle 10g release 2, I am searching for a performant to reload partitions completely.
I heard about the possibility to load the new data (== complete partition which shall replace existing partition data) completely into a temporary partition and then just to exchange the partitions (throw away the old one and replace it with the new one). This (I was told - and it sounds good to me) is a most performant way of updating the complete data of one partition.
Yet it is unclear to me how to load the new data (which automatically would be inserted in the partition which it shall replace).
So is this possibility existing at all?
Any link to an example?
Best regards from sunny Black Forrest,
Mattin

Hi Martin,
the procedere would be something like
create table tmp_berichtswerte as select * from berichtswerte where 1=0;
Populate the temp table
alter table berichtswerte exchange partition brw_p200109 with table tmp_berichtswerte;
Rebuild the indexes on that partition (and the global indexes on the table)P.S. Sunny? Right now? your are kidding!

Similar Messages

  • How to use Exchange partition

    Hi All,
    I have a requirement like .. i have to insert the data from partition table to unpartition table like temp table. by googling i came to know about Exchange partition. by using Exchange partition we can dump temp table to partition table but i don't know how to copy the data from partition table to temp table. following script am using.
    ALTER TABLE abc_partition
    EXCHANGE PARTITION P_2011_1115 WITH TABLE abc_tmp
    INCLUDING INDEXES
    WITHOUT VALIDATION;
    And again i have created a partition table and i ran below query
    ALTER TABLE abc_tmp
    EXCHANGE PARTITION P_2011_1115 WITH TABLE abc_partition
    INCLUDING INDEXES
    WITHOUT VALIDATION;
    but i was getting an error like partition ALTER TABLE EXCHANGE requires a non-partitioned, non-clustered table
    Thanks
    Sree
    Edited by: 874823 on Apr 30, 2012 2:01 AM

    In that case, you need to follow these basic steps.
    1. Use a CTAS (Create Table as Select) to create the staging table. This table's structure needs to match that of the partition table - be that a hash or index organised structure. The columns need to be in the same order, and of the same data type. Not null constraints need to be applied to the applicable columns. If you have manually set storage clauses (e.g. PCTFREE for example) for the partition table, the same needs to be applied to the staging table.
    A CTAS would look something as follows:
    create table staging_table(
      col1 not null,
      col2 null,
      col3 null
    ) nologging as
    select
      some_col,
      some_other_column,
      third_column
    from some_other_data2. The next step is to add the required indexes to the staging table - as that table needs to match the structure of the partitioned table. So the staging table needs to have the same index structures as local partition indexes of the partition table.
    3. The actual partition exchange can now happen. The data is not actually exchanged. Ownership of the data changes. The data blocks (for data and indexes) owned by the staging table, is now owned by that partition in the partition table. Likewise the staging table now owns the data and indexes of the partition.
    4. The last step is cleaning up - dropping and purging the staging table (assuming that you no longer have a need for it).
    The above steps can be fully automated (for any partition table) by developing a generic PL/SQL interface library that performs these steps. Additional features such as parallel processing and tablespaces to use for the staging table and indexes can also considered for such a PL/SQL interface.

  • How to use Oracle partitioning with JPA @OneToOne reference?

    Hi!
    A little bit late in the project we have realized that we need to use Oracle partitioning both for performance and admin of the data. (Partitioning by range (month) and after a year we will move the oldest month of data to an archive db)
    We have an object model with an main/root entity "Trans" with @OneToMany and @OneToOne relationships.
    How do we use Oracle partitioning on the @OneToOne relationships?
    (We'd rather not change the model as we already have millions of rows in the db.)
    On the main entity "Trans" we use: partition by range (month) on a date column.
    And on all @OneToMany we use: partition by reference (as they have a primary-foreign key relationship).
    But for the @OneToOne key for the referenced object, the key is placed in the main/source object as the example below:
    @Entity
    public class Employee {
    @Id
    @Column(name="EMP_ID")
    private long id;
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ADDRESS_ID")
    private Address address;
    EMPLOYEE (table)
    EMP_ID FIRSTNAME LASTNAME SALARY ADDRESS_ID
    1 Bob Way 50000 6
    2 Sarah Smith 60000 7
    ADDRESS (table)
    ADDRESS_ID STREET CITY PROVINCE COUNTRY P_CODE
    6 17 Bank St Ottawa ON Canada K2H7Z5
    7 22 Main St Toronto ON Canada     L5H2D5
    From the Oracle documentation: "Reference partitioning allows the partitioning of two tables related to one another by referential constraints. The partitioning key is resolved through an existing parent-child relationship, enforced by enabled and active primary key and foreign key constraints."
    How can we use "partition by reference" on @OneToOne relationsships or are there other solutions?
    Thanks for any advice.
    /Mats

    Crospost! How to use Oracle partitioning with JPA @OneToOne reference?

  • ORA-02266: unique/primary keys - error while using Exchange Partition

    Hi All,
    While using EXCHANGE PARTITION statement as given below,
    ALTER TABLE SOURCE_TABLE EXCHANGE PARTITION PRT_EXCG_PRTN WITH TABLE TARGET_TABLE
    we are getting this error,
    ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    However, there are no tables have foreign keys referring this TARGET_TABLE, we checked this by referring
    USER_CONSTRAINTS table, it has only primary key and NOT NULL constraints.
    SELECT * FROM USER_CONSTRAINTS WHERE TABLE_NAME like 'TARGET_TABLE';
    We are using the following version,
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE     9.2.0.6.0     Production
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    Is it due to any error in our end or it could be a bug in Oracle and should we go for any patch updation ?
    Please guide us to resolve this error as soon as possible, thank you.
    Regards,
    Deva

    *** Duplicate Post ***
    Please Ignore.

  • How to use's mail's "perform mail action with message"

    I can't for the life of me figure out how to use "perform mail action with message", I basically want to create a script that get's used on a rule from Mail, but nothing I try will work.
    This is what I started with...
    tell application "Mail"
    perform mail action with message msgs for rule theRule
    end
    end
    This doesn't compile i've seen an example of it being used like this...
    using terms from application "Mail"
    perform mail action with message msgs for rule theRule
    end perform
    end using
    this also doesn't compile, so I'm not sure what it's wanting

    This is one of those annoying things about programming - you have to arrange and spell things exactly right (this gets worse if you have fat fingers). You can look at the dictionary for Mail to see the specifics - in your example you are missing an "s" at the end of the word "message":
    <pre title="this text can be pasted into the Script Editor" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 10px; padding: 5px; width: 720px; color: #000000; background-color: #E0E0E0; overflow: auto">tell application "Mail"
    perform mail action with messages msgs for rule theRule
    end tell
    </pre>

  • How to use Destination partitions in Import Manager ..?

    Hello everybody,
    I am trying to implement example given in latest MDM Import manager reference guide (page no 177). Wherein i have in source file category as
    Source___________________Destination
    Category_________________Category___Printer type__DPI
    300 DPI Laser Printers_______Printers____Laser_______300
    300 DPI Inkjet Printers_______Printers____Inkjet_______ 300
    600 DPI Dot Matrix Printers___Printers____Dot Matrix___600
    Where in destination printer type & DPI are my attributes for category printers.
    How can I make use of partition tab to achieve this????
    I m unable to get any attribute for partition under Destination Partition pane..

    Hi Anton
    Format your GM Time source as YYYY:MM:DD:HH:NN:SS:TTT (e.g. 2010:02:19:14:34:28:000). Deviations from this format seem to confuse the IM.
    HTH,
    Mark

  • Anyone know how to use Exchange Web Service API in PB Classic 12.5

    Trying to figure out how to use the api/dll's of the EWS.  I am new to web services in pb so I seem to be going nowhere fast.  If you have used it I would appreciate some guidance or better yet code/instruction on how to use/access it/setup.  I need to be able to get to exchange (in this case using an office365 test account) and read emails/calendar info etc..
    Thanks for any help..
    Dave V.

    Hi Matt,
    I find an article about Overlay a SharePoint calendar with a calendar from Exchange or SharePoint, for your reference:
    https://support.office.microsoft.com/en-us/article/Overlay-a-SharePoint-calendar-with-a-calendar-from-Exchange-or-SharePoint-4caebe59-3994-4a94-9322-b31abb8a5e9a?CorrelationId=0cba4045-24cb-4cb2-b6d6-51e4015df3a0&ui=en-US&rs=en-US&ad=US
    However, if you want to use SQL Queries and HTML, please contact to Exchange Development Team to get more professional advice.
    Best Regards,
    Allen Wang

  • How to use recovery partition for installing OS

    hello,
             i tried a lot to recover my os with lenove own button for system restore but it did't work and finaly i install OS XP Professional and manualy install all drivers. i must wanna say to lenove mangment that their this way is absolut more complicated then simply provide lenove customer backup cd with laptop. even when i call lenove help line for backup system cd then they demanded money for the cd eigther it must b free for lenove customer as lenove system restore button and partition whole typoligy seems to be total failur. If some one here plz give me advise what should i do with that partition of my hard drive which having system backup from lenove. i make 3 partition of my hdd with i did't remove that partition... so now i want to know that can i still use that partition for system restore or i should remove that partition to make my hdd space free
    Thanx 4 reading
    Mehr

    I had the same problem. I hate Lenovo. I will not buy an another lenovo in my lifetime again. I paid for the OS, then when i call customer care, they ask me for money. Guys look at Dell. I had the system for 7 yrs, i had the OS that i purchased with my laptop. I am loving Dell. Lenovo , your process is wrong. 

  • How to use RAW partition for Oracle for placing data?

    Dear all,
    I have installed Oracle on a SUN machine and use database mount point /oracle which is a UFS system.
    But now I would like to use RAW partition instead of a UFS system to place Oracle database data...
    The installation guide mentions that database mount points have to be prepared before installation, could I just use /dev/rdsk/c0t0d0s5 as database mount points after partitioning c0t0d0s5?
    I am attempting to create a tablespace in the above partition... Could any experts tell me if the above works?
    Thanks a lot!

    kwan,
    Raw partion is used to store Oracle data files and not Oracle software. Oracle home is going be in regular file system. More than one file can not share the same raw device.
    You create the raw device at the OS level using the OS command. Then create tablespace on Oracle and use the clause DATAFILE 'Raw file Name'
    Hope this helps
    Best,
    G

  • How to use oracle partition in ODI

    hi all,
    i have a oracle database with daily partition. partition syntex is tbl_abc partition(20090909), now i want to use it in interface..
    kindly tell the way...
    Regard
    Naseer

    Hi Naseer,
    How are you?
    ODI doesnt support partition. You can do a work around for that by creating a VIEW out of that partition name, reverse it in ODI and use that as a source.
    Like,
    CREATE TABLE sales_range
    (salesman_id NUMBER(5),
    salesman_name VARCHAR2(30),
    sales_amount NUMBER(10),
    sales_date DATE)
    PARTITION BY RANGE(sales_date)
    PARTITION sales_jan2000 VALUES LESS THAN(TO_DATE('02/01/2000','DD/MM/YYYY')),
    PARTITION sales_feb2000 VALUES LESS THAN(TO_DATE('03/01/2000','DD/MM/YYYY')),
    PARTITION sales_mar2000 VALUES LESS THAN(TO_DATE('04/01/2000','DD/MM/YYYY')),
    PARTITION sales_apr2000 VALUES LESS THAN(TO_DATE('05/01/2000','DD/MM/YYYY'))
    create view sales_jan200 as select * from sales_range PARTITION (sales_jan2000);
    Makes sense?
    Thanks,
    G

  • Issues in using exchange partition

    Hi,
    I have some issues. Please give me a solution friends!!!!
    I have two tables. One table (name as 'A') is partitioned another one(like table name 'B') is not partitioned but have unique index. I am going to exchange the data from B to A. That time B tables's index is moved to unusable state. Can u please help to resolve this. Is ther any option except using Alter index rebuild option.
    Thanks in advance..

    Wrong forum, this is for Oracle REST Data Services.

  • Exchange Partition Usage

    Hi,
    We store data from the main table by referring other lookup tables and store them temporarily in a Swap table and then
    in the end, we move data from here to the Main table using Exchange Partition.
    EXECUTE IMMEDIATE('ALTER TABLE TMP_SWAP EXCHANGE PARTITION PRT_TMP_SWAP WITH TABLE MAIN_TABLE');
    It is equivalent to Truncating data in the main table and insert data into it by reading from the swap table.
    Please tell me, how internally oracle handles "EXCHANGE PARTITION" implementation and how we get better performance
    instead of using TRUNCATE and INSERT, thank you.
    Regards,
    Deva

    Hi,
    It simply detaches extents/data blocks from the source table and attaches it to the destination table.
    This is the reason performance is better than INSERT statement.
    Regards
    Message was edited by:
    Citrus
    corrected a typo

  • How to accelerate by partitioning drives & how to distribute data among 'em

    Dear forum,
    I have read guide to storage acceleration and guides to phototoshop acceleration, but they always warn that the best solution depends on the work i do, the hardware i have, and the hardware i think i can afford to buy. I'm hoping that if i tell you what photoshop work i do, what hardware i have, and what hardware i'm intending to buy, you can tell me how to accelerate by partitioning my drives and how to distribute data among them. My biggest questions are about how big the volumes should be, and what should go on each volume. It sounds vague here, but I get more specific below:
    THE PHOTOSHOP WORK I DO:
    *wet-mount raw scans of 6x7 cm film using silverfast software on microtek artixscan 120tf 4000dpi scanner: resulting 16-bit TIFF file is typically 550 MB in size.
    *working in Photoshop CS2 on same file, adding multiple layers makes file 1 GB to 1.4 GB in size
    *my system's limitations show up most painfully when I OPEN a file (this can take five minutes) SAVE a file (this can take more than ten minutes!), when i FLATTEN the image's layers for printing (this can take 5 minutes), and when i CONVERT the file from 16-bit to 8-bit (this can take 5 minutes). most other operations in Ps CS2 are fast enough (not snappy, but fast enough) for me to stay with my current processor for the time being.
    THE HARDWARE I HAVE:
    *Power Mac G5 dual 1.8GHz, made in 2004, with only 4 slots for RAM (not 8 slots).
    (I'm told this has quite limited bus speed, as compared with other dual-processor G5s, and that this hardware will not benefit much at all from adding a RAID array.)
    *one internal seagate 80GB 7200rpm SATA drive. this is half-full (it has 39 GB on it): it holds my OS and my Users folder, but NOT my photoshop image files.
    *one internal Western DIgital 400 GB 7200rpm SATA drive. this holds my photoshop image files, but not my user folder.(This WD drive turns out to cause the G5 to hang up occasionally, requiring a re-boot; to avoid this, i recently learned, i can connect it with a host card adapter [see below].)
    *two 500 GB external firewire drives
    *two 300GB external USB drives
    *I have 2.25 GB of RAM, but I'm about to buy 2 more GB to max out at 4GB.
    THE HARDWARE I'M INTENDING TO BUY:
    *2GB of RAM, of course.
    *two Hitachi T7K500 500 GB SATAII HD 16MB Cache 7200rpm drives to occupy both internal drive slots in the G5
    *a 2-drive external enclosure to hold my old seagate 80GB drive and my old WD400GB drive.
    *a seritek host card adaptor for connecting the external enclosure to the G5.
    THE PLAN:
    What follows is a combination of suggestions I have received about what I could do and my speculation about how I could do it. Please see my Questions, embedded in the lines below: I'd be very grateful for any amendments or directions you can offer on this topic.
    Drive A: first newly internal Hitachi 500GB drive:
    partition into 2 volumes:
    first (faster) volume, "volume A1," of 100GB to hold OS and Users folder but NOT photoshop image files.
    (Question: how much space should I leave free on volume A1 for optimum performance? is 50% free of 100GB optimal? is 60% free of 100GB better? Is 50% free of 150GB better still? or does that cut into the other volume's space too much (indirectly cutting into the space of "volume B1" on Drive B, which is to be the WorkDisk/ScratchDisk)?
    second (slower) volume, "volume A2" of remainder GB (almost 400GB) as backup for 400GB "volume B1" of the OTHER internal Hitachi Drive, a.k.a. Drive B.
    Drive B: second newly internal Hitachi 500GB drive:
    partition into 2 volumes:
    first (faster) volume, "volume B1" of almost 400GB as designated WorkDisk/ScratchDisk for large photoshop image files;
    second (slower) partition "volume B2" (exactly 100GB) as backup for 100GB volume 1 (OS volume) of the OTHER internal Hitachi Drive, a.k.a. Drive A.
    (Question: how much space should I leave free on this WorkDisk/ScratchDisk for optimum performance? is 50% free of almost 400GB optimal? is 60% free of almost 400GB better? Is 50% free of 300GB just as good, with the additional advantage of indirectly allowing "volume A1" on Drive A to be 150+GB?
    Drive C: old Seagate 80GB drive, in external enclosure: disk designated for running the Photoshop Application? How would I set this up? any pitfalls to watch out for? should i partition this drive, or leave the whole thing for Photoshop? or is it better to run photoshop off Drive D?
    Drive D: old WD 400 GB Drive: second scratch disk? Storage disk? Both storage and scratch disk? how large should an empty volume on this disk be in order to be useful as a scratch disk? volume 1 or volume 2? if i run the Photoshop Application off of this drive, how large should the volume for that be? should it be volume 1, the faster, outside volume, leaving volume 2 for scratch disk space? or vice versa?
    External Firewire and USB drives: i guess i'll just use them for storage/archiving and extra backup? or am i much safer buying more SATAs and Enclosures? or are the external firewire and USB drives plenty safe (so long as i double-back up), since i'll only power them up for the data transfer, and then power them back down?
    Given that the large Photoshop files are not in my User folder, does it matter whether i keep the User folder (with its MS Word docs and a bunch of PDFs and so on) on my OS volume, "volume A1"? would it speed things up when I'm using photoshop if i moved the Users folder to another drive? what if i'd like to play iTunes while also working on photoshop? my iTunes music folder (with all the song data) is already on an external firewire drive. but the iTunes Library and iTunes application are, of course, in my User folder, which is on the OS drive. would moving the Users folder to another drive make much difference when i use photoshop and iTunes simultaneously?
    But I wonder whether it makes sense to be using volume A2 on Drive A as a backup drive: wouldn't it make more sense to back up my working files to two external drives that can be traded out, one on-site and one off-site, back and forth (not so convenient when one of the backup drives is internal!)? and after all, why would i devote a 400GB volume to the task of backing up another 400GB volume that will never be more than half full? I need to leave a WorkDisk/ScratchDisk half empty for efficient use, but i can back up that 200GB of working files on a 200GB volume, right? so for a backup drive, I might as well use a slow, inexpensive external USB drive that will only be tuned on for backup and will then stay powered off, a drive that's easily transportable on and off site, right? or am i misunderstanding something?
    by the way, what backup software do you recommend for backing up back and forth between Drive A and Drive B? I've been using Carbon Cpy Cloner. do you recommend that? or something that does more archiving of progressive states of data?
    Thank you for any help you can offer!
    Sincerely,
    Mark Woods
    Dual 1.8 GHz PowerPC G5 (2.2), 512 KB L2 Cache per CPU, w/ 4 RAM slots   Mac OS X (10.3.9)   2.25 GB DDR SDRAM (2x128MB plus 2x1GB)

    Crossposted: Re: How to use Oracle partitioning with JPA @OneToOne reference?

  • Oracle Exchange partition feature not working as expected?

    I used the Exchange Partition feature to swap segments between 2 tables- one Partitioned, and one Non-Partitioned. The exchange went well. However, all the data in the partitioned table has gone to the partition which stores the maxbound values.
    Any ideas if this is the default behavior or have i missed out something?
    /** actual table names changed due to client confidentiality issues */
    -- Drop the 2 intermediate tables if they already exist
    drop table ordered_inv_bkp cascade constraints ;
    drop table ordered_inv_t cascade constraints ;
    1st create a Non-Partitioned Table from ORDERED_INV and then add the primary key and unique index(s):
    create table ordered_inv_bkp as select * from ordered_inv ;
    alter table ordered_inv_bkp add constraint ordinvb_pk primary key (ordinv_id) ;
    create unique index ordinv_scinv_uix on ordered_inv_bkp(
    SCP_ID ASC,
    INV_ID ASC,
    ANATLOC_ID ASC,
    SOI_ID ASC,
    CANCEL_TS ASC );
    -- Next, we have to create a partitioned table ORDERED_INV_T with a similar
    -- structure as ORDERED_INV.
    -- This is a bit tricky, and involves a pl/sql code
    declare
    l_dt_start DATE;
    l_ptn VARCHAR2(50);
    cnt PLS_INTEGER;
    l_cnt_initial PLS_INTEGER;
    ts_name VARCHAR2(50);
    l_sql VARCHAR2(10000);
    ts_indx VARCHAR2(100);
    l_num_errors NUMBER ;
    l_num_errors_ok NUMBER ;
    l_user_name VARCHAR2(50) ;
    l_sysdate VARCHAR2(50);
    l_cnt_script PLS_INTEGER ;
    BEGIN
    SELECT COUNT(*) INTO cnt FROM user_TABLES
    WHERE TABLE_NAME='ORDERED_INV_T';
    IF cnt=0 THEN
    l_sql:= 'CREATE TABLE ORDERED_INV_T
    PARTITION BY RANGE (ORDINV_TIME)
    ( PARTITION TP_ORDINV_MAX VALUES LESS THAN (MAXVALUE)
    TABLESPACE TEST_TPT_DATA
    ENABLE ROW MOVEMENT
    AS SELECT * FROM ORDERED_INV WHERE 1=0 ';
    EXECUTE IMMEDIATE l_sql;
    -- Add section to set default values for the intermediate table OL_ORDERED_INV_T
    FOR crec_cols IN (
    SELECT u.column_name ,u.nullable, u.data_default,u.table_name
    FROM USER_TAB_COLUMNS u WHERE
    u.table_name ='ORDERED_INV' AND
    u.data_default IS NOT NULL )
    LOOP
    l_sql:= 'ALTER TABLE ORDERED_INV_T MODIFY '||crec_cols.column_name||' DEFAULT '||crec_cols.data_default;
    -- dbms_output.put_line('chk data default => ' || l_sql) ;
    EXECUTE IMMEDIATE l_sql;
    END LOOP;
    END IF;
    -- Split partition to create more partitions
    select TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS') into l_sysdate from dual;
    DBMS_OUTPUT.PUT_LINE ('Finding oldest value at ' || l_sysdate) ;
    EXECUTE IMMEDIATE 'SELECT NVL(TRUNC(MIN(OL_ORDINV_TIME),''MONTH''),TRUNC(SYSDATE,''MONTH''))
    FROM ORDERED_INV' INTO l_dt_start;
    select TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS') into l_sysdate from dual;
    DBMS_OUTPUT.PUT_LINE ('Started creating partitions at ' || l_sysdate) ;
    LOOP
    EXIT WHEN l_dt_start > ADD_MONTHS(TRUNC(SYSDATE,'MONTH'),1);
    l_ptn:='tp_ordinv_'|| TO_CHAR(l_dt_start,'YYYYMM');
    l_sql:= 'ALTER TABLE ORDERED_INV_T
    split partition TP_ORDINV_MAX at (TO_DATE('''|| TO_CHAR(ADD_MONTHS(l_dt_start,12),'YYYYMM') ||''',''YYYYMM''))
    into ( partition '||l_ptn||' , partition TP_ORDINV_MAX)';
    execute immediate l_sql;
    l_dt_start:=add_months(l_dt_start,12);
    END LOOP;
    END;
    -- Also, add indexes to this table
    alter table ORDERED_INV_T add constraint ordinvt_pk primary key (ordinv_id) ;
    create unique index ordinvt_uix on ordered_inv_t(
    SCP_ID ASC,
    INV_ID ASC,
    ANATLOC_ID ASC,
    SOI_ID ASC,
    CANCEL_TS ASC );
    -- Next, use exchange partition for actual swipe
    -- Between ordered_inv_t and ordered_inv_bkp
    -- Analyze both tables : ordered_inv_t and ordered_inv_bkp
    BEGIN
    DBMS_STATS.GATHER_TABLE_STATS(OWNNAME => 'HENRY220', TABNAME => 'ORDERED_INV_T');
    DBMS_STATS.GATHER_TABLE_STATS(OWNNAME => 'HENRY220', TABNAME =>'ORDERED_INV_BKP');
    END;
    SET TIMING ON;
    ALTER TABLE ordered_inv_t
    EXCHANGE PARTITION TP_ORDINV_MAX
    WITH TABLE ordered_inv_bkp
    WITHOUT VALIDATION
    UPDATE GLOBAL INDEXES;
    -- Check query :
    select partition_name, num_rows, high_value from user_tab_partitions where table_name = 'ORDERED_INV_T' ;
    These are the results:
    TP_ORDINV_199801 0 TO_DATE(' 1999-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_199901 0 TO_DATE(' 2000-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200001 0 TO_DATE(' 2001-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200101 0 TO_DATE(' 2002-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200201 0 TO_DATE(' 2003-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200301 0 TO_DATE(' 2004-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200401 0 TO_DATE(' 2005-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200501 0 TO_DATE(' 2006-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200601 0 TO_DATE(' 2007-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200701 0 TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200801 0 TO_DATE(' 2009-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_200901 0 TO_DATE(' 2010-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_201001 0 TO_DATE(' 2011-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_201101 0 TO_DATE(' 2012-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_201201 0 TO_DATE(' 2013-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
    TP_ORDINV_MAX 24976 MAXVALUE
    Pay attention to the last record

    >
    used the Exchange Partition feature to swap segments between 2 tables- one Partitioned, and one Non-Partitioned. The exchange went well. However, all the data in the partitioned table has gone to the partition which stores the maxbound values.
    >
    That isn't possible. The data in the partition before the exchange could only have gone to the non-partitioned table.
    Please edit you post and add \ tags on the lines before and after your code to preserve formatting. See the FAQ for details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Re: exchange partition on weekly partition

    We have divided month in 4 week partitions Week 1 start from date 2 to 8, Week2 start from 9 to 15, Week3 start from 16 to 22 and Week4 start from 23 to 1st of coming month.
    Tables has huge data (some tables size in TB). Can exchange partition will work on it or I have to change it to daily partition (with huge data)?
    Yes - exchange partition will work on it. As I said above:
    EXCHANGE PARTITION just exchanges two 'like' partitions so doesn't care what time period the partitions represent (daily, weekly, monthly, etc).
    That allows you to EXCHANGE one 'weekly' partition with a temp table.
    But you said you are loading data daily:
    We are loading data in our dataware house on daily basis from temp to stage and fact tables through insert command
    So you don't have a weeks worth of data to exchange; you have a 'days' worth of data. That can only be EXCHANGED with a partition that is intended to hold a days worth of data.
    If you are manually adding partitions to your current table then just begin manually add DAILY partitions instead of adding weekly ones. Then you can do a simple daily EXCHANGE to load the data.
    Or you could REDEFINE your existing table to use daily partitions by just defining partitions that correspond to your existing weekly ones to hold your current data and then daily partitions for your new data.
    CREATE TABLE SCOTT.PARTITION_DAILY_TEST
      ID       NUMBER(10),
      MY_DATE  DATE
    PARTITION BY RANGE (MY_DATE)
    INTERVAL( NUMTODSINTERVAL(1,'DAY'))
      PARTITION P_201204_WEEK1 VALUES LESS THAN (TO_DATE(' 2012-04-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
      PARTITION P_201204_WEEK2 VALUES LESS THAN (TO_DATE(' 2012-04-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
      PARTITION P_201204_WEEK3 VALUES LESS THAN (TO_DATE(' 2012-04-23 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
      PARTITION P_201204_WEEK4 VALUES LESS THAN (TO_DATE(' 2012-05-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
      PARTITION P_201205_WEEK1 VALUES LESS THAN (TO_DATE(' 2012-05-08 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    That table definition above defines specific partitions for existing data but tells Oracle to CREATE and USE daily partitions for new data.
    Then you can use EXCHANGE PARTITION (via a work tablel) to move data from your current table partitions to the new table partitions.

    If you are manually adding partitions to your current table then just begin manually add DAILY partitions instead of adding weekly ones. Then you can do a simple daily EXCHANGE to load the data.
    Or you could REDEFINE your existing table to use daily partitions by just defining partitions that correspond to your existing weekly ones to hold your current data and then daily partitions for your new data.
    rp0428,
    Just for confirmation can we add daily partition instead of weekly in our existing table for future data and current data will remain in weekly partition.

Maybe you are looking for

  • Audio/video delay when viewing (ex: youtube)

    whenever I try to view an online video for example on youtube or any online video lesson, there is a several second delay stammering through the whole thing. I dont have any updates needed. help?

  • Purchasing external monitor for macbook

    I am interested in purchasing an external monitor for my white 2.2 gig macbook. I would appreciate any suggestions or ideas including estimated prices. Thank you.

  • How To Launch QuickTime7 Player Instead of Browswer Plugin???

    I have some movie trailers encoded in QuickTime7 H.264, just like Apple's movie trailers that they call "HD 480p." I am trying to make these trailers launch the QuickTime standalone player, like the pro "HD" trailers on Apple's Movie Trailer site do

  • Pop Art Effect

    Could anyone please tell me if I can get the pop art effect, or download an application (the same that is found in the photo booth) or can I transport a photo from iphoto to the photo booth to get this effect onto my photo's?? Thanks Jo

  • Podcast and library questions

    1) How do I move my podcasts and library database between old and new PC's? 2) Why do Video Podcasts not play the ALL episodes when pressing PLAY the same as Audio Podcasts? {Content against terms of use removed by host. Technical questions left. Tit