Skip to Main Content
  • Questions
  • Converting Dictionary Managed to LMT tablespace

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Ravi.

Asked: December 15, 2000 - 3:19 pm UTC

Last updated: January 04, 2013 - 10:10 am UTC

Version: 816

Viewed 1000+ times

You Asked

Tom,

For example, after moving a dictionary managed tablespace to locally managed autoallocate tablespace using dbms_space_admin pack, the extent_management filed of dba_tablespaces will show as USER.(rather than LOCAL). Could you please explain me what does that mean. My question is, will the extent size of the objects after converting be
a) controlled by oracle automatically
b) or will be based on the storage charactersitcs of the objects getting created

Thanks
Ravi

and Tom said...

This support note covers this topic:

Article-ID: <Note:120061.1>
Circulation: PUBLISHED (EXTERNAL)
Folder: server.Rdbms.DBA.Admin
Topic: Managing Tablespaces
Title: Next Extent Size After Migrating Tablespace from Dictionary
to Locally Managed
Document-Type: BULLETIN
Impact: LOW
Skill-Level: NOVICE
Server-Version: 08
Updated-Date: 18-OCT-2000 12:31:11
References:
Attachments: NONE
Content-Type: TEXT/PLAIN
Keywords: DICTIONARY; LOCALLY; MANAGED; MIGRATE;
Products: 5/RDBMS (V8.1);
Platforms: GENERIC;

PURPOSE
-------

To Explain why migrated tablespaces are not subject to the
UNIFORM/SYSTEM policy of newly created locally managed tablespaces


SCOPE & APPLICATION
-------------------
An Understanding of the Architecture of Migrated Tablespaces

MIGRATED TABLESPACES:
-----------------------------
After migrating a dictionary managed tablespace to locally managed tablespace you notice that the tables are still extending with the next extent specified even though it's now a locally managed tablespace


Example:
==================================================
MIGRATE FROM DICTIONARY MANAGED TO LOCALLY MANAGED
==================================================
SQL> begin
2 dbms_space_admin.tablespace_migrate_to_local
3 (tablespace_name=> 'USERS', rfno=>5);
4 end;
5 /

PL/SQL procedure successfully completed.

===============================================
Verify that tablespace is now locally-managed:
===============================================

SQL> select TABLESPACE_NAME, EXTENT_MANAGEMENT
2 FROM DBA_TABLESPACES
3 where tablespace_name = 'USERS';

TABLESPACE_NAME EXTENT_MAN
------------------------------ ----------
USERS LOCAL

=================================================
CREATE TABLE with the storage segments;
=================================================

SQL> create table DW_GSO_COLLN_NEW
2 tablespace USERS
3 storage (initial 500M next 500M pctincrease 0)
4 as select * from cdwadm.dw_gso_colln
5 where rownum < 10000000;
Table created.

SQL> select segment_name,extent_id,bytes
2 from dba_extents
3 where segment_name='DW_GSO_COLLN_NEW';
SEGMENT_NAME EXTENT_ID BYTES
------------------------------ ---------- ----------
DW_GSO_COLLN_NEW 0 524288000
DW_GSO_COLLN_NEW 1 524288000
DW_GSO_COLLN_NEW 2 524288000


QUESTION:

Why is the table extending with the next extent that is
specified even though it's locally managed tablespace.

ANSWER:

Migrated tablespaces are not subject to the UNIFORM/SYSTEM policy of newly created locally managed tablespaces. This would be too difficult to implement, since the tablespace is likely to contain the existing objects which already violate new policy. For this reason, migrated tablespace only support the same allocation policy as the dictionary tablespaces, i.e. we do whatever the user tells us to do. If you select from DBA_TABLESPACES, you should see "USER" value in the
ALLOCATION_TYPE column for migrated tablespaces, and UNIFORM or
SYSTEM value for tablespaces which were created as locally managed.

Therefore, the user will not get the policy benefits from migration, but can still get performance benefits - no ST enqueue contention and more efficient extent operations.

SQL> select TABLESPACE_NAME,
EXTENT_MANAGEMENT, ALLOCATION_TYPE,PLUGGED_IN
FROM DBA_TABLESPACES 3 ;

TABLESPACE_NAME EXTENT_MAN ALLOCATIO PLU
------------------------ ---------- --------- ---
SYSTEM DICTIONARY USER NO
RBS DICTIONARY USER NO
TEMP DICTIONARY USER NO
TOOLS DICTIONARY USER NO
USERS LOCAL USER NO <--MIGRATED
IDX DICTIONARY USER NO
MRFACTDATA LOCAL USER NO <--MIGRATED
LOCAL_AUTO LOCAL SYSTEM NO <--NOT MIGRATED
LOCALLY_MANAGED LOCAL UNIFORM NO <--NOT MIGRATED

9 rows selected.



Rating

  (45 ratings)

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

Comments

Migrating ditionary to LMT

aries, April 09, 2002 - 2:25 am UTC

Its good! Im already enjoying the benefits of LMT (uniform sizes), but for newly created tablespaces.

My follow up question is how can i really migrate tablespace and make full use of the benefits of LMT (ie. uniform sizes)? Do i have to do table import/export and recreate all my tablespaces as LMT?

Tom Kyte
April 09, 2002 - 7:43 am UTC

While you can migrate a DMT to LMT -- I would strongly advise against doing so. you lose the main benefit - that of uniform extents.


You can create a new LMT and then use use alter table move/alter index rebuild to move the objects into it. See
</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:47812348053 <code>
for examples.

Uniform extents

H, October 09, 2002 - 10:11 am UTC

Well, if we have initial=next and pctincrease=0 in DMT and use dbms_space_admin to migrate to LMT, then we can get uniform extents that is get the full benefit of LMT. What are your thoughts?

Thanks.

Tom Kyte
October 09, 2002 - 4:47 pm UTC

Not really, a migrated tablespace won't have the bitmaps at the "front" like a natural one would -- and the extents probably aren't all exactly the same, the algorithm allows for some rounding and different sized extents in a DMT even with intial=next and pctincrease=0

LMT

H, October 14, 2002 - 4:59 pm UTC

Hi Tom,
I am having a discussion with a collegue, and he thinks that although we dont get the benefits of uniform extents there are still performance gains when we migrate using the procedure from DMT to LMT.

Please explain what do you think?

thanks.

Tom Kyte
October 14, 2002 - 8:12 pm UTC

you get the performance when adding additional extents.

You get none of the other niceness, which is one of the major reasons to use LMTS. No more fragementation, nice, orderly, no muss, no fuss. No stupid pctincreases!



