SQL Server View the amount of space the database occupies in the data cache

Source: Internet
Author: User

1  UseMaster2 Go3 Select *  fromsys.dm_os_buffer_descriptors4 Go5 6 --View the amount of space the database occupies in the data cache7 --128 Bytes, 1/8 kilobytes (KB) because each data page corresponds to a row in dynamic management view (management VIEW,DMV)8 --1 byte (byte) = 8 bit (bit)9 --1000 kilobytes (KB) = 1024 bytes (byte)Ten --1 megabytes (MB) = 1.024 million kilobytes (KB) One Select Count(*)*8/1024x768  as 'Cached Size (MB)', A         Casedatabase_id when 32767  Then 'Resouredb' -                         Else db_name(database_id)End  as 'Database', - database_id the  fromsys.dm_os_buffer_descriptors - Group  by db_name(database_id), database_id - Order  by 'Cached Size (MB)' desc - Go

Results:

SQL Server View the amount of space the database occupies in the data cache

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.