If a database has filled its allocated storage space, you cannot add new data or updates to it. Existing data is always preserved. If the space allocated for a database proves to be too small, the Database Owner can increase it with the alter database command. alter database permission defaults to the Database Owner, and cannot be transferred. You must be using the master database to use alter database.
The default increase is 2MB from the default pool of space. This statement adds 2MB to newpubs on the default database device:
alter database newpubs
The full alter database syntax allows you to extend a database by a specified number of megabytes (minimum 1MB) and to specify where the storage space is to be added:
alter database database_name [on {default | database_device} [= size] [, database_device [= size]]...] [log on {default | database_device} [ = size ] [, database_device [= size]]...] [with override] [for load]
For complete documentation of alter database, see the Reference Manual.
The on clause in the alter database command is just like the on clause in create database. The for load clause is just like the for load clause in create database and can be used only on a database created with the for load clause.
To increase the space allocated for newpubs by 2MB on the database device pubsdata, and by 3MB on the database device newdata, type:
alter database newpubs on pubsdata = 2, newdata = 3
When you use alter database to allocate more space on a device already in use by the database, all of the segments already on that device use the added space fragment. All the objects already mapped to the existing segments can now grow into the added space. The maximum number of segments for any database is 32.
When you use alter database to allocate space on a device that is not yet in use by a database, the system and default segments are mapped to the new device. To change this segment mapping, use sp_dropsegment to drop the unwanted segments from the device.
Using sp_extendsegment automatically unmaps the system and default segments.
For information about with override, see the System Administration Guide.
Copyright © 2005. Sybase Inc. All rights reserved. |