Migrating production database...

Senthil, January 08, 2003 - 8:04 pm UTC

Tom,

I understand we can use dbms_space_admin package to migrate from dmt to lmt. We are in the process of moving on from 8i to 9i. Our application uses various tablespace names in it effectively while creating tables and indexes, and the database size can go up to 120GB. What would be the best method to migrate, or what do you suggest the safest way?

Please advise.

thanks,
senthil

Tom Kyte
January 12, 2003 - 9:37 am UTC

i would create new tablespaces and using

alter table T move tablespace NEW_TBS;
alter index I rebuild tablespace NEW_TBS;

move the objects at my leisure from DMT to LMT.

I don't like the migration of a dmt to lmt. it is not as clean.

Has my question reached you???

Senthil, January 11, 2003 - 8:22 pm UTC

Tom,

Did i put my question in the wrong place? Or should i have to fill up few more details.

thanks indeed.


Tom Kyte
January 12, 2003 - 9:36 am UTC

i look at 99% of the reviews, sometimes I miss one or two -- it is not really a place for an entirely new question here...

Mg, August 20, 2003 - 4:41 am UTC

Hi Tom,

I have export(full), from Oracle 8i. Then I try to import the same dump file to oracle 9i. Then I get following error :

ORA-12913 : Cannot create dictionary managed tablespace

So could you please tell me how can I overcome this problem.

Thanks



Tom Kyte
August 21, 2003 - 7:42 am UTC

precreate your tablespaces.

you have a locally managed system tablespace (this is good!)

you cannot have any DMT's when you have this (this too is good!)

just create the necessary tablespaces and import away.

MG, August 20, 2003 - 5:32 am UTC

Hi Tom,

I like to add additional on above question.

What I want :
I have oracle 8i database. I need to take tablespaces, users and other objects from oracle 8i to oracle 9i.

problems:
(1). In the new database (ora 9i ), I need different tablespace name, and the datafile's structure also the different. Cannot create dictionary managed tablespace
(2). I cannot connect both instance from one pc.

Could you please tell me how Can I do this in easiest way?

Thanks

Tom Kyte
August 21, 2003 - 7:44 am UTC

I don't understand (1). why you "need" a different tablespace name. You can easily precreate the tablespaces using whatever datafiles you want and import.

as for (2), you haven't set something up right is all I can say. similar to me stating to you "my car won't start -- why and how do i fix it". no information supplied to give you a clue as to what is wrong -- no error messages, no error codes....

MG, August 22, 2003 - 6:06 am UTC

Hi Tom,

(1). Actually Tom, my office needs different tablespace name(according to their new policies..). So thats why different ts should given.
(2). Current Environment:
* In Ora8i has different ts name along different data file paths.
* So I needs to recreate a all the objects(tables/indexes etc) in ora8i to ora 9i (with above desired ts name, datafile path changes).
* So 1st I have exp from ora8i and then try to imp from 9i. It fails:
"Due to missing paths, as in ora8i (now in 9i machine it is not existing)"

* 2nd I have created same structure(dir struc) ans 8i, and then try to import. Then I got an error

ORA-12913 : Cannot create dictionary managed tablespace
* Then I have seen in your site, once told, we have set the system tablespace to dictionary, before we imp dictionary managed objects.
But as this is not so efficient, I wants to imp them into local managed tablespace, But I don't know how? Could you please tell how to do this?





Tom Kyte
August 22, 2003 - 9:00 am UTC

you'll have to precreate the objects using ddl scripts then.

imp won't map a set of tablespaces in the dmp file to a different set of tablespace names in the target database.


you will precreate your tablespaces.
you will precreate your tables.
you will then import tables only
you will then create by hand all of your indexes in the right place
and finally you can import the rest of the stuff -- constraints, grants, etc.

lots of work for a tablespace nameing policy.




clarification ....

reader, February 19, 2004 - 6:06 pm UTC

<quote>Not really, a migrated tablespace won't have the bitmaps at the "front" like a natural one would -- and the extents probably aren't all exactly the same, the
algorithm allows for some rounding and different sized extents in a DMT even with intial=next and pctincrease=0 <quote>

Tom, if there is no bitmap on the migrated one, how does the extent allocation and deallocation is managed? I am puzzled. Thanks.



Tom Kyte
February 19, 2004 - 7:26 pm UTC

it's a hack (and not really entirely too important to us -- it "works" but it doesn't give you the nice attributes of LMTS -- equi sized extents or nice system allocated extents)



A question

Invisible, February 20, 2004 - 7:01 am UTC

Here seems like as good a place as any to ask this...

Is converting DMT to LMT *always* a good idea?

It strikes me that Oracle does what it does for, like, A REASON. If Oracle always does task X using method Y, it's because method Y is always the best method. If Oracle lets YOU choose between method Y or method Z, it's because one isn't _always_ better than the other.

"If indexes are so cool, why can you turn them off?"

Because they can make it slower as well as faster.

"Why doesn't Oracle partition my tables automatically?"

Because that can make it slower as well as faster.

"Which kind of partitioning is best?"

It depends.

"Which access path is best?"

It depends.

etc.

It takes extra effort for the folks at Oracle to program two different ways of doing something. If Oracle gives you a choice, it's usually because although one may appear "better" than the other, there is at least one important situation where the reverse is true.

Of course... Oracle isn't some theoretical model. It's a real-world product, used by actual people. So it has to contend with unfortunate things like... backwards compatibility. *shudders*

So my question is... LMT seems (from what I can gather) to be "better" than DMT. Now, is that ALWAYS the case? (i.e., is DMT for backwards compatibility only?) Or is there some situation where DMT is actually better than LMT?

Also, if I change one to the other, will the apps using the database care?

Thanks for your time.


Tom Kyte
February 20, 2004 - 9:58 am UTC

moving DMT stored data into an LMT if you were already going to reorg is always a "good idea (tm)".

if the DMT data is doing just fine, you were not going to reorg it in the first place, i'd just "leave it be"

LMTs are an evolution.

DMTs are provided for backwards compatibility.

With 9ir2 and above, if you create a database with system as LMT, you do not even have a choice anymore (so by default, in 9ir2 and above, you do not have a choice).


Apps using the database should almost always be totally unaware anything changed. Only if they themselves perform some DDL during an upgrade or patch might they become aware of the change.



Converting SYSTEM tablespace to LMT

Robert, June 30, 2004 - 5:51 pm UTC

Tom,

I have a 9.2.0.5 database where the SYSTEM tablespace is DICTIONARY managed.
You said not to use the TABLESPACE_MIGRATE_TO_LOCAL procedure, but to rather MOVE or EXP/IMP the objects instead.

What would you recommend I do with my DICTIONARY managed SYSTEM tablespace?
(1) Use the TABLESPACE_MIGRATE_TO_LOCAL utility?
(2) Just live with it?
(3) Rebuild my database?
(4) Something else...?

Thanks,

Robert

Tom Kyte
June 30, 2004 - 8:13 pm UTC

#2



Contradiction!!!

Arindam, July 06, 2004 - 9:39 pm UTC

Tom,
You have been always been a person that I follow day in and day out for resolving my problems. I was just browsing one of the OUG sites and I came accross a presentation on LMT by one of presentations by "high profile" oracle "guru". This is what he wrote about LMT :

"Myth: When using locally managed tablespaces in Oracle8i, there is no need to worry about space management.

Fact:
- True, you don’t worry about object-level and
tablespace-level space management. All extents (free or
used) will be of the same size.-
- The space management is done using the first extent of
the tablespace. If your default storage clause is 8MB,
then 8MB is allocated for this, even though it may
require only 64K.
- Not setting optimal PCTUSED and PCTFREE will cause
block-level and row-level fragmentation. LMTs do not
provide a cure for this malady.
- Object reorganization with optimal PCTUSED and PCTFREE is
required to cure block-level and row-level fragmentation. "
Now that is kinda confusing to me. I know you always put fact with figures and the author never gives any to prove the same. Could you please clarify my/our doubts on that ? That presenttation has been given in Detroit OUG. I don't want to malign anyone, but want "THE TRUTH". If you want I can attach the whole presentation(ppt.). If what the author writes is true then whats the big point is using LMT ? I am not jumping to conclusions, but want some clarifications.

Thanks
Arindam../


Tom Kyte
July 07, 2004 - 7:37 am UTC

why wouldn't you post a link? it is always nice to be able to read someones work *in context*.


but tell me -- rather then parsing terms here -- where do you see a contradiction?


o using uniform LMTs every extent is the same size. Using auto allocate (my current "general" preference) extents are nice powers of two and tend to fit quite nicely together. so that 'fact' is ok with me and does not contradict anything..

o the space management is done at the head of the file and uses 64k (apparently 128k with a 32k block). If you use 8mb uniform extents and create a tablespace with files that are N*8mb in size, you will appear to use 8mb of space for managing the bit maps. A simple "alter" of the datafile to make it 64k larger will 'give you the 8mb back'. It does not use an extent, it uses 64k (and after you use 64, you have 8mb-64k leftover, not big enough to be an extent). In general, their observation would at face level appear to be true -- but all they needed to do was add 64k to their datafile to get the "first extent" back.

o that is true, ASSM would be the "auto" feature to attempt to fix that (pctused anyway -- pctfree is still relevant)

o not sure what block level fragmentation is -- but yes in *extreme* cases, a reorg with optimal settings for those parameters may be necessary -- depends on the degree of "chained rows" you have there (and if the chained rows are actually causing a measurable problem of course!)


but I fail to see any contradictions? can you be more clear?

Confusion arised from Loat 8Mb and a hint about fragmentation!!

Arindam../, July 07, 2004 - 11:29 am UTC

</code> http://www.doug-mi.org/October2001/Presentations/Quest.ppt <code>

The above link will give you the full presentation. On the first pass at the presentation the "fragmentation" part seems a "big deal" , and I got confused as to "why the should I use LMT's , if in fact it'll, create "fragmentation" , may be a mistake on my understanding. The way its been written I thought that the block(?)/row level fragmentation is inevitable, but you said in "extreme cases" it might. Can you provide us with an example to conceptually visualise this ?

Regards
Arindam../

Tom Kyte
July 07, 2004 - 12:13 pm UTC

Gaja is very smart (no longer with quest, independent now)


do you know/understand what pctfree/pctused do? do you have access to Expert One on One Oracle? I wrote about them in the chapter on tables -- what they do and how to set them


</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1339202657182 <code>
has an example of chained/migrated rows (fragmentation -- chained rows cannot be fixed, migrated rows can be)

for data warehouse read only tablespaces

Vrajesh Shah, July 26, 2004 - 1:05 pm UTC

Tom,
We have Data warehouse in oracle version 9.2 (migrated from 8.1.7) about 500GB size. We are planning to migrate the dictonary managed tablespaces to LMT. As the 90% of the tablespaces are in read only, do you think that it is worth efforts to convert it into LMT? Can we just convert read-write ( only 10%) to LMT? Is there in performance impact to have both kinds of tablespaces in Database? Our system tablespace is dictonary managed as daatabase is migrated from old version.

Tom Kyte
July 26, 2004 - 1:31 pm UTC

i would only worry about new segments created in the future truth be told. No need to rewrite the entire database here.

Just create new segments in new tablespaces that are LMT's

Please help

Raju, August 09, 2004 - 1:53 am UTC

Hi Tom,
How to correct this? Both blocks throw errors.
Could you please help?

SQL> begin
  2   for a in (select tablespace_name from dba_tablespaces) 

loop
  3    execute immediate 'alter tablespace :tbs coalesce' using 

a.tablespace_name;
  4   end loop;
  5  end;
  6  /
begin
*
ERROR at line 1:
ORA-02140: invalid tablespace name 
ORA-06512: at line 3 


SQL> begin
  2   for a in (select tablespace_name from dba_tablespaces) 

loop
  3     execute immediate 'alter tablespace' || 

a.tablespace_name || 'coalesce';
  4   end loop;
  5  end;
  6  /
begin
*
ERROR at line 1:
ORA-00940: invalid ALTER command 
ORA-06512: at line 3 
 

Tom Kyte
August 09, 2004 - 7:48 am UTC

you can use bind variables (should use bind variables) only where a literal could have been used. eg:

select * from emp where ename = :x

is valid, because:

select * from emp where ename = 'KING'

is valid.

but,
alter tablespace :x coalesc;

is NOT valid because:

alter tablespace 'SYSTEM' coalesce;

is not valid - in general, DDL cannot be bound.



As for the second error -- think "space" -- are you missing a space after tablespace, and before coalesce -- in order to make a valid sql statment...


