Understading Oracle PCT, MIN MAX EXTENT

Excerpt from asktom.
Question
1)If i used LMT with auto extend why did it run out of space and not extend
itself automatically.As it is LMT should it not ignore the initial extents etc
etc clause.( I did not use uniform allocation)
2)I know there is not much data in the schema but the way the create tables
have done it takes some many extents resulting in 10 Gb tablespace.only 4 tables
have about 30000 rows.
Am i correct inthis assumption.
How to reduce this extra tablespace consumption of 10 Gb total datafiles.
3)wrt point 2 I am sure schema will fit in datafile of just 300 MB how to do
this.When I did the exp i used direct path and compress=n

Answer:
1) lmts do not IGNORE initial, next, minextents, pctincrease.  they just use
them differently. Watch:

ops$tkyte@ORA920> create tablespace demo
2 datafile
3 uniform size 64k;
Tablespace created.

64k uniform extents..

ops$tkyte@ORA920> create table t ( x int ) storage (initial 2m ) tablespace
demo;
Table created.

we ask for an initial of 2m, in a DMT it would look for 2m of contigous space.
In an uniform LMT, it looks for 2m of space using many uniform extents:


ops$tkyte@ORA920> select sum(bytes), count(*) from user_extents where
segment_name = 'T';

SUM(BYTES) COUNT(*)
---------- ----------
2097152 32

and it takes 32 64k extents to give us 2m

ops$tkyte@ORA920> drop table t;
Table dropped.

ops$tkyte@ORA920> create table t ( x int ) storage ( minextents 50 ) tablespace
demo;
Table created.

now, we specify no initial, just minextents -- and we got it:

ops$tkyte@ORA920> select sum(bytes), count(*) from user_extents where
segment_name = 'T';

SUM(BYTES) COUNT(*)
---------- ----------
3276800 50

ops$tkyte@ORA920> drop table t;

Table dropped.

ops$tkyte@ORA920>
ops$tkyte@ORA920> create table t ( x int ) storage ( initial 2m minextents 50 )
tablespace demo;
Table created.

now it gets interesting. A 2m initial extent (we know that'll take 32) and
minextents 50. What'll do?


ops$tkyte@ORA920> select sum(bytes), count(*) from user_extents where
segment_name = 'T';

SUM(BYTES) COUNT(*)
---------- ----------
5308416 81

81 extents -- well, 81-32 = 49. so what it did was:

o got our initial
o determined that now that the single initial was gotten -- we needed 49 more

just like it would have done in a DMT....


ops$tkyte@ORA920> drop table t;

Table dropped.


ops$tkyte@ORA920> create table t ( x int ) storage ( initial 128k minextents 5
pctincrease 100 ) tablespace demo;

Table created.

Ok, now what. well, it'll be:

128 initial (2 extents) plus four more extents... no next specified so it used
64k -- it'll add:

64+128+256+512



ops$tkyte@ORA920> select sum(bytes), count(*) from user_extents where
segment_name = 'T';

SUM(BYTES) COUNT(*)
---------- ----------
1114112 17


and that is what it did:


ops$tkyte@ORA920>
ops$tkyte@ORA920> select 128 + 64 + 128 + 256 + 512 from dual;

128+64+128+256+512
------------------
1088

ops$tkyte@ORA920> select 1114112/1024 from dual;

1114112/1024
------------
1088



2) you might want to extract the ddl from the dmp file (use indexfile=foo.sql
and foo.sql will have it) and precreate the objects WITHOUT a storage clause.
Questions:
Wrt answer 2: This means
1)I extract the DDLs for table creation using indexfile option
2)Modify it by removing the storage clause
3)Run that on the user
4)Run imp again with ignore=y. This will get the data in the precreated tables.
Q) What to do about Table constraints will the IMP take care of it or I need
to precreate those also ?

Answer:
imp will put the constraints on for you.  although you might find you want to
put on the indexes manually as well since they too have storage clauses.

Source: http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:11511550949535

Comments

Popular Posts