DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: What is the significance of SEGMENTS in a database?

  1. #1
    Join Date
    May 2001
    Posts
    55

    What is the significance of SEGMENTS in a database?

    Everyone,

    First of all, I am a bit nervous about my subject line after reading the previous topic on "how to post questions on the forum" by Tarry Singh. I hope my subject is ok. I also hope it is ok to ask this question here, because Tarry Singh seems to constantly refer to "scripts". My question is not about scripts, so is this the right place ?

    Anyway, let me get on ("get to the point!" I hear the so called disgruntled seniors scream!)

    I have been reading the Oracle Concepts guide downloaded from the Oracle Tech Net and I seem to be having a confusion about a fundamental concept.

    There seem to be so many different logical and physical structures. I have developed a understanding of most of them except for Segments. I cannot understand why Segments are needed at all in the design of the database? Do they help in any way? Are they significant at all? Could Oracle have not done away with this and just reduced the complication ? I am a newbie and my ignorance might shock someone, but please do respond.

    Cheers
    A farmer learns more from a bad harvest than a good one

  2. #2
    Join Date
    Nov 2002
    Location
    New Delhi, INDIA
    Posts
    1,796
    i guess you didn't read the concepts carefully...

    to make things short... Segemnts are of four types.
    1. Table segment.
    2. Index Segment.
    3. Rollback Segment.
    4. Temporary Segment.

    Its the way oracle organizes and manages its distribution of data across its datafiles.

    Segments are not physical but logical. Its like Oracle software program marks certain part of the datafiles on the disk to be kept as table (which will store data in the form of rows and columns), some part as indexes (which will store references to the data in table segments), some as rollback (which will store information to undo the changes made in the table segments) and some as temporary (which will store data temporarily for sorting). These segments are further divided into logical extents and then logical blocks which are multiple of OS blocks. And all these segemnts are contained in a tablespace which is also logical.

    HTH

    PS: Read the chapter 1 of concepts book again.
    Amar
    "There is a difference between knowing the path and walking the path."

    Amar's Blog  Get Firefox!

  3. #3
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    The topic of your requested confusion is quiet vast. So, can you narrow it down.

    In short, a set of datablocks would form an extent, and a set of one or more extents would form a segment.

    Sam
    Thanx
    Sam



    Life is a journey, not a destination!


  4. #4
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    Originally posted by adewri

    PS: Read the chapter 1 of concepts book again.
    Just a small correction its Chapter 2 and not chapter 1
    http://download-west.oracle.com/docs...block.htm#2528

    Sam
    Thanx
    Sam



    Life is a journey, not a destination!


  5. #5
    Join Date
    Nov 2002
    Location
    New Delhi, INDIA
    Posts
    1,796
    Originally posted by sambavan
    Just a small correction its Chapter 2 and not chapter 1
    http://download-west.oracle.com/docs...block.htm#2528

    Sam
    Its in my habit. I always tell the newbies to read the first chapter atleast as it contains the overview of Oracle. Rest are more in details.
    Amar
    "There is a difference between knowing the path and walking the path."

    Amar's Blog  Get Firefox!

  6. #6
    Join Date
    May 2001
    Posts
    55
    Fellas,

    I knew I would get lots of replies telling me to read the concepts again I have read it again and again and again, and also have no one to discuss them with, so I use the forum.

    I have read the relationship between blocks, extents, segments and tablespaces. Also the 4 kinds of segments. Infact I was reading the same URL which Sambavan has suggested I read.

    My query is, why was there a reason for Oracle to create a further classification called SEGMENTS? I do understand that you need blocks to create rows, and a group of contiguous blocks as extents. But why in the design of a database do you need Segments ? The Oracle chapters in the concepts explains WHAT, but not WHY.

    Maybe I just need to take a break for a few days and revisit the same area again, but sometimes it is only when we discuss that the most confusing things suddenly appear all too obvious and simple and this is what I was thinking I could get from this forum.
    A farmer learns more from a bad harvest than a good one

  7. #7
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    if you dont have segments how on earth do you know what extents belong to what object?

    it goes like this

    tablespace - segment - extent - block

    consider tablespace DATA contains 2 segments, one is table segment EMP and the other index segment EMP_PK, each segment has 2 extents so in total there are 4 extents in tablespace DATA. If you get rid of segment definition how would you differentiate between 4 extents? How do you know what extent belong to what table, index?

  8. #8
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Originally posted by adewri
    Segments are not physical but logical. Its like Oracle software program marks certain part of the datafiles on the disk to be kept as table (which will store data in the form of rows and columns), some part as indexes (which will store references to the data in table segments), some as rollback (which will store information to undo the changes made in the table segments) and some as temporary (which will store data temporarily for sorting). These segments are further divided into logical extents and then logical blocks which are multiple of OS blocks. And all these segemnts are contained in a tablespace which is also logical.
    Amar :

    I think you may need to restructure ur "part" to "PARTS", because only extents are allocated (contigious) in the datafile and not the SEGMENT..however, Extent will have info as to which Segment it belongs...

    So, Segment is purely logical storage, and extents can be called SemiLogical (Or rather SemiPhysical) as you are not sure how extents will be distributed at disk level. Ok the file level(OS logical Storage) we can say it to be physically allocated.

    Thas why when you truncate/drop a segment it would take pretty much time if Extents are more(Say more then 1000)...as OS needs to drop (At file level) all those contigious chunks of memory which are marked as extents by the Oracle.

    Had it been what you have said Amar(i mean Part of Mem allocated for each segment), it should have taken same amount of time to Truncate/DROP segemnts irresepective of the Number of Extents.

    topstar :

    I hope now you gotta why Oracle has introduced SEGMENT concept?

    Abhay.
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  9. #9
    Join Date
    Nov 2002
    Location
    New Delhi, INDIA
    Posts
    1,796
    Originally posted by abhaysk
    Amar :

    I think you may need to restructure ur "part" to "PARTS", because only extents are allocated (contigious) in the datafile and not the SEGMENT..however, Extent will have info as to which Segment it belongs...

    So, Segment is purely logical storage, and extents can be called SemiLogical (Or rather SemiPhysical) as you are not sure how extents will be distributed at disk level. Ok the file level(OS logical Storage) we can say it to be physically allocated.

    Thas why when you truncate/drop a segment it would take pretty much time if Extents are more(Say more then 1000)...as OS needs to drop (At file level) all those contigious chunks of memory which are marked as extents by the Oracle.

    Had it been what you have said Amar(i mean Part of Mem allocated for each segment), it should have taken same amount of time to Truncate/DROP segemnts irresepective of the Number of Extents.

    topstar :

    I hope now you gotta why Oracle has introduced SEGMENT concept?

    Abhay.
    BTW contiguous allocation of extents is also logical. If you believe that extents are contiguous at disk level then you are very much mistaken and hence your above theory is also wrong.
    Amar
    "There is a difference between knowing the path and walking the path."

    Amar's Blog  Get Firefox!

  10. #10
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Originally posted by adewri
    If you believe that extents are contiguous at disk level then you are very much mistaken and hence your above theory is also wrong.
    Amar :
    I think you didnt read the post properly..PS

    extents can be called SemiLogical (Or rather SemiPhysical) as you are not sure how extents will be distributed at disk level
    However, physical (Semi) in the sense i meant

    Ok at the file level(See File as OS logical Storage) we can say it to be physically allocated.
    Now does it make sense?

    Abhay.
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width