sys.dm_os_buffer_descriptors(Transact-SQL)

현재 SQL Server 버퍼 풀에 있는 모든 데이터 페이지에 대한 정보를 반환합니다. 데이터베이스, 개체 또는 유형에 따라 버퍼 풀에서 데이터베이스 페이지를 배포하는 방식을 결정하는 데 이 뷰의 결과를 사용할 수 있습니다.

데이터 페이지를 디스크에서 읽으면 해당 페이지가 SQL Server 버퍼 풀에 복사되며 다시 사용할 수 있도록 캐시됩니다. 각 캐시된 데이터 페이지에는 하나의 버퍼 설명자가 있습니다. 버퍼 설명자는 SQL Server 인스턴스에 현재 캐시된 각 데이터 페이지를 고유하게 식별합니다. sys.dm_os_buffer_descriptors는 모든 사용자 및 시스템 데이터베이스에 대해 캐시된 페이지를 반환합니다. 여기에는 Resource 데이터베이스와 연결된 페이지가 포함됩니다.

열 이름

데이터 형식

설명

database_id

int

버퍼 풀에 있는 페이지와 연결된 데이터베이스의 ID입니다. Null을 허용합니다.

file_id

int

페이지의 지속형 이미지를 저장하는 파일의 ID입니다. Null을 허용합니다.

page_id

int

파일 내 페이지의 ID입니다. Null을 허용합니다.

page_level

int

페이지의 인덱스 수준입니다. Null을 허용합니다.

allocation_unit_id

bigint

페이지 할당 단위의 ID입니다. 이 값은 sys.allocation_units를 조인하는 데 사용할 수 있습니다. Null을 허용합니다.

참고   sys.dm_os_buffer_descriptors는 SQL Server 2005보다 이전 버전의 SQL Server에서 만들어진 클러스터형 인덱스의 allocation_unit_id에 존재하지 않는 값을 표시할 수 있습니다.

page_type

nvarchar(60)

데이터 페이지 또는 인덱스 페이지와 같은 페이지 유형입니다. Null을 허용합니다.

row_count

int

페이지의 행 수입니다. Null을 허용합니다.

free_space_in_bytes

int

페이지의 사용 가능한 공간(바이트)입니다. Null을 허용합니다.

is_modified

bit

1 = 디스크에서 읽은 후 페이지가 수정되었습니다. Null을 허용합니다.

numa_node

int

버퍼에 대한 Nonuniform Memory Access 노드입니다. Null을 허용합니다.

read_microsec

bigint

페이지를 버퍼로 읽어 오는 데 필요한 실제 시간(밀리초)입니다 이 값은 버퍼를 다시 사용하면 다시 설정됩니다. Null을 허용합니다.

사용 권한

서버에 대한 VIEW SERVER STATE 권한이 필요합니다.

주의

sys.dm_os_buffer_descriptors는 Resource 데이터베이스에 사용되고 있는 페이지를 반환합니다. 사용 가능한 페이지나 빼앗긴 페이지 또는 읽을 때 오류가 있던 페이지에 대한 정보는 sys.dm_os_buffer_descriptors에서 반환되지 않습니다.

원본

대상

위치

관계

sys.dm_os_buffer_descriptors

sys.databases

database_id

다 대 일

sys.dm_os_buffer_descriptors

<userdb>.sys.allocation_units

allocation_unit_id

다 대 일

sys.dm_os_buffer_descriptors

<userdb>.sys.database_files

file_id

다 대 일

1.각 데이터베이스에 대해 캐시된 페이지 수 반환

다음 예에서는 각 데이터베이스에 대해 로드된 페이지 수를 반환합니다.

SELECT COUNT(*)AS cached_pages_count
    ,CASE database_id 
        WHEN 32767 THEN 'ResourceDb' 
        ELSE db_name(database_id) 
        END AS database_name
FROM sys.dm_os_buffer_descriptors
GROUP BY db_name(database_id) ,database_id
ORDER BY cached_pages_count DESC;

2.현재 데이터베이스의 각 개체에 대해 캐시된 페이지 수 반환

다음 예에서는 현재 데이터베이스의 각 개체에 대해 로드된 페이지 수를 반환합니다.

SELECT COUNT(*)AS cached_pages_count 
    ,name ,index_id 
FROM sys.dm_os_buffer_descriptors AS bd 
    INNER JOIN 
    (
        SELECT object_name(object_id) AS name 
            ,index_id ,allocation_unit_id
        FROM sys.allocation_units AS au
            INNER JOIN sys.partitions AS p 
                ON au.container_id = p.hobt_id 
                    AND (au.type = 1 OR au.type = 3)
        UNION ALL
        SELECT object_name(object_id) AS name   
            ,index_id, allocation_unit_id
        FROM sys.allocation_units AS au
            INNER JOIN sys.partitions AS p 
                ON au.container_id = p.partition_id 
                    AND au.type = 2
    ) AS obj 
        ON bd.allocation_unit_id = obj.allocation_unit_id
WHERE database_id = db_id()
GROUP BY name, index_id 
ORDER BY cached_pages_count DESC;

참고 항목

참조

sys.allocation_units(Transact-SQL)

동적 관리 뷰 및 함수(Transact-SQL)

SQL Server 운영 체제 관련 동적 관리 뷰(Transact-SQL)

개념

Resource 데이터베이스