Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2007
    Location
    Sydney, Australia
    Posts
    13

    Unanswered: Check database size and free space

    Hi Guys

    A novice question.

    How do I check the database size and how much free space is available to the database through sql query?

    sp_helpdb does not give me the free space available.

    Thanks

    Atap

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    What version of ASE?
    Works fine on all versions I checked from ASE 11.9 to 15
    Code:
    1> sp_helpdb master
    2> go
     name                     db_size       owner                    dbid   created        status                                                                                                 
     ------------------------ ------------- ------------------------ ------ -------------- ------------------------------------------------------------------------------------------------------ 
     master                         33.0 MB sa                            1 Jan 01, 1900   no options set                                                                                         
    
    (1 row affected)
     device_fragments               size          usage                free kbytes 
     ------------------------------ ------------- -------------------- ----------- 
     master                         3.0 MB        data and log                   0 
     master                         30.0 MB       data and log               30368

  3. #3
    Join Date
    Oct 2011
    Posts
    29
    select a.file_id,
    [FILE_SIZE_MB] =
    convert(decimal(12,2),round(a.size/128.000,2)),
    [SPACE_USED_MB] =
    convert(decimal(12,2),round(fileproperty(a.name,'S paceUsed')/128.000,2)),
    [FREE_SPACE_MB] =
    convert(decimal(12,2),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)) ,
    NAME = left(a.NAME,15),FILENAME = left(a.physical_name,100)from sys.database_files a

  4. #4
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    sqlserverdba1,

    Besides the fact that this thread is more than 3 years old the query you posted is not for Sybase. You working in wrong forum?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •