Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Determine database grow per month Expand / Collapse
Author
Message
Posted Friday, March 08, 2013 2:59 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 10:05 PM
Points: 141, Visits: 648
Is it possible to determinate how much disk space an specific database grow per month?

in sql server 2008

Any one advice me,,






Thanks
Jerry
Post #1428469
Posted Friday, March 08, 2013 3:13 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, June 05, 2013 2:40 AM
Points: 5,075, Visits: 4,833
If you haven't put in custom auditing the only way would be to query msdb.dbo.backupset and compare the backup sizes, but it might not be a true representation depending on how much white space is in the database.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1428480
Posted Friday, March 08, 2013 3:16 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Monday, June 10, 2013 4:11 AM
Points: 1,474, Visits: 2,344
Hi Jerry,
You might be able to get a rough idea from backup history. Definitely only a guide though!

select server_name, database_name, backup_start_date, backup_size
from msdb.dbo.backupset
where type = 'D'
and database_name = 'dbname'
order by backup_start_date desc

For more accurate measure, you'll need to collect size information yourself on a regular basis.
I believe there's tools out there that do that kind of thing, or you can roll your own.
Post #1428483
Posted Friday, March 08, 2013 3:17 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Monday, June 10, 2013 4:11 AM
Points: 1,474, Visits: 2,344
Or, what Anthony said
Post #1428485
Posted Friday, March 08, 2013 3:22 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, June 05, 2013 2:40 AM
Points: 5,075, Visits: 4,833
CREATE TABLE [DatabaseFileUsage](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[DatabaseName] [sysname] NOT NULL,
[FileID] [int] NULL,
[FileSizeMB] [decimal](18, 2) NULL,
[SpaceUsedMB] [decimal](18, 2) NULL,
[FreeSpaceMB] [decimal](18, 2) NULL,
[LogicalName] [sysname] NOT NULL,
[FileLocation] [sysname] NOT NULL,
[DateCollected] [date] NULL,
CONSTRAINT [PK_DatabaseFileUsage] PRIMARY KEY CLUSTERED
(
[ID] ASC
)
)
GO
CREATE PROCEDURE [InsertDatabaseFileUsage]
AS
BEGIN
DECLARE @SQL NVARCHAR(MAX)
SELECT @SQL = REPLACE(
CAST(
(
SELECT 'USE ' + QUOTENAME(name) +';' + CHAR(13) + CHAR(10) +
'INSERT INTO [#####].[dbo].[DatabaseFileUsage] (DatabaseName, FileID, FileSizeMB, SpaceUsedMB, FreeSpaceMB, LogicalName, FileLocation)' + CHAR(13) + CHAR(10) +
'SELECT ' + CHAR(13) + CHAR(10) +
'DatabaseName = DB_NAME(), ' + CHAR(13) + CHAR(10) +
'a.FILEID, ' + CHAR(13) + CHAR(10) +
'[FILE_SIZE_MB] = CONVERT(DECIMAL(12, 2), ROUND(a.size / 128.000, 2)), ' + CHAR(13) + CHAR(10) +
'[SPACE_USED_MB] = CONVERT(DECIMAL(12, 2), ROUND(fileproperty(a.NAME, ' + CHAR(39) + 'SpaceUsed' + CHAR(39) +') / 128.000, 2)), ' + CHAR(13) + CHAR(10) +
'[FREE_SPACE_MB] = CONVERT(DECIMAL(12, 2), ROUND((a.size - fileproperty(a.NAME, ' + CHAR(39) + 'SpaceUsed' + CHAR(39) +')) / 128.000, 2)), ' + CHAR(13) + CHAR(10) +
'a.NAME, a.FILENAME ' + CHAR(13) + CHAR(10) +
'FROM dbo.sysfiles a;' + CHAR(13) + CHAR(10)
FROM sys.databases
FOR XML PATH('')
)
AS NVARCHAR(MAX)
),
'&#x 0D;',CHAR(13) + CHAR(10) -- REMOVE THE SPACE ON THIS LINE BETWEEN the x and the 0
)
--SELECT @SQL
EXECUTE sp_executesql @SQL
END

This is my custom routine.

Create the table in a central database
Change ##### to the name of the central database
Create the procedure, ensure you remove the space on the line with the comment (have to put the space in as the string is a reserved XML phrase and gets removed in the forums)
Schedule a job to run the proc nightly and then you can do growth trends.




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1428488
Posted Friday, March 08, 2013 3:38 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 6:14 AM
Points: 516, Visits: 2,257
solomon.jernas (3/8/2013)
Is it possible to determinate how much disk space an specific database grow per month?

in sql server 2008

Any one advice me,,

Thanks
Jerry


Check out this excelelnt website about creating a DBA Repository (which also includes monitoring database growth trends : http://sql-ution.com/


-----------------------------------
http://www.SQL4n00bs.com
Post #1428493
Posted Friday, March 08, 2013 9:01 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 10:05 PM
Points: 141, Visits: 648
I executed the procedure, but i didn't get any information...


Post #1428632
Posted Friday, March 08, 2013 11:47 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 12:02 PM
Points: 2,581, Visits: 7,295
I use backup history too. Quite a few threads , posts & scripts here and elsewhere.


Post #1428719
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse