Wrox Home  
Search P2P Archive for: Go

  Return to Index  

oracle thread: RE: Changing storage settings on tables


Message #1 by davidbradley@h... on Sat, 31 Mar 2001 16:16:23
David -

Thanks to you, I'm learning more about locally managed tablespaces
over the last few days than I had in the past several weeks (my
customer has just recently moved to Oracle8i, you see).

Your question sounds a whole lot like the one that posed in your
email thread "Alter Tablespace Default Storage", and I believe
that the root cause is the same.  I hope that you saw the response
that I posted to that thread.  In the meantime, though, I'll take
the easy way out again and just copy an Oracle technical note that
deals directly with this ORA-25150 error.

While you're examining this, perhaps you or your company could explore
the possibility of an Oracle Support contract...

Here it is in all its glory:
Article-ID:         <Note:123040.1>
Circulation:        PUBLISHED (EXTERNAL)
Folder:             server.DBA.Storage
Topic:              Storage Options (Extent sizes, PctFree)
Title:              Modify the NEXT Extent Value for Objects Residing on 
                    Locally-managed Tablespaces
Document-Type:      PROBLEM
Impact:             MEDIUM
Skill-Level:        CASUAL
Server-Version:     08.01.0X
Updated-Date:       16-NOV-2000 22:45:09
References:         
Shared-Refs:        
Authors:            DJEUNOT.FR
Attachments:        NONE
Content-Type:       TEXT/PLAIN
Keywords:           ALTER; AUTOALLOCATE; DBMS_SPACE_ADMIN; DICTIONARY; EXTENT; LOCAL; 
MIGRATE; NEXT; STORAGE; 
Errors:             ORA-25150; 
Products:           5; 
Platforms:          GENERIC;  

Problem Description
-------------------

You need to change the extent size for an object residing on a
locally-managed tablespace.  You get the following restriction
whichever kind of size extent allocation the tablespace owns:

*** Example1 of a table residing on an AUTOALLOCATE extent 
    locally-managed tablespace

SQL> create tablespace LOCAL_TBS_DATA
  2  datafile '/8i/ora816/oradata/V816/local01.dbf' size 600K
  3  extent management local autoallocate;    

Tablespace created.

SQL> create table T_LOCAL (c number)
  2  tablespace LOCAL_TBS_DATA;                 

Table created.

SQL> select table_name, initial_extent, next_extent
  2  from dba_tables where table_name='T_LOCAL';

TABLE_NAME                     INITIAL_EXTENT NEXT_EXTENT
------------------------------ -------------- -----------
T_LOCAL                                 65536


SQL> alter table T_LOCAL storage (NEXT 200K);
alter table T_LOCAL storage (NEXT 200K)
*
ERROR at line 1:
ORA-25150: ALTERING of extent parameters not permitted


*** Example2 of a table residing on a UNIFORM EXTENT SIZE 
    locally-managed tablespace

SQL> create tablespace LOCAL_TBS_DATA2
  2  datafile '/8i/ora816/oradata/V816/local2_01.dbf' size 600K
  3  extent management local uniform size 65k;

Tablespace created.

SQL> create table T_LOCAL2 (c number)
  2  tablespace LOCAL_TBS_DATA2;

Table created.

SQL> select table_name, initial_extent, next_extent
  2  from dba_tables where table_name='T_LOCAL2';

TABLE_NAME                     INITIAL_EXTENT NEXT_EXTENT
------------------------------ -------------- -----------
T_LOCAL2                                73728       73728


SQL> alter table T_LOCAL2 storage (NEXT 200k);
alter table T_LOCAL2 storage (NEXT 200k)
*
ERROR at line 1:
ORA-25150: ALTERING of extent parameters not permitted


Solution Description
--------------------

1.  Migrate the locally-managed tablespace to a dictionary management.
2.  Then migrate it back to local management.

Example: 
==================================================
MIGRATE FROM LOCALLY MANAGED TO DICTIONARY MANAGED
==================================================

SQL> execute DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_FROM_LOCAL('LOCAL_TBS_DATA');
PL/SQL procedure successfully completed.

SQL> execute DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_FROM_LOCAL('LOCAL_TBS_DATA2');
PL/SQL procedure successfully completed.

================================================
Verify that tablespace is now dictionary-managed
================================================

SQL> select TABLESPACE_NAME, EXTENT_MANAGEMENT
  2  FROM DBA_TABLESPACES
  3  where tablespace_name in ('LOCAL_TBS_DATA','LOCAL_TBS_DATA2');

TABLESPACE_NAME                EXTENT_MAN
------------------------------ ----------
LOCAL_TBS_DATA2                DICTIONARY
LOCAL_TBS_DATA                 DICTIONARY
 
=======================================================
MIGRATE FROM DICTIONARY MANAGED BACK TO LOCALLY MANAGED
=======================================================
Identify the file_id corresponding to the tablespace:

SQL> select FILE_ID, TABLESPACE_NAME from dba_data_files
  2  where TABLESPACE_NAME in ('LOCAL_TBS_DATA','LOCAL_TBS_DATA2');

       FILE_ID  TABLESPACE_NAME
--------------  ----------------------------------------
             7  LOCAL_TBS_DATA
             8  LOCAL_TBS_DATA2

SQL> execute DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_TO_LOCAL(
             tablespace_name =>'LOCAL_TBS_DATA', rfno => 7);
PL/SQL procedure successfully completed.

SQL> execute DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_TO_LOCAL(
             tablespace_name =>'LOCAL_TBS_DATA2', rfno => 8);
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 in ('LOCAL_TBS_DATA','LOCAL_TBS_DATA2');

TABLESPACE_NAME                EXTENT_MAN
------------------------------ ----------
LOCAL_TBS_DATA2                LOCAL
LOCAL_TBS_DATA                 LOCAL


=============================================
Alter the TABLE with a new NEXT storage value 
=============================================

SQL> ALTER TABLE t_local STORAGE (NEXT 200K);
Table altered.

SQL> ALTER TABLE t_local2 STORAGE (NEXT 200K);
Table altered.

SQL> select table_name, initial_extent, next_extent
  2  from dba_tables where table_name in ('T_LOCAL','T_LOCAL2');

TABLE_NAME                     INITIAL_EXTENT NEXT_EXTENT
------------------------------ -------------- -----------
T_LOCAL2                                73728      204800
T_LOCAL                                 65536      204800


Explanation
-----------

The 1st migration allows you to manage the extent sizing, and the 
2nd migration ignores extent size handling. 

Migrated tablespaces are not subject to the UNIFORM/SYSTEM policy of newly
created locally managed tablespaces.
Refer to <Note:120061.1> Next Extent Size After Migrating Tablespace from
                         Dictionary to Locally Managed


References
----------

<Note:109627.1> Migrating a Tablespace from Dictionary to Locally Managed 
                Requires Space
<Note:93771.1>  Locally-Managed Tablespaces in Oracle8i
Documentation Oracle8i : Concepts - Chapter 3 Tablespaces and Datafiles
Documentation Oracle8i : Supplied Packages Reference - DBMS_SPACE_ADMIN packag

  Return to Index