sp_addsegment

Description

Defines a segment on a database device in a database.

Syntax

sp_addsegment segname, dbname, devname

Parameters

segname

is the name of the new segment to add to the syssegments table of the database. Segment names are unique in each database.

dbname

specifies the name of the database in which to define the segment. dbname must be the name of the current database or match the database name qualifying sp_addsegment.

devname

is the name of the database device in which to locate segname. A database device can have more than one segment associated with it.

Examples

Example 1

Creates a segment named indexes for the database pubs2 on the database device named dev1:

sp_addsegment indexes, pubs2, dev1

Example 2

Creates a segment named indexes for the database pubs2 on the database device named dev1:

disk init 
    name = "pubs2_dev", 
    physname = "/dev/pubs_2_dev",
    vdevno = 9, size = 5120
go
alter database pubs2 on pubs2_dev = 2
go
pubs2..sp_addsegment indexes, pubs2, dev1

Usage

Permissions

Only the Database Owner or a System Administrator can execute sp_addsegment.

See also

Commands alter database, create index, create table, disk init

System procedures sp_dropsegment, sp_extendsegment, sp_helpdb, sp_helpdevice, sp_placeobject