Keeping stats up to date for partitioned tables

Hi,
Oracle version 10.2.0.4
I have a partioned table. I would like to keep stats up-to-date.
Can I just run a single command to update table stats, indexes and partitions please?
exec dbms_stats.gather_table_stats(user, 'TABLE', cascade=>true)or I also need to run exec dbms_stats.gather_table_stats(user, 'TABLE', granularity=>partition)
thanks,
Ashok
Edited by: 902986 on 27-Oct-2012 11:06
Edited by: 902986 on 27-Oct-2012 11:07

thanks
yes there were many indexes on the original non-partitioned table and I have created another table partitioned and now populating it with the data from the original table. the new table is partitioned on a date range column for all years before 2012, then for 2012, 2013 and so forth.
the indexes are all created locally bar a unique index (as per original table), created globally to enforce uniqueness across the table itself. the search will always look to year to date say 1st jan 2012 tilll today for risk analysis. the partition is on that date column and there is also a local index on that date column as well, to avoid table scan (tested with disabling that index, predictably did table scan and was less efficient).
in a DW environment, I don't see much value in having global index bar for primary key/unique constraint. I do realise that if the query crosses more than one partition, say 2 partitions, there will be two b-tree local index scans rather than one, but that would be rare (from the way they query the table).
therefore my plan is to perform a full table stats with cascade=>true and measure the time it takes and plan to do the same if the maintenance window allows it.
thanks again for your help
Edited by: 902986 on 28-Oct-2012 13:24

Similar Messages

  • Auto stats gathering for partitioned table

    Hi,
    We are in 10gR2 in sun solaris. We are using auto stats gathering for our DB. Here is my question,
    i know oracle gather statistics of the table, if the table changes more than 10%. How this work out for partitioned table? If the partition table changes more than 10% will last partition analyzed or the full table. We have partitioned based on insertion date.
    Appreciate your responds.
    Regards,
    Satheesh Shanmugam
    http://borndba.com

    I hope it will be only current partition which has teh stale statistics will be gathered the stastics instead of full table.
    Anil Malkai

  • How to delete the data from partition table

    Hi all,
    Am very new to partition concepts in oracle..
    here my question is how to delete the data from partition table.
    is the below query will work ?
    delete from table1 partition (P_2008_1212)
    we have define range partition ...
    or help me how to delete the data from partition table.
    Thanks
    Sree

    874823 wrote:
    delete from table1 partition (P_2008_1212)This approach is wrong - as Andre pointed, this is not how partition tables should be used.
    Oracle supports different structures for data and indexes. A table can be a hash table or index organised table. It can have B+tree index. It can have bitmap indexes. It can be partitioned. Etc.
    How the table implements its structure is a physical design consideration.
    Application code should only deal with the logical data structure. How that data structure is physically implemented has no bearing on application. Does your application need to know what the indexes are and the names of the indexes,in order to use a table? Obviously not. So why then does your application need to know that the table is partitioned?
    When your application code starts referring directly to physical partitions, it needs to know HOW the table is partitioned. It needs to know WHAT partitions to use. It needs to know the names of the partitions. Etc.
    And why? All this means is increased complexity in application code as this code now needs to know and understand the physical data structure. This app code is now more complex, has more moving parts, will have more bugs, and will be more complex to maintain.
    Oracle can take an app SQL and it can determine (based on the predicates of the SQL), which partitions to use and not use for executing that SQL. All done totally transparently. The app does not need to know that the table is even partitioned.
    This is a crucial concept to understand and get right.

  • Extract DDL for Partitioned tables in Oracle 8i

    Hi
    I am currently working on an Oracle 8i database. I have a need to extract the DDL of the existing tables & indexes. Dont need a schema level DDL extract, i just need it for a couple of tables and the corresponding indexes. I am currently using PL/SQL Developer a third party tool which is okay for extracting DDL for Non Partitioned tables, but when it comes to getting the DDL for PARTITIONED tables, it doesnt give me the partition information nor the tablespace information. We dont have a license for Toad or any other tools to get the DDL's. I also dont have the export/import privs on the DB. I need a free ware that can give me the DDL for the existing partitioned tables or atleast a query that I can run against the regular DBA views, which can give me the DDL along with Storage clause, the tablespace, indexes, grants & constraints.
    Thanks in Advance
    Chandra

    I also dont have the export/import privs on the DB. I need a
    free ware that can give me the DDL for the existing
    partitioned tables or atleast a query that I can run
    against the regular DBA views, which can give me the
    DDL along with Storage clause, the tablespace,
    indexes, grants & constraints.But you (or the owner or the tables you connect with) should have export/import privs on its on tables (i.e the two tables). So use the User Views instead of DBA Views.
    USER_TABLES, USER_TAB_PARTITIONS etc

  • How to populate date & time when user enter data for custom table in sm30

    Can anyone tell me How to populate system date & time when user enter data for custom table in sm30..
      Req is
      i have custom table and using sm30 user can enter data.
    after saving date i want to update date & time in table
    Pls let me know where to write the code?
    Thanks in Advance

    You have to write the code in EVENT 01 in SE54 transaction. Go to SE54, enter your Ztable name and in the menu 'Environment-->Events'. Press 'ENTER' to go past the popup message. In the next screen, click on 'New Entries'. In the first column, enter 01 and in the next column give some name for your routine(say UPDATE_USER_DATE_TIME). Then click on the souce code icon that appears in blue at the end of the row. In the code, you need logic like below.
    FORM update_user_date_time.
      DATA: f_index LIKE sy-tabix.
      DATA: BEGIN OF l_total.
              INCLUDE STRUCTURE zztable.
      INCLUDE  STRUCTURE vimtbflags.
      DATA  END OF l_total.
      DATA: s_record TYPE zztable.
      LOOP AT total INTO l_total.
        IF l_total-vim_action = aendern OR
           l_total-vim_action = neuer_eintrag.
          MOVE-CORRESPONDING l_total TO s_record.
          s_record-zz_user = sy-uname.
          s_record-zz_date = sy-datum.
          s_record-zz_time = sy-uzeit.
          READ TABLE extract WITH KEY l_total.
          IF sy-subrc EQ 0.
            f_index = sy-tabix.
          ELSE.
            CLEAR f_index.
          ENDIF.
          MOVE-CORRESPONDING s_record TO l_total.
          MODIFY total FROM l_total.
          CHECK f_index GT 0.
          MODIFY extract INDEX f_index FROM l_total.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " UPDATE_USER_DATE_TIME
    Here ZZTABLE is the Z table and ZZ_USER, ZZ_DATE, and ZZ_TIME are the fields that are updated.

  • Where we maintain data for this Table T015W in SPRO

    Hi Gurus,
    I wanted to know that where we maintain data for this table T015W.
    This Table relates to banking.

    Hello,
           You could maintain the instruction keys in SPRO under the path
    Financial Supply Chain Management > Treasury and Risk Management > Basic Functions > SAP Business Partner for Financial Services > Settings for Financial Services > General Settings > Basic Settings > Define Instruction Keys
    Kind regards,
    Vinodh

  • SYNC(EVERY interval ) deployment for Partitioned Tables

    I am wondering if anyone has deployed the SYNC(EVERY "SYSDATE + interval") style in a Partition table environment where there is a large number of partitions but only a few the most recent 7days (lets say 30 days) have any inserts/updates. As I understand it, the SYNC(EVERY interval) creates a DBMS_SCHEDULER job for each partition and the job will submit as per the interval. We have about 5000 partitions on any given day; partitions get dropped and we add a new one for the fututre (we keep 30 days ahead).
    1. Is it possible to modify the interval in these auto created Jobs? For Partitions older thasn X days i would want to run the job every Z hours
    2. Disable the future jobs until the day required (enable 10 minutes before the partition becomes "active" -- gets data
    Regards

    Hi,
    you can read about this in the manual (http://docs.oracle.com/cd/E11882_01/text.112/e24436/csql.htm#i997677). The manual says: "Each partition of a locally partitioned index can have its own type of sync (ON COMMIT, EVERY, or MANUAL). The type of sync specified in master parameter strings applies to all index partitions unless a partition specifies its own type." So it is possible to set for each partition its own sync type. This is possible with an ALTER statement:
    ALTER INDEX index_name MODIFY PARTITION partition_name PARAMETER (paramstring)1. With the above alter you can change it
    2. You can put a partition to MANUAL and then synchronize when necessary.
    So if you know when the partition needs to change, you can change it possible with another job or procedure.
    Herald ten Dam
    http://htendam.wordpress.com

  • Partition pruning not working for partitioned table joins

    Hi,
    We are joining  4 partitioned tables on partition column & other key columns. And we are filtering the driving table on partition key. But explain plan is showing that all tables except the driving table are not partition pruning and scanning all partitions.Is there any limitation that filter condition cannot be dynamic?
    Thanks a lot in advance.
    Here are the details...
    SELECT a.pay_prd_id,
                  a.a_id,
                  a.a_evnt_no
      FROM b,
                c,
                a,
                d
    WHERE  (    a.pay_prd_id = b.pay_prd_id ---partition range all
                AND a.a_evnt_no  = b.b_evnt_no
                AND a.a_id       = b.b_id
       AND (    a.pay_prd_id = c.pay_prd_id---partition range all
            AND a.a_evnt_no  = c.c_evnt_no
            AND a.a_id       = c.c_id
       AND (    a.pay_prd_id = d.pay_prd_id---partition range all
            AND a.a_evnt_no  = d.d_evnt_no
            AND a.a_id       = d.d_id
       AND (a.pay_prd_id =  ---partition range single
               CASE '201202'
                  WHEN 'YYYYMM'
                     THEN (SELECT min(pay_prd_id)
                                      FROM pay_prd
                                     WHERE pay_prd_stat_cd = 2)
                  ELSE TO_NUMBER ('201202', '999999')
               END
    DDLs.
    create table pay_prd
    pay_prd_id number(6),
    pay_prd_stat_cd integer,
    pay_prd_stat_desc varchar2(20),
    a_last_upd_dt DATE
    insert into pay_prd
    select 201202,2,'OPEN',sysdate from dual
    union all
    select 201201,1,'CLOSE',sysdate from dual
    union all
    select 201112,1,'CLOSE',sysdate from dual
    union all
    select 201111,1,'CLOSE',sysdate from dual
    union all
    select 201110,1,'CLOSE',sysdate from dual
    union all
    select 201109,1,'CLOSE',sysdate from dual
    CREATE TABLE A
    (PAY_PRD_ID    NUMBER(6) NOT NULL,
    A_ID        NUMBER(9) NOT NULL,
    A_EVNT_NO    NUMBER(3) NOT NULL,
    A_DAYS        NUMBER(3),
    A_LAST_UPD_DT    DATE
    PARTITION BY RANGE (PAY_PRD_ID)
    INTERVAL( 1)
      PARTITION A_0001 VALUES LESS THAN (201504)
    ENABLE ROW MOVEMENT;
    ALTER TABLE A ADD CONSTRAINT A_PK PRIMARY KEY (PAY_PRD_ID,A_ID,A_EVNT_NO) USING INDEX LOCAL;
    insert into a
    select 201202,1111,1,65,sysdate from dual
    union all
    select 201202,1111,2,75,sysdate from dual
    union all
    select 201202,1111,3,85,sysdate from dual
    union all
    select 201202,1111,4,95,sysdate from dual
    CREATE TABLE B
    (PAY_PRD_ID    NUMBER(6) NOT NULL,
    B_ID        NUMBER(9) NOT NULL,
    B_EVNT_NO    NUMBER(3) NOT NULL,
    B_DAYS        NUMBER(3),
    B_LAST_UPD_DT    DATE
    PARTITION BY RANGE (PAY_PRD_ID)
    INTERVAL( 1)
      PARTITION B_0001 VALUES LESS THAN (201504)
    ENABLE ROW MOVEMENT;
    ALTER TABLE B ADD CONSTRAINT B_PK PRIMARY KEY (PAY_PRD_ID,B_ID,B_EVNT_NO) USING INDEX LOCAL;
    insert into b
    select 201202,1111,1,15,sysdate from dual
    union all
    select 201202,1111,2,25,sysdate from dual
    union all
    select 201202,1111,3,35,sysdate from dual
    union all
    select 201202,1111,4,45,sysdate from dual
    CREATE TABLE C
    (PAY_PRD_ID    NUMBER(6) NOT NULL,
    C_ID        NUMBER(9) NOT NULL,
    C_EVNT_NO    NUMBER(3) NOT NULL,
    C_DAYS        NUMBER(3),
    C_LAST_UPD_DT    DATE
    PARTITION BY RANGE (PAY_PRD_ID)
    INTERVAL( 1)
      PARTITION C_0001 VALUES LESS THAN (201504)
    ENABLE ROW MOVEMENT;
    ALTER TABLE C ADD CONSTRAINT C_PK PRIMARY KEY (PAY_PRD_ID,C_ID,C_EVNT_NO) USING INDEX LOCAL;
    insert into c
    select 201202,1111,1,33,sysdate from dual
    union all
    select 201202,1111,2,44,sysdate from dual
    union all
    select 201202,1111,3,55,sysdate from dual
    union all
    select 201202,1111,4,66,sysdate from dual
    CREATE TABLE D
    (PAY_PRD_ID    NUMBER(6) NOT NULL,
    D_ID        NUMBER(9) NOT NULL,
    D_EVNT_NO    NUMBER(3) NOT NULL,
    D_DAYS        NUMBER(3),
    D_LAST_UPD_DT    DATE
    PARTITION BY RANGE (PAY_PRD_ID)
    INTERVAL( 1)
      PARTITION D_0001 VALUES LESS THAN (201504)
    ENABLE ROW MOVEMENT;
    ALTER TABLE D ADD CONSTRAINT D_PK PRIMARY KEY (PAY_PRD_ID,D_ID,D_EVNT_NO) USING INDEX LOCAL;
    insert into c
    select 201202,1111,1,33,sysdate from dual
    union all
    select 201202,1111,2,44,sysdate from dual
    union all
    select 201202,1111,3,55,sysdate from dual
    union all
    select 201202,1111,4,66,sysdate from dual

    Below query generated from Business Objects and submitted to Database (the case statement is generated by BO). Cant we use Case/Subquery/Decode etc for the partitioned column? We are assuming that  the case causing the issue to not to dynamic partition elimination on the other joined partitioned tables (TAB_B_RPT, TAB_C_RPT).
    SELECT TAB_D_RPT.acvy_amt,
           TAB_A_RPT.itnt_typ_desc,
           TAB_A_RPT.ls_typ_desc,
           TAB_A_RPT.evnt_no,
           TAB_C_RPT.pay_prd_id,
           TAB_B_RPT.id,
           TAB_A_RPT.to_mdfy,
           TAB_A_RPT.stat_desc
      FROM TAB_D_RPT,
           TAB_C_RPT fee_rpt,
           TAB_C_RPT,
           TAB_A_RPT,
           TAB_B_RPT
    WHERE (TAB_B_RPT.id = TAB_A_RPT.id)
       AND (    TAB_A_RPT.pay_prd_id = TAB_D_RPT.pay_prd_id -- expecting Partition Range Single, but doing Partition Range ALL
            AND TAB_A_RPT.evnt_no    = TAB_D_RPT.evnt_no
            AND TAB_A_RPT.id         = TAB_D_RPT.id
       AND (    TAB_A_RPT.pay_prd_id = TAB_C_RPT.pay_prd_id -- expecting Partition Range Single, but doing Partition Range ALL
            AND TAB_A_RPT.evnt_no    = TAB_C_RPT.evnt_no
            AND TAB_A_RPT.id         = TAB_C_RPT.id
       AND (    TAB_A_RPT.pay_prd_id = fee_rpt.pay_prd_id -- expecting Partition Range Single
            AND TAB_A_RPT.evnt_no    = fee_rpt.evnt_no
            AND TAB_A_RPT.id         = fee_rpt.id
       AND (TAB_A_RPT.rwnd_ind = 'N')
       AND (TAB_A_RPT.pay_prd_id =
               CASE '201202'
                  WHEN 'YYYYMM'
                     THEN (SELECT DISTINCT pay_prd.pay_prd_id
                                      FROM pay_prd
                                     WHERE pay_prd.stat_cd = 2)
                  ELSE TO_NUMBER ('201202', '999999')
               END
    And its explain plan is...
    Plan
    SELECT STATEMENT ALL_ROWS Cost: 79 K Bytes: 641 M Cardinality: 3 M
    18 HASH JOIN Cost: 79 K Bytes: 641 M Cardinality: 3 M
    3 PART JOIN FILTER CREATE SYS.:BF0000 Cost: 7 K Bytes: 72 M Cardinality: 3 M
    2 PARTITION RANGE ALL Cost: 7 K Bytes: 72 M Cardinality: 3 M Partition #: 3 Partitions accessed #1 - #1048575
    1 TABLE ACCESS FULL TABLE TAB_D_RPT Cost: 7 K Bytes: 72 M Cardinality: 3 M Partition #: 3 Partitions accessed #1 - #1048575
    17 HASH JOIN Cost: 57 K Bytes: 182 M Cardinality: 874 K
    14 PART JOIN FILTER CREATE SYS.:BF0001 Cost: 38 K Bytes: 87 M Cardinality: 914 K
    13 HASH JOIN Cost: 38 K Bytes: 87 M Cardinality: 914 K
    6 PART JOIN FILTER CREATE SYS.:BF0002 Cost: 8 K Bytes: 17 M Cardinality: 939 K
    5 PARTITION RANGE ALL Cost: 8 K Bytes: 17 M Cardinality: 939 K Partition #: 9 Partitions accessed #1 - #1048575
    4 TABLE ACCESS FULL TABLE TAB_C_RPT Cost: 8 K Bytes: 17 M Cardinality: 939 K Partition #: 9 Partitions accessed #1 - #1048575
    12 HASH JOIN Cost: 24 K Bytes: 74 M Cardinality: 957 K
    7 INDEX FAST FULL SCAN INDEX (UNIQUE) TAB_B_RPT_PK Cost: 675 Bytes: 10 M Cardinality: 941 K
    11 PARTITION RANGE SINGLE Cost: 18 K Bytes: 65 M Cardinality: 970 K Partition #: 13 Partitions accessed #KEY(AP)
    10 TABLE ACCESS FULL TABLE TAB_A_RPT Cost: 18 K Bytes: 65 M Cardinality: 970 K Partition #: 13 Partitions accessed #KEY(AP)
    9 HASH UNIQUE Cost: 4 Bytes: 14 Cardinality: 2
    8 TABLE ACCESS FULL TABLE PAY_PRD Cost: 3 Bytes: 14 Cardinality: 2
    16 PARTITION RANGE JOIN-FILTER Cost: 8 K Bytes: 106 M Cardinality: 939 K Partition #: 17 Partitions accessed #:BF0001
    15 TABLE ACCESS FULL TABLE TAB_C_RPT Cost: 8 K Bytes: 106 M Cardinality: 939 K Partition #: 17 Partitions accessed #:BF0001
    Thanks Again.

  • CTAS using dbms_metadata.get_ddl for Partitioned table

    Hi,
    I would like to create a temporary table from a partitioned table using CTAS. I plan to use the following steps in a PL/SQL procedure:
    1. Use dbms_metadata.get_ddl to get the script
    2. Use raplace function to change the tablename to temptable
    3. execute the script to get the temp table created.
    SQL> create or replace procedure p1 as
    2 l_clob clob;
    3 str long;
    4 begin
    5 SELECT dbms_metadata.get_ddl('TABLE', 'FACT_TABLE','USER1') into l_clob FROM DUAL;
    6 dbms_output.put_line('CLOB Length:'||dbms_lob.getlength(l_clob));
    7 str:=dbms_lob.substr(l_clob,dbms_lob.getlength(l_clob),1);
    8 dbms_output.put_line('DDL:'||str);
    9 end;
    12 /
    Procedure created.
    SQL> exec p1;
    CLOB Length:73376
    DDL:
    PL/SQL procedure successfully completed.
    I cannot see the DDL at all. Please help.

    Thanks Adam. The following piece of code is supposed to do that. But, its failing because the dbms_lob.substr(l_clob,4000,4000*v_intIdx +1); is putting newline and therefore dbms_sql.parse
    is failing.
    Please advice.
    create table my_metadata(stmt_no number, ddl_stmt clob);
    CREATE OR REPLACE package USER1.genTempTable is
    procedure getDDL;
    procedure createTempTab;
    end;
    CREATE OR REPLACE package body USER1.genTempTable is
    procedure getDDL as
    Description: get a DDL from a partitioned table and change the table name
    Reference: Q: How Could I Format The Output From Dbms_metadata.Get_ddl Utility? [ID 394143.1]
    l_clob clob := empty_clob();
    str long;
    l_dummy varchar2(25);
    dbms_lob does not have any replace function; the following function is a trick to do that
    procedure lob_replace( p_lob in out clob, p_what in varchar2, p_with in varchar2 )as
    n number;
    begin
    n := dbms_lob.instr( p_lob, p_what );
    if ( nvl(n,0) > 0 )
    then
    dbms_lob.copy( p_lob,
    p_lob,
    dbms_lob.getlength(p_lob),
    n+length(p_with),
    n+length(p_what) );
    dbms_lob.write( p_lob, length(p_with), n, p_with );
    if ( length(p_what) > length(p_with) )
    then
    dbms_lob.trim( p_lob,
    dbms_lob.getlength(p_lob)-(length(p_what)-length(p_with)) );
    end if;
    end if;
    end lob_replace;
    begin
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES',false);
    DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',true);
    DBMS_METADATA.SET_TRANSFORM_PARAM (DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES',false);
    execute immediate 'truncate table my_metadata';
    -- Get DDL
    SELECT dbms_metadata.get_ddl('TABLE', 'FACT','USER1') into l_clob FROM DUAL;
    -- Insert the DDL into the metadata table
    insert into my_metadata values(1,l_clob);
    commit;
    -- Change the table name into a temporary table
    select ddl_stmt into l_clob from my_metadata where stmt_no =1 for update;
    lob_replace(l_clob,'"FACT"','"FACT_T"');
    insert into my_metadata values(2,l_clob);
    commit;
    -- execute immediate l_clob; <---- Cannot be executed in 10.2.0.5; supported in 11gR2
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'DEFAULT');
    end getDDL;
    Procedure to create temporary table
    procedure createTempTab as
    v_intCur pls_integer;
    v_intIdx pls_integer;
    v_intNumRows pls_integer;
    v_vcStmt dbms_sql.varchar2a;
    l_clob clob := empty_clob();
    l_str varchar2(4000);
    l_length number;
    l_loops number;
    begin
    select ddl_stmt into l_clob from my_metadata where stmt_no=2;
    l_length := dbms_lob.getlength(l_clob);
    l_loops := ceil(l_length/4000);
    for v_intIdx in 0..l_loops loop
    l_str:=dbms_lob.substr(l_clob,4000,4000*v_intIdx +1);
    l_str := replace(l_str,chr(10),'');
    l_str := replace(l_str,chr(13),'');
    l_str := replace(l_str,chr(9),'');
    v_vcStmt(v_intIdx) := l_str;
    end loop;
    for v_intIdx in 0..l_loops loop
    dbms_output.put_line(v_vcStmt(v_intIdx));
    end loop;
    v_intCur := dbms_sql.open_cursor;
    dbms_sql.parse(
    c => v_intCur,
    statement => v_vcStmt,
    lb => 0,
    --ub => v_intIdx,
    ub => l_loops,
    lfflg => true,
    language_flag => dbms_sql.native);
    v_intNumRows := dbms_sql.execute(v_intCur);
    dbms_sql.close_cursor(v_intCur);
    end createTempTab;
    end;
    /

  • SQL coding for partitioned tables

    Hi My tables are partitioned into 4 different partitions.. each one representing each quarter of a year.. do i need to specify the partition name in my sql query to grab the data or does oracle have the intelligence to go this partition based on my select statement..
    say q1, q2,q3,q4 table partitions and the table name is y1
    can i say
    <code> select * from y1 where date ='01/01/2005'</code>
    does this above written code takes you directly to the partition where this data is located..
    if it does how do we know that in the execution plan that it wasnot scanning the full table but rather one partition..
    thanks in advance

    have a look at the explain plan and you will see how oracle acces the partitioned table.
    All Oracle documentation can be found under
    http://otn.oracle.com/pls/db92/db92.docindex?remark=homepage
    You will probably find answer to your question under
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/toc.htm
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96533/toc.htm
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/toc.htm

  • Replication For Partitioned Table

    Well , I have a partitioned Table having partition on Date Field. Table Contains composite primary Key Date Field + Connection Id . Table Contains approx 30 Million Records.
    Now when i m goin for replication setup , created materialized view on the basis of primary key , the fast refresh process takin time approx 3 hrs for refreshing 80,000 records on LAN environment.
    Before partitioning this table the same refresh was taking only 20 Minutes.
    can any body help me out to fasten up the refresh ?

    What version of oracle are you using? What type of partitioning you are using on the table? Is the materialized view partitioned? What type of refresh mechanism are you using?(REFRESH FAST or REFRESH FORCE or REFRESH COMPLETE)? Is it ON DEMAND or ON COMMIT?

  • Select for partitioned table, will this work with sign?

    Hi,
    I have partitioned table and select for it like :
    PARTITION BY RANGE  ( "INDATE"  )
      (   PARTITION "PRT_20091201" VALUES LESS THAN (TO_DATE(' 2009-12-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')...
       SELECT COLUMN_LIST FROM TABLE1   WHERE
               ( indate >= to_date(t_indate || t_timefrom, 'mm/dd/yyyy HH24:MI:SS'))                       AND
               ( indate <= to_date(t_indate || t_timeto,   'mm/dd/yyyy HH24:MI:SS'))                        AND... so selecting all info for the given date withing specifiied time period, and I'm using >= condition on partitioned column, do you think it will work correctly getting directly to the single partition, or Oralce requires me put strictly = sign for that column, and then additioanly I can probably select time period, something like:
    SELECT COLUMN_LIST FROM TABLE1   WHERE
              ( indate = to_date(t_indate , 'mm/dd/yyyy'))                        AND
                   ( trim_to_time(indate) >= to_char(t_timefrom, ' HH24:MI:SS'))              AND
                   ( trim_to_time(indate) <= to_char( t_timeto,   ' HH24:MI:SS'))              AND... Tx all
    Tr

    trento wrote:
    Hi,
    I have partitioned table and select for it like :
    PARTITION BY RANGE  ( "INDATE"  )
    (   PARTITION "PRT_20091201" VALUES LESS THAN (TO_DATE(' 2009-12-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')...
    SELECT COLUMN_LIST FROM TABLE1   WHERE
    ( indate >= to_date(t_indate || t_timefrom, 'mm/dd/yyyy HH24:MI:SS'))                       AND
    ( indate <= to_date(t_indate || t_timeto,   'mm/dd/yyyy HH24:MI:SS'))                        AND... so selecting all info for the given date withing specifiied time period, and I'm using >= condition on partitioned column, do you think it will work correctly getting directly to the single partition, or Oralce requires me put strictly = sign for that column, and then additioanly I can probably select time period, something like:
    SELECT COLUMN_LIST FROM TABLE1   WHERE
    ( indate = to_date(t_indate , 'mm/dd/yyyy'))                        AND
    ( trim_to_time(indate) >= to_char(t_timefrom, ' HH24:MI:SS'))              AND
    ( trim_to_time(indate) <= to_char( t_timeto,   ' HH24:MI:SS'))              AND... Tx all
    TrI agree with David that the first example looked okay, but you should test to make sure. You can check individual partition contents by executing a query using the PARTITION option to specifiy a specific partition to check the values there.

  • Fastest way to import the data for big tables

    Hi friends,
    I have recently joined a billing product set up team for TELECOM giant.As part of the setup process /initial testing we need to put huge data (nearly 1.5 billion records/~200 GB size of data) in some tables. Currently i am using impdp for importing .It takes a lot of time (nearly >9 hours for loading this data).
    I have tried the below ways to import the data(All these tables are partitioned):
    1. Normal impdp (single thread i.e. parallel=1): This one takes a lot of time (>24 hours).
    2. Normal impdp but partition-wise .This one is completed in relatively less amout of time compared to the 1st method.
    3. Drop drop the indexes ,do inset append from another schema in same instance which has the data and then recreate the indexes ( total process takes ~9 hours)
    My questions to all:
    1.Is there any other way/trick in the book which I can try to put the data in less amount of time
    2.What i have observed that even if I give parallel=8 or any number ,sometimes parallel workers are spawned and sometimes not. Can someone educate me why ?
    3.How can i come to know (before running the impdp ) that my parallel clause is going to spawn the parallel workers or not. I have searched on this subject but no success as to how I will come to know this.
    I dont know what strategy to follow ,because this is a involved and repetitive task for me. Due to the above task I am not able to concentrate on other DBA tasks due to this which come to me.
    Cheers,
    Kunwar

    assuming you have a table with 3 indexes, then create a script for each index (reblace index_name_n with your index name) and start them at the same time, after the import of the table is completed
    DUMPFILE=<DUMPFILE> or NETWORK_LINK=<DBLINK>
    DIRECTORY=DATA_PUMP_DIR
    LOGFILE=<IMP_INDEX_NAME_n>
    CONTENT=ALL
    PARALLEL=1
    JOB_NAME=IMP_<INDEX_NAME_n>
    INCLUDE=TABLE_EXPORT/TABLE/INDEX:"IN('<INDEX_NAME_n>')"
    TABLES=<SCHEMA>.<TABLE>change following settings during import:
    increase pga_aggregate_target
    increase db_writer_processes
    db_block_checking=false
    db_block_checksum=false
    set undo and temp ts to autoextend
    set noarchivelogmode
    create 4GB redo logs
    hth

  • EA 4.0 - Icon for partitioned tables changed

    The icon in the tree list changed in the EA Version 4.0 to the normal table icon.
    Best will be to get an icon with a small "p" inside so that partitioned tables can be seen in the tree list.

    CREATE TABLE "ANPQUALITY"."PART_REPLICATION"
      ( "UNIQUEPART_ID"   VARCHAR2(80 BYTE) NOT NULL ENABLE,
        "IDENTIFIER_TYPE" VARCHAR2(10 BYTE) NOT NULL ENABLE,
        "DATE_CHANGED"   TIMESTAMP (6) WITH TIME ZONE,
        "TIME_STAMP"     TIMESTAMP (6) WITH TIME ZONE,
        "V_DATE_CHANGED" DATE GENERATED ALWAYS AS (TO_DATE(TO_CHAR("DATE_CHANGED",'YYYYMMDD HH24:MI:SS'),'YYYYMMDD HH24:MI:SS')) VIRTUAL VISIBLE ,
        CONSTRAINT "PART_REPLICATION_PK" PRIMARY KEY ("UNIQUEPART_ID", "IDENTIFIER_TYPE") USING INDEX PCTFREE 5 INITRANS 8 MAXTRANS 255
           COMPUTE STATISTICS STORAGE(INITIAL 104857600 NEXT 104857600 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
            BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE TRACE ENABLE)
      PCTFREE 5 PCTUSED 40 INITRANS 8 MAXTRANS 255 COMPRESS FOR OLTP STORAGE
      (BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "TRACE" LOB ("PART_DATA") STORE AS BASICFILE (
        ENABLE STORAGE IN ROW CHUNK 32768 RETENTION NOCACHE LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      PARTITION BY RANGE ("V_DATE_CHANGED") INTERVAL (NUMTOYMINTERVAL(1,'MONTH')  )
      (PARTITION "P_00" VALUES LESS THAN (TO_DATE(' 2012-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
      PCTFREE 5 PCTUSED 40 INITRANS 8 MAXTRANS 255
      STORAGE(INITIAL 104857600 NEXT 104857600 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "TRACE" LOB ("PART_DATA") STORE AS BASICFILE (
       TABLESPACE "TRACE" ENABLE STORAGE IN ROW CHUNK 32768 RETENTION NOCACHE LOGGING
         STORAGE(INITIAL 104857600 NEXT 104857600 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
         BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT))
      COMPRESS FOR OLTP

  • Error while selecting data for mara table from KOTG516 table

    Hello all,
    I am trying to select the data from mara table with respect to KOTG516 table . but i am not getting the value into t_mara table as t_kotg516-matnr is empty . but the t_kotg516 conatins the matnr value . here is the code . i am not getting where i went wrong . please help .
    TYPES: BEGIN OF Y_KOTG516,
            KAPPL TYPE KAPPL,
            KSCHL TYPE KSCHG,
            VKORG TYPE VKORG,
            VTWEG TYPE VTWEG,
            KUNAG TYPE KUNAG,
            MATNR TYPE MATNR,
            DATBI TYPE KODATBI,
          END OF Y_KOTG516.
    DATA: T_KOTG516 TYPE STANDARD TABLE OF Y_KOTG516,
          E_KOTG516 TYPE Y_KOTG516.
    TYPES: BEGIN OF Y_MARA,
            MATNR TYPE MATNR,
            MEINS TYPE MEINS,
          END OF Y_MARA.
    DATA: T_MARA TYPE STANDARD TABLE OF Y_MARA,
          E_MARA TYPE Y_MARA.
        SELECT KAPPL
               KSCHL
               VKORG
               VTWEG
               KUNAG
               MATNR
               DATBI
         FROM KOTG516
         INTO TABLE T_KOTG516
       WHERE VKORG IN S_VKOR
         AND VTWEG IN S_VTWE
         AND KUNAG IN S_KUNAG.
            IF NOT T_KOTG516[] IS NOT INITIAL
                    and SY-SUBRC EQ 0.
              SELECT MATNR
                     MEINS
                FROM MARA
                INTO TABLE T_MARA
               FOR ALL ENTRIES IN T_KOTG516
               WHERE MATNR EQ T_KOTG516-MATNR
                 AND MEINS EQ 'CS'
                  OR MEINS EQ 'IT'.
              ENDIF.
      FOR T_KOTG516 I HAVE VALUE but matnr is not getting selected from mara table as i cheked t_kotg516-mara is empty . i cant use with header line . please advise .
    Regards

    hi,
    SELECT KAPPL
                 KSCHL
                  VKORG
                 VTWEG
                KUNAG
               MATNR
                DATBI
               FROM KOTG516
              INTO TABLE T_KOTG516
              WHERE VKORG IN S_VKOR
               AND VTWEG IN S_VTWE
                 AND KUNAG IN S_KUNAG.
    if sy-subrc = 0 .
    SELECT MATNR
    MEINS
    FROM MARA
    INTO TABLE T_MARA
    FOR ALL ENTRIES IN T_KOTG516
    WHERE MATNR EQ T_KOTG516-MATNR
    AND MEINS EQ 'CS'
    OR MEINS EQ 'IT'.
    ENDIF.
    regards
    deepak .

Maybe you are looking for

  • Display a long text of service order header in xMAM PDA version

    Hi, I am wondering if you can tell me how long or many digits the long text of the service order header can be displayed in the PDA? or is there any restriction e.g. max 256 digits for the long text? Thank you Minh Tri

  • Where to buy hard drive

    I have an hp pavilion dv6305us notebook. I am going to have to replace the hard drive. Could someone e mail me @ [email removed for privacy] with ideas on where I can buy a new, yet affordable HDD from a repetable company.

  • Best way to import

    If I am importing pics from a card, would it be faster to copy the files to the hard drive on my laptop then import the folder to LR with a duplicate in the backup folder or can you do all this at once?  While out of town I am planning on keepint the

  • IPod contents not showing after connection to 2nd Mac

    I sync my iPod with my home computer with no problem. I bring it to work and just connect it to my work computer and it sees it as a volume on the desktop and in iTunes, but when I unmount and go to use it, the iPod the contents are gone. I know ever

  • How can I disable SAP XI user authentication?

    Hi I am sending a soap from a external program, but it doesn't support input of user id and password. Is there a way to disable the user authentication on the sender SOAP adapter? Or is there a way of sending the logon data in the request or in the u