View to get DB Size

The DBCC SQLPERF(logspace) is a handy routine to check the transaction log sizes.  But it does have some limitations:

  • The log file size is in KB.  All of our databases are in GB, so I end up unconsciously converting the KB output into GB.
  • Saving the data to a table is not convenient.
  • It provides the log file size, and the percent used, but the actual amount of data in the log is left as an exercise for the reader.

My first attempt at producing an alternative view of SQLPERF(logspace) just included the log file information from the SQL performance counters. 

My colleague Max MA (t) suggested adding counter values for the database data file size.  He also suggested replacing a calculated value for percent of log used with a counter value. 

I agreed with adding the data file size counter; I didn’t like the log percent used counter value because it is represented as an integer value with a rounded value.

Here is the query, that happens to make a convenient view:

[sourcecode language='sql'  padlinenumbers='true']
	SELECT	DatabaseName
			, [Data File(s) Size (KB)] AS [Data File(s) Size (GB)]
			, [Log File(s) Size (KB)] AS [Log File(s) Size (GB)] 
			, [Log File(s) Used Size (KB)] AS [Log File(s) Used Size (GB)]
			, CAST(CASE WHEN [Log File(s) Size (KB)] = 0.00 THEN 0.00
					ELSE [Log File(s) Used Size (KB)] / [Log File(s) Size (KB)] * 100.0 
				END AS NUMERIC(18, 2)) AS [Log % Used]
	FROM	(	SELECT  instance_name as DatabaseName
						, ltrim(rtrim(counter_name)) as counter_name
						, CAST(cntr_value / 1024. / 1024. AS NUMERIC(18, 2)) AS [Storage(GB)]
				FROM	sys.dm_os_performance_counters
				WHERE	counter_name IN ('Data File(s) Size (KB)'
										, 'Log File(s) Size (KB)'
										, 'Log File(s) Used Size (KB)') ) as SourceTable
	PIVOT	(	SUM ([Storage(GB)])
				FOR	counter_name IN ([Data File(s) Size (KB)]
									 , [Log File(s) Size (KB)]
									 , [Log File(s) Used Size (KB)] ) ) AS PivotTable;

Here is the sample output:


Since the code always runs off the blog page, here is a readable version of it:


This is simple stuff but makes checking log files and data file growth convenient.  This could easily be used as part of a regularly collected baselines routine.

Stay curious… Keep learning…


Leave a Reply

You must be logged in to post a comment.

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>

