Amazing
Gabriel Schor, January 08, 2009 - 2:21 pm UTC
But of course!!! Almost asked myself why it didn't cross my mind but I answered that very quickly :-)
Thank you,
Amount of space?
Developer, May 08, 2009 - 2:18 pm UTC
Tom,
So do you need twice the amount of space for the table you are splitting? Are the rows moved for both the partitions involved in the splitting? or is Oracle intelligent enough to calculate which partition is going to be smaller and then just move those rows? So if a 6 million row table split is going to result into a 1 million and 5 million row partitions after the split, will Oracle create a temporary segment for just the 1 million row partition or will it need to create 2 temporary segments and move 1 million into one and 5 million into other? (essentially doubling the space needed during the split).
I have a table partition that has 6 million rows in it. The partition size is 1.2GB. It has a BLOB column in it. The BLOB size is 950GB. Do I need 1,900GB free before I could do a split operation on this table?
Thanks.
ORA-10632: Invalid rowid while spliting partition
Prien, October 06, 2009 - 5:56 pm UTC
hi Tom,
I faced issue while spliting the partition for one of the tables.
1) Table name is let's say TRANSACTIONS partitiond on CREATE_DATE (Range partition)(Min-2008-11-01 and max-20091201 monthly partitions)
2) It has only one index - Index is local and unique one
3) All the index partitions were in tablespace say TBS_1
4) I moved them to TBS_2 as we wanted to drop TBS_1
5) TBS_1 was dropped.
6) Now while spliting 2008-11-01 into 2008-10-01 and 2008-11-01, It says :
ORA-00959: tablespace 'TBS_1' does not exist
7) I dropped the index and then splitted the 2008-11-01 into 2008-10-01 and 2008-11-01. It allowed me to do the same.
8) While spliting 2008-10-01 into 2008-09-01 and 2008-10-01 using
alter table TRANSACTIONS split partition 20081001 at (to_Date('2008-09-01','yyyy-mm-dd'))
into (partition 20080901 ,partition 20081001 ) parallel 32;
It gave me below error:
ORA-00604: error occurred at recursive SQL level 1
ORA-12801: error signaled in parallel query server P027
ORA-10632: Invalid rowid
Did I do something wrong?
Thanks & Regards,
Prien
October 08, 2009 - 7:18 am UTC
no, you did not, please contact support for that - it would be something we did wrong.
Just a thought
A reader, October 08, 2009 - 1:24 pm UTC
May be i am wrong
1. May be this had generated trace. Look into that if you find something
2. Or may be due to Hakan factor. But this is only i have seen with exchange partition not split may be you need to check.
online partition split
Oliver, October 12, 2009 - 11:05 am UTC
Hello Tom,
besides that splitting large partitions might need lots of space they can take a lot of time too. Is there any means to do this online (in 9i or 10g)? Maybe with dbms_redefinition?
TIA!
Oliver
dbms_redef
A reader, October 20, 2009 - 10:01 am UTC
I think dbms_redefination uses MV's internally to to this task.
October 22, 2009 - 4:54 pm UTC
under the covers, a lot of the materialized view stuff is used - yes.
David Aldridge, October 21, 2009 - 12:11 pm UTC
Not to be nit-picky or anything (the traditional mantra prior to a session of nit-picking) but the amount of space required could vary considerably from 2x.
It would depend on the storage clauses for the new partitions (most likely pctfree and compress I suppose), and the actual amount of data in the original segment(s) being split in comparison to the segment(s) size.
So it's conceivable that a full, compressed partition is split into uncompressed partitions with high pctfree (> x2), or that a partition with very few rows in a very large (mostly empty) segment be split into compressed partitions (< x1).
I'll get my coat ...
October 23, 2009 - 12:28 pm UTC
you are correct, it'll recreate the segments leaving the old segments behind.
the new data could be MUCH MORE than the old data
the new data could be MUCH LESS than the old data
partition splitting
satin satin, May 26, 2010 - 3:55 pm UTC
Tom,
Could you please suggest me how can i complete this . I have partition table with 28 month partitions and a Max value partitions. Since last 8 months we didnot split any partitions so the last 8 months of data is sitting in "MAXVALUE" partition. Now How do I split the 8 months data into 8 partitions
Thanks
May 27, 2010 - 7:24 am UTC
split off into 8 months ago and the rest
then 7 months ago and the rest
....
then 1 months ago and the rest.
create table temp
( just like the current table )
partition by .....;
create table dummy (just like current table)
insert /*+ append */ into temp select * from current_table partition(max_partition);
drop max_partition from current table
alter current table add partition for month8, month7, month6.... month1
loop
-- turn empty dummy into fully dummy;
alter table temp exchange partition with dummy;
-- make full dummy become a partition of current table
alter table current exchange partition with dummy;
end loop
partition split
satin satin, May 26, 2010 - 4:05 pm UTC
I missed the data type of partition is number of format (YYYYMM) and I have only this value in the table and we cannot covnvert to this format
Multiple Sessions Splitting a Singe Default Partition
Rajeshwaran, Jeyabal, June 08, 2011 - 9:57 am UTC
usr_801142427@PRD1> SELECT sid,seq#,event,wait_class,seconds_in_wait,state
2 FROM v$session_wait
3 WHERE sid IN(214, 229,197,191)
4 /
SID SEQ# EVENT WAIT_CLASS SECONDS_IN_WAIT STATE
---------- ---------- ---------------------------------------------------------------- ------------ --------------- -------------------
191 41390 library cache lock Concurrency 6559 WAITING
197 2582 latch: cache buffers chains Concurrency 11 WAITED SHORT TIME
214 2136 latch: cache buffers chains Concurrency 110 WAITED SHORT TIME
229 5128 library cache lock Concurrency 7372 WAITING
Elapsed: 00:00:00.01
usr_801142427@PRD1>
uhg_801142427@PRD1> with dts as(
2 SELECT sql_id,sid,serial#
3 FROM v$session
4 WHERE sid IN(214, 229,197,191)
5 )
6 select sql_text,concurrency_wait_time,cpu_time,elapsed_time,dts.sid,dts.serial#
7 from v$sql, dts
8 where v$sql.sql_id = dts.sql_id
9 /
SQL_TEXT CONCURRENCY_WAIT_TIME CPU_TIME ELAPSED_TIME SID SERIAL#
-------------------------------------------------- --------------------- ---------- ------------ ---------- ----------
alter table data_stg_inbound drop partition P_6615 7561233283 9055535967 1.6619E+10 191 4635
15 update indexes
alter table data_stg_inbound split partition p_max 188574 8860840207 8861062037 197 24130
values (661517) into (partition p_661517, partiti
on p_max)
alter table data_stg_inbound split partition p_max 8843768 1959183601 1967999527 197 24130
values (661517) into (partition p_661517, partiti
on p_max)
alter table data_stg_inbound split partition p_max 171045 8880087435 8880087435 214 39340
values (661518) into (partition p_661518, partiti
on p_max)
alter table data_stg_inbound split partition p_max 5883349 1928141060 1934015371 214 39340
values (661518) into (partition p_661518, partiti
on p_max)
alter table data_stg_inbound split partition p_max 8347073210 9078911572 1.7430E+10 229 23696
values (661516) into (partition p_661516, partiti
on p_max)
6 rows selected.
Elapsed: 00:00:00.15
uhg_801142427@PRD1>Questions:1) Multiple Sessions are splitting partition p_max, then one session will succeed then others session should end up with Resource busy exception. Why its not happening here?
2) What does this wait event means "library cache lock " & latch: cache buffers chains ?
June 08, 2011 - 11:01 am UTC
1) they do not have to get an ora-54, they can wait
2) They are parsing (library cache) and heavy logical IO (cache buffers chains) related.
partition wizard
A reader, July 18, 2011 - 9:02 pm UTC
it could be a no-brainer if you employ this partition software by the name of Partition Wizard
Is there a way to partition a big table online without using dbms_definition?
Kulkarni, October 21, 2011 - 4:35 am UTC
Tom,
Is there a way where we can partition a big table online without affecting the business? However I am bit skeptical to use dbms_redefinition package as we will not be knowing what will be happening in he background and it is difficult to mend the things if this breaks in the middle.
Is there any manual method?
October 21, 2011 - 8:25 pm UTC
if it breaks in the middle, so what? All you lost was a bit of time.
Stop being skeptical.
Start being scientific.
Skeptics are good - if they base their skepticism on solid facts, things known to be true.
Skeptics that say - I don't think I like that because I don't understand it - ugh.
Are there manual methods? Sure, but they are infinitely more error prone and complex - and I'm not going into it.
use dbms_redefinition.
the start-redef procedure will copy the existing data into your new table without locking anything. it will also setup the functional equivalent of a materialized view log so that we know what rows where added/removed/modified during this time.
then use copy table dependents to get all of your indexes, grants, constraints, etc. or, if you want to do this yourself - go ahead, just create the indexes, constraints, grants, etc on the newly populated table. Call the synchronize routine everynow and then to keep the tables in sync
then finish_redef. this will sync the tables - lock the tables - sync them one last time (to get any changes that just happened during the prior sync) and then renames the old to new and new to old.
then you are done.
dbms_redef
Kulkarni, October 24, 2011 - 2:25 am UTC
Tom,
Sorry for using the work skeptical. But I am bit concerned to use this as we will not be knowing what is happening in the background and also how to fix it if it breaks in the middle.
Is there any way to monitory this online redefinition process? I mean can we get the steps Oracle follows while redefine a table online?
I tried to trace the the session using "10046 at level 12" doing online redefinition but could not get much information.
Thanks much in advance.
October 24, 2011 - 5:26 am UTC
why do you say "you could not get much information"???????
You saw step by step by step exactly what it did.
Let me ask you something - do you know what is happening in the background when you issue "create table t as select * from t1, t2, t3 where ..."??
No more than you do about dbms_redefinition.
No more than you do about create materialized view.
No more than you do about create index.
No more than you do about <ANY DDL COMMAND GOES HERE>.
I frankly am at a loss as to what to tell you. If you trace it, you would see that the start redef basically does a big old INSERT /*+ APPEND */ into your table. A direct path load.
You can trace the copy table depenedents - to see it does DDL - createing stuff, granting stuff.
I told you what the steps are
o you create a new table
o we load it (which you can plainly see - when I demonstrate how to use dbms_redef, I use sql trace to show precisely what it does).
o we also set up the equivalent of a materialized view log so we can sync up the tables
o we copy table dependents by reading the dictionary and recreating your triggers, grants, constraints, indexes, etc.
o we sync up using the log I mentioned
o then we lock tables - do one more sync - rename tables and we are done.
I've already written that - those are the steps (and if you know Oracle very well - you could, based on what I've written above - figure out exactly how to use other features to do this manually - I've even used the right keywords to make that exercise trivial).
If it breaks in the middle, you get an error. When you get an error, you determine corrective action based on that.
If you get "out of space" during the start redef - guess what you would do?
If you get an error from copy table dependents - you would read the error and figure out "what caused that index to not create, why didn't that trigger compile, why did that grant fail, etc" - and then correct it (and rerun copy table dependents to finish the process)
and so on.
Why are you not afraid of a SELECT statement? You don't know the intimate details of what happens in the millions of cpu instructions being executed?
Why are you not afraid of CREATE TABLE?
Please, go into your testing environment, work with this, test it, simulate your production environment.
But stop saying "oh, so scary, I don't know what it does" - you don't know what anything truly does under the covers - a create table executes HUNDREDS of sql statements - it does a ton of work.
Do with this database capability what you do with EVERY OTHER feature/function in EVERY OTHER piece of software - learn it (learn the interface). Test it, test it hard. Simulate your situation, test it more.
Then, use it.
partition split on range partitions to list subpartition
A reader, April 02, 2012 - 5:06 pm UTC
Hi Tom,
I am using Oracle enterprise edition 9.2.0.8 planning to upgrade to 10.2.0.5 soon. I have few tables partitioned on range(monthly) which I want to list sub partition to create multiple list sub partitions for each range partition.
Current partitions: April, Mar, Feb,Jan..etc
New partitions with sub partitioning: April(country1,country2...etc), Mar(country1,country2...etc), Feb(country1,country2...etc), Jan(country1,country2...etc),..etc
May i know how can I achieve this using split partition. Can you please share the syntax for subpartitioning the current range partitions which doesn't have any subpartitions.
April 03, 2012 - 6:39 am UTC
going from the really old to the simply very old... why not 11.2.0.3?
you cannot use split to achieve composite partitioning
You can use dbms_redefinition to online redefine into a new table
You can use create table as select to create a new table
You can create the new table and insert into it
and so on.