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/
Similar Messages
-
Create local spatial index on range sub-partitions?
Is is possible to create a local spatial index on a table with range sub-partitions? We're trying to do this on a table that contains lots of x,y,z point data.
Trying to do so gives me the error: ORA-29846: cannot create a local domain index on a composite partitioned tableAccording to the spatial documentation:The following restrictions apply to spatial index partitioning:
- The partition key for spatial tables must be a scalar value, and must not be a spatial column.
- Only range partitioning is supported on the underlying table. All other kinds of partitioning are not currently
supported for partitioned spatial indexes.So there is nothing saying it can or can't be done. The examples I've seen in the documentation tend to partition based on a single value and don't use subpartitioning.
Example of what we're trying to do:SQL> SELECT * FROM V$VERSION;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 64-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
SQL>
SQL> --- Create a table, partioned by X and subpartitioned by Y
SQL> CREATE TABLE sub_partition_test
2 (
3 x NUMBER,
4 y NUMBER,
5 z NUMBER,
6 geometry MDSYS.SDO_GEOMETRY
7 )
8 PARTITION BY RANGE (x)
9 SUBPARTITION BY RANGE (y)
10 (
11 PARTITION p_x100 VALUES LESS THAN (100)
12 (
13 SUBPARTITION sp_x100_y100 VALUES LESS THAN (100),
14 SUBPARTITION sp_x100_y200 VALUES LESS THAN (200),
15 SUBPARTITION sp_x100_yMAXVALUE VALUES LESS THAN (MAXVALUE)
16 ),
17 PARTITION p_x200 VALUES LESS THAN (200)
18 (
19 SUBPARTITION sp_x200_y100 VALUES LESS THAN (100),
20 SUBPARTITION sp_x200_y200 VALUES LESS THAN (200),
21 SUBPARTITION sp_x200_yMAXVALUE VALUES LESS THAN (MAXVALUE)
22 ),
23 PARTITION p_xMAXVALUE VALUES LESS THAN (MAXVALUE)
24 (
25 SUBPARTITION sp_xMAXVALUE_y100 VALUES LESS THAN (100),
26 SUBPARTITION sp_xMAXVALUE_y200 VALUES LESS THAN (200),
27 SUBPARTITION sp_xMAXVALUE_yMAXVALUE VALUES LESS THAN (MAXVALUE)
28 )
29 );
Table created.
SQL>
SQL> -- Insert some sample data
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (1, 1, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(1, 1, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (50, 150, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(50, 150, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (150, 150, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(150, 150, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (150, 250, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(150, 250, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (150, 300, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(150, 300, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (220, 210, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 210, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (220, 150, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 150, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (220, 250, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 250, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (220, 300, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 300, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (320, 250, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 250, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (320, 160, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 160, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (320, 290, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 290, 50), NULL, NULL));
1 row created.
SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
2 VALUES (320, 320, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 320, 50), NULL, NULL));
1 row created.
SQL>
SQL> -- Create some metadata
SQL> DELETE FROM user_sdo_geom_metadata WHERE TABLE_NAME = 'SUB_PARTITION_TEST';
1 row deleted.
SQL> INSERT INTO user_sdo_geom_metadata VALUES ('SUB_PARTITION_TEST','GEOMETRY',
2 SDO_DIM_ARRAY(
3 SDO_DIM_ELEMENT('X', 0, 1000, 0.005),
4 SDO_DIM_ELEMENT('Y', 0, 1000, 0.005)
5 ), 262152);
1 row created.
SQL>
SQL> -- Create an Unusable Local Spatial Index
SQL> CREATE INDEX sub_partition_test_spidx ON sub_partition_test (geometry)
2 INDEXTYPE IS MDSYS.SPATIAL_INDEX
3 LOCAL
4 UNUSABLE;
CREATE INDEX sub_partition_test_spidx ON sub_partition_test (geometry)
ERROR at line 1:
ORA-29846: cannot create a local domain index on a composite partitioned tableThanks,
JohnOk, thanks. That's what we're planning on doing now.
SQL> CREATE TABLE partition_test
2 (
3 x NUMBER,
4 y NUMBER,
5 z NUMBER,
6 geometry MDSYS.SDO_GEOMETRY
7 )
8 PARTITION BY RANGE (x, y)
9 (
10 PARTITION p_x100y100 VALUES LESS THAN (100, 100),
11 PARTITION p_x100y200 VALUES LESS THAN (100, 200),
12 PARTITION p_x100yMAX VALUES LESS THAN (100, MAXVALUE),
13 PARTITION p_x200y100 VALUES LESS THAN (200, 100),
14 PARTITION p_x200y200 VALUES LESS THAN (200, 200),
15 PARTITION p_x200yMAX VALUES LESS THAN (200, MAXVALUE),
16 PARTITION p_x300y100 VALUES LESS THAN (300, 100),
17 PARTITION p_x300y200 VALUES LESS THAN (300, 200),
18 PARTITION p_x300yMAX VALUES LESS THAN (MAXVALUE, MAXVALUE)
19 );
Table created.
SQL>
SQL> INSERT INTO user_sdo_geom_metadata VALUES ('PARTITION_TEST','GEOMETRY',
2 SDO_DIM_ARRAY(
3 SDO_DIM_ELEMENT('X', 0, 1000, 0.005),
4 SDO_DIM_ELEMENT('Y', 0, 1000, 0.005)
5 ), 262152);
1 row created.
SQL> CREATE INDEX partition_test_spidx ON partition_test (geometry)
2 INDEXTYPE IS MDSYS.SPATIAL_INDEX
3 LOCAL
4 UNUSABLE;
Index created. -
Create a partitioned table using Round Robin
Hi,
I want to create a partitioned table.
My concern is that if I use round robin now, whether I can create a primary key for this table in the future?
Thanks!You cannot use Round Robin, if your table has primary keys.
But as you must know , now we can create a HASH Partitioning on the tables with out primary key too, i thought ii would rather test once again and comment:
Please find the screen shot below which confirms that Round Robin cannot be done on table with Primary keys.
Where as the table without primary keys am able to use Round robin. Till here it was fine for me.
Now in the second case where i created a table with Round robin and then later i added the primary key using Alter statement, then am able to have Round Robin on the table with primary keys. ( don't know what does that means )
Column screenshot:
Regards,
Krishna Tangudu -
ORA-01426 creating local partitioned intermedia index (URGENT)
We are trying to create a domain index on a daily partitioned table with Oracle 9.2.0.1. This table will have 365 partitions, one by day.
When creating the context index oracle dumps the next error:
ORA-29855: se ha producido un error en la ejecución de la rutina
ODCIINDEXCREATE
ORA-20000: Error de Oracle Text:
DRG-50857: oracle error in driddl.kglpurge
ORA-20000: Oracle Text error:
DRG-50857: oracle error in drdmlv
ORA-01426: desbordamiento numérico
ORA-30576: error al cargar el diccionario de la Opción ConText
DRG-50610: internal error: kglpurge []
ORA-06512: en "CTXSYS.DRUE", línea 157
ORA-06512: en "CTXSYS.TEXTINDEXMETHODS", línea 186
According to Thechnical overview Oracle Text 9.0.1 the limit on the number of partitions of a context index is of 9999; but it crashes when it gets to 255 (we can see this by the $ tables it has written).
¿is this a bug, is there any patch for this? ¿do we have to split the table?"UNIQUENESS" has to be across the table. However, when you create a LOCAL Index, the index segment is only within that table Partition. How can Oracle guarantee Uniqueness ? Only if the Index also includes the Table Partition Key -- that way it knows that no two rows in the two partitions will have the same value on the Partition Keys. The additional columns then allow for uniqueness without Oracle having to "verify" values in other Table Partitions.
That is why a LOCALlly Partitioned UNIQUE Index must include the Table Partition Key columns. -
How can I create my own tag name while creating a partition table.
I have X4500 running Solaris 10. I have formatted a disk and created partition table as given below.
Specify disk (enter its number): 0
selecting c0t0d0
[disk formatted]
/dev/dsk/c0t0d0s0 is part of active ZFS pool zpool1. Please see zpool(1M).
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
fdisk - run the fdisk program
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
inquiry - show vendor, product and revision
volname - set 8-character volume name
!<cmd> - execute <cmd>, then return
quit
format> partition
PARTITION MENU:
0 - change `0' partition
1 - change `1' partition
2 - change `2' partition
3 - change `3' partition
4 - change `4' partition
5 - change `5' partition
6 - change `6' partition
select - select a predefined table
modify - modify a predefined partition table
name - name the current table
print - display the current table
label - write partition map and label to the disk
!<cmd> - execute <cmd>, then return
quit
partition> print
Current partition table (original):
Total disk sectors available: 1953508749 + 16384 (reserved sectors)
Part Tag Flag First Sector Size Last Sector
0 usr wm 34 4.00GB 8388641
1 usr wm 8388642 2.00GB 12582945
2 usr wm 12582946 200.00GB 432013345
3 usr wm 432013346 175.00GB 799014945
4 usr wm 1166180386 375.43GB 1953508748
5 usr wm 799014946 175.00GB 1166016545
6 usr wm 1166016546 80.00MB 1166180385
8 reserved wm 1953508749 8.00MB 1953525132
partition>
I am unable to specify my own tag name. How can I change the tag name to one of my interest.
I need to create 3 partitions as told below
partitions:
/earth
/mars
/work
/earth and /work should be roughly equal in size, /mars should be twice the size of the others, if that is possible. If not 3 partitions of equal size will do.
Please, help me .
Thank you.Exactly 1TB? Slightly under/slightly over?
Traditional Solaris disk labels are in VTOC format, but this format cannot describe disks larger than 1TB. So EFI labels must be used on disks larger than 1TB. Setup is slightly different.
Are these physical disks or LUNs from a SAN array? If they are array LUNS, it is often the case that they don't have a Sun label of any type. So...
#1 Apply a Solaris label
If the LUNS don't have a label (when selected in 'format', it gives a warning that no label is present and offers to apply a label immediately). When run non-interactively, format assumes "yes" for any questions. So all you'd have to do is select every disk to have it apply labels to any unlabled disk. Run 'format' once and find the highest number (maybe it's 50 for you). Create a text file that looks like this:
disk 1
disk 2
disk 3
disk 50Then feed that to format like this:
# format -f /tmp/disklist or whatever you've named the file.
#2 Apply the partition layout to all disks you want.
You asked if you should do the same procedure, but I don't see that you've actually done anything above other than print out the existing layout. Take one of your 48 drives and partition it the way you want manually (set the slices to the sizes that you want). Then you can copy the layout of that disk to others. You only want to do this between disks/LUNs of the same size. As an example, if you've explicitly partitioned c1t0d0 and you want to apply this to c1t1d0, do this:
# prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2Repeat for all of your other disks.
Darren -
Fdisk not creating correct partition table
Hi,
I am trying to use fdisk to create a couple of partitions on an external USB disk but it doesn't do correctly what I ask it to. It seems the problem is the difference in what the CHS (cylinder head sector) info says and what the start/size info says. For example for a 160GB disk with two partitions I would like to have it be (disk geometry is 7296/255/63 [117210240 sectors]):
#: id cyl hd sec - cyl hd sec [ start - size]
1: 12 0 1 1 - 763 254 63 [ 63 - 12273597] Compaq Diag.
*2: 07 764 0 1 - 1023 254 63 [ 12273660 - 104936580] HPFS/QNX/AUX
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
But if I try using fdisk this is what I end up with:
#: id cyl hd sec - cyl hd sec [ start - size]
1: 12 0 1 1 - 1023 254 63 [ 63 - 12273597] Compaq Diag.
*2: 07 1023 254 63 - 1023 254 63 [ 12273660 - 104936580] HPFS/QNX/AUX
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
So as you can see the start/size info is right, but the CHS numbers are not (the end of partition 1 is not correct and the begining and end of partition 2 is not correct). The commands that I gave to fdisk to do this were:
fdisk:*1> edit 1
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
1: 12 0 1 1 - 1023 254 63 [ 63 - 12273597] Compaq Diag.
Partition id ('0' to disable) [0 - FF]: [12] (? for help)
Do you wish to edit in CHS mode? [n] y
BIOS Starting cylinder [0 - 7295]: [0]
BIOS Starting head [0 - 254]: [1]
BIOS Starting sector [1 - 63]: [1]
BIOS Ending cylinder [0 - 7295]: [1023] 763
BIOS Ending head [0 - 254]: [254]
BIOS Ending sector [1 - 63]: [63]
and
fdisk:*1> edit 2
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
*2: 07 1023 254 63 - 1023 254 63 [ 12273660 - 104936580] HPFS/QNX/AUX
Partition id ('0' to disable) [0 - FF]: [7] (? for help)
Do you wish to edit in CHS mode? [n] y
BIOS Starting cylinder [0 - 7295]: [1023] 764
BIOS Starting head [0 - 254]: [254] 0
BIOS Starting sector [1 - 63]: [63] 1
BIOS Ending cylinder [0 - 7295]: [1023] 7295
BIOS Ending head [0 - 254]: [254]
BIOS Ending sector [1 - 63]: [63]
How can I fix this? I have tried both the CHS method and the default (start/size) method when creating the partitions and neither give the completely correct results. I have tried completely erasing the partition table and recreating it, but nothing seems to give me what I would think should be no big deal. I am puzzled as to how one set of info (ie CHS) does not agree with the start/size info??? I think the 1023 value for cylinders is OK for the end of partition 2 due to some funny WIndows bit of trivia, but the CHS for end of part 1 and start of part 2 should be correct since they are less than 1023.
The disk does have an MBR type partition table. I am doing this on a SATA external drive attached to a USB DriveWire if that makes a difference.
What am I doing wrong? Can I get there using fdisk on my MacBook?
Thanks ....
-BobWell, I have given up on using fdisk and just decided to edit the raw disk with a hex editor and modify the appropriate bytes of the partition table. The first 512 bytes of the disk contain this info in the following format:
446 bytes of boot code and other stuff
64 bytes of partition info (16 bytes for each of four partitions)
2 bytes with special 0x55 0xAA values
512 bytes total
Each partition table entry has the structure:
Boot flag - 1 byte which is either 0x0 or 0x80
CHS Begin - 3 bytes for cylinder, head, sector
Type - 1 byte for what type of filesystem partition 1 is
CHS End - 3 bytes for cylinder, head, sector
LBA Begin - 4 bytes
# of sectors - 4 bytes
I found explanations at http://www.viralpatel.net/taj/tutorial/partition_table.php and http://www.ata-atapi.com/hiwtab.html had a couple of examples to study.
So thanks for everyone's suggestions. I just wish that fdisk really worked like it is supposed to without the funny business!!
-Bob -
Create a spatial index on a large table
Hi all
I think that I might be starting to push XE beyond what it is capable of, but I thought I would ask here to see if anyone has some ideas how to get around my problem.
I have a table with around 8,000,000 record in it. It has position data in it (SDO_GEOMETRY) which I would like to index. The geometry is not complex, just a single point for each record. The SQL I use is
CREATE INDEX "ANNOTATION_TEXT_SX" ON "ANNOTATION_TEXT" ("GEOLOC") INDEXTYPE IS "MDSYS"."SPATIAL_INDEX"
The command fails, due to memory issues. The errors thrown are
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-13249: internal error in Spatial index: [mdidxrbd]
ORA-13249: Error in Spatial index: index build failed
ORA-13236: internal error in R-tree processing: [failed to cluster in memory]
ORA-13232: failed to allocate memory during R-tree creation
ORA-13236: internal error in R-tree processing: [failed to allocate memory 7272216 (mdrtsalloc)]
ORA-04031: unable to allocate ORA-04031: unable to allocate 7272264 bytes of shared memory ("lar
I have done a bit of reading up, this type of error generally occurs when the tablespace runs out of memory. Since I am using the SYSTEM tablespace, I figure I am running it out to its capacity before the index is completed.
I have not created any other tablespaces. Is this an option to allow the creation of the index? Storage and Memory are at about 60% capacity (due to this one table) so is it just too big to create a spatial index on in XE? Am I barking up the wrong tree?
Cheers
JamesGood to see you are not using the SYSTEM tablespace. (And no need to apologize too profusely for being new at this - we all were at one time.)
It normally doesn't matter how many rows are involved. The issue is how much actual space those rows require. 8,000,000 rows is actually not a lot in the GIS world, esp. if all you have is simple point data. Using the sdo_point field instead of the arrays should be a lot more compact as well.
Some steps I would take:
- Identify the actual amount of space used, in total as well as by tablespace. (One of the web-based admin screens can show you this.)
- Load it all up usnig the free 'developer license' Enterprise Edition insead of XE just to verify it'll work.
- Try indexing a smaller data set and see whether that works. (Export the table first) Delete about 1/2 rows and try indexing.
The ORA-04031 is really telling you something about the SGA is not big enough. One of the SGA pools is trying to extend by 7M. Post the info about your SGA, as well ass some details about your machine (disk/processor/total memory)
Message was edited by:
forbrich
The actual error causing the problem is the last line. It ends with "la and the rest is cut off. Could it have said 'large pool'??? -
Error while creating a partitioned table
I am trying to create a table with 2 partitions but am getting the following error.
Can someone please help out as to what is missing here..!!!
PARTITION BY RANGE (to_char(to_date(log_date,'YY/MM/DD HH24:MI:SS'), 'DD'))
ERROR at line 7:
ORA-00907: missing right parenthesis
create table dummy_logs
application_id number,
log_date date
tablespace my_tspace pctfree 4
partition by range (to_char(to_date(log_date,'yy/mm/dd hh24:mi:ss'), 'dd'))
( partition day01 values less than ('02'),
partition day02 values less than ('03')
PS: The partition is to be based on the day('DD') on which the row will be added.Nopes Adith, It didn't helped.
I specifically need the whole clause
to_char(to_date('07/07/11 08:06:02','YY/MM/DD HH24:MI:SS'), 'DD') as I need to extract the day field from the sysdate.
and also, it works fine when I query it through dual.
05:15:55 SQL> select to_char(to_date(sysdate,'YY/MM/DD HH24:MI:SS'), 'DD') from dual;
TO
12 -
How to create a partition table on the basis of substring of column val
Hi All,
I have table
Create table Mytable
( Col1 number,
Col2 number,
Col3 varchar2(20)
insert into mytable values(11,2,'20110901');
insert into mytable values(12,2,'20110902');
insert into mytable values(13,2,'20110903');
insert into mytable values(14,2,'20110904');
insert into mytable values(15,2,'20110905');
insert into mytable values(16,2,'20110906');
Col3 data have the date value in the form of yyyymmdd format.
I want to create a 30 partitions on the basis of day on col3.
how can i achive this. i tried range partition but how can i get day of col3?
any help appriciated.
Edited by: P:) on Sep 28, 2011 5:56 PMHi,
the first point would be to use the correct data type for col3 and make it a date. Then I can see no reason why you couldn't range partition based on the date.
Andre -
Local Vs Global Index on partitioned table?
Hello All,
DESC PS_P1_EMP_QRYSCRTY
Name Null? Type
EMPLID NOT NULL VARCHAR2(11)
EMPL_RCD NOT NULL NUMBER(38)
ROWSECCLASS NOT NULL VARCHAR2(30)
ACCESS_CD CHAR(1)
MY SQL QUERY IS:-
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSID
This query was taking around 15 mins to run at sql-prompt
I have created a partitioned table based on PS_P1_EMP_QRYSCRTY :-
CREATE TABLE PS_P1_EMP_QRYSCRTY_BAK
TABLESPACE PSNEWTAB
PARTITION BY HASH(ROWSECCLASS)
( PARTITION PART1 ,
PARTITION PART2 ,
PARTITION PART3 ,
PARTITION PART4 ,
PARTITION PART5 ,
PARTITION PART6 ,
PARTITION PART7 ,
PARTITION PART8 ,
PARTITION PART9 ,
PARTITION PART10 ,
PARTITION PART11 ,
PARTITION PART12 ,
PARTITION PART13 ,
PARTITION PART14 ,
PARTITION PART15 ,
PARTITION PART16
ENABLE ROW MOVEMENT
AS SELECT * FROM PS_P1_EMP_QRYSCRTY
I created a local index like on PS_P1_EMP_QRYSCRTY_BAK
CREATE INDEX PS_P1_EMP_QRYSCRTY_BAK
ON PS_P1_EMP_QRYSCRTY_BAK(ROWSECCLASS,EMPLID,EMPL_RCD)
TABLESPACE PSINDEX
LOCAL;
The Following is an extract From PS_P1_EMP_QRYSCRTY_BAK
1ST COLUMN =TABLE NAME
2ND COLUMN = PARTITION NAME
3RD COLUMN = NUM OF DISTINCT ROWSECCLASS IN THE PARTITION
4TH COLUMN = NUM OF TOTAL ROWS IN THE PARTITION
TABLE_NAME PARTITION_NAME NUM_OF_DISTINCT_ROWSECCLASS NUM_OF_ROWS
PS_P1_EMP_QRYSCRTY_BAK | PART1 | 25 | 289058
PS_P1_EMP_QRYSCRTY_BAK | PART2 | 25 | 154537
PS_P1_EMP_QRYSCRTY_BAK | PART3 | 27 | 364219
PS_P1_EMP_QRYSCRTY_BAK | PART4 | 33 | 204528
PS_P1_EMP_QRYSCRTY_BAK | PART5 | 23 | 527974
PS_P1_EMP_QRYSCRTY_BAK | PART6 | 22 | 277210
PS_P1_EMP_QRYSCRTY_BAK | PART7 | 23 | 517125
PS_P1_EMP_QRYSCRTY_BAK | PART8 | 30 | 307634
PS_P1_EMP_QRYSCRTY_BAK | PART9 | 28 | 523169
PS_P1_EMP_QRYSCRTY_BAK | PART10 | 38 | 192565
PS_P1_EMP_QRYSCRTY_BAK | PART11 | 27 | 120062
PS_P1_EMP_QRYSCRTY_BAK | PART12 | 33 | 407829
PS_P1_EMP_QRYSCRTY_BAK | PART13 | 37 | 522349
PS_P1_EMP_QRYSCRTY_BAK | PART14 | 25 | 275991
PS_P1_EMP_QRYSCRTY_BAK | PART15 | 21 | 259676
PS_P1_EMP_QRYSCRTY_BAK | PART16 | 23 | 468071
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSID
Now when i run this query it gives result in around 5-6 mins
MY PS_P1_EMP_QRYSCRTY_BAK table contains sumwhat 6 million rows...
Now My Questions are:-
1) Is the number of partition done by me optimal under these circumstances...i mean can i get better performance By increasing or decreasing the number of partitions.
2) I created local index on PS_P1_EMP_QRYSCRTY_BAK.
Whether creating local or global index will be more beneficial keeping in mind the where clause and Select clause of the query....
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSID
i mean in where clause rowsecclass is used thats why i partitioned my table on ROWSECCLASS.
And in select clause i m selecting EMPLID and EMPL_RCD
Thats y i made a local index on ROWSECCLASS,EMPLID ,EMPL_RCD .
Thanks
--Pradeep1) Is the number of partition done by me optimal under these circumstances...i mean can i get better performance >By increasing or decreasing the number of partitions.
2) I created local index on PS_P1_EMP_QRYSCRTY_BAK.
Whether creating local or global index will be more beneficial keeping in mind the where clause and Select clause of >the query....You'll have to see for yourself what is optimal. Every system is different. Here are some ideas, though.
Your query
SELECT DISTINCT OPR.OPRID , EMP.EMPLID ,EMP.EMPL_RCD , OPR.CLASSID ,'Y'
FROM PS_SJT_OPR_CLS OPR , PS_P1_EMP_QRYSCRTY_BAK EMP
WHERE EMP.ROWSECCLASS=OPR.CLASSIDappears to read all qualifying rows across all qualifying partitions. Since you are partitioning by an id that would appear to exclude range and list partitioning instead so the hash partition is probably the best for your application.
Regarding global vs local partitions, I have seen timings indicate that global indexes can improve cross-partition queries slighly. I have not worked with partitions for a while but remember that global partition maintenance is difficult; anything the partition structure changes the global index had to be rebuild. You can check the documentation to see if that has changed.
If possible creating a unique index should give better performance than using an index allowing duplicates. -
How to create a local partition index asign its storage tablespace
hi
i see the syntax about create local context index
quote:
Syntax for CONTEXT Indextype
Use this indextype to create an index on a text column. You query this index with the CONTAINS operator in the WHERE clause of a SELECT statement. This index requires manual synchronization after DML.
CREATE INDEX [schema.]index on [schema.]table(column) INDEXTYPE IS ctxsys.context [ONLINE]
LOCAL [(PARTITION [partition] [PARAMETERS('paramstring')]
[, PARTITION [partition] [PARAMETERS('paramstring')]])]
[PARAMETERS(paramstring)] [PARALLEL n] [UNUSABLE];
and i try the under code ,all failed.
SQL> create index html2_idx on HTML2(newsdescription) indextype is ctxsys.contex
t local (partition indx parameters('lexer my_lexer'),partition indx01 tablespace
users01 parameters('lexer my_lexer'),partition indx02 tablespace users02 param
eters('lexer my_lexer'),partition indx03 tablespace users03 parameters('lexer m
y_lexer') );
ERROR:ORA-29850
could anybody show some demo sql code creating partition context index asign its storage tablespace
thankstry:
create index html2_idx on HTML2(newsdescription) indextype is ctxsys.contex
t local (
partition indx parameters('lexer my_lexer'),
partition indx01 parameters('storage users01_stg lexer my_lexer'),
partition indx02 parameters('storage users02_stg lexer my_lexer'),
Create storage preferences users01, users02, .. with I, K, ... attributes for tablespace users01, users02, ...
Btw, ¿does anyone know whats the upper limit of partitions for a domain index? I've read in OTN they were 9999 but it crashes me (oracle 9.2.0.1) when I have 255... ¿has anyone tried this? -
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 -
Problems creating a partitioned primary key index.
I am creating a partitioned table and I noticed that when I use the constraint option of the create table the primary key is not partitioned. I then tried using the using index clause and specifying the create index local and that is giving errors. Here is my current syntax that is causing the errors:
create table redef_temp (
USER_ID VARCHAR2(32),
GROUP_ID VARCHAR2(32),
JOIN_DATE DATE DEFAULT SYSDATE NOT NULL,
constraint primary key
using index (create index pk_redef_temp
on redef_temp (USER_ID, GROUP_ID)
LOCAL STORE IN (IDX)))
tablespace data
partition by hash (user_id)
(PARTITION ic_x_user_group_part_p1 tablespace DATA,
PARTITION ic_x_user_group_part_p2 tablespace DATA,
PARTITION ic_x_user_group_part_p3 tablespace DATA,
PARTITION ic_x_user_group_part_p4 tablespace DATA)
PARALLEL ENABLE ROW MOVEMENT;
ThanksThe following works on 9.2.0.8 and 10.2.0.3:
create table redef_temp (
USER_ID VARCHAR2(32),
GROUP_ID VARCHAR2(32),
JOIN_DATE DATE DEFAULT SYSDATE NOT NULL,
constraint pk_redef_temp primary key (user_id, group_id)
using index (
create index pk_redef_temp
on redef_temp (USER_ID, GROUP_ID)
LOCAL tablespace test_8k
tablespace test_8k
partition by hash (user_id) (
PARTITION ic_x_user_group_part_p1 tablespace test_8k,
PARTITION ic_x_user_group_part_p2 tablespace test_8k,
PARTITION ic_x_user_group_part_p3 tablespace test_8k,
PARTITION ic_x_user_group_part_p4 tablespace test_8k
PARALLEL ENABLE ROW MOVEMENT
/Your syntax for the constraint definition was wrong, and your use of 'store in' for the index tablespace was wrong. I've had to change all tablespace names to 'test_8k'.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk -
Estimation of Local Partitioned Bitmap Index size in Oracle
Its datawarehousing project and the we have around 20 partitioned dimensional tables . The requirement is to create local partitioned bitmap index on almost all columns of dimension tables excluding primary key columns as they are already indexed.We need to estimate the size of index partitionwise.
Please let me have if there is any ready piece of script which will help me in estimating size of bitmap local partitioned index.You may want to look into the DBMS_SPACE.CREATE_INDEX_COST procedure.
Usage Notes* The table on which the index is created must already exist.
* The computation of the index size depends on statistics gathered on the segment.
* It is imperative that the table must have been analyzed recently.
* In the absence of correct statistics, the results may be inaccurate, although the procedure will not raise any errors. -
Error while creating partition table
Hi frnds i am getting error while i am trying to create a partition table using range
getting error ORA-00906: missing left parenthesis.I used the following statement to create partition table
CREATE TABLE SAMPLE_ORDERS
(ORDER_NUMBER NUMBER,
ORDER_DATE DATE,
CUST_NUM NUMBER,
TOTAL_PRICE NUMBER,
TOTAL_TAX NUMBER,
TOTAL_SHIPPING NUMBER)
PARTITION BY RANGE(ORDER_DATE)
PARTITION SO99Q1 VALUES LESS THAN TO_DATE(‘01-APR-1999’, ‘DD-MON-YYYY’),
PARTITION SO99Q2 VALUES LESS THAN TO_DATE(‘01-JUL-1999’, ‘DD-MON-YYYY’),
PARTITION SO99Q3 VALUES LESS THAN TO_DATE(‘01-OCT-1999’, ‘DD-MON-YYYY’),
PARTITION SO99Q4 VALUES LESS THAN TO_DATE(‘01-JAN-2000’, ‘DD-MON-YYYY’),
PARTITION SO00Q1 VALUES LESS THAN TO_DATE(‘01-APR-2000’, ‘DD-MON-YYYY’),
PARTITION SO00Q2 VALUES LESS THAN TO_DATE(‘01-JUL-2000’, ‘DD-MON-YYYY’),
PARTITION SO00Q3 VALUES LESS THAN TO_DATE(‘01-OCT-2000’, ‘DD-MON-YYYY’),
PARTITION SO00Q4 VALUES LESS THAN TO_DATE(‘01-JAN-2001’, ‘DD-MON-YYYY’)
;More than one of them. Try this instead:
CREATE TABLE SAMPLE_ORDERS
(ORDER_NUMBER NUMBER,
ORDER_DATE DATE,
CUST_NUM NUMBER,
TOTAL_PRICE NUMBER,
TOTAL_TAX NUMBER,
TOTAL_SHIPPING NUMBER)
PARTITION BY RANGE(ORDER_DATE) (
PARTITION SO99Q1 VALUES LESS THAN (TO_DATE('01-APR-1999', 'DD-MON-YYYY')),
PARTITION SO99Q2 VALUES LESS THAN (TO_DATE('01-JUL-1999', 'DD-MON-YYYY')),
PARTITION SO99Q3 VALUES LESS THAN (TO_DATE('01-OCT-1999', 'DD-MON-YYYY')),
PARTITION SO99Q4 VALUES LESS THAN (TO_DATE('01-JAN-2000', 'DD-MON-YYYY')),
PARTITION SO00Q1 VALUES LESS THAN (TO_DATE('01-APR-2000', 'DD-MON-YYYY')),
PARTITION SO00Q2 VALUES LESS THAN (TO_DATE('01-JUL-2000', 'DD-MON-YYYY')),
PARTITION SO00Q3 VALUES LESS THAN (TO_DATE('01-OCT-2000', 'DD-MON-YYYY')),
PARTITION SO00Q4 VALUES LESS THAN (TO_DATE('01-JAN-2001', 'DD-MON-YYYY')))In the future, if you are having problems, go to Morgan's Library at www.psoug.org.
Find a working demo, copy it, then modify it for your purposes.
Maybe you are looking for
-
Multiple Apple TV's on the same network with airplay issues.
I work at a school with 37 Apple TV's. They are all on the same network, some of them are wired while others are wireless. The problem I am having is that airplay works and then doesn't work for some unknown reason. The Apple TV's are connected to
-
Trying to install iTunes 10.5 on Windows 7
I have the 64-bit version of Windows 7 and everytime I try updating to iTunes 10.5 I get this error message: An error occurred during the installation of assembly 'Microsoft.VC80.CRT.type="1fc8b3b9a1e18e3b".processorArchitecture="x86"'.Please refer t
-
Help with Essbase 9 and the Java API
Hi, I am trying to connect to Essbase from a Java desktop application and I am unable to do so. I need to know if I am in principle doing the right things and if I have the correct environment set up. We have a server with Essbase version 9.3.1. We n
-
Hi All, I have a doubt regarding the usage of webservice runtime. I have a scenario where we have a webdynpro ABAP program which displays all the messages for a particular interface. In our scenario we have only an Integration server of PI 7.1. In th
-
Error when i launch Netpoint Installer ??
Hi all, i installed NetPoint and when i try to launch it i got the following error http://images.imagehotel.net/?tj2x0pvmrh.jpg any help !!??