(and one might wonder why you are coalescing, but that's another story)

system tablespace from dmt to lmt

Varun, August 13, 2004 - 11:40 pm UTC

Hi Tom,

You do not favor a migration from DMT to LMT. In our db, all except SYSTEM is LMT. Do you think migrating would anyway improve performance?
Also is there a practical limit of size of a datafile on a unix server as far as performance is concerned? I mean increasing the size of a datafile vs adding a new datafile to a tspace.

Thanks.


Tom Kyte
August 14, 2004 - 1:21 pm UTC

Nope, it would have no measurable effect.


files can be a bottleneck in a high multi-user situation, files are mini-databases themselves. It would be fairly rare for this to be an issue. In general, go as large as you like.

reader

A reader, September 07, 2005 - 1:03 pm UTC

<> april 09, 2002
While you can migrate a DMT to LMT -- I would strongly advise against doing so.
you lose the main benefit - that of uniform extents.
<>

Is the reason because, of the storage parameters from the
exp file.


Tom Kyte
September 07, 2005 - 2:05 pm UTC

no, because you are migrating a mucked up dictionary managed tablespace with strange extent sizes to locally managed - the data doesn't "move", you have the same extent sizes as you did before.

reader

A reader, September 07, 2005 - 2:34 pm UTC

<>
the data doesn't "move", you have the
same extent sizes as you did before.
<>

If the exp file is from DMT and if LMT is pre-created
as UNIFORM sized extents,why would not the imp create
equi-sized extents per the LMT parameter



Tom Kyte
September 07, 2005 - 2:46 pm UTC

umm, where does a dmp file from export come into play here?

we were talking about using the builtin package to migrate a DMT to an LMT -- no data moves.

reader

A reader, September 07, 2005 - 3:41 pm UTC

I did a test. When I imported from DMT table into
a pre-created LMT, it cretaes the initial extent
equal to the size of the commpressed extent size from
the dmp file , however the next extent equal to the
size of UNIFORM extent as shown by dba_tables

The dba_extents table shows all UNIFORM size extents

Tom Kyte
September 07, 2005 - 7:28 pm UTC

yes, but -- again, what does that have to do with what we were talking about in this page.

You wrote "is that because of exp or what"

I replied "no, export has nothing to do with it"


I'm not sure where this export thing came about here?

reader

A reader, September 15, 2005 - 5:09 pm UTC

Moving DMT to LMT: Leaving the SYSTEM as DMT when using
"alter table move ....", would it pose issues when
migrating the database to a higher version

Tom Kyte
September 15, 2005 - 5:36 pm UTC

Dictionary managed system tablespaces are fully supported.

reader

A reader, October 07, 2005 - 8:38 am UTC

<quote>
you will precreate your tablespaces.
you will precreate your tables.
you will then import tables only
you will then create by hand all of your indexes in the right place
and finally you can import the rest of the stuff -- constraints, grants, etc.
<quote>

The final step import rest of the stuff. Will this not
be done when the tables are imported in step 3.
( constraints, grants etc. )

Tom Kyte
October 07, 2005 - 9:17 am UTC

... you will then import tables only ....


only tables is what I said at that step. grants=n, constraints=n, indexes=n...

Dictionary managed to locally managed

Nadeesh, November 19, 2005 - 2:20 pm UTC

Tom,

You said above.

*********

Followup:
While you can migrate a DMT to LMT -- I would strongly advise against doing so.
you lose the main benefit - that of uniform extents.


You can create a new LMT and then use use alter table move/alter index rebuild
to move the objects into it.

********

I have to migrate my databases from 8.1.7.4 to 9.2 and was reading Oracle 9i migration guide. Presently I am using uniform extent with pctincrease=0 and my all tablespaces are dictionary managed. It is mentioned in guide that

"If COMPATIBLE is set to 9.0.0 or higher, then the default is locally managed. The default storage clause is parsed to determine whether to use AUTOALLOCATE or UNIFORM allocation policy for this tablespace."

Will I able to use uniform allocation policy after migration.

Tom Kyte
November 19, 2005 - 2:26 pm UTC

yes, it says as much?


... whether to use AUTOALLOCATE or
UNIFORM allocation policy for this tablespace."....

Dictionary Objects - Recreation

VIKAS, February 15, 2006 - 10:40 am UTC

Dear Mr. kyte

Some of my Dictionary / Sys schema objects have become invalid/corrupt.

Even executing catalog.sql and catroc.sql scripts is not rendering any use.

Can you please suggest a best and safest way to recreate dictionary / sys schema objects. without having any ill effects on the database? How can we achive this? Please help.

Take care, regards.

Vikas.

Tom Kyte
February 15, 2006 - 11:47 am UTC

I seriously doubt the word corrupt applies here.

questions

a) what are the objects, are they perhaps "things you are not using"
b) are you suffering any adverse affects from these invalid objects?
c) if you just compile the INVALID objects (not rebuid the entire schema which likely would result in even MORE invalid objects) what then


I have a feeling a) and b) are answered with a) yes, b) no - so c) is not really relevant.

Dictionary Objects - Recreation

VIKAS SANGAR, February 16, 2006 - 1:31 am UTC

Dear Mr. Kyte

In response, to the above follow up of yours and as an annexure to my query, here is the list of SYS Objects that are lying Invalid in sys schema even after re-compiling.

NAME TYPE COMPLIED
------------- ----- ---------------------
ODCIINDEXINFO TYPE 2/10/2006 6:04:03 PM
ODCIINDEXINFO TYPE 2/10/2006 6:04:03 PM
ODCICOST TYPE 2/10/2006 6:04:04 PM
ODCICOLINFO TYPE 2/10/2006 6:04:03 PM
ODCIARGDESC TYPE 2/10/2006 6:04:07 PM
NO_VM_DROP TRIGGER 2/16/2006 11:10:58 AM
NO_VM_DROP_PROC PROCEDURE 2/16/2006 11:15:04 AM
WM_DDL_UTIL PACKAGE BODY 2/16/2006 11:15:06 AM
UD_TRIGS PACKAGE BODY 2/16/2006 11:15:06 AM
OWM_REPUTIL PACKAGE BODY 2/16/2006 11:15:06 AM
OWM_MIG_PKG PACKAGE BODY 2/16/2006 11:15:06 AM
OWM_DDL_PKG PACKAGE BODY 2/16/2006 11:15:06 AM
LT_EXPORT_PKG PACKAGE BODY 2/16/2006 11:15:06 AM
LT_CTX_PKG PACKAGE BODY 2/16/2006 11:15:06 AM
LTUTIL PACKAGE BODY 2/16/2006 11:15:06 AM
LTRIC PACKAGE BODY 2/16/2006 11:15:06 AM
LTPRIV PACKAGE BODY 2/16/2006 11:15:05 AM
LTDTRG PACKAGE BODY 2/16/2006 11:15:05 AM
LTDDL PACKAGE BODY 2/16/2006 11:15:05 AM
LTAQ PACKAGE BODY 2/16/2006 11:15:05 AM
LT PACKAGE BODY 2/16/2006 11:15:05 AM
WM_DDL_UTIL PACKAGE 2/16/2006 11:15:05 AM
UD_TRIGS PACKAGE 2/16/2006 11:15:05 AM
OWM_DDL_PKG PACKAGE 2/16/2006 11:15:03 AM
LTUTIL PACKAGE 2/16/2006 11:15:05 AM
LTRIC PACKAGE 2/16/2006 11:15:05 AM
LTDDL PACKAGE 2/16/2006 11:15:04 AM

