Psst! Did you know DevelopmentNow is a mobile web site design agency?

Contact us for help mobilizing your site, or to sign up for our beta Mobile Web SDK!
all groups > sqlserver server > february 2006 >

sqlserver server : sql database restricted growth limit notification


mp3nomad
2/28/2006 12:57:28 PM
Is there a way to setup a job in sql server 2005 to notify me if a database
is getting close to reaching it's restricted growth limit? For example if a
database is limited to 140 mb... can I setup something in sql server to
noitfy me if the database gets within 90% of it's restricted growth limit?
Along these lines, is there a way to allow the database to grow in size over
it's restricted limit if it happens to occur during non-business hours... say
after 5pm and before 8am or over a weekend?

The reason I ask is that we are hosting sql 2005 databases for some of our
clients and I'm restricting their growth unless they pay us for additional
space. One of my clients is asking if this can be done.

Thanks for any help you can provide!
Ravi
2/28/2006 2:19:26 PM
Here is some sample code find out the %used.
Note - sysles and sysaltfiles may not be always up-to-date. make sure to run
UPDATEUSAGE

DBCC UPDATEUSAGE('Northwind')
DECLARE @DBSize float
DECLARE @DataSize float
SELECT @DBSize=size/128.0 from sysfiles WHERE FileID=1
SELECT @DataSize=sum(convert(dec(15),reserved))/128.0 from sysindexes where
indid in (0, 1, 255)
SELECT @DataSize/@DBSize*100


--
Thanks & Rate the Postings.
-Ravi-


[quoted text, click to view]
mp3nomad
2/28/2006 5:01:27 PM
Thanks. Is there any way to increase the restricted growth limit other than
through SQL Server Management Studio?

[quoted text, click to view]
Ravi
2/28/2006 6:56:29 PM
use ALTER DATABASE Command. Refer Books Online for syntax
Here is the sample code to increase the size

ALTER DATABASE AdventureWorks
MODIFY FILE
(NAME = test1dat3,
SIZE = 20MB);
GO


--
Thanks & Rate the Postings.
-Ravi-


[quoted text, click to view]
mp3nomad
2/28/2006 7:26:27 PM
thanks Ravi.

[quoted text, click to view]
AddThis Social Bookmark Button