sp_extendsegment

Extends the range of a segment to another database device.

Syntax

sp_extendsegment segname, dbname, devname

Parameters

Examples

Usage

There are additional considerations when using sp_extendsegment:
  • You cannot extend a segment on a device that already has an exclusive segment, and you cannot extend an exclusive segment on a device that has another segment.

    For example, if you attempt to extend segment orders_seg on a device orders.dat, which already has an exclusive segment, you see an error message similar to:
    A segment with a virtually hashed table exists on 
    device orders.dat.
    If you attempt to extend exclusive segment orders_seg on device orders.dat, which has other segments, you see an error message similar to:
    You cannot extend a segment with a virtually hashed 
    table on device orders.dat, because this device has 
    other segments.
  • A segment can be extended over several database devices.

  • You can only execute sp_extendsegment for the logsegment system segment in single-user mode.

  • If the logsegment segment is extended, any other segments on the device are dropped and the device is used for the log segment exclusively.

  • When you extend the logsegment segment, the SAP ASE server recalculates its last-chance threshold.

  • To associate a segment with a database device, create or alter the database with a reference to that device. A database device can have more than one segment associated with it.

  • After defining a segment, you can use it in the create table and create index commands to place the table or index on the segment. If you create a table or index on a particular segment, subsequent data for the table or index is located on that segment.

See also alter database, create index, create table in Reference Manual: Commands.

Permissions

The permission checks for sp_extendsegment differ based on your granular permissions settings.

SettingDescription
Enabled

With granular permissions enabled, you must be a user with manage database privilege.

Disabled

With granular permissions disabled, you must be the database owner or a user with sa_role.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

InformationValues
Event

38

Audit option

exec_procedure

Command or access audited

Execution of a procedure

Information in extrainfo
  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

Related reference
sp_addsegment
sp_dropsegment
sp_helpdb
sp_helpdevice
sp_helpsegment
sp_placeobject