Obtain database growth through backup records

Source: Internet
Author: User

We usually want to know whether the database has grown and how much it has grown. You may think of comparing the sizes of databases in various historical periods.
But how can we get these historical data? It seems that there is no good way
I am talking about how to view the database growth by viewing the backup records.
First, we should back up the database frequently, which can be implemented by Job.
The database backup records are stored in the backupset table of the msdb database. by viewing the backup records, we can get a rough estimate of the database growth.

The script is as follows:
Copy codeThe Code is as follows:
Select
BackupDate = convert (varchar (10), backup_start_date, 111)
, Sizeingig = floor (backup_size/1024000000) -- convert the size to GB.
From msdb... backupset
Where
Database_name = 'databasename '-- Name of the database you want to view. Replace
And type = 'D'
Order
Backup_start_date desc

The output result is as follows:
BackupDate sizeingig
2009/06/22 2
2009/06/04 1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.