I am facing problems in Export/Import of a schema. The LT_EXPORT_PKG is being used by Export process and it throws the following Messages :-

Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P1 character set (possible charset conversion)

About to export specified users ...
. exporting pre-schema procedural objects and actions
EXP-00008: ORACLE error 4068 encountered
ORA-04068: existing state of packages has been discarded
ORA-04063: package body "SYS.LT_EXPORT_PKG" has errors
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 1
EXP-00083: The previous problem occurred when calling SYS.LT_EXPORT_PKG.schema_info_exp
. exporting foreign function library names for user GEPRD
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user GEPRD
About to export GEPRD's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export GEPRD's tables via Conventional Path ...
. . exporting table ACCOUNTHIERARCHY 11 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.

Please suggest, how can I rectify this problem? I have even tried "GRANT EXECUTE ON SYS.LT_EXPORT_PKG to <USER>", But of no use. How can I revalidate/rejuvenate the above invalid objects?

Also, I remembr that one of our developers accidently dropped the SELECT_CATALOG_ROLE after which we have started facing this Problem, and the same was re-created soon as it came to our knowledge.

Would droping and recreating these invalid / all objects help. If yes, how shall we achieve this? What precautions should we take? If no, What else shall we do?


Take care, regards.
VIKAS.

Tom Kyte
February 16, 2006 - 11:39 am UTC

how can a developer accidently drop a role, they shouldn't have that ability.

was the role PROPERLY recreated.

do this as sys:

alter package lt_export_pkg compile body;
show errors package body lt_export_pkg;


and show us why it is failing the compilation



have you a tar open with support of couse?

In 10g R2

Ik, March 24, 2006 - 11:52 am UTC

Tom,

This is on the original question - asking this because it was publised in 2000 and was relevant for 8i.

Is this behaviour true with 10g too?

I mean, what would be behaviour on a tablespace which is migrated from 8i - DMT to 10g LMT.

(1) Existing objects still would continue to be dictionary managed?

(2) How about new extents allocated to existing objects?

(3) What about new objects created on those migrated LMTs?

Thanks for your help.

Tom Kyte
March 24, 2006 - 3:29 pm UTC

I would not recommend using this migrate to local at all - just avoid it. Leave it as a dictionary managed tablespace OR move the objects to a locally managed tablespace. This is like a "bad halfway" point.

Migration and the Alter table Move

Richard, May 10, 2006 - 7:57 am UTC

Oracle 8.1.7.4 Standard Edition:
If I were to use the DBMS_SPACE migration technique on my DMT (which contains table MY_TABLE), and then I performed ALTER TABLE MY_TABLE MOVE; , would the table now be a *fully fledged* LMT table, or would things be just the same as before?

Tom Kyte
May 10, 2006 - 9:21 am UTC

it would be as bad as it ever was.

IF you are going to alter move - then I don't see why you would not

a) create a new, nice, good Locally managed tablespace (LMT)
b) alter move into it
c) drop old dictionary managed tablespace (DMT)

ORA-12913 : Cannot create dictionary managed tablespace

Ailsa, June 13, 2006 - 5:46 am UTC

Hi Tom,

I hope that this counts as a clarification rather than a new question.
Following your response to Mg in this thread, regarding the import from 8i to 9i using a full export.
As advised I have precreated my LMT tablespaces as follows :
CREATE TABLESPACE USERS DATAFILE
'K:\ORACLE\ORADATA\SODB\SODB_USERS_01.DBF' SIZE 25M
AUTOEXTEND ON NEXT 320 MAXSIZE 500M default storage
(initial 64K next 1M pctincrease 0 minextents 1 maxextents 2147483645);

but still get the error:

ORA-12913 : Cannot create dictionary managed tablespace

IMP-00017: following statement failed with ORACLE error 12913:
"CREATE TABLESPACE "USERS" DATAFILE 'K:\ORACLEDATABASE\ORADATA\SODB\USERS01"
".DBF' SIZE 113246208 AUTOEXTEND ON NEXT 1310720 MAXSIZE 16383M DEFAU"
"LT STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 4096 PCTINCR"
"EASE 0) ONLINE PERMANENT EXTENT MANAGEMENT DICTIONARY"
IMP-00003: ORACLE error 12913 encountered
ORA-12913: Cannot create dictionary managed tablespace

Do you have any idea why this might be? Sorry if this is not enough information - I can provide more if you need. The tablespace I have created is smaller as the original contains about 100M data max.

Many thanks for your help on this and many subjects!

Ailsa

Tom Kyte
June 13, 2006 - 12:25 pm UTC

does the import stop at that point?

(sorry, I haven't hit that myself - I never use full exports, I see what is happening now - but is that stopping the import or does it just continue?)

ORA-12913 : Cannot create dictionary managed tablespace

Michel Cadot, June 13, 2006 - 12:49 pm UTC

Hi,

It is not an import issue. 
It is the "standard" way Oracle checks tablespace creation.
If your SYSTEM tablespace is locally managed you can't create a dictionary managed tablespace and this is checked before the presence of the tablespace.

SQL> create tablespace test datafile 'E:\ORACLE\BASES\MIKA\TEST01.DBF' size 20m
  2  extent management local;

Tablespace created.

SQL> create tablespace test datafile 'E:\ORACLE\BASES\MIKA\TEST01.DBF' size 20m
  2  extent management dictionary;
create tablespace test datafile 'E:\ORACLE\BASES\MIKA\TEST01.DBF' size 20m
*
ERROR at line 1:
ORA-12913: Cannot create dictionary managed tablespace

Regards
Michel 

Tom Kyte
June 13, 2006 - 5:00 pm UTC

I know that - try to figure out if

a) import just stops (if so, we'll have to edit the dmp file, dangerous but we'll risk it and I can help make that a bit safer than usual)

b) import reports error but goes on - in which case, just ignore it

ORA-12913 : Cannot create dictionary managed tablespace

