TechNet
Products
IT Resources
Downloads
Training
Support
Products
Windows
Windows Server
System Center
Microsoft Edge
Office
Office 365
Exchange Server
SQL Server
SharePoint Products
Skype for Business
See all products »
Resources
Channel 9 Video
Evaluation Center
Learning Resources
Microsoft Tech Companion App
Microsoft Technical Communities
Microsoft Virtual Academy
Script Center
Server and Tools Blogs
TechNet Blogs
TechNet Flash Newsletter
TechNet Gallery
TechNet Library
TechNet Magazine
TechNet Wiki
Windows Sysinternals
Virtual Labs
Solutions
Networking
Cloud and Datacenter
Security
Virtualization
Updates
Service Packs
Security Bulletins
Windows Update
Trials
Windows Server 2016
System Center 2016
Windows 10 Enterprise
SQL Server 2016
See all trials »
Related Sites
Microsoft Download Center
Microsoft Evaluation Center
Drivers
Windows Sysinternals
TechNet Gallery
Training
Expert-led, virtual classes
Training Catalog
Class Locator
Microsoft Virtual Academy
Free Windows Server 2012 courses
Free Windows 8 courses
SQL Server training
Microsoft Official Courses On-Demand
Certifications
Certification overview
Special offers
MCSE Cloud Platform and Infrastructure
MCSE: Mobility
MCSE: Data Management and Analytics
MCSE Productivity
Other resources
Microsoft Events
Exam Replay
Born To Learn blog
Find technical communities in your area
Azure training
Official Practice Tests
Support options
For business
For developers
For IT professionals
For technical support
Support offerings
More support
Microsoft Premier Online
TechNet Forums
MSDN Forums
Security Bulletins & Advisories
Not an IT pro?
Microsoft Customer Support
Microsoft Community Forums
Sign in
Home
Library
Wiki
Learn
Gallery
Downloads
Support
Forums
Blogs
Resources For IT Professionals
United States (English)
Россия (Pусский)
中国(简体中文)
Brasil (Português)
Skip to locale bar
Post an article
Translate this page
Powered by
Microsoft® Translator
Wikis - Page Details
First published by
chandra sekhar pathivada
(7Microsoft Partne)
When:
16 Jul 2013 10:59 AM
Last revision by
Naomi N
(eMicrosoft Partne)
When:
19 Jul 2013 6:06 PM
Revisions:
2
Comments:
1
Options
Subscribe to Article (RSS)
Share this
Can You Improve This Article?
Positively!
Click Sign In to add the tip, solution, correction or comment that will help other users.
Report inappropriate content using
these instructions
.
Wiki
>
TechNet Articles
>
Estimate Database Backup Size
Estimate Database Backup Size
Article
History
Estimate Database Backup Size
The output from the system command sp_spaceused gives the reserved value of the database which indicates the total size of all the pages in the database. We can use the same value to estimate the database backup size.
Below query extracted from the sp_spaceused which gives the list of all the databases and their reserved size.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
use master
create table dbo.all_db_size (dbname varchar(256),reserved varchar(256),data varchar(256),index_size varchar(90),unused varchar(90))
EXECUTE sp_MSforeachdb '
use [?]
declare @reservedpages bigint ,@usedpages bigint,@pages bigint
select @reservedpages = sum(a.total_pages),
@usedpages = sum(a.used_pages),
@pages = sum(
CASE
-- XML-Index and FT-Index internal tables are not considered "data", but is part of "index_size"
When it.internal_type IN (202,204,211,212,213,214,215,216) Then 0
When a.type <> 1 Then a.used_pages
When p.index_id < 2 Then a.data_pages
Else 0
END
)
from sys.partitions p join sys.allocation_units a on p.partition_id = a.container_id
left join sys.internal_tables it on p.object_id = it.object_id
insert into master.dbo.all_db_size (dbname,reserved,data,index_size,unused)
select db_name() as dbname,
reserved_kb = ltrim(str(@reservedpages * 8192 / 1024.,15,0) ),
data_kb = ltrim(str(@pages * 8192 / 1024.,15,0) ),
index_size_kb = ltrim(str((@usedpages - @pages) * 8192 / 1024.,15,0) ),
unused_kb = ltrim(str((@reservedpages - @usedpages) * 8192 / 1024.,15,0) )
'
select * from dbo.all_db_size
backup size
,
en-US
,
needs work
,
SQL Server
[Edit tags]
Leave a Comment
Please add 6 and 1 and type the answer here:
Post
Wiki - Revision Comment List(Revision Comment)
Sort by:
Published Date
|
Most Recent
|
Most Useful
Comments
Naomi N
19 Jul 2013 6:06 PM
Naomi N edited Original. Comment: This article needs some work
Edit
Page 1 of 1 (1 items)
Wikis - Comment List
Sort by:
Published Date
|
Most Recent
|
Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
Posted by
Naomi N
on
19 Jul 2013 6:06 PM
Naomi N edited Original. Comment: This article needs some work
Edit
Page 1 of 1 (1 items)