Sybase- adding space

Am I doing this correct to add free space in sybase db ? the only problems with below is I found the same device exist in default segment and also in Segment_Data_02, how do I make sure I only extend Segment_Data_02 on the device size below ?

disk init name='secdisk1', physname='/dev/md/rdsk/d436',vdevno=12,size='2000M'

alter database sybsecurity on secdisk1 = "1000M"

sp_extendsegment Segment_Data_02, sybsecurity, secdisk1
Who is Participating?
Joe WoodhousePrincipal ConsultantCommented:

Like I said, segments are not containers, no data is stored in a segment.

When you add a data fragment (piece of a device in a database), all built-in data segments now also point to that new space. If you add log space, the built in "logsegment" points there. All this is true unless you specifically remove it.

Think of it like adding shelves to a bookshelf. You might say that the first two shelves are reserved for DVDs, and stick a label on them called "DVD". Does that mean anything is stored in that label? Of course not. And can you still put other things on those shelves? Of course, unless you also make the label say "DVDs only". :)
Joe WoodhousePrincipal ConsultantCommented:
Segments aren't containers, they're labels. They just say "so this part of the database that lives on this device is reserved for these types of objects".

So your "alter database" statement added 1000MB to sybsecurity, available for the built-in segments "system" (for system tables) and "default" (user objects if not created on another segment).

Your "sp_extendsegment" said that any object created on "Segment_Data_02" is also allowed here... but none of the other segments were de-referenced.

Run the following:

   use sybsecurity
   sp_helpdb sybsecurity

(sp_helpdb gives you more information when run from within the database you run it on.)

This will list every segment currently referencing this device. If you want only Segment_Data_02 to be there, run on any others:

   exec sp_dropsegment [segment], sybsecurity, secdisk1
   [repeat for the others]
motioneyeAuthor Commented:
Hi Joe,
What make me confuse is the same device exist in default,system and also in Segment_Data_02.  so if we have new data inserted is that means data can be tied to one of these segment ?
motioneyeAuthor Commented:
Thanks Joe,
Only u are expert in sybase in this EE :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.