Michel Cadot, June 14, 2006 - 3:22 am UTC

Hi Tom,

I didn't want to offende you or your knowledge. I just wanted to answer to Ailsa explicit question:
"As advised I have precreated my LMT tablespaces ... but still get the error ORA-12913 ... Do you have any idea why this might be?"

Your point and question are of course still opened.

Regards
Michel

ORA-12913 : Cannot create dictionary managed tablespace

Ailsa, July 10, 2006 - 6:24 am UTC

Hi Tom,

Thanks for the response (and Michel too) and sorry for the delay in replying.

The import continued, but terminated unsuccessfully and errored at the creation of each tablespace e.g.:

IMP-00017: following statement failed with ORACLE error 12913:
"CREATE TABLESPACE "USERS" DATAFILE 'K:\ORACLEDATABASE\ORADATA\SODB\USERS01"
".DBF' SIZE 113246208 AUTOEXTEND ON NEXT 1310720 MAXSIZE 16383M DEFAU"
"LT STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 4096 PCTINCR"
"EASE 0) ONLINE PERMANENT EXTENT MANAGEMENT DICTIONARY"
IMP-00003: ORACLE error 12913 encountered
ORA-12913: Cannot create dictionary managed tablespace

We worked around it by creating another 8i copy and will upgrade that as necessary.

Thanks again!

Importin objects from DMT to LMT table

Keyur, July 19, 2006 - 9:44 am UTC

Hello Tom:

We are on 9.2.0.6 at this moment. We are thinking to move for LMT. I am just confuse about, If, I will create a new LMT tablespace and then DO I have to move all the tables and indexes or I can just import it all tables back.

So if import is good ? My question is, all tables will use it's own storage structure which are before LMT or It will use uniform extents of LMT and will ignore individual objects storage parameter.

Thank you

~Keyur

Tom Kyte
July 19, 2006 - 1:32 pm UTC

I would not use export - just create new tablespace and move the objects.

why bother with export/import at all?

Can System TS be converted from DMT to LMT

Manish Sharma, September 11, 2006 - 4:18 pm UTC

Hi Tom,
1. Can we convert SYSTEM TS from DMT to LMT using dbms_space.admin package or for this we have to create a new Database with system as LMT ??
2. Does 10gr2 still supports DMT tablespaces ??


Thanks
Manish Sharma


Tom Kyte
September 11, 2006 - 4:52 pm UTC

1) depends on the release however, I would not suggest converting (any tablespace). See Note 175434.1

2) yes, but system MUST be created as a dictionary managed tablespace (although you can transport in a dictionary managed one, just not create one without system being dictionary)

SYSTEM TS from DMT to LMT

Manish Sharma, September 12, 2006 - 8:58 am UTC

Hi Tom.
#1 I am upgrading 9ir2 to 10gr2, i want to migrate SYSTEM Tablespace from DMT to LMT in 10gr2.

Should you prefer to do in 9ir2 or 10gr2.

Thanks
Manish Sharma


Tom Kyte
September 12, 2006 - 9:15 am UTC

was I not un-ambigous above? I would not migrate it.

Read that note.

Temporary TS from DMT to LMT

Berny, March 22, 2007 - 6:11 am UTC

Hi Tom,

I have a locally managed temporary tablespace on this DB:

select * from dba_tablespaces where contents='TEMPORARY';

TABLESPACE_NAME TEMP
BLOCK_SIZE 8192
INITIAL_EXTENT 1048576
NEXT_EXTENT 1048576
MIN_EXTENTS 1
MAX_EXTENTS
PCT_INCREASE 0
MIN_EXTLEN 1048576
STATUS ONLINE
CONTENTS TEMPORARY
LOGGING NOLOGGING
FORCE_LOGGING NO
EXTENT_MANAGEMENT LOCAL
ALLOCATION_TYPE UNIFORM
PLUGGED_IN NO
SEGMENT_SPACE_MANAGEMENT MANUAL
DEF_TAB_COMPRESSION DISABLED

select * from dba_tablespaces where contents='TEMPORARY';

FILE# 1
CREATION_CHANGE# 0
CREATION_TIME
TS# 2
RFILE# 1
STATUS ONLINE
ENABLED READ WRITE
BYTES 11391729664
BLOCKS 1390592
CREATE_BYTES 41943040
BLOCK_SIZE 8192
NAME /data/oracle/oradata/IV920/temp01.dbf

select * from dba_temp_files;

FILE_NAME /data/oracle/oradata/IV920/temp01.dbf
FILE_ID 1
TABLESPACE_NAME TEMP
BYTES 11391729664
BLOCKS 1390592
STATUS AVAILABLE
RELATIVE_FNO 1
AUTOEXTENSIBLE YES
MAXBYTES 34359721984
MAXBLOCKS 4194302
INCREMENT_BY 80
USER_BYTES 11390681088
USER_BLOCKS 1390464

Since on this validation instance it's relatively big, I was wondering about its history. In alert.log all I could find about it was:
Fri Jul 14 17:15:08 2006
CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '/data/oracle/oradata/IV920/temp01.dbf' SIZE 40M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
Completed: CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '/data/
Fri Jul 14 17:15:08 2006
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP
Completed: ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP

After that no more entries regarding TEMP TS in alert.log
So I thought it must have been changed sometime since then from DMT to LMT using DBMS_SPACE_ADMIN package, right?
Doesn't that package write anything into alert.log about that? Any chance how I could find out when that change was done? Any chance how to find out when TEMP TS grew to its current size?
Tom Kyte
March 22, 2007 - 9:40 am UTC

that shows the tablespace was created locally managed - why do you think it was converted?

The autoextends (permitted by maxsize there) are not recorded.

DMT - LMT syntax for temporary TS

Berny, March 22, 2007 - 10:54 am UTC

Hi Tom,

Just found that the syntax stands for a locally managed one. Sorry, I thought there should be a "local" part of it, but that's just the case for non-temporary ones.
For temporary ones the create TS syntax is:
CREATE TEMPORARY TABLESPACE ... ; => LMT
versus
CREATE TABLESPACE ... TEMPORARY ; => DMT

So all my questions are answered.

Thanx,
Berny

ST Enqueue when migrating tables

chris, March 27, 2007 - 4:51 am UTC

