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 > calculating free space of database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-12-11, 14:51
regtha regtha is offline
Registered User
 
Join Date: Jan 2010
Posts: 72
calculating free space of database

I wrote the below query to calculate the free data space avaialble for each database present in the server. Can any of you please go through this and correct if I am wrong.
-------------------------------------------
select
"DB"= convert(char(10),db_name(dbid)),
"DB_Free_Space_Percentage" = convert(varchar(6),round(sum(unreservedpgs) * 100 / sum(size),0))
from sysusages u
where segmap = 3 and dbid not in (3,31513,31514)
group by dbid
order by 2

----------------------------------------

Thank you
Reply With Quote
  #2 (permalink)  
Old 01-13-11, 03:54
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
Looks OK to me
Reply With Quote
  #3 (permalink)  
Old 01-31-11, 03:56
erovij erovij is offline
Registered User
 
Join Date: Jun 2009
Posts: 19
If the name of your db's are less than 10 characters then i think it is ok

Thanks
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