Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Nikhil.

Asked: December 13, 2016 - 12:01 pm UTC

Last updated: April 04, 2017 - 12:43 pm UTC

Version: 11.2.0

Viewed 1000+ times

You Asked

We nee to partition existing tables having billions of records in 11g.
In 11g there is no provision where we can alter table to add partitions.

Will DBMS_REDEFINITION package can be used to do that.

I have never used it, so could you please suggest.

and Chris said...

Yes. DBMS_redefinition can help you do this with minimal downtime.

Follow the links below for some worked examples:

https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:869096700346654484
https://asktom.oracle.com/pls/apex/f?p=100:11:::NO::P11_QUESTION_ID:9526051800346812767

Rating

  (4 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thanks a lot Chris!

A reader, December 14, 2016 - 4:21 am UTC


Parallel execution of dbms_redefinition

A reader, April 03, 2017 - 9:58 am UTC

Hi,

Is there any way , we can do redefinition in parallel like ALTER session kind of setting?
Chris Saxon
April 03, 2017 - 3:00 pm UTC

You can set parallel DML and query to the desired level, e.g.:

ALTER SESSION FORCE PARALLEL DML PARALLEL 4;
ALTER SESSION FORCE PARALLEL QUERY PARALLEL 4;


See the example 3 in the docs for the complete code

http://docs.oracle.com/database/122/ADMIN/managing-tables.htm#GUID-4E77A941-A660-4DB3-A7B8-D15FBD9BF509__CJAEIAED

Error

A reader, April 04, 2017 - 8:58 am UTC

Could you please help to get rid of below error -

ORA-42039: cannot online redefine table "TEST_SCHEMA"."TB_TES_REDIFE" with FGA or RLS enabled
ORA-06512: at "SYS.DBMS_REDEFINITION", line 143
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1635
ORA-06512: at line 1
42039. 00000 - "cannot online redefine table \"%s\".\"%s\" with FGA enabled"
*Cause: An attempt was made to redefine a table with Fine Grained Auditing
(FGA) or Row Level Security (RLS) enabled.
*Action: Do not attempt to online redefine a table with Fine Grained Auditing
(FGA) or Row Level Security (RLS) enabled.

Connor McDonald
April 04, 2017 - 12:31 pm UTC

Um.... isn't this sort of obvious:

"Action: Do not attempt to online redefine a table with Fine Grained Auditing
(FGA) or Row Level Security (RLS) enabled. "

You'd need to drop the policy in order to do dbms_redefinition

More deatils

A reader, April 04, 2017 - 12:36 pm UTC

Hi Connor,

Can you explain what these policies (Fine Grained Auditing
(FGA) or Row Level Security (RLS)) are?

Is it recommended to drop these policies?

How to do it and redefine the table with such policies?

I tried searching on these, but didn't get useful info.
Connor McDonald
April 04, 2017 - 12:43 pm UTC

See here

https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:5141373100346218033

and we've got a whole chapter on it in the docs

https://docs.oracle.com/database/121/DBSEG/vpd.htm#DBSEG007

But yes - if you want to redefine something online, then the policies need be to dropped (which in itself might ultimately force you to *not* do it online)

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library