Checking space used in a database
To get a summary of the amount of storage space used by a database, executeSp_spaceusedIn the database:
sp_spaceused
database_name database_size ------------------------------ ------------- pubs2 2.0 MB reserved data index_size unused ------------- ------------- --------------- -------- 1720 KB 536 KB 344 KB 840 KB
Table 6-2 describes the columns in the report.
Table 6-2: Columns in sp_spaceused output
Column |
Description |
Database_name |
The name of the database being examined. |
Database_size |
The amount of space allocated to the databaseCreate databaseOrAlter database. |
Reserved |
The amount of space that has been allocated to all the tables and indexes created in the database. (Space is allocated to database objects inside a database in increments of 1 extent, or 8 pages, at a time .) |
Data,Index_size |
The amount of space used by data and indexes. |
Unused |
The amount of space that has been reserved but not yet used by existing tables and indexes. |
The sum of the values inUnused,Index_size, AndDataColumns shoshould equal the figure inReservedColumn. SubtractReservedFromDatabase_sizeTo get the amount of unreserved space. This space is available for new or existing objects that grow beyond the space that has been reserved for them.
By runningSp_spaceusedRegularly, you can monitor the amount of database space available. For example, ifReservedValue is close toDatabase_sizeValue, you are running out of space for new objects. IfUnusedValue is also small, you are running out of space for additional data as well.
This article is copied from http://infocenter.sybase.com/help/index.jsp? Topic =/com. sybase. help. ase_15.0.sag2/html/sag2/sag2200.htm.