1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Logical Structure

Discussion in 'Server Administration and Options' started by kamran0931, Dec 22, 2011.

  1. kamran0931

    kamran0931 Active Member

    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    55
    Hi
    Why we need logical structures, i mean why this distribution ?

    Tablespaces
    Segments
    Extents
    Data Blocks

    Thanks
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    What would you suggest as an alternative? The database must communicate with the operating system and hardware such that all such entities can function properly. A tablespace is a logical collection of segments contained by the data files created at the operating system level, segments are logical collections of extents, extents are logical collections of data blocks (and the extents associated with a segment can span physical storage units) and data blocks are physical entities utilizing characteristics of the physical storage medium and layout determined by the manufacturer of the devices and of the operating system firmware.

    Are you complaining about the structure of Oracle and its datafiles? Are you trolling for an argument?? If it's the former please explain yourself further and if it's the latter you won't find one here.
     
  3. kamran0931

    kamran0931 Active Member

    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    55
    Thanks Mr. Fitzjarrell for your reply.
    No, it just came into my mind that why such distribution.
    For example if we create a table then through what procedure will it go (in logical structure).
    I am new to oracle so please correct me when i am wrong.

    Thanks

    Kamran
     
  4. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    Now that the question is clear:

    A tablespace must exist before a table can be created in it. Creating a tablespace involves both a logical component (recording the relevant data in the data dictionary) and a physical component (creating the physical data files in accordance with the CREATE TABLESPACE specifications). The block size is set (normally) at the database level however in recent releases of Oracle a tablespace can have a different block size (no need to go into that now) so Oracle knows how to divide the storage space into usable blocks (the common size is 8192, or 8k).

    Now that you have a tablespace filled with data blocks you can create a table; Oracle creates the table as a segment comprised of extents, which are collections of data blocks providing a specific allocation size. Allocation in later releases of Oracle can be configured as automatic [ Oracle decides the starting size and when to increase the extent size based upon the overall storage a segment consumes ] or as uniform [ you tell Oracle what size you want to use and it will continue to do so for that segment until the segment is dropped ]. Making this easier to understand: for a uniform 1 MB extent size Oracle, when creating the segment, will allocate 128 8k blocks as the initial extent and will continue to allocate 128 blocks of storage as the table needs to expand until either the data inserts stop, the table is dropped or the data file runs out of available space. [This presumes an 8k block size for the database and tablespace.]

    As you can see all of the structures you mentioned are used and depend upon each other.

    There is much more to this than I just explained but try to understand that part now. You can read about the other aspects of how data is stored in an Oracle database after you comprehend the explanation I provided.
     
  5. kamran0931

    kamran0931 Active Member

    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    55
    Many thanks Mr. Fitzjarrell