List-range partition and subpartition
Does anyone know that Oracle 10g support partition by list and subpartition by range? Thanks.
check the documentation link [http://download.oracle.com/docs/cd/B19306_01/appdev.102/b31695/dialogs.htm#sthref441]
hope you will find your answer on link page.
Similar Messages
-
Modify HUGE HASH partition table to RANGE partition and HASH subpartition
I have a table with 130,000,000 rows hash partitioned as below
----RANGE PARTITION--
CREATE TABLE TEST_PART(
C_NBR CHAR(12),
YRMO_NBR NUMBER(6),
LINE_ID CHAR(2))
PARTITION BY RANGE (YRMO_NBR)(
PARTITION TEST_PART_200009 VALUES LESS THAN(200009),
PARTITION TEST_PART_200010 VALUES LESS THAN(200010),
PARTITION TEST_PART_200011 VALUES LESS THAN(200011),
PARTITION TEST_PART_MAX VALUES LESS THAN(MAXVALUE)
CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR, LINE_ID);
Data: -
INSERT INTO TEST_PART
VALUES ('2000',200001,'CM');
INSERT INTO TEST_PART
VALUES ('2000',200009,'CM');
INSERT INTO TEST_PART
VALUES ('2000',200010,'CM');
VALUES ('2006',NULL,'CM');
COMMIT;
Now, I need to keep this table from growing by deleting records that fall b/w a specific range of YRMO_NBR. I think it will be easy if I create a range partition on YRMO_NBR field and then create the current hash partition as a sub-partition.
How do I change the current partition of the table from HASH partition to RANGE partition and a sub-partition (HASH) without losing the data and existing indexes?
The table after restructuring should look like the one below
COMPOSIT PARTITION-- RANGE PARTITION & HASH SUBPARTITION --
CREATE TABLE TEST_PART(
C_NBR CHAR(12),
YRMO_NBR NUMBER(6),
LINE_ID CHAR(2))
PARTITION BY RANGE (YRMO_NBR)
SUBPARTITION BY HASH (C_NBR) (
PARTITION TEST_PART_200009 VALUES LESS THAN(200009) SUBPARTITIONS 2,
PARTITION TEST_PART_200010 VALUES LESS THAN(200010) SUBPARTITIONS 2,
PARTITION TEST_PART_200011 VALUES LESS THAN(200011) SUBPARTITIONS 2,
PARTITION TEST_PART_MAX VALUES LESS THAN(MAXVALUE) SUBPARTITIONS 2
CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR,LINE_ID);
Pls advice
Thanks in advanceSorry for the confusion in the first part where I had given a RANGE PARTITION instead of HASH partition. Pls read as follows;
I have a table with 130,000,000 rows hash partitioned as below
----HASH PARTITION--
CREATE TABLE TEST_PART(
C_NBR CHAR(12),
YRMO_NBR NUMBER(6),
LINE_ID CHAR(2))
PARTITION BY HASH (C_NBR)
PARTITIONS 2
STORE IN (PCRD_MBR_MR_02, PCRD_MBR_MR_01);
CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR,LINE_ID);
Data: -
INSERT INTO TEST_PART
VALUES ('2000',200001,'CM');
INSERT INTO TEST_PART
VALUES ('2000',200009,'CM');
INSERT INTO TEST_PART
VALUES ('2000',200010,'CM');
VALUES ('2006',NULL,'CM');
COMMIT;
Now, I need to keep this table from growing by deleting records that fall b/w a specific range of YRMO_NBR. I think it will be easy if I create a range partition on YRMO_NBR field and then create the current hash partition as a sub-partition.
How do I change the current partition of the table from hash partition to range partition and a sub-partition (hash) without losing the data and existing indexes?
The table after restructuring should look like the one below
COMPOSIT PARTITION-- RANGE PARTITION & HASH SUBPARTITION --
CREATE TABLE TEST_PART(
C_NBR CHAR(12),
YRMO_NBR NUMBER(6),
LINE_ID CHAR(2))
PARTITION BY RANGE (YRMO_NBR)
SUBPARTITION BY HASH (C_NBR) (
PARTITION TEST_PART_200009 VALUES LESS THAN(200009) SUBPARTITIONS 2,
PARTITION TEST_PART_200010 VALUES LESS THAN(200010) SUBPARTITIONS 2,
PARTITION TEST_PART_200011 VALUES LESS THAN(200011) SUBPARTITIONS 2,
PARTITION TEST_PART_MAX VALUES LESS THAN(MAXVALUE) SUBPARTITIONS 2
CREATE INDEX TEST_PART_IX_001 ON TEST_PART(C_NBR,LINE_ID);
Pls advice
Thanks in advance -
Create list-range partition table
Database version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
I am trying to create a partition table with LIST-Range, and I am getting this following error, is oracle 10.2.0.4 database supports to create list-range partition(composite)
SQL> CREATE TABLE tbp_list_range
REPORT_DATE DATE,
member_id_01 varchar2(2),
DATE_SERVICE date,
member_id varchar2(15)
PARTITION BY LIST(member_id_01)
SUBPARTITION BY RANGE (DATE_SERVICE)
PARTITION SPTYR04M01_C VALUES('AA','aa')
NOLOGGING
COMPRESS (
SUBPARTITION PTYR12M011 VALUES LESS THAN (TO_DATE(' 2012-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
SUBPARTITION PTYR12M021 VALUES LESS THAN (TO_DATE(' 2012-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
SUBPARTITION recent1 VALUES LESS THAN (MAXVALUE)
PARTITION SPTYR04M01_Yo VALUES('BJ','bj')
NOLOGGING
COMPRESS (
SUBPARTITION PTYR12M01 VALUES LESS THAN (TO_DATE(' 2012-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
SUBPARTITION PTYR12M02 VALUES LESS THAN (TO_DATE(' 2012-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')),
SUBPARTITION recent2 VALUES LESS THAN (MAXVALUE)
SUBPARTITION BY RANGE (DATE_SERVICE)
ERROR at line 9:
ORA-00922: missing or invalid option
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
Any help would be greatly appreciated.
Thanks,any possible work around for this scenario on 10.2.0.4
--thanks -
Where did the Partitions and SubPartitions go?
I created a table with partition Range (Transaction_Date, Retention_Period) and hash (Record_Id) subpartition template (for 32 subpartitions)
Then I add more partitions and while the loop is going on I can get counts of partitions and subpartitions. The job finished and my log table shows about 1800 partitions added and there should be 32 subpartitions for each of the partitions. However, user_tab_partitions shows zero records for the table, and user_tab_subpartitions also show zero record. After a few minutes the partitions show up but no subpartitions. The indexes on the table have also disappeared (one local and one global)
Any explanation for this behaviour?
Working on Exadata 11.2.0.3
Querying
USER_TABLES
USER_TAB_PARTITIONS
USER_TAB_SUBPARTITIONS
USER_INDEXES>
Step 1. Create Table xyz (c1 date, c2 integer c3 integer, etc)
partition by range (c1,c2)
subpartition template (s01, s02... s32)
create index i1 on xyz (c1,c2,c3) local;
Then, since I want to create about 1800 partitions I have a procedure that has a "loop around" ALTER TABLE add Partition .. until all the partitions are created. This is the "Job" which while running I query USER_TAB_PARTITIONS and USER_TAB_SUBPARTITIONS to see how things are progressing. And Yes ALTER Table has no progressing to verify.
So al the partitions get created. No errors from the procedure to go through creating all the partitions. So I would expect that at the end I should get to see all the new partitions for the Table. Instead I get "no records" from USER_TAB_PARTITIONS and USER_TAB_SUBPARTITIONS.
I am also aware that "ALTER TABLE ADD PARTITION .." cannot make indexes go away. However, if the query on USER_INDEXES returns nothing, what happend to the Index created before the partitions were added?
I am not using DBMS_REDEFINITION. The only procedure is to add partitions one at a time for each date for 3 years. If you have a better way than a procedure please advise accordingly.
>
In order to help you the first step is to understand what problem you are dealing with. Then comes trying to determine what options are available for addressing the problem. There are too many times , and yours may, or may not, be another one, where people seem to have settled on a solution before they have really identified the problem.
Anytime someone mentions the use of dynamic SQL it raises a red flag. And when that use is for DDL, rather than DMl, it raises a REALLY BIG red flag.
Schema objects need to be managed properly and the DDL that creates them needs to be properly written and kept in some sort of version control.
Scripts and procedures that use dynamic SQL are more properly used to create DDL, not to execute it. That is, rather than use a procedure to dynamically create or alter a table you would use the procedure to dynamically create a DDL script that would create or alter the table.
Let's assume that you know for certain that your table really needs to have 1800 partitions, be subpartitioned the way you say and have partition and subpartitions names that you assign. Well, that would be a pain to hand-write 1800 partition definitions.
So you would create a procedure that would produce a CREATE TABLE script that had the proper clauses and syntax to specify those 1800 partitions. Your 'loop' would not EXECUTE an ALTER TABLE for each partition but would create the partition specification and modify the partition boundaries for each iteration through the loop. Sort of like
for i from 1 to 365 loop
add partition spec for startDate + i
end loop;The number of iterations would be a parameter and you would start with 2 or 3. Always test with the smallest code that will produce the correct results. If the code works for 3 days it will work for any larger reasonable number.
Then you would save that script in your version control system and run it to create the table. There would be nothing to monitor since there is just one script and when it is done it is done.
That would be a proper use of dynamic sql: to produce DDL, not to execute it.
Back to your issue. If I were your manager then based on what you posted I would expect you to already have
1. a requirements document that stated the problem (e.g. performance, data management) that was being addressed
2. test results that showed that your proposed solution (a table partitioned the way you posted) solves the problem
The requirements doc would have detail about what the performance/management issues are and what impact they are having
You also need to document what the possible solutions are, the relative merits of each solution and the factors you considered when ranking the solutions. That is, why is your particular partitioning scheme the best solution for the problem.
You should have test results that show the execution plans and performance you achieved by using a test version of your proposed table and indexes.
Until you have 'proven' that your solution will work as you expect I wouldn't recommend implementing the full-blown version of it.
1. Create a table MANUALLY that has 2 or three days worth of partitions.
2. Load those partitions with a representative amount of data
3. Execute test queries to query data from one of those partitions
4. Execute the same test queries against your current table
5. Capture the execution plans (the actual ones) for those queries. Verify that you are getting the performance improvements that you expected.
Once ALL of that prep work is done and you have concluded that your table/index design is correct then go back to work on writing a script/procedure that will produce (not execute) DDL to produce the main table and partitioning you designed.
Just an aside on what you posted. The indexes should be created AFTER the table and its partitions are created. If you are creating your local index first, as you post suggests, you are forcing Oracle to revamp it 1800 times when each partition is added. Just create the index after the table.
p.s. the number of posts anyone has is irrevelant. The only thing that matters is whether the advice or suggestions they provide is helpful. And the helpfullness of those is limited to, and based on, ONLY the information a poster provides. For exampe, your proposed partitioning scheme might be perfectly appropriate for your use case or it could be totally inappropriate. We have no way of knowing without knowing WHY you chose that scheme.
But I haven't seen one like that so it makes me suspicious that you really need to get that complicated. -
Hi Oracle Gurus,
I have a table with list partition, as the partitions are growing large I need to create subpartitions.
Is it possible to create a range subpartition under list partition. If yes I need that subpartition to be built on time not on date.
Is it possible.While range-list partitioning exists in 10g, list-range partitioning to the best of my knowledge does not exist. There are some new options in 11g but I can't remember what they are off the top of my head. You can check the on-line documentation to see what your partitioning options are
Your partitioning options will depend on what version of Oracle you are using. Also remember that you need the licence to use the partitioning feature -
Doubt in partition and subpartition
hi gems...good afternoon...
I have a doubt redgarding partitioning and subpartitioning...This may be a silly question, but i am really not getting this...please help me..
I have a table which has Range-Hash composite partitioning.
The Range partitioning is on the default tablespace TS_PROD (because I didnt mention any tablespace name in the Range partitions).
The Hash subpartitioning are on the corresponding partition tablespaces (TS_PART1,TS_PART2,TS_PART3....TS_PART6).
I have created total 8 Range partitions and the number of Hash subpartitions are 6 for each of them.
Now when I query the DBA_TAB_PARTITIONS, then I got the desired output i.e. all the Range partitions are in the default tablespace.
When I query the DBA_TAB_SUBPARTITIONS, then also I got the desired output i.e. all the Hash subpartitions are in the separate partition tablespaces.
But when I have inserted data in that table, then I found that both the default tablespace and partition tablespaces are getting filled up.
Moreover, the sum of the increase in sizes of the partition tablespaces is equal to the increase in default tablespace.
I am not getting the concept of this. Where are the datas are getting stored??? In the default tablespace or in the partition tablespaces??
Thanks a lot in advance..thanks a lot RP for your reply...
and sorry for the late and miscommunication...
Actually i am not so experienced in the DBA line and in my company suddenly my senior DBA left and i am the only one here...I got tensed... :( :(
I have started reading documentation of Oracle, have started the Administrator's Guide first...
Anyways...now i got the concept of the partitioning and subpartitioning i was doing...
The mistake which I was doing is: I was not mentioning the primary key index tablespace and that segment is going into the default tablespace and thats why the size was increasing for both default tablespace and partitioned tablespaces. Because of that fact I was getting confused again and again.
As soon as I mentioned the primary key index tablespace, the size of the default tablespace stopped increasing...
Now the script from which I am getting the size of the tablespaces: (join of dba_datafiles and dba_free_space)
select /* + RULE */ t.tablespace, t.totalspace as " Totalspace(MB)",
round((t.totalspace-fs.freespace),2) as "Used Space(MB)",
fs.freespace as "Freespace(MB)",
round(((t.totalspace-fs.freespace)/t.totalspace)*100,2) as "% Used",
round((fs.freespace/t.totalspace)*100,2) as "% Free"
from
(select round(sum(d.bytes)/(1024*1024)) as totalspace, d.tablespace_name tablespace
from dba_data_files d
group by d.tablespace_name) t,
(select round(sum(f.bytes)/(1024*1024)) as freespace, f.tablespace_name tablespace
from dba_free_space f
group by f.tablespace_name) fs
where t.tablespace=fs.tablespace
order by t.tablespace;
Thanks a lot RP for your help... :) -
Required alter script for adding partition and subpartition
Hi Folks,
Please help me to write ALTER STATEMENT for adding new partition P1 and SUBPARTITION P1_201001 and P1_201002.
Thank you
TABLE
=======
CREATE TABLE TEST
"REPORT_ID" NUMBER,
"MONTH_ID" NUMBER,
"GROUP_ID" NUMBER,
"AGE_GROUP_ID" NUMBER,
"GENDER_CD" CHAR(1 BYTE),
PCTFREE 0 PCTUSED 0 INITRANS 1 MAXTRANS 255 COMPRESS BASIC NOLOGGING STORAGE
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
TABLESPACE "USER_WORK" PARTITION BY RANGE
"REPORT_ID"
SUBPARTITION BY LIST
"MONTH_ID"
SUBPARTITION TEMPLATE
SUBPARTITION "M201212" VALUES
201212
TABLESPACE "USER_WORK"
(PARTITION "P3" VALUES LESS THAN (4) PCTFREE 0 PCTUSED 0 INITRANS 1 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USER_WORK" COMPRESS BASIC NOLOGGING ( SUBPARTITION "P3_M201212" VALUES
201212
TABLESPACE "USER_WORK" COMPRESS BASIC, SUBPARTITION "P3_M201301" VALUES
201301
TABLESPACE "USER_WORK" COMPRESS BASIC )
);First modify the subpartition template
ALTER TABLE TEST set
SUBPARTITION TEMPLATE
SUBPARTITION "M201212" VALUES
201212
SUBPARTITION P1_201001 VALUES (201001),
SUBPARTITION P1_201002 VALUES (201002)
)Then if the new partition is HIGHER than ALL existing ranges you can just add it
alter table test add
PARTITION "P1" VALUES LESS THAN (5) If the new partition is LOWER than one onf the existing ranges you will need to SPLIT the existing partition.
alter table test SPLIT PARTITION "P3" AT (2)
INTO (PARTITION P1, PARTITION P3)See the sections in the VLDB and Partitioning Guide
Modifying a Subpartition Template
http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1007904
Splitting a Partition of a Range-Partitioned Table
http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1008028 -
Oracle 11g List - Range Partition - Help Needed
Hi All,
I want to create a composite partition (LIST-RANGE) but RANGE partition should using interval partition
This is my query .
CREATE TABLE "DMSDB"."DEVICE_UTILS"
( "ULID" VARCHAR2(100 CHAR),
"IP_ADDRESS" VARCHAR2(24 CHAR),
"PORT" VARCHAR2(8 CHAR),
"SHUTDOWN" NUMBER(10,0),
"LINE_TYPE" NUMBER(10,0) DEFAULT '0',
"OCCUPIED" NUMBER(10,0),
"UTILIZATION" NUMBER(10,0),
"IDLE_TIME" VARCHAR2(32 CHAR),
"ACTIVATION_TIME" VARCHAR2(32 CHAR),
"PULLED_DATE" TIMESTAMP (6) DEFAULT SYSDATE,
"ACCESS_TIME" TIMESTAMP (6) DEFAULT SYSDATE
PARTITION BY LIST(ULID)
PARTITION PART_DEVUTILS_ULID VALUES (DEFAULT)
SUBPARTITION BY RANGE( PULLED_DATE)
PARTITION PART_DEVUTILS_WEEK INTERVAL (NUMTOYMINTERVAL(1,'WEEK'))
Somehow its not working. can you please suggest where i am making mistake?Interval partitioning is not supported at the subpartition level.
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_7002.htm#BABCDDIA
Regards
Girish Sharma -
Range partitioning and update to range value
There is a V. large table on our system, where a column is initally set to NULL, but updated with sysdate when processed. The majority of qureies against this table are for those with NULL values. I'm considering range partitioning by this column, where all NULLs will appear in the one partition, all non_NULLs in the other. The questions are.....
1)will a row automatically move from one partion to the next on update of the NULL value
2) If so, what are the overheadsUsing ENABLE ROW MOVEMENT will work, but the overhead of moving the rows is fairly high. If the date column is only updated once over the life of the record, then this overhead may be acceptable. However, if the date field is updated to sysdate most times the record is touched, then this may be a large performance hit.
You may want to investigate the use of a function based index to get the NULL dates indexed. A function like:
DECODE(date_field,NULL,1,NULL)
would create an index containing only the null rows. Then a query like:
SELECT stuff
FROM table
WHERE DECODE(date_field,NULL,1,NULL) = 1would likely do and index range scan.
TTFN
John -
my table has partition and subpartition like -----
PARTITION BY RANGE (SEGMENT_)
SUBPARTITION BY LIST (DATE_FOR_PURGE)
PARTITION S_1 VALUES LESS THAN (2)
NOLOGGING
NOCOMPRESS
TABLESPACE TAO_TBL
( SUBPARTITION S_1_D_99999999 VALUES (99999999) TABLESPACE TAO_TBL,
SUBPARTITION S_1_D_20100520 VALUES (20100520) TABLESPACE TAO_TBL,
SUBPARTITION S_1_D_20100628 VALUES (20100628) TABLESPACE TAO_TBL,
SUBPARTITION S_1_D_20100629 VALUES (20100629) TABLESPACE TAO_TBL,
SUBPARTITION S_1_D_20100705 VALUES (20100705) TABLESPACE TAO_TBL,
SUBPARTITION S_1_D_20100708 VALUES (20100708) TABLESPACE TAO_TBL,
SUBPARTITION S_1_D_20100930 VALUES (20100930) TABLESPACE TAO_TBL,
SUBPARTITION S_1_D_20101001 VALUES (20101001) TABLESPACE TAO_TBL,
SUBPARTITION S_1_D_20101002 VALUES (20101002) TABLESPACE TAO_TBL )
i want to use partition in the select clause
what will be the query?You mean that you want to explicitly set the partition in the select statement?
SELECT <column list>
FROM <table name>
PARTITION (<partition name>)
WHERE<predicates> -
Using PARTITION FOR/SUBPARTITION FOR syntax to insert
We are trying to use PARTITION FOR syntax (or, better, SUBPARTITION FOR syntax) to insert into a subpartitioned table.
http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements009.htm#i165979
08:26:46 GM_CS_CDR@oradev02> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Solaris: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
5 rows selected.This table is has interval partitions on DATA_ORIGIN_ID and list subpartitions on TABLE_NAME.
First, a basic insert without specifying partitions:
08:10:05 GM_CS_CDR@oradev02> insert into key_ids2 (
08:11:51 2 DATA_ORIGIN_ID ,
08:11:51 3 TABLE_NAME ,
08:11:51 4 DUR_UK ,
08:11:51 5 DUR_UK_ID )
08:11:51 6 select
08:11:51 7 12 ,
08:11:51 8 TABLE_NAME ,
08:11:51 9 DUR_UK ,
08:11:51 10 DUR_UK_ID
08:11:51 11 from key_ids where table_name = 'PART'
08:11:51 12 and rownum <= 10;
10 rows created.Verifying SUBPARTITION FOR syntax on a SELECT:
08:19:43 GM_CS_CDR@oradev02>
08:26:45 GM_CS_CDR@oradev02>
08:26:45 GM_CS_CDR@oradev02>
08:26:45 GM_CS_CDR@oradev02>
08:26:45 GM_CS_CDR@oradev02> select count(*) from key_ids2
08:26:45 2 subpartition for(12,'PART');
COUNT(*)
10
1 row selected.But when we add a subpartition specification (to limit the lock to a single subpartition), we get a syntax error:
08:14:57 GM_CS_CDR@oradev02> insert into key_ids2 subpartition for(12,'PART') (
08:14:57 2 DATA_ORIGIN_ID ,
08:14:57 3 TABLE_NAME ,
08:14:57 4 DUR_UK ,
08:14:57 5 DUR_UK_ID )
08:14:57 6 select
08:14:57 7 14 ,
08:14:57 8 TABLE_NAME ,
08:14:57 9 DUR_UK||'!' ,
08:14:57 10 DUR_UK_ID
08:14:57 11 from key_ids
08:14:57 12 where table_name = 'PART'
08:14:57 13 and rownum <= 10;
insert into key_ids2 subpartition for(12,'PART') (
ERROR at line 1:
ORA-14173: illegal subpartition-extended table name syntaxSpecifying at the partition level did not work either:
08:14:58 GM_CS_CDR@oradev02> insert into key_ids2 partition for(14) (
08:15:23 2 DATA_ORIGIN_ID ,
08:15:23 3 TABLE_NAME ,
08:15:23 4 DUR_UK ,
08:15:23 5 DUR_UK_ID )
08:15:23 6 select
08:15:23 7 14 ,
08:15:23 8 TABLE_NAME ,
08:15:23 9 DUR_UK||'!' ,
08:15:23 10 DUR_UK_ID
08:15:23 11 from key_ids
08:15:23 12 where table_name = 'PART'
08:15:23 13 and rownum <= 10;
insert into key_ids2 partition for(14) (
ERROR at line 1:
ORA-14108: illegal partition-extended table name syntaxBut specifying explicit partition and subpartition does work:
08:17:45 GM_CS_CDR@oradev02> insert into key_ids2 partition (SYS_P15127) (
08:18:23 2 DATA_ORIGIN_ID ,
08:18:23 3 TABLE_NAME ,
08:18:23 4 DUR_UK ,
08:18:23 5 DUR_UK_ID )
08:18:23 6 select
08:18:23 7 12 ,
08:18:23 8 TABLE_NAME ,
08:18:23 9 DUR_UK||'!' ,
08:18:23 10 DUR_UK_ID
08:18:23 11 from key_ids
08:18:23 12 where table_name = 'PART'
08:18:23 13 and rownum <= 10;
10 rows created.
08:18:24 GM_CS_CDR@oradev02> insert into key_ids2 subpartition (SYS_SUBP15126) (
08:19:42 2 DATA_ORIGIN_ID ,
08:19:42 3 TABLE_NAME ,
08:19:42 4 DUR_UK ,
08:19:42 5 DUR_UK_ID )
08:19:42 6 select
08:19:42 7 12 ,
08:19:42 8 TABLE_NAME ,
08:19:42 9 DUR_UK||'!#' ,
08:19:42 10 DUR_UK_ID
08:19:42 11 from key_ids
08:19:42 12 where table_name = 'PART'
08:19:42 13 and rownum <= 10;
10 rows created.We have been successful in using the PARTITION FOR syntax for tables that were partitioned but not subpartitioned.
Any ideas?
Thanks,
MikeI've created a simplified script to reproduce our issue. The use of the syntax on an INSERT INTO using VALUES still produces the same error.
Thanks,
Andy
select * from v$version;
create table part_test_tbl
data_origin_id NUMBER not null,
table_name VARCHAR2(30) not null,
dur_uk VARCHAR2(250) not null,
dur_uk_id NUMBER
partition by range (data_origin_id) INTERVAL (1)
subpartition by list (TABLE_NAME)
SUBPARTITION TEMPLATE(
subpartition BLUE values ('BLUE'),
subpartition RED values ('RED'),
subpartition YELLOW values ('YELLOW'),
subpartition GREEN values ('GREEN'),
subpartition ORANGE values ('ORANGE')
(PARTITION DFLT_INTRVL VALUES LESS THAN (0)
subpartition BLUE values ('BLUE'),
subpartition RED values ('RED'),
subpartition YELLOW values ('YELLOW'),
subpartition GREEN values ('GREEN'),
subpartition ORANGE values ('ORANGE')
-- Create/Recreate indexes
create index PART_TEST_TBL_PK on PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
compress 2 local;
create unique index PART_TEST_TBL_UK on PART_TEST_TBL (TABLE_NAME, DUR_UK_ID)
compress 1;
-- Create/Recreate primary, unique and foreign key constraints
alter table PART_TEST_TBL
add constraint PART_TEST_TBL_PK primary key (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK) USING INDEX PART_TEST_TBL_PK;
alter table PART_TEST_TBL
add constraint PART_TEST_TBL_UK unique (TABLE_NAME, DUR_UK_ID) USING INDEX PART_TEST_TBL_UK;
--Add test data
BEGIN
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'BLUE', '1', 1);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'BLUE', '2', 2);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'YELLOW', '3', 3);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'GREEN', '4', 4);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (0, 'ORANGE', '5', 5);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'BLUE', '6', 6);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'BLUE', '7', 7);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'YELLOW', '8', 8);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'GREEN', '9', 9);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (1, 'ORANGE', '10', 10);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'BLUE', '11', 11);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'BLUE', '12', 12);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'YELLOW', '13', 13);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'GREEN', '14', 14);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (2, 'ORANGE', '15', 15);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'BLUE', '16', 16);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'BLUE', '17', 17);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'YELLOW', '18', 18);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'GREEN', '19', 19);
insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
values (10, 'ORANGE', '20', 20);
COMMIT;
END;
--Validate the subpartition_extended syntax
select count(*) from PART_TEST_TBL subpartition for(10,'BLUE');
--Show subpartition_extended syntax does not work on INSERT INTO
INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
(data_origin_id
,table_name
,dur_uk
,dur_uk_id)
VALUES
(10
,'BLUE'
,'16!'
,1016);
--Show subpartition_extended syntax does not work on INSERT INTO
INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
(data_origin_id
,table_name
,dur_uk
,dur_uk_id)
SELECT ptt.data_origin_id
,ptt.table_name
,ptt.dur_uk || '!' dur_uk
,ptt.dur_uk_id + 1000 dur_uk_id
FROM PART_TEST_TBL ptt
WHERE ptt.table_name = 'BLUE'
AND ptt.data_origin_id = 10;
DROP TABLE part_test_tbl PURGE;-----
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Solaris: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> create table part_test_tbl
2 (
3 data_origin_id NUMBER not null,
4 table_name VARCHAR2(30) not null,
5 dur_uk VARCHAR2(250) not null,
6 dur_uk_id NUMBER
7 )
8 partition by range (data_origin_id) INTERVAL (1)
9 subpartition by list (TABLE_NAME)
10 SUBPARTITION TEMPLATE(
11 subpartition BLUE values ('BLUE'),
12 subpartition RED values ('RED'),
13 subpartition YELLOW values ('YELLOW'),
14 subpartition GREEN values ('GREEN'),
15 subpartition ORANGE values ('ORANGE')
16 )
17 (PARTITION DFLT_INTRVL VALUES LESS THAN (0)
18 (
19 subpartition BLUE values ('BLUE'),
20 subpartition RED values ('RED'),
21 subpartition YELLOW values ('YELLOW'),
22 subpartition GREEN values ('GREEN'),
23 subpartition ORANGE values ('ORANGE')
24 )
25 );
Table created
SQL> -- Create/Recreate indexes
SQL> create index PART_TEST_TBL_PK on PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
2 compress 2 local;
Index created
SQL> create unique index PART_TEST_TBL_UK on PART_TEST_TBL (TABLE_NAME, DUR_UK_ID)
2 compress 1;
Index created
SQL> -- Create/Recreate primary, unique and foreign key constraints
SQL> alter table PART_TEST_TBL
2 add constraint PART_TEST_TBL_PK primary key (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK) USING INDEX PART_TEST_TBL_PK;
Table altered
SQL> alter table PART_TEST_TBL
2 add constraint PART_TEST_TBL_UK unique (TABLE_NAME, DUR_UK_ID) USING INDEX PART_TEST_TBL_UK;
Table altered
SQL> --Add test data
SQL> BEGIN
2
3 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
4 values (0, 'BLUE', '1', 1);
5
6 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
7 values (0, 'BLUE', '2', 2);
8
9 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
10 values (0, 'YELLOW', '3', 3);
11
12 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
13 values (0, 'GREEN', '4', 4);
14
15 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
16 values (0, 'ORANGE', '5', 5);
17
18 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
19 values (1, 'BLUE', '6', 6);
20
21 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
22 values (1, 'BLUE', '7', 7);
23
24 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
25 values (1, 'YELLOW', '8', 8);
26
27 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
28 values (1, 'GREEN', '9', 9);
29
30 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
31 values (1, 'ORANGE', '10', 10);
32
33 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
34 values (2, 'BLUE', '11', 11);
35
36 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
37 values (2, 'BLUE', '12', 12);
38
39 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
40 values (2, 'YELLOW', '13', 13);
41
42 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
43 values (2, 'GREEN', '14', 14);
44
45 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
46 values (2, 'ORANGE', '15', 15);
47
48 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
49 values (10, 'BLUE', '16', 16);
50
51 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
52 values (10, 'BLUE', '17', 17);
53
54 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
55 values (10, 'YELLOW', '18', 18);
56
57 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
58 values (10, 'GREEN', '19', 19);
59
60 insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
61 values (10, 'ORANGE', '20', 20);
62
63 COMMIT;
64 END;
65 /
PL/SQL procedure successfully completed
SQL> --Validate the subpartition_extended syntax
SQL> select count(*) from PART_TEST_TBL subpartition for(10,'BLUE');
COUNT(*)
2
SQL> --Show subpartition_extended syntax does not work on INSERT INTO
SQL> INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
2 (data_origin_id
3 ,table_name
4 ,dur_uk
5 ,dur_uk_id)
6 VALUES
7 (10
8 ,'BLUE'
9 ,'16!'
10 ,1016);
INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
(data_origin_id
,table_name
,dur_uk
,dur_uk_id)
VALUES
(10
,'BLUE'
,'16!'
,1016)
ORA-14173: illegal subpartition-extended table name syntax
SQL> --Show subpartition_extended syntax does not work on INSERT INTO
SQL> INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
2 (data_origin_id
3 ,table_name
4 ,dur_uk
5 ,dur_uk_id)
6 SELECT ptt.data_origin_id
7 ,ptt.table_name
8 ,ptt.dur_uk || '!' dur_uk
9 ,ptt.dur_uk_id + 1000 dur_uk_id
10 FROM PART_TEST_TBL ptt
11 WHERE ptt.table_name = 'BLUE'
12 AND ptt.data_origin_id = 10;
INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
(data_origin_id
,table_name
,dur_uk
,dur_uk_id)
SELECT ptt.data_origin_id
,ptt.table_name
,ptt.dur_uk || '!' dur_uk
,ptt.dur_uk_id + 1000 dur_uk_id
FROM PART_TEST_TBL ptt
WHERE ptt.table_name = 'BLUE'
AND ptt.data_origin_id = 10
ORA-14173: illegal subpartition-extended table name syntax
SQL> DROP TABLE part_test_tbl PURGE;
Table dropped
SQL> -
Re-org oracle 11.1.0.7 partitioned and sub partitioned index not validiting
Hi,
As part of maintenance i did the following thing on the oracle 11.1.0.7 on windows (no archive log mode);
Re-orgnaized the tables in application- data tablespace - done
Re-orgnaized large table in SYSAUX tablespace - only one table (alter table sys.WRI$_OPTSTAT_HISTGRM_HISTORY move tablespace sysaux
alter index sys.I_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST rebuild nologging;
alter index sys.I_WRI$_OPTSTAT_H_ST rebuild nologging;)
Re-built the indexes on applicaton index tbs- done
Re-built the partition indexes on application index tbs - done
rebuilding of indexes in SYSAUX - done since it was invalid
Run the analyze job –
Re-claim the space at database level and OS level
but i have the issues of partitioned and subpartition indexes are not validating..how to validate the indexes i am using the below querires but:
ORA-14287: cannot REBUILD a partition of a Composite Range partitioned ii am using the below sqls:
set head off
set linesize 200
select 'alter index '||index_owner||'.'||index_name||' rebuild partition '||partition_name||' ; ' from dba_ind_partitions where status <> 'VALID' and index_owner not in ('SYS','SYSTEM')
set head off
set linesize 200
select 'alter index '||index_owner||'.'||index_name||' rebuild subpartition '||subpartition_name||' ;'
from dba_ind_subpartitions
where status <> 'VALID' -
Gathering statistics on partitioned and non-partitioned tables
Hi all,
My DB is 11.1
I find that gathering statistics on partitioned tables are really slow.
TABLE_NAME NUM_ROWS BLOCKS SAMPLE_SIZE LAST_ANALYZED PARTITIONED COMPRESSION
O_FCT_BP1 112123170 843140 11212317 8/30/2011 3:5 NO DISABLED
LEON_123456 112096060 521984 11209606 8/30/2011 4:2 NO ENABLED
O_FCT 115170000 486556 115170 8/29/2011 6:3 YES
SQL> SELECT COUNT(*) FROM user_tab_subpartitions
2 WHERE table_name =O_FCT'
3 ;
COUNT(*)
112I used the following script:
BEGIN
DBMS_STATS.GATHER_TABLE_STATS(ownname => user,
tabname => O_FCT',
method_opt => 'for all columns size auto',
degree => 4,
estimate_percent =>10,
granularity => 'ALL',
cascade => false);
END;
/It costs 2 mins for the first two tables to gather the statistics respectively, but more than 10 mins for the partitioned table.
The time of collecting statistics accounts for a large part of total batch time.
And most jobs of the batch are full load in which case all partitions and subpartitions will be affected and we can't just gather specified partitions.
Does anyone have some experiences on this subject? Thank you very much.
Best regards,
Leon
Edited by: user12064076 on Aug 30, 2011 1:45 AMHi Leon
Why don't you gather stats at partition level? If your partitions data is not going to change after a day (date range partition for ex), you can simply do at partition level
GRANULARITY=>'PARTITION' for partition level and
GRANULARITY=>'SUBPARTITION' for subpartition level
You are gathering global stats every time which you may not require.
Edited by: user12035575 on 30-Aug-2011 01:50 -
Range - Interval Partition and List Subpartition.
Hi
I am trying to create the Range(Interval) Partition with List Sub partition (dynamically). Here the LOCATION_CD List is Dynamic. Basically Location_CD is Country name. e.g USA, IND,GER.....
Below Works good...
CREATE TABLE TEMP
SEQUENCE_ID NUMBER,
RESERVATION_DATE TIMESTAMP,
LOCATION_CD VARCHAR2(5)
PARTITION BY RANGE (RESERVATION_DATE)
INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
SUBPARTITION BY LIST(LOCATION_CD)
SUBPARTITION TEMPLATE
( SUBPARTITION CD_01 VALUES ('USA'),
SUBPARTITION CD_02 VALUES ('IND'),
SUBPARTITION CD_03 VALUES ('GER')
PARTITION TEMP values LESS THAN (TO_DATE('01-JAN-2000','DD-MON-YYYY'))
Today there are 3 Countries but going forward it can be more or less.
I like the Interval Range Partition concept, where the new partition is automatically gets added.
But at the same time can the new list sub partition be added ? If this doesn't work...can we have another alternative approach or partition technique ?
Please suggest.
Thanks
Jitesh R.Why didn't you just perform two inserts and answer the question yourself?
orabase> CREATE TABLE T (
2 SEQUENCE_ID NUMBER,
3 RESERVATION_DATE TIMESTAMP,
4 LOCATION_CD VARCHAR2(5))
5 PARTITION BY RANGE (RESERVATION_DATE)
6 INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
7 SUBPARTITION BY LIST(LOCATION_CD)
8 SUBPARTITION TEMPLATE (
9 SUBPARTITION CD_01 VALUES ('USA'),
10 SUBPARTITION CD_02 VALUES ('IND'),
11 SUBPARTITION CD_03 VALUES ('GER')) (
12 PARTITION root values LESS THAN (TO_DATE('01-JAN-2000','DD-MON-YYYY')));
Table created.
orabase> insert into t values (1, TO_DATE('02-JAN-2000'), 'USA');
1 row created.
orabase> select partition_name, subpartition_name
2 from user_tab_subpartitions
3 where table_name = 'T';
PARTITION_NAME SUBPARTITION_NAME
ROOT ROOT_CD_03
ROOT ROOT_CD_02
ROOT ROOT_CD_01
SYS_P84 SYS_SUBP83
SYS_P84 SYS_SUBP82
SYS_P84 SYS_SUBP81
6 rows selected.
orabase> insert into t values (1, TO_DATE('02-JAN-2000')+400, 'USA');
1 row created.
orabase> select partition_name, subpartition_name
2 from user_tab_subpartitions
3 where table_name = 'T';
PARTITION_NAME SUBPARTITION_NAME
SYS_P88 SYS_SUBP85
SYS_P88 SYS_SUBP86
SYS_P88 SYS_SUBP87
SYS_P84 SYS_SUBP81
SYS_P84 SYS_SUBP82
SYS_P84 SYS_SUBP83
ROOT ROOT_CD_01
ROOT ROOT_CD_02
ROOT ROOT_CD_03
9 rows selected. -
Partition by LIST and subpartition by LIST
Hi,
Can I create a table having partition by LIST and also subpartition by LIST.
If we can then please provide a syntax or otherwise if we can't then please provide a valid reason for it.
Regards,
KoushikYou can have list-list composite partitioning in 11G, not before that.
http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/partconc.htm#BCGJEEGJ
Search the documentation for the syntax.
Maybe you are looking for
-
Epson Printing Problem with CS3
My Epson Stylus Pro 9600 has a problem with CS3 printing. When printing large images (i.e. 36x60) a portion of the image would be missing at the bottom (blank) The 10.01 update addressed this issue but it seems not completely. The problem was attribu
-
I'm setting up a master group for the first time. The master group contains 2 nodes. I want to replicate an entire schema - the schema contains tables,indexes, procedures, triggers and functions. The actually schema already exists and has data (the s
-
My phone locked and I forgot my APPLEID and can not open it what to do ?
I can't open my phone please assist Thanks
-
Why i can use my iphone ? i just see in the screen the itunes icone and thats it
nothing
-
TS4268 my imessage will not activate
my imessage has been saying 'activating' for the past two days