DEFINITIONS

Definitions More Info.
Definition ID14.116
TitleSQL
CategoryNOTES
Definitionsadece tek tablo bakimi- only one table maintenance
Definition DescriptionUSE AtlantisDB
GO
DECLARE @TableName VARCHAR(MAX)= NULL
-- Tablo adı parametresini SET ediyorsun
SELECT @TableName=COALESCE(@TableName+',','')+'['+t.TABLE_CATALOG+'].['+ t.TABLE_SCHEMA+'].['+t.TABLE_NAME+']'
FROM INFORMATION_SCHEMA.TABLES T
WHERE t.TABLE_SCHEMA ='cdc'
AND t.TABLE_NAME='dbo_AdayLogDB_CT'
ORDER BY t.TABLE_NAME
--PRINT (@TableName)

-- Hallengren script calistirilir
DECLARE @sql varchar(max)
DECLARE @databaseName nvarchar(100)

SET @databaseName='AtlantisDB'

SET @sql='EXECUTE DPAudit.dbo.IndexOptimize
@Databases = '''+@databaseName+''',
@FragmentationLow = NULL,
@FragmentationMedium = ''INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE'',
@FragmentationHigh = ''INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE'',
@FragmentationLevel1 = 16,
@FragmentationLevel2 = 20,
@MinNumberOfPages = 1,
@MaxNumberOfPages = NULL,
@SortInTempdb = ''N'',
@MaxDOP = 4,
@FillFactor = 95,
@PadIndex = NULL,
@LOBCompaction = ''Y'',
@UpdateStatistics = ''ALL'',
@OnlyModifiedStatistics = ''N'',
@StatisticsModificationLevel = NULL,
@StatisticsSample = NULL,
@StatisticsResample = ''N'',
@PartitionLevel = ''Y'',
@MSShippedObjects = ''Y'',
@Indexes='''+@TableName+''',
--@TimeLimit = 7500,
--@Delay = 20,
@WaitAtLowPriorityMaxDuration = NULL,
@WaitAtLowPriorityAbortAfterWait = NULL,
@Resumable = ''N'',
@AvailabilityGroups = NULL,
@LockTimeout = NULL,
@LockMessageSeverity = 16,
@StringDelimiter = '','',
@DatabaseOrder = NULL,
@DatabasesInParallel = ''N'',
@LogToTable = ''Y'',
@Execute = ''Y'' '+char(10)+char(13)
EXECUTE(@sql)
-- PRINT(@sql)
RecordBycunay
Record Date20-03-2024 17:00:14
Düzenle
Kopyala
Sil