If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > Check database size and free space

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-01-08, 19:15
atapojha atapojha is offline
Registered User
 
Join Date: Nov 2007
Location: Sydney, Australia
Posts: 13
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
Reply With Quote
  #2 (permalink)  
Old 09-03-08, 04:04
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
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
Reply With Quote
  #3 (permalink)  
Old 11-26-11, 12:07
sqlserverdba1 sqlserverdba1 is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 11-28-11, 07:41
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
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?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On