다음을 통해 공유


MSSQLSERVER_1101

적용 대상:SQL ServerAzure SQL DatabaseAzure SQL Managed InstanceMicrosoft Fabric의 SQL 데이터베이스

세부 정보

attribute
제품 이름 SQL Server
이벤트 ID 1101
이벤트 원본 MSSQLSERVER
구성 요소 SQLEngine
심볼 이름 NOALLOCPG
메시지 텍스트 '%.*ls' 파일 그룹이 최대 허용 크기에 도달하는 스토리지 공간 또는 데이터베이스 파일 부족으로 인해 가득 찼기 때문에 데이터베이스 '%.*ls'에 새 페이지를 할당할 수 없습니다. UNLIMITED 파일은 여전히 16TB로 제한됩니다. 파일 그룹의 개체를 삭제하거나, 파일 그룹에 파일을 추가하거나, 파일 그룹의 기존 파일에 대해 자동 증가를 설정하여 필요한 공간을 만드십시오.

설명

파일 그룹에서 사용할 수 있는 디스크 공간이 없습니다.

사용자 작업

다음 작업을 수행하면 파일 그룹에서 공간을 사용할 수 있습니다.

  • AUTOGROW를 켭니다.

  • 파일 그룹에 파일을 더 추가합니다.

  • 파일 그룹에서 불필요한 인덱스 또는 테이블을 삭제하여 디스크 공간을 확보합니다.

이 T-SQL 스크립트는 가득 찬 파일을 진단하고 문제를 해결하기 위한 솔루션 명령을 제공하는 데 도움이 될 수 있습니다. 디스크 공간 문제는 진단하지 않습니다.

set nocount on
declare @prcnt_full int = 95
SELECT db_name(database_id) DbName,
       name LogName,
       physical_name,
       type_desc ,
	   convert(bigint, SIZE)/128 File_Size_MB ,
       convert(bigint,(case when max_size = -1 then 17179869176 else max_size end))/128 File_MaxSize_MB ,
	   (size/(case when max_size = -1 then 17179869176 else max_size end)) *100 as percent_full_of_max_size
FROM sys.master_files
WHERE file_id != 2
  AND (size/(case when max_size = -1 then 17179869176 else max_size end)) *100 > @prcnt_full


if @@ROWCOUNT > 0
BEGIN
    DECLARE @db_name_max_size sysname, @log_name_max_size sysname, @configured_max_log_boundary bigint 
    
    DECLARE reached_max_size CURSOR FOR
		SELECT db_name(database_id) DbName,
			   name LogName,
			   convert(bigint, SIZE)/128 File_Size_MB
		FROM sys.master_files
		WHERE file_id != 2
		  AND (size/(case when max_size = -1 then 17179869176 else max_size end)) *100 > @prcnt_full


    OPEN reached_max_size

    FETCH NEXT FROM reached_max_size into @db_name_max_size , @log_name_max_size, @configured_max_log_boundary 

    WHILE @@FETCH_STATUS = 0
    BEGIN
        SELECT 'The database "' + @db_name_max_size+'" contains a data file "' + @log_name_max_size + '" whose max limit is set to ' + convert(varchar(24), @configured_max_log_boundary) + ' MB and this limit is close to be reached!' as Finding
        SELECT 'Consider using one of the below ALTER DATABASE commands to either change the log file size or add a new file' as Recommendation
        SELECT 'ALTER DATABASE ' + @db_name_max_size + ' MODIFY FILE ( NAME = N''' + @log_name_max_size + ''', MAXSIZE = UNLIMITED)' as SetUnlimitedSize
        SELECT 'ALTER DATABASE ' + @db_name_max_size + ' MODIFY FILE ( NAME = N''' + @log_name_max_size + ''', MAXSIZE = something_larger_than_' + CONVERT(varchar(24), @configured_max_log_boundary) +'MB )' as IncreaseFileSize
        SELECT 'ALTER DATABASE ' + @db_name_max_size + ' ADD FILE ( NAME = N''' + @log_name_max_size + '_new'', FILENAME = N''SOME_FOLDER_LOCATION\' + @log_name_max_size + '_NEW.NDF'', SIZE = 81920KB , FILEGROWTH = 65536KB )' as AddNewFile

        FETCH NEXT FROM reached_max_size into @db_name_max_size , @log_name_max_size, @configured_max_log_boundary 

    END

    CLOSE reached_max_size
    DEALLOCATE reached_max_size
END
ELSE
    SELECT 'Found no files that have reached max log file size' as Findings