professional definition essay proofreading websites uk best thesis statement proofreading website for masters popular dissertation results proofreading websites usa top annotated bibliography proofreading service for masters custom college descriptive essay ideas top article review writer services online help with my culture article review popular course work ghostwriters service for mba theme for 1984 custom persuasive essay writer for hire for university custom biography editor for hire type my custom descriptive essay on trump professional scholarship essay writing services for masters popular blog post editing sites uk popular university essay ghostwriting services top movie review writing sites for college best term paper editing sites for college custom research paper writer site gb cheap blog post editor site au top mba essays topic help me write popular annotated bibliography online only yesterday summary pay for finance curriculum vitae astronomy proofreading sites write popular phd essay on usa gary gildner pay to write top descriptive essay pay to get custom paper online professional dissertation conclusion writers website cheap homework ghostwriter site for school popular persuasive essay editing websites au pay to write economics assignment custom college essay ghostwriters website for university custom problem solving ghostwriter website for college esl article writers sites for college forgiving my father lucille clifton best blog post ghostwriting websites popular critical thinking editing sites for school professional rhetorical analysis essay writers website for school popular dissertation proposal ghostwriters for hire for mba help with engineering thesis proposal custom university curriculum vitae ideas pay for my sociology home work best business plan ghostwriter websites for college admission ghostwriting websites au volcano essay pay to get drama biography help writing top critical essay on hillary top movie review ghostwriter service us creative writing writer sites uk top persuasive essay writing for hire marriage is a private affair questions cheap biography ghostwriter site for school rhetorical analysis ghostwriters site usa top expository essay writers site for phd custom dissertation editor service us do my criminal law research proposal cheap dissertation abstract ghostwriter website uk esl critical essay writing service usa essays com best dissertation introduction ghostwriting websites for college do my best college essay on lincoln professional content proofreading sites online custom bibliography ghostwriters website for phd best dissertation results ghostwriter websites for phd adam smith and john maynard keynes top cheap essay writing site for phd popular essay editor for hire for masters cheap term paper writing service for masters esl critical essay ghostwriters for hire au professional thesis proposal ghostwriter for hire for school best papers writing services online custom article editor websites for school cheap annotated bibliography ghostwriting sites esl blog ghostwriter site usa professional thesis proposal ghostwriter services pay to get best analysis essay on founding fathers popular research paper writer website for college professional school essay ghostwriting services custom term paper editor websites for phd academic writers services usa popular dissertation introduction editing service for masters best school biography examples professional university thesis proposal topics popular masters reflective essay samples popular personal essay writing website ca best analysis essay editor for hire for school top essay ghostwriters services au custom cv proofreading website usa popular critical analysis essay ghostwriter services for college custom argumentative essay editing site for mba pay to write sociology thesis critical thinking editor service ca expository writers for hire us top argumentative essay writer service online professional homework editing website usa best critical analysis essay ghostwriters websites for masters order business dissertation proposal countdown ben mikaelsen help writing accounting movie review antaeus borden deal top blog post writer sites for mba buy biology bibliography essay on sportsmanship best problem solving writing services for mba hammurabi laws fair or cruel help writing cheap expository essay on lincoln cheap book review writer website uk professional creative essay ghostwriters services custom dissertation proposal writing websites ca type my cheap argumentative essay on hillary clinton cheap problem solving writing service us cheap cheap essay writer for hire for college esl phd dissertation chapter topic order professional university essay on civil war top report writing for hire usa esl personal essay ghostwriters service uk professional business plan editing websites for mba best college term paper samples almost a man cheap college presentation example help writing remedial math dissertation proposal top biography writer services for school help with my esl dissertation hypothesis online cheap college dissertation methodology sample best school essay proofreading website for college esl research paper ghostwriters websites custom definition essay proofreading services custom admission paper ghostwriters service gb professional blog writing sites for university professional dissertation proofreading site for phd help writing speech admission paper pay for my algebra research proposal professional research paper writers for hire for college buy cheap critical analysis essay professional blog ghostwriters site usa custom academic essay writing for hire for school esl course work proofreading websites usa top scholarship essay proofreading website us popular argumentative essay proofreading sites uk esl critical essay editor service for phd esl blog post writer site uk esl masters essay editing service for college pay for my esl literature review pay for custom expository essay on pokemon go popular critical analysis essay writer site for masters best scholarship essay ghostwriters websites pay to get geology research proposal pay for my economics thesis proposal best essay ghostwriter website online who is dill order cheap descriptive essay online top content ghostwriter for hire usa professional creative writing writer services popular dissertation abstract editing service for school thesis statement writer websites us best term paper writing website for masters esl critical essay ghostwriters website online custom definition essay writers services for masters best university reflective essay examples esl thesis editing websites uk professional college dissertation results ideas chemistry writers site course work editing site online professional resume ghostwriting website ca popular dissertation introduction proofreading for hire for mba top argumentative essay writing websites for school esl descriptive essay ghostwriters site uk help writing shakespeare studies content pay for professional personal statement online popular academic essay writing services for mba popular creative writing writer for hire for college esl dissertation ghostwriter websites au application letter writer sites us university editor for hire online best blog post ghostwriters site top biography writer service for masters top biography editing site for masters cheap creative writing editor site for university pay for social studies homework cheap university essay editing website au best scholarship essay proofreading for hire for college professional article writers site us professional expository essay editor websites online best application letter ghostwriter services for mba popular thesis proposal proofreading site uk write world literature papers esl dissertation conclusion editor websites uk phd essay examples republic of gilead popular reflective essay ghostwriters sites for university esl literature review writer site online pay for reflective essay on brexit research paper free research proposal editor websites best admission paper ghostwriting services for university esl definition essay writing site uk professional problem solving ghostwriters website for phd best thesis statement ghostwriters site ca pay for scholarship essay on hillary clinton popular university admission essay assistance cheap problem solving editing for hire for school home work proofreading sites au cheap phd essay ghostwriting website gb esl research proposal writing website top dissertation abstract ghostwriting websites ca best dissertation results proofreading websites for university degradation of character help writing geography paper top thesis ghostwriters websites for mba esl writers site for mba professional analysis essay editor services gb esl problem solving ghostwriters for hire usa fernand mondego pay for accounting dissertation abstract popular research paper writer website us best admission essay proofreading websites for phd esl academic essay writers site for college cheap blog ghostwriting services uk top thesis proposal editor services ca pay to do political science application letter admission writer for hire us best analysis essay ghostwriting website for phd write my health dissertation results thomas jefferson contributions custom critical analysis essay writers services ca top persuasive essay editor sites for masters esl university definition essay ideas cheap thesis ghostwriter for hire for masters write my masters essay on hacking homework writing website uk top creative essay editor for hire for college popular research paper proofreading service for school best blog writer services esl creative essay writing websites uk help writing journalism dissertation professional research proposal ghostwriting site au professional scholarship essay ghostwriting website for mba professional dissertation hypothesis writing site ca gilgameshs introductory letter best essays editing websites for mba popular presentation writers site for phd help me write ancient civilizations movie review john donne holy sonnet 5 analysis esl essay ghostwriting for hire for mba write finance movie review top paper ghostwriters service uk movie review writer website usa professional cv editor sites custom term paper proofreading site uk chemistry ghostwriter websites esl thesis statement ghostwriters service for university best creative writing ghostwriting websites for masters which was not a cause of the war of 1812? professional thesis editing services uk top cover letter writer service for mba esl book review ghostwriter service popular school blog advice professional research paper writing services au esl masters dissertation advice top analysis essay editor service for college professional mba essay writers services professional critical analysis essay editing sites usa professional descriptive essay ghostwriter website for phd cheap biography ghostwriter site for mba esl masters essay proofreading services for mba type my cheap critical essay on shakespeare best reflective essay ghostwriters services au cheap university essay writer for hire for college top essays ghostwriters services for university best bibliography editing service ca composition proofreading websites hydrated copper sulfate esl literature review writer websites for school best thesis statement ghostwriting site online cheap movie review ghostwriter services for mba type my geology dissertation chapter help with health case study top article review ghostwriter website online professional critical essay writing website for mba professional phd persuasive essay topic zoology essay editing for hire type my chemistry research paper custom course work ghostwriting websites gb top cv editing services for school professional essay proofreading for hire gb best academic essay ghostwriter for hire for mba professional rhetorical analysis essay writer website for phd cheap critical essay editor sites online popular scholarship essay writers website uk pay for esl scholarship essay on presidential elections custom dissertation ghostwriters services for school popular custom essay editor site online descriptive essay proofreading website uk popular rhetorical analysis essay editor websites gb professional college application letter advice cheap research proposal writer for hire for college buy law dissertation hypothesis custom critical essay proofreading services for masters cheap thesis statement writers website for masters write best analysis essay on trump esl personal essay writers websites for school top movie review proofreading services uk at&t strategy popular paper writing website usa cheap dissertation editor website for school personification in macbeth popular thesis proposal editor for hire uk pay for my life science thesis cheap content writing service for phd top cv editing for hire uk cheap school essay writer services for masters help with my esl expository essay on lincoln professional college cv ideas coming of age in mississippi analysis help with top dissertation chapter professional university essay editing websites government ghostwriters websites professional biography ghostwriting websites online best dissertation abstract ghostwriter sites au custom cheap essay writer service for phd popular problem solving ghostwriter sites custom critical essay writer websites usa top university essay proofreading for hire for college cheap critical essay editor for hire esl creative writing writers sites gb best mba critical analysis essay advice best essays ghostwriter service for mba pay for best college essay on usa top analysis essay proofreading sites for masters best dissertation results ghostwriters site gb analysis of everyday use by alice walker custom school essay ghostwriting website for college thesis proposal ghostwriting service gb content ghostwriter site online examples of dramatic irony in oedipus popular masters curriculum vitae ideas write my accounting annotated bibliography custom business plan writers site for phd cheap content writing service au citizen kane analysis essay top book review ghostwriter services usa cheap scholarship essay writing sites for university essay cause and effect cheap academic essay ghostwriting website for mba esl dissertation hypothesis writers websites uk dissertation hypothesis ghostwriter service uk help me write drama cv custom personal essay ghostwriters sites divine command theory example custom mba application letter example help writing law creative writing popular home work ghostwriting websites for college pay to write geography business plan best blog writers site for mba popular dissertation proposal ghostwriting website for college custom creative essay writer services gb custom custom essay editing website online buy leadership dissertation hypothesis what is the significance of the mayflower compact top college essay ghostwriters sites for phd professional masters content samples popular paper editor service gb esl application letter editor sites cheap phd essay writers website help with best critical analysis essay on donald trump top college reflective essay assistance esl annotated bibliography editing site for university help with my esl critical essay on donald trump literature writing website order persuasive essay on pokemon go professional book review ghostwriting website for college buy esl article review online top university essay ghostwriter website for phd custom dissertation results writers site ca popular assignment editing service ca donald justice biography write cheap college essay on usa esl masters essay ghostwriter for hire ca custom descriptive essay ghostwriters service for masters university ghostwriter sites ca custom assignment proofreading for hire uk pay for my health personal statement best analysis essay editing sites for university cheap personal statement writers service online the ministers black veil theme best rhetorical analysis essay ghostwriting site ca popular homework writing services usa best proofreading service ca esl resume ghostwriters sites au esl article review proofreading website us best case study writer website best scholarship essay writer site for school popular movie review writing website for mba popular descriptive essay proofreading website for school professional speech editor service usa order psychology course work best personal essay writer services au admission essay proofreading services online best dissertation writer site uk popular dissertation proposal writers sites gb top dissertation results writing services gb cheap report writer for hire gb professional custom essay writers sites for college custom thesis proposal writing service for college esl bibliography writer services for college esl reflective essay ghostwriter site for school top biography proofreading website uk esl blog post editor service type my sociology course work esl university report samples cheap dissertation methodology ghostwriter for hire au type my health content best blog post ghostwriter website esl critical thinking editing service usa best expository essay proofreading websites for college dissertation chapter ghostwriting website online cheap phd scholarship essay sample custom mba personal statement sample esl persuasive essay editor sites for college top admission essay writers sites for mba help with my research paper online popular college essay writers websites for school custom analysis essay editing for hire ca esl presentation editing for hire usa esl argumentative essay editor website us pay for custom persuasive essay on donald trump best assignment writing sites ca custom dissertation hypothesis writer website for college pay for professional problem solving online esl mba personal statement advice popular literature review editor websites au custom rhetorical analysis essay writing websites online best curriculum vitae ghostwriter service usa best movie review writers service ca professional book review writers service for masters problem solving editor services ca top papers editor service ca top dissertation hypothesis editor service us cheap dissertation proposal writers services ca professional home work ghostwriter service uk order best personal statement online home work editing service us best college case study topics custom critical essay ghostwriter services uk letter ghostwriting site ca top speech ghostwriters services cheap curriculum vitae proofreading service us custom creative writing ghostwriters service online do my poetry term paper popular university essay writer for hire for college custom dissertation writer websites for mba top home work editing services popular problem solving writers sites ca euripides alcestis summary cheap college essay ghostwriters service for school personal reflection definition technological advances in ww2 research proposal writing for hire ca cheap literature review writing service uk issues in ethiopia professional movie review editor service for phd custom home work editing service online esl blog writers website uk reparations for slavery popular case study writers sites for college top cover letter ghostwriting website for university custom curriculum vitae proofreading for hire for university cheap persuasive essay proofreading websites for masters popular thesis proposal writing website for university write my political science biography popular home work writer website cheap ghostwriters for hire for college write my expository essay on trump esl argumentative essay editor websites for mba custom literature review proofreading websites ca professional cv proofreading sites for college professional curriculum vitae ghostwriting sites best best essay ghostwriter service for mba professional school rhetorical analysis essay assistance cheap thesis ghostwriter services for mba help with custom dissertation hypothesis popular book review ghostwriters sites ca best dissertation results proofreading sites for university write me world affairs dissertation results popular cover letter ghostwriters service for phd nadine gordimer once upon a time top annotated bibliography ghostwriters websites write english as second language blog post popular masters article example pay to do scholarship essay on shakespeare custom cheap essay ghostwriters website for phd best rhetorical analysis essay ghostwriting sites for college academic ghostwriting websites top dissertation methodology ghostwriter service au cheap personal statement editing website for mba help writing engineering papers custom term paper ghostwriter website for mba professional masters essay writer website uk losing faith quotes