Indexes on a partitioned table

hi experts.... which data dict view shows that an index on a partitioned table is,
a Local Index or
a Global Index or
a Global Partitioned Index?

Hi,
LOCALITY column tells whether it is LOCAL or GLOBAL.
See the link for more details.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2015.htm#REFRN20156
Regards,

Similar Messages

  • Creating a bit map index on a partitioned table

    Dear friends,
    I am trying to create a bitmap index on a partitioned table but am receiving the following ORA error. Can you please let me know on how to create a local bit map index as the message suggests?
    ERROR at line 1:
    ORA-25122: Only LOCAL bitmap indexes are permitted on partitioned tables
    Trying to use the keyword local in front leads to wrong syntax.
    Thanks in advance !!
    Somnath

    ORA-25122 Only LOCAL bitmap indexes are permitted on partitioned tables
    Cause: An attempt was made to create a global bitmap index on a partitioned table.
    Action: Create a local bitmap index instead
    Example of a Local Index Creation
    CREATE INDEX employees_local_idx ON employees (employee_id) LOCAL;
    Example is about btree and I think it will work for bitmap also.

  • Non-Partitioned Global Index on Range-Partitioned Table.

    Hi All,
    Is it possible to create Non-Partitioned Global Index on Range-Partitioned Table?
    We have 4 indexes on CS_BILLING range-partitioned table, in which one is CBS_CLIENT_CODE(*local partitioned index*) and others are unknown types of index to me??
    Means other 3 indexes are what type indexes ...either non-partitioned global index OR non-partitioned normal index??
    Also if we create index as :(create index i_name on t_name(c_name)) By default it will create Global index. Please correct me......
    Please help me in identifying other 3 indexes types by referring below ouputs!!!
    select INDEX_NAME,TABLE_NAME,PARTITIONING_TYPE,LOCALITY from dba_part_indexes where TABLE_NAME='CS_BILLING';
    INDEX_NAME TABLE_NAME PARTITI LOCALI
    CSB_CLIENT_CODE CS_BILLING RANGE LOCAL
    select index_name,index_type,table_name,table_type,PARTITIONED from dba_indexes where table_name='CS_BILLING';
    INDEX_NAME INDEX_TYPE TABLE_NAME TABLE_TYPE PAR
    CSB_CREATE_DATE NORMAL CS_BILLING TABLE NO
    CSB_SUBMIT_ORDER NORMAL CS_BILLING TABLE NO
    CSB_CLIENT_CODE NORMAL CS_BILLING TABLE YES
    CSB_ORDER_NBR NORMAL CS_BILLING TABLE NO
    select INDEX_OWNER,INDEX_NAME,TABLE_NAME,COLUMN_NAME from dba_ind_columns where TABLE_NAME='CS_BILLING';
    INDEX_OWNER INDEX_NAME TABLE_NAME COLUMN_NAME
    RPADMIN CSB_CREATE_DATE CS_BILLING CREATE_DATE
    RPADMIN CSB_SUBMIT_ORDER CS_BILLING SUBMIT_TO_INVOICE
    RPADMIN CSB_SUBMIT_ORDER CS_BILLING ORDER_NBR
    RPADMIN CSB_CLIENT_CODE CS_BILLING CLIENT_CODE
    RPADMIN CSB_ORDER_NBR CS_BILLING ORDER_NBR
    select dip.index_name, dpi.locality, dip.partition_name, dip.status
    from dba_part_indexes dpi, dba_ind_partitions dip
    where dpi.table_name ='CS_BILLING'
    and dpi.index_name = dip.index_name;
    INDEX_NAME LOCALI PARTITION_NAME STATUS
    CSB_CLIENT_CODE LOCAL CSB_2006_4Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2006_3Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2007_1Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2007_2Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2007_3Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2007_4Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2008_1Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2008_2Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2008_3Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2008_4Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2009_1Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2009_2Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2009_3Q USABLE
    CSB_CLIENT_CODE LOCAL CSB_2009_4Q USABLE
    select * from dba_part_indexes
    where table_name ='CS_BILLING'
    and locality = 'GLOBAL';
    no rows selected
    -Yasser
    Edited by: YasserRACDBA on Mar 5, 2009 11:45 PM

    Yaseer,
    Is it possible to create Non-Partitioned and Global Index on Range-Partitioned Table?
    Yes
    We have 4 indexes on CS_BILLING range-partitioned table, in which one is CBS_CLIENT_CODE(*local partitioned index*) and others are unknown types of index to me??
    Means other 3 indexes are what type indexes ...either non-partitioned global index OR non-partitioned normal index??
    You got local index and 3 non-partitioned "NORMAL" b-tree tyep indexes
    Also if we create index as :(create index i_name on t_name(c_name)) By default it will create Global index. Please correct me......
    Above staement will create non-partitioned index
    Here is an example of creating global partitioned indexes
    CREATE INDEX month_ix ON sales(sales_month)
       GLOBAL PARTITION BY RANGE(sales_month)
          (PARTITION pm1_ix VALUES LESS THAN (2)
           PARTITION pm2_ix VALUES LESS THAN (3)
           PARTITION pm3_ix VALUES LESS THAN (4)
            PARTITION pm12_ix VALUES LESS THAN (MAXVALUE));Regards

  • Domain index on list-partitioned table?

    Hi,
    I have a list-partitioned table, and wanted to create a partitioned Oracle Text index on it. I keep getting an error, and am now wondering if it's possible to do. Here is my syntax:
    CREATE INDEX SCHEMA1.IDX_ALL_TEXT_LOCAL ON SCHEMA1.TABLE1(ALL_TEXT)
    INDEXTYPE IS CTXSYS.CONTEXT
    LOCAL
    (PARTITION PTN1 PARAMETERS('sync (on commit) storage ptn1'),
    PARTITION PTN2 PARAMETERS('sync (on commit) storage ptn2'),
    PARTITION PTN3 PARAMETERS('sync (on commit) storage ptn3'),
    PARTITION PTN4 PARAMETERS('sync (on commit) storage ptn4'),
    PARTITION PTN5 PARAMETERS('sync (on commit) storage ptn5'),
    PARTITION PTN6 PARAMETERS('sync (on commit) storage ptn6'),
    PARTITION PTN7 PARAMETERS('sync (on commit) storage ptn7'),
    PARTITION PTN8 PARAMETERS('sync (on commit) storage ptn8')
    PARAMETERS('section group my_group lexer new_lexer');
    ERROR at line 1:
    ORA-29850: invalid option for creation of domain indexes
    Any advice would be much appreciated.
    Thanks,
    Nora

    ... will it spread the index across the tablespaces that are associated with each partition?No, as demonstrated below.
    SCOTT@orcl_11gR2> CREATE TABLE table1
      2       ( id         NUMBER(6),
      3         all_text      VARCHAR2 (20)
      4       )
      5  PARTITION BY LIST (id)
      6   (PARTITION ptn1 VALUES (2,4) TABLESPACE example,
      7    PARTITION ptn2 VALUES (3,9) TABLESPACE example
      8   )
      9  /
    Table created.
    SCOTT@orcl_11gR2> INSERT ALL
      2  INTO table1 VALUES (2, 'test2')
      3  INTO table1 VALUES (3, 'test3')
      4  INTO table1 VALUES (4, 'test4')
      5  INTO table1 VALUES (9, 'test9')
      6  SELECT * FROM DUAL
      7  /
    4 rows created.
    SCOTT@orcl_11gR2> CREATE INDEX IDX_ALL_TEXT_LOCAL
      2  ON TABLE1 (ALL_TEXT)
      3  INDEXTYPE IS CTXSYS.CONTEXT
      4  /
    Index created.
    SCOTT@orcl_11gR2> SELECT table_name, tablespace_name
      2  FROM   user_tab_partitions
      3  WHERE  table_name = 'TABLE1'
      4  /
    TABLE_NAME                     TABLESPACE_NAME
    TABLE1                         EXAMPLE
    TABLE1                         EXAMPLE
    2 rows selected.
    SCOTT@orcl_11gR2> SELECT table_name, tablespace_name
      2  FROM   user_tables
      3  WHERE  table_name LIKE '%IDX_ALL_TEXT_LOCAL%'
      4  /
    TABLE_NAME                     TABLESPACE_NAME
    DR$IDX_ALL_TEXT_LOCAL$I        USERS
    DR$IDX_ALL_TEXT_LOCAL$R        USERS
    DR$IDX_ALL_TEXT_LOCAL$N
    DR$IDX_ALL_TEXT_LOCAL$K
    4 rows selected.
    SCOTT@orcl_11gR2>

  • Creating index on large partitioned table

    Is anyone aware of a method for telling how far along is the creation of an index on a large partitioned table? The statement I am executing is like this:
    CREATE INDEX "owner"."new_index"
    ON "owner"."mytable"(col_1, col_2, col_3, col_4)
    PARALLEL 8 NOLOGGING ONLINE LOCAL;
    This is a two-node RAC system on Windows 2003 x64, using ASM. There are more than 500,000,000 rows in the table, and I'd estimate that each row is about 600-1000 bytes in size.
    Thank you.

    you can know the progress from v$session_longops.
    select
    substr(SID ||','||SERIAL# ,1,8) "sid,srl#",
    substr(OPNAME ||'>'||TARGET,1,50) op_target,
    substr(trunc(SOFAR/TOTALWORK*100)||'%',1,5) progress,
    TIME_REMAINING rem,
    ELAPSED_SECONDS elapsed
    from v$session_longops
    where SOFAR!=TOTALWORK
    order by sid;
    hth

  • Indexing on a Partitioned Table

    Hi, Everybody,
    I have already an partitioned table which has 8 partitions. I have indexes also on this partitiioned table. I have created the partioned indexes. It is partitioned by range. I have now added 3 more partitions and inserted data into the 3 new partitions.
    Now my question is :
    1. Can i create indexes only on the new partitions? What is the syntax?
    2. Or should i drop all the indexes and create new indexes for all the partitions again?
    Thanks in advance...
    Regards

    Can i create indexes only on the new partitions? I give up. Can you?
    What is the syntax?http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5010.htm#sthref6509
    Or should i drop all the indexes and create new indexes for all the partitions again?What would be gained by doing so?

  • Creating Local partitioned index on Range-Partitioned table.

    Hi All,
    Database Version: Oracle 8i
    OS Platform: Solaris
    I need to create Local-Partitioned index on a column in Range-Partitioned table having 8 million records, is there any way to perform it in fastest way.
    I think we can use Nologging, Parallel, Unrecoverable options.
    But while considering Undo and Redo also mainly time required to perform this activity....Which is the best method ?
    Please guide me to perform it in fastest way and also online !!!
    -Yasser

    YasserRACDBA wrote:
    3. CREATE INDEX CSB_CLIENT_CODE ON CS_BILLING (CLIENT_CODE) LOCAL
    NOLOGGING PARALLEL (DEGREE 14) online;
    4. Analyze the table with cascade option.
    Do you think this is the only method to perform operation in fastest way? As table contain 8 million records and its production database.Yasser,
    if all partitions should go to the same tablespace then you don't need to specify it for each partition.
    In addition you could use the "COMPUTE STATISTICS" clause then you don't need to analyze, if you want to do it only because of the added index.
    If you want to do it separately, then analyze only the index. Of course, if you want to analyze the table, too, your approach is fine.
    So this is how the statement could look like:
    CREATE INDEX CSB_CLIENT_CODE ON CS_BILLING (CLIENT_CODE) TABLESPACE CS_BILLING LOCAL NOLOGGING PARALLEL (DEGREE 14) ONLINE COMPUTE STATISTICS;
    If this operation exceeds particular time window....can i kill the process?...What worst will happen if i kill this process?Killing an ONLINE operation is a bit of a mess... You're already quite on the edge (parallel, online, possibly compute statistics) with this statement. The ONLINE operation creates an IOT table to record the changes to the underlying table during the build operation. All these things need to be cleaned up if the operation fails or the process dies/gets killed. This cleanup is supposed to be performed by the SMON process if I remember correctly. I remember that I once ran into trouble in 8i after such an operation failed, may be I got even an ORA-00600 when I tried to access the table afterwards.
    It's not unlikely that your 8.1.7.2 makes your worries with this kind of statement, so be prepared.
    How much time it may take? (Just to be on safer side)The time it takes to scan the whole table (if the information can't read from another index), the sorting operation, plus writing the segment, plus any wait time due to concurrent DML / locks, plus the time to process the table that holds the changes that were done to the table while building the index.
    You can try to run an EXPLAIN PLAN on your create index statement which will give you a cost indication if you're using the cost based optimizer.
    Please suggest me if any other way exists to perform in fastest way.Since you will need to sort 8 million rows, if you have sufficient memory you could bump up the SORT_AREA_SIZE for your session temporarily to sort as much as possible in RAM.
    -- Use e.g. 100000000 to allow a 100M SORT_AREA_SIZE
    ALTER SESSION SET SORT_AREA_SIZE = <something_large>;
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • BUG ? Create index on a partitioned table drops the complete table !

    Hi ...
    now i had twice the problem when i tried to create a local index (with 2 fields) on a partitioned table .
    I set initrans to 1 and maxtrans to 255 (i know - initrans has to be at least 2).
    I got an error - and the table (including the data) was gone ... :-((
    Has anybody the same behavior and is it a bug ??
    Christian

    See 1.5 Bad bug when creating index fails.
    Have fun,
    K.

  • How to create index on specific partition table?

    Hi Experts,
    we created 4 partitions on table .
    Table Name : test
    partitions : Test_prt1
                       Test_prt2
                       Test_prt3
                      Test_prt4
    Our requiremnt  create the index on specific partition (ex : Test_prt2) only.

    Creating Partitioned Tables and Indexes
    http://technet.microsoft.com/en-us/library/ms187526(v=sql.105).aspx
    you can create a aligned index, the index will be spread over the filegroups
    Create NonClustered Index IX_orders_aligned
    On dbo.orders(order_id)
    On test_monthlyDateRange_ps(orderDate);
    OR
    Unaligned parition, you can create index on any filegroups
    Create NonClustered Index IX_orders_unpartitioned
    On dbo.orders(order_id)
    On [Test_prt2_FileGroup];
    For more information refer the below link
    http://sqlfool.com/2008/12/indexing-for-partitioned-tables/
    Or
    You can try Creating a filtered index (I've not tried it though)
    http://www.mssqltips.com/sqlservertip/1785/sql-server-filtered-indexes-what-they-are-how-to-use-and-performance-advantages/
    --Prashanth

  • HOW TO CREATE LOCAL INDEX ON BIG PARTITION TABLE

    Dear All,
    I have one big table 450GB stored on 9 partitions and same partitions I have created for the index. Now the problem is when i am trying to create local index it took one and half day and is still going on...
    is there any shortest way to create local index on this table easily.
    Database version is 11.2.0.1.0
    INDEX SCRIPT IS
    CREATE INDEX INDEX_SPACE0_IX_LOCAL ON FINANCE (END_TIME)
    INITRANS 2 MAXTRANS
    255
    LOCAL ( PARTITION INDEX_SPACE01
    LOGGING
    NOCOMPRESS
    TABLESPACE INDEX_SPACE01
    PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS
    2147483645 BUFFER_POOL
    DEFAULT), PARTITION INDEX_SPACE02
    LOGGING
    NOCOMPRESS
    TABLESPACE INDEX_SPACE02 PCTFREE
    5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS
    2147483645 BUFFER_POOL DEFAULT),
    PARTITION INDEX_SPACE03
    LOGGING
    NOCOMPRESS
    TABLESPACE
    INDEX_SPACE03
    PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS
    2147483645 BUFFER_POOL DEFAULT),
    PARTITION INDEX_SPACE04
    LOGGING
    NOCOMPRESS
    TABLESPACE
    INDEX_SPACE04 PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS
    1 MAXEXTENTS
    2147483645 BUFFER_POOL DEFAULT),
    PARTITION INDEX_SPACE05
    LOGGING
    NOCOMPRESS
    TABLESPACE
    INDEX_SPACE05 PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS
    1 MAXEXTENTS 2147483645 BUFFER_POOL DEFAULT),
    PARTITION INDEX_SPACE06
    LOGGING
    NOCOMPRESS
    TABLESPACE INDEX_SPACE06 PCTFREE 5 INITRANS 2
    MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL
    DEFAULT),
    PARTITION INDEX_SPACE07
    LOGGING
    NOCOMPRESS
    TABLESPACE INDEX_SPACE07 PCTFREE
    5 INITRANS 2
    MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL
    DEFAULT),
    PARTITION INDEX_SPACE08
    LOGGING
    NOCOMPRESS
    TABLESPACE INDEX_SPACE08 PCTFREE
    5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS
    2147483645
    BUFFER_POOL DEFAULT),
    PARTITION INDEX_SPACE09
    LOGGING
    NOCOMPRESS
    TABLESPACE
    INDEX_SPACE09 PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS
    1 MAXEXTENTS 2147483645 BUFFER_POOL
    DEFAULT))
    NOPARALLEL;
    Thanks in advance......
    Thanks,
    Edited by: sherkhan on Aug 24, 2011 3:36 AM
    Edited by: sherkhan on Aug 24, 2011 3:49 AM

    Have you verified that 'n' Index partition segments have got created so far ? (they would apepar as TEMPORARY segments only till the full index creation is completed). Have you monitored the session statistics and waits and confirmed that it is not waiting on something horrible ?
    A CREATE INDEX can well be NOLOGGING instead of LOGGING. It could also use PARALLEL but I always recommend setting it back to NOPARALLEL immediately after the CREATE is completed.
    You can also "quickly" build an empty index and then gradually create (i.e. build) each partition
    CREATE INDEX INDEX_SPACE0_IX_LOCAL  .........  UNUSABLE ;
    ALTER INDEX INDEX_SPACE0_IX_LOCAL REBUILD PARTITION PARTITION INDEX_SPACE01;
    ALTER INDEX INDEX_SPACE0_IX_LOCAL REBUILD PARTITION PARTITION INDEX_SPACE02;
    ...Hemant K Chitale

  • Can I create unpartitioned index on partitioned table??

    Hi,
    I am not clear about the concepts of partitioned and non partitioned index.I was under impression that If we create a index on partitioned table it will be automatically becomes a partitioned index.But I cheked in my DB there are many unpartitioned indexes on large partitioned tables.
    Which one of these is efficient? wht is the concept of local and global related to these partitioned and unparitioned.I am bit confused.pls help me.
    Thanks

    There's nothing prevent you from creating a nonpartitioned index on partitioned table. The official name for it is Global Nonpartitioned Indexes
    Global Nonpartitioned Indexes
    Global nonpartitioned indexes behave just like a nonpartitioned index. They are commonly used in OLTP environments and offer efficient access to any individual record.
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/partconc.htm#i461446

  • Bitmap Join Index on Partitioned Table

    Are there any restrictions on creating a bitmap join index on a partition table (I think that the bitmap indexes can only be created as local on partitioned tables)?
    Thanks in advance
    Murthy.

    Fair enough. I've included a cut-down set of SQL below.
    CREATE TABLE DIMENSION_DATE
    DATE_ID NUMBER,
    CALENDAR_DATE DATE,
    CONSTRAINT DATE_ID
    PRIMARY KEY
    (DATE_ID)
    CREATE UNIQUE INDEX DATE_I1 ON DIMENSION_DATE
    (CALENDAR_DATE, DATE_ID);
    CREATE TABLE ORDER_F
    ORDER_ID VARCHAR2(40 BYTE),
    SUBMITTEDDATE_FK NUMBER,
    COMPLETEDDATE_FK NUMBER,
    -- Then I add the first bitmap index, which works:
    CREATE BITMAP INDEX SUBMITTEDDATE_FK ON ORDER_F
    (DIMENSION_DATE.DATE_ID)
    FROM ORDER_F, DIMENSION_DATE
    WHERE ORDER_F.SUBMITTEDDATE_FK = DIMENSION_DATE.DATE_ID;
    -- Then attempt the next one:
    CREATE BITMAP INDEX completeddate_fk
    ON ORDER_F(b.date_id)
    FROM ORDER_F, DIMENSION_DATE b
    WHERE ORDER_F.completeddate_fk = b.date_id;
    -- which results in:
    -- ORA-01408: such column list already indexed

  • Indexing on partitioned tables

    I was wondering if there are any good standards for indexing very large partitioned tables (i.e. what should I index). Also, if there are any good standards for indexing these partitioned tables when running queries that do not include the partitioned column in the query?

    There's no real difference in what you would index, other than maybe a slightly lower requirement for indexing on tha partitioning key column(s).
    You ought to be considering whether you need local or global indexes though, and you'll find a lot of information on that over at http://asktom.oracle.com and in the documentation -- to simplify, OLTP usually uses global indexes and DWH usually uses local indexes. You'll want to understand the pro's and con's or each before deciding on your own situation though.

  • Partition an Non Partition Table in 11.2.0.1

    Hi Friends,
    I am using Oracle 11.2.0.1 Oracle Database.
    I have a table with 10 Million records and it's a Non Partitioned Table.
    1) I would like to partition the table (with partition by range ) without creating new table . I should do it in the existing table itself (not sure DBMS_REDEFINITION is the only option ) (or) can i use alter table ...?
    2) Add one partition which will have data for the unspecified range.
    Please let me know the inputs on the above
    Regards,
    DB

    Hi,
    what is the advantage of using DBMS_REDEFINITION over normal method (create partition table,grant access,insert records)You can't just add a partition in a non-partitioned table. You need to recreate existing table to have it partitioned (you can't just start adding new partitions to existing non-partitioned table). Advantage of dbms_redefinition is that it is online operation to re-create an existing table and and your data always remains available during table recreation
    I would like to know how to copy the object privileges,constraints,indexes from Non Partitioned table (sales) to Partitioned table (sales_part) which i am creating. will >DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS help on this?First you need to tell us what method you are using to partition an existing table? If you are using dbms_redifiniiton, you really don't need to worry about triggers, indexex or constraints at all. Just follow any document which explains how to use dbms_redifinition. Dr. Tim has done a lot of work for dummys like us by writing documents for us. Follow this document.
    http://www.oracle-base.com/articles/misc/partitioning-an-existing-table.php
    If so can i use DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS alone for copying the table dependents alone after i create partition table (or) it should be used along with >DBMS_REDEFINITION.START_REDEF_TABLE only?See above document which i mentioned.
    Salman

  • PARTITION TABLE 이란?

    제품 : ORACLE SERVER
    작성날짜 : 2004-08-13
    PARTITION TABLE 이란?
    =====================
    PURPOSE
    partition table에 대한 기본 개념입니다.
    SCOPE
    8~10g Standard Edition 에서는 Partitioning Option 은 지원하지 않습니다.
    Explanation
    ORACLE 8에서 제공하는 partition table 에 대해 알아보자.
    1. Partitioned Table이란?
    partitioning 이란 큰 object 를 작고 manage 가 가능하게 분리하는 것을 의미하며,
    table 이나 index 에서만 가능하고 cluster, snapshot 은 불가능하다.
    각 partition 은 별개의 segment 에 저장되어진다.
    Oracle8에서 table 은 기본이 되는 key value 에 의해 partition 으로 분리되어진다.
    각 partition은 독립적으로 운영된다.
    예를 들어 table partition 은 DML (insert, update, delete) 문에 의한
    transaction 을 다른 partition 에 영향을 주지 않고 복구가 가능하다.
    DBA_TAB_PARTITIONS 에 각 partition 의 storage 정보 등을 갖는다.
    2. 어떻게 partitioned Table을 생성하는가 ?
    partition key(s)와 개개의 partition 에 범위를 주어 생성한다.
    이 partition 이름은 주어질 수 있으며 만일 생략되면 ORACLE 이 SYS_Pn 으로
    generate 한다.
    예제 :
    emp partition 을 EMPNO column을 partition key 로 하여 생성해 보자.
    CREATE TABLE emp
    (EMPNO NUMBER(5),
    PARTITION BY RANGE(EMPNO)(
    partition emp_p1 VALUES LESS THAN (2000),
    partition emp_p2 VALUES LESS THAN (4000),
    partition emp_p3 VALUES LESS THAN (MAXVALUE));
    select * from emp partition (emp_p3);
    ACCT_NO PERSON SALES_AMOUNT WEEK_NO
    1000 abc 10 30
    insert into emp partition (emp_p3) values (7000, 'bcd', 10, 30);
    3. partition table 관련한 dictionary 정보
    . storage parameters
    --> DBA_TAB_PARTITIONS
    . partiton table 의 upper partition bound
    --> select high_value, partition_position from sys.dba_tab_partitions
    where table_name = 'SALES';
    4. Partitioned tables의 제약점은?
    a) Datatype 제약
    Partitioned table은 LONG 이나 LONG RAW datatype을 가질 수 없다.
    또한 LOB datatypes (BLOB, CLOB, NCLOB, or BFILE), object types을 가질 수
    없다. 이 LOB type 은 V8.1부터는 가능할 것으로 기대된다.
    b) Clusters 는 partition 될 수 없다.
    c) Bitmap 제한
    bitmap 은 local partitioned table 에서만 가능하고 global indexes 로는
    불가능하다.
    d) Physical 제한
    Partitioned table은 여러 개의 database에 걸쳐 있을 수 없다.
    오직 1 instance 에서만 가능하다.
    5. Local Prefixed와 Local Non-Prefixed index란?
    Local index란 partitioned table 의 index로 이는 오로지 한 partition 의
    row들을 나타내는 ROWID 를 갖는 index 이다.
    이는 주로 partition table 의 partition key 로 사용되어진다.
    이를 equi-partitioning 이라 한다.
    Prefixed index는 partition key 에 대응하는 leading index key(s) 이다.
    Non-Prefixed index 는 leading column 이 되는 partition key 를 포함하지 않는
    index key 이다.
    6. Global index란?
    global index 는 prefix 만 제공하며 non-prefix 는 제공하지 않는다.
    global Index 는 전체 table 의 ROWID 처럼 사용되어진다.
    7. partitions을 사용하는 방법?
    Partition-Extended Table Name을 사용한다.
    즉 "schema.table PARTITION part_name" 를 사용하는데 schema 는 schema owner
    이고 table은 base table 이름이며, PARTITION 은 써도 되고 안 써도 되는 용어이고,
    partition_name은 partition 의 name 이다.
    이 partition-extented table 이름은 다음 문장에서 사용되어진다.
    INSERT
    UPDATE
    DELETE
    LOCK TABLE
    SELECT
    Q) partition 에 insert 시:
    SQL> insert into sales partition (p8) values (7000, 'bcd', 10, 30);
    Q) partition을 delete시:
    SQL> delete from sales partition (p8);
    Q) partition을 update 시:
    SQL> update sales partition (p8) set sales_amount = 20;
    Q) partition을 select 시:
    SQL> select * from sales PARTITION (Q4);
    8. partition-extended table 이름의 제약?
    . remote schema object를 포함할 수 없다.
    partition-extended table name 은 dblink 를 포함할 수 없으며, dblink 를 통해
    table 로 변환 가능한 synonym 을 포함할 수 없다.
    만일 remote partition의 사용을 원할 때에는 remote site 에서
    partitioned-extended table 이름을 사용하여 view 를 생성할 수 있다.
    . partition-extended table 이름은 PL/SQL에서 사용되지 않는다.
    partition-extended table 이름을 사용한 SQL 문은 DBMS_SQL package 를 통해
    만일 사용하고자 한다면 view 를 사용하여야 한다.
    . 오로지 base table 만 허용된다.
    partition extension 은 base table 에만 허용되고 synonyms, views, 그외 schema
    에서는 허용되지 않는다.
    9. Export/Import 시 Table-Level 과 Partition-Level 의 차이점?
    테이블 단위의 export에서는 partitioned or non-partitioned table 전체가 index
    와 그 table 에 dependent 한 다른 모든 object 가 함께 export 된다.
    즉 partitioned table 의 모든 partition 이 export 된다. (이는 direct path
    export and conventional path export에 모두 적용.)
    또한 모든 export 모드 (full, user, table) 가 테이블 단위의 export 를 support
    한다.
    partition 단위의 export에서는 사용자가 테이블의 하나 또는 그 이상의 partition
    을 export 할 수 있다.
    Full database 단위나 user mode 는 partition-level의 export 를 support 하지
    않는다. 오직 table levle 만 가능하다.
    또한 incremental export (incremental,cumulative, and complete) 가 full
    database mode 에서만 가능하기 때문에 partition-level export는 incremental
    exports를 지원하지 못한다.
    Partition-level import는 export 되어진 non-partitioned table을 import 하지
    못한다. 그러나, table-level 의 import로 non-partitioned table 로부터
    partitioned table 이 import되어진다.
    즉 partition-level import 는 export 되어진 table 이 partitioned 되어 있고
    export file 에 있을 때에만 가능하다.
    export file 의 partition name 이 valid 하지 않는 경우 import 시 경고
    message 를 발생한다.
    모든 경우 partitioned data 는 import 시 선택적으로 가능하게 export 되어 진다.
    export 나 import 시 table name 을 지정 시는
    TABLES=schema_name : tables_name : partition_name 으로 사용한다.
    Partition 단위의 export 는 table 내의 특정 partition 을 한개 또는 그 이상을
    export 가능하게 한다.
    이 때 partition name 이 주어지지 않으면 table 전체가 사용된다.
    다음은 partiotion level 의 export 예제이다.
    exp system/manager FILE = export.dmp TABLES = (scott.b:px, scott.b:py,
    mary.c, d:qb)
    이 예제에서 scott.b 는 반드시 partitioned table이고 px ,py 는 2개의
    partition 이다.
    mary.c 는 partitioned 또는 non-partitioned table 이다. 그러나 d table 은
    반드시 partitioned table 이며 qb 는 그 partioion 중의 하나이다.
    만일 table-name이나 같은 table 의 partition-name이 중복 사용되어지면
    export 는 error 를 발생한다. 예를 들어 다음 partition-level의 export 명령어는
    table sc 와 partition px 가 중복 사용되어 error 를 발생한다.
    exp system/manager FILE = export.dmp TABLES = (sc, sc:px, sc)
    10. partiton table 또는 view를 어떻게 non-partitioned table로 변환시키는가?
    table 을 변환하기 위해 dummy table 을 생성하고,
    alter table EXCHANGE PARTITION 명령어를 통해 수행한다.
    이 명령어는 매우 빨리 data dictionary 를 update 시킨다.
    SPLIT PARTITION 은 매우 큰 partition table 이나 view 를 handling 하는 데
    유용하다.
    SQL:
    1. partition을 갖는 dummy_t table 을 생성
    2. alter table EXCHANGE partition T with dummy_T
    3. drop table T
    exp/imp:
    1. export the table
    2. drop the table .
    3. partiton 을 갖는 table 을 다시 생성
    4. table data 를 import 한다.
    11. table partition을 결합하는 법?
    export/import:
    partition-level 의 export, import 를 통해 가능하다.
    1. partition data 를 갖는 temporary table을 생성한다.
    2. drop the partition to be merged
    3. insert into table (select * from temporary table)
    4. drop temp.
    그러나, table partition 을 분할하는 방법은 export, import 를 통해 불가능하다.
    Example
    Reference Document
    ------------------

    Before we go too far with this, if you manually query with TO_DATE on the variable instead of TO_CHAR on the column, does the query actually use the index?
    The TO_CHAR on the column will definitely stop Oracle from using any index on the column. If the query will use the index if you TO_DATE the variable, as I see it, you have three options. First, fix the application problem that won't let you use TO_DATE from the application. Second, change the application to call a function returning a ref cursor, get the date string as a parameter to the function, and do the TO_DATE in the function.
    Third, you could consider creating a function-based index on TO_CHAR(transaction_date, 'dd-Mon-yy'). This would be the least desirable option, particularly if you would also be selecting records based on a range of transaction_dates, since it loses a lot of information that the optimizer could use in devising an efficient query plan. It could also change your results for a range scan.
    John

Maybe you are looking for

  • Itunes can't find music library on computer

    Somehow I've moved my music on my computer and itunes cannot find any of it. I can't play anything on the computer, an exclamation point is next to it and the computer tells me itunes cannot find the music. Help! What did I do and how do I fix this?

  • Open notepad using a servlet

    Does anyone know to open the note pad from servlet application i am using IE 5.5

  • Reg : Mesage in Adobe form

    Hi, I have an input field on the form. I want to validate the field. If the entered value is Greater than 10 .. then I need to raise a message saying that Please enter a value less than 10. Can you please tell how to dothis?/

  • Re getting a 2011 version of Photoshop Elements

    My friends..... I purchased a downloaded version of Adobe Photoshop Elements 9 in 2011.  More recently, due to some problems with OSX Mavericks, I had my operating system re-installed.  During that process, I lost said version of Photoshop Elements 9

  • How do I upgrade from LR3 to LR4 on both my MAC and my PC?

    I have LR3 installed on my PC desktop and my MAcbook Pro. How can I download and upgrade both without buying it twice?