MSSQLSERVER_1101

適用於:SQL ServerAzure SQL DatabaseAzure SQL 受控執行個體

詳細資料

屬性
產品名稱 SQL Server
事件識別碼 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