I am currently working on migrating one of our clients databases form 7.3.4 to 8i, as part of the migration we would like to convert to locally managed tablespaces however we have an issue with the amount of time it takes to migrate. The issue we have is there are a number of objects with poorly chosen extent sizes, the worst is a 5GB table with an 8k extent size, when using alter table x move tablespace y we see a hugh number of ST enqueues as the extents are deallocated from the data dictionary. In this case migrating the tablespace using dbms_space_admin appears to perform far less work updating the dictionary, if we then move the tables to another newly created tablespace would we gain the same benefits as just performing the alter table move.

Chris

Tom Kyte
March 27, 2007 - 9:34 am UTC

yes you would - and this is a "good use" of the dbms_space_admin to migrate to local - so you can DEALLOCATE (drop, get rid of) the old segments more readily

A reader, February 27, 2010 - 11:50 pm UTC

My System tablespace is DMT and objects has diffrent next extent size and pct_increase.
If I migrate the System tablespace to LMT using "DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_TO_LOCAL
('SYSTEM'); "
Does the next extent size or pct_increase of the objects change? (since in LMT it can be either
uniform or system allocated)


Tom Kyte
March 01, 2010 - 11:52 am UTC

next and pctincrease are ignored after object creation with locally managed tablespaces, we only need to refer to them when you CREATE something (we'll figure out how much to initially allocate - in as many extents as we like - during the creation, but freely ignore them after that)

transformation of type of Tablespace

Arindam, September 19, 2010 - 4:27 am UTC

Hi Tom,

I read some of the above topics and got some queries raised in my mind:

1) In a topic you have told that by converting a tablespace from DMT to LMT we wouldn't get any Bitmap area there. If this is true then what is the purpose of converting this?
2) Also I found there was said that the uniform size of new LMT will be rounded over the initial extent even if initial=next and pctincrease=0. Why is this so?
3) Is there any way to convert System tablespace from LMT to DMT?
Tom Kyte
September 20, 2010 - 2:19 pm UTC

1) you would end up with a tablespace that still had all of the strange sized extents you had when it is dictionary. To me, one of the major benefits you get from a locally managed tablespace is the fact that the extents are all pretty much nicely sized (either uniform - same size - or system allocated - nice multiples of each other in size). If you convert a DMT to an LMT you do not get that.

What you DO get is faster extent management. You can add new extents faster in the future- with less contention. You can also DROP existing extents quickly (if you have a table with say 10,000 extents in a DMT and you want to drop it - I would recommend converting the DMT to an LMT FIRST - in order to not wait a day or so to drop 10,000 extents).

So, you get *some* benefit but miss out on what I would call "the big benefit". You might as well bite the bullet and reorganize that tablespace.

2) not sure what you mean. rounded over the initial extent of what? rounded to what?

3) see note Note 175434.1, yes you can.

DMT and LMT

Arindam, September 20, 2010 - 11:21 pm UTC

Hi Tom,

for 1) Do you mean that by converting a tablespace from DMT to LMT, we would not succeed in having uniform size? Will the size be allocated in the converted a LMT as per the "default storage" clause defined in DMT? So are you saying that only benefit of converting a DMT to LMT is bitmap area maintained in it?
for 2) The question will not even arise if #1 is true.
for 3) I found dbms_space_admin.tablespace_migrate_from_local(). But it would not convert System tablespace. Then how to do it?
Tom Kyte
September 21, 2010 - 3:43 pm UTC

1) correct, you would have exactly the same extents as before.

in other words, the same mess.



as for #3, I can see I read your question wrong. I never thought to think anyone would ask how to convert a LMT to a DMT - so I transposed those. sorry - once you are LMT with system - you are LMT.

DMT to LMT (7.x to 9i R2 migrated database

A reader, November 19, 2010 - 6:47 am UTC

Hi Kyte,

Please suggest is it fair to convert DMT to LMT tablespace on Oracle 7.x to oracle 9.2 database.

Regards
Rama
Tom Kyte
November 19, 2010 - 9:39 am UTC

read what I've already written - asked and answered.

Releasing space from DMT

Arunkumar Mani, November 22, 2010 - 8:20 am UTC

Tom,
My customer had upgraded his database to 8.1.7 on 2002 - they had 5 tablespaces then ( system,rbs,temp,data,index) -all are DMT. Unfortunately they Put TEMP datafile AUTOEXTENSIBLE ON ( heck, I dont like that) - now it has grown up to 50G. DB node is not connected to SAN, local disk shortage - they dont have plan to add space. They now want us to release space from other tablespaces and then create new ones to be used for the current partition.Resizing went on for 8-10 hours, more CPU consumption, but at the end of the day we could achieve nothing regarding to space release. Questions:

1) Do you think migrating DMT - LMT and then resize will work? ( for data tablespaces)
2) create LMT temp tablespace, make it default to all users,drop the DMT temp tablespace - will it be time consuming like it did for DMT temp resize?

The above is what running in my mind inorder to release space from unwanted/unused DMT tablespaces and give it to disk so that we can create new LMT tablespaces. Please suggest me if there is another way to reduce the time to achieve this.
Tom Kyte
November 23, 2010 - 12:52 pm UTC

I love autoextend - best thing ever.

1) resize works equally well on DMT (dictionary managed tablespace) as LMT (locally managed tablespace). Both have the requirement that the file can only be resized down to where the LAST EXTENT in the file resides.

2) resizing is not time consuming in general, you are confusing me here. It is a very fast operation - what are you seeing? How many extents are you releasing (that might take a while, but you could offset that by migrating to a LMT first.

If TEMP is dictionary manged with thousands of extents - it could take a while to drop (migrating to local might benefit before dropping)



If the time is spent deallocating extents, migrate the tablespaces to LMTs first.

Default storage

A reader, December 05, 2010 - 6:18 am UTC

Hi Tom,

I have a small query to ask you:

In default storage clause of a DMT ("autoextend off"), what will happen if the "maxextents" clause exceeds its limit? Will the datafile wouldn't be resized afterward if I try to increase it? or Will it be increased further,but with what storage?
Tom Kyte
December 07, 2010 - 9:33 am UTC

maxextents is a segment level setting.

it doesn't affect the datafile growth at all.

A segment might hit maxextents - at which point the application performing the DML that caused the next extent to try to be allocated will receive an error message.

Migrating DMT to LMT

Balaji Jayakumar, December 18, 2012 - 1:21 am UTC

Hi Tom,

I have read the entire thread so far, and still got few doubts.
We are working on a Bank's core database(cannot expect a downtime so easily).
We have oracle 9.2.0.7 and 80% of the tablespaces are DMT, the remaining 20% tablespaces are LMT with either uniform or system as allocation type, by which i could decipher that, they are LMT's by creation(may be done by dba's who worked here earlier).

Now that, my team has asked me to check if the rest of tablespaces(except system) could be migrated to LMT. And from what i read, i am left with two choices.

choice1: using the dbms package --But, I see the pct increase parameter is set as 1 in almost all DMT's in our db, only one DMT has pct increase set to 0, so unfortunately choice 1 seems to be not so good in terms of benefits, (decided after reading your thread :-)).

choice 2: If i decide to go for the other option(create new LMT tablespace and then move the tables/indexes),

1. Does it require any downtime for the application.

2. Will it consume more CPU. (size of db is ~ 1.65 TB and growing, size of the biggest DMT is 318 GB)

3. In your link ' http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:47812348053' , alter table move statements are generated to have the same storage parameters like in DMT, so will it not be the same after the tables moves to LMT. Sorry if i comprehended wrong, please clarify.

4. Is it possible to have the same name for the tablespace that is new created for LMT. Will a new name to the tbs have any impact to the application references to the db.

5. Will the object references have any impact. (I mean the objects, while moving and after moving, will there be any impact to the application user)
6. We are planning to upgrade to 10g in another 6 months, so is it wise to use migrate now itself, or wait and do the LMT migration along with version upgrade. Does it make any difference or the same. My team is urging me to migrate now itself. But if i strongly convince, they can accept.



Last but not least, 2 questions that are not related to choice 2.

1. Please also tell me what considerations should I keep in mind while converting if i use dbms package.
Like prerequisite check before DMT to LMT migration.

2. if i use dbms package/other method, should i adjust any storage parameters before migraton.

3. How to estimate the time it will take for DMT to LMT migration using dbms package.

Thanks
Balaji Jayakumar


Tom Kyte
December 18, 2012 - 1:14 pm UTC

if this is a 9207 database in maintenance mode, I suggest changing nothing - not. a. thing.

it isn't even the latest patch set...


let it be, don't change anything, you have enough risk being on such old software as it is. introducing change for the sake of change is just asking for trouble.

save it for your next upgrade. since downtime is a no-no, you'll use golden gate to do a live upgrade into a new 11.2 or maybe even later database.

do not touch it.

Cont...Migrating DMT to LMT December 18, 2012

Balaji Jayakumar, December 19, 2012 - 12:03 am UTC

Hi Tom,

Thanks for the prompt reply.

We will save the LMT migration for live along with the version upgrade. But we have plans to move to only 10g, due to application constraints.

But now, I have to test the LMT migration in the UAT/PREPROD with option 2, using alter table move, so that, i can estimate the time and prepare a step by step document for the live migration.

Now can you clear my doubts about the option no.2

If not all the questions, but

1. What happens to the existing extents of a segment after we move the table to a newly created LMT(UNIFORM/SYSTEM).

for eg: we have a large segment (50gb) and (3mb) segment in the same DMT tablespace. When we move such a table to a newly created LMT, how does oracle place the extents in the new LMT. Will it be based on earlier storage parameters specified or it will arrange the extents in the new LMT method(either uniform or system).

2. We do not have golden gate, so we have to use the alter table move option. So, can you tell us, if its totally safe to go by this method, (i.e, when we move a large table with lakhs of records, with no logging option, has there been any report of partial move with few records missing).

Thanks
Balaji Jayakumar
Tom Kyte
December 19, 2012 - 11:58 am UTC

1) use something like:

alter table t move tablespace new_ts storage (initial 1k next 1k minextents 1);

that'll strip off any storage clause from the old table and will just allocate based on

a) the LMT storage type (uniform size N/system allocated)

b) the minimum space needed to store the existing data.


Otherwise - the operation will take the existing init/next/minextents/pctincrease and figure out how much space is needed to satisfy that and then allocate AT LEAST that much space and then move the object. Potentially - you could end up overallocating because of that (if the init/next/minextents/pctincrease caused you to allocate more space than the current segment would actually consume...)

2) you will not lose any data with an alter table t move, it is an atomic operation, it either entirely happens or entirely does not happen (it either succeeds or fails - never "partial").

make sure to back up immediately after a non-logged operation if you do that.

Cont...Migrating DMT to LMT December 18, 2012

Balaji Jayakumar, December 21, 2012 - 5:40 am UTC

Hi Tom,

I started with a small DMT tablespace(500mb) with 2 segments(each 58mb as a single extent), the next_extent was given as 20mb for the DMT. But both segments did not grow beyond the first.

Now i created the lmt tablespace as
CREATE TABLESPACE "XXX_LMT" DATAFILE '/csisdb/dbtables9/XXX_lmt01.dbf' SIZE 524288000 LOGGING ONLINE PERMANENT;

The result is a intented LMT(autoallocate)and then i moved the two extents using two different move statements.

alter table tbaadm.XXX_TABLE1 move tablespace XXX_LMT;

alter table tbaadm.XXX_TABLE2 move tablespace XXX_LMT storage (initial 1k next 1k minextents 1);

Now after i reviewed the extent allocation in the new LMT tablespace I got puzzled !!

The XXX_TABLE1 has 58 extents each 128 blocks (1mb) allocated for each extent.

The XXX_TABLE2 has 73 extents. But the first 16 extents are given 8 blocks (64k) and then the remaining 57 extents are given 128 blocks (1mb).

1. What is the difference that oracle makes in the two statements issued for moving the tables ?

2. Which method should i follow for the rest of my tablespaces/segments ?

3. When should i go for uniform auto allocation in LMT ?

Thanks
Balaji Jayakumar
Tom Kyte
January 04, 2013 - 10:10 am UTC

1) in the first case, when you leave off the storage clause, the old storage clause is used.

in an LMT - when we see a storage clause - we figure out how much space would have been allocated in a DMT with it - and then allocate *at least* that much space - and then start to fill it.

so, you used "initial 58mb next 20mb pctincrease <something> minextents 1"

we determined we needed 58mb of space - we thought the most efficient way to do that was 58-1mb extents in that autoallocate LMT.

if you had used "initial 10mb next 20mb pctincrease 100 minextents 5" we would have allocated

10+20+40+80+160 = 310mb

of space initially. After that - the storage clause is ignored, we don't use next, we don't use pctincrease, nothing - for future extent allocations.


in the second case, you used initial 1k, next 1k, minextents 1 - so we allocated AT LEAST 1k of space (we allocated 64k) and then started loading data into it - extending as needed.


2) see my suggestion right above, the 1k 1k suggestion.

3) probably never, I've become a huge fan of autoallocate. I'd need a really god reason to use it.
http://www.oracle.com/technetwork/issue-archive/2007/07-may/o37asktom-101781.html

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