-- Partition Olustur USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION0] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION0,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION0.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION0] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION1000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION1000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION1000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION1000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION2000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION2000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION2000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION2000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION3000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION3000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION3000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION3000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION4000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION4000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION4000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION4000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION5000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION5000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION5000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION5000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION6000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION6000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION6000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION6000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION7000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION7000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION7000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION7000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION8000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION8000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION8000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION8000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION9000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION9000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION9000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION9000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION10000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION10000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION10000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION10000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION11000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION11000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION11000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION11000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION12000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION12000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION12000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION12000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION13000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION13000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION13000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION13000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION14000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION14000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION14000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION14000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION15000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION15000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION15000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION15000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION16000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION16000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION16000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION16000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION17000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION17000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION17000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION17000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION18000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION18000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION18000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION18000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION19000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION19000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION19000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION19000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION20000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION20000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION20000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION20000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION21000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION21000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION21000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION21000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION22000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION22000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION22000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION22000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION23000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION23000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION23000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION23000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION24000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION24000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION24000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION24000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION25000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION25000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION25000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION25000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION26000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION26000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION26000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION26000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION27000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION27000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION27000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION27000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION28000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION28000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION28000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION28000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION29000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION29000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION29000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION29000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION30000000] GO ALTER DATABASE AtlantisDB ADD FILE (name = MesajHareketDB_PARTF_PARTITION30000000,FILENAME = 'G:\Data\PARTITIONDATA\MesajHareketDB\MesajHareketDB_PARTF_PARTITION30000000.ndf', size = 20 MB, filegrowth = 10 MB) TO FILEGROUP [MesajHareketDB_PARTG_PARTITION30000000] GO USE AtlantisDB GO ALTER DATABASE AtlantisDB ADD FILEGROUP [MesajHareketDB_PARTG_PARTITION31000000] GO PRINT 'PARTITION DOSYALARI EKLENDI' -- Function ve Schemayi tanimla BEGIN TRANSACTION CREATE PARTITION FUNCTION [pfnc_MesajHareketDB_PART](int) AS RANGE RIGHT FOR VALUES (N'1000000', N'2000000', N'3000000', N'4000000', N'5000000', N'6000000', N'7000000', N'8000000', N'9000000', N'10000000', N'11000000', N'12000000', N'13000000', N'14000000', N'15000000', N'16000000', N'17000000', N'18000000', N'19000000', N'20000000', N'21000000', N'22000000', N'23000000', N'24000000', N'25000000', N'26000000', N'27000000', N'28000000', N'29000000', N'30000000', N'31000000')
CREATE PARTITION SCHEME [pscheme_MesajHareketDB_PART] AS PARTITION [pfnc_MesajHareketDB_PART] TO ([MesajHareketDB_PARTG_PARTITION0], [MesajHareketDB_PARTG_PARTITION1000000], [MesajHareketDB_PARTG_PARTITION2000000], [MesajHareketDB_PARTG_PARTITION3000000], [MesajHareketDB_PARTG_PARTITION4000000], [MesajHareketDB_PARTG_PARTITION5000000], [MesajHareketDB_PARTG_PARTITION6000000], [MesajHareketDB_PARTG_PARTITION7000000], [MesajHareketDB_PARTG_PARTITION8000000], [MesajHareketDB_PARTG_PARTITION9000000], [MesajHareketDB_PARTG_PARTITION10000000], [MesajHareketDB_PARTG_PARTITION11000000], [MesajHareketDB_PARTG_PARTITION12000000], [MesajHareketDB_PARTG_PARTITION13000000], [MesajHareketDB_PARTG_PARTITION14000000], [MesajHareketDB_PARTG_PARTITION15000000], [MesajHareketDB_PARTG_PARTITION16000000], [MesajHareketDB_PARTG_PARTITION17000000], [MesajHareketDB_PARTG_PARTITION18000000], [MesajHareketDB_PARTG_PARTITION19000000], [MesajHareketDB_PARTG_PARTITION20000000], [MesajHareketDB_PARTG_PARTITION21000000], [MesajHareketDB_PARTG_PARTITION22000000], [MesajHareketDB_PARTG_PARTITION23000000], [MesajHareketDB_PARTG_PARTITION24000000], [MesajHareketDB_PARTG_PARTITION25000000], [MesajHareketDB_PARTG_PARTITION26000000], [MesajHareketDB_PARTG_PARTITION27000000], [MesajHareketDB_PARTG_PARTITION28000000], [MesajHareketDB_PARTG_PARTITION29000000], [MesajHareketDB_PARTG_PARTITION30000000], [MesajHareketDB_PARTG_PARTITION31000000]) COMMIT TRANSACTION GO PRINT 'PARTITION SCHEMA ve FONKSIYONU OLUSTURULDU' GO -- Tabloyu Olustur IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'MesajHareketDB_PART') DROP TABLE MesajHareketDB_PART GO CREATE TABLE [dbo].[MesajHareketDB_PART]( [MesajHareketID] [bigint] IDENTITY(1,1) NOT NULL, [MesajID] [int] NULL, [ALoginID] [int] NULL, [RefNumber] [int] NULL, [Clientjobrefno] [varchar](10) NULL, [GonderimTarihi] [varchar](12) NULL, [OkunmaTarihi] [varchar](12) NULL, [CLoginId] [int] NULL, [Postinguser] [int] NULL, [Silindi] [bit] NULL, [FirmaSilindi] [bit] NULL, [Cevaplasin] [bit] NULL, [OtomatikCevap] [tinyint] NULL, [parametreler] [varchar](100) NULL, [CreationDate] [datetime] NULL, [LastModifyDate] [datetime] NULL ) ON [MesajHareketDB_FG] GO
ALTER TABLE [dbo].[MesajHareketDB_PART] ADD CONSTRAINT [DF_MesajHareketDB_PART_ClientjobrefnoN] DEFAULT ('') FOR [Clientjobrefno] GO
ALTER TABLE [dbo].[MesajHareketDB_PART] ADD CONSTRAINT [DF_MesajHareketDB_PART_SilindiN] DEFAULT ((0)) FOR [Silindi] GO
ALTER TABLE [dbo].[MesajHareketDB_PART] ADD CONSTRAINT [DF_MesajHareketDB_PART_new_CreationDateN] DEFAULT (getdate()) FOR [CreationDate] GO
ALTER TABLE [dbo].[MesajHareketDB_PART] ADD CONSTRAINT [DF_MesajHareketDB_PART_LastModifyDateN] DEFAULT (getdate()) FOR [LastModifyDate] GO USE [AtlantisDB] GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO PRINT 'MesajHareketDB_PART tablosu olusuturldu' -- Tabloyu Compress et USE [AtlantisDB] ALTER TABLE [dbo].[MesajHareketDB_PART] REBUILD PARTITION = ALL WITH(DATA_COMPRESSION = PAGE )
-- Data taşı SET IDENTITY_INSERT MesajHareketDB_PART ON INSERT INTO MesajHareketDB_PART ([MesajHareketID], [MesajID], [ALoginID], [RefNumber], [Clientjobrefno], [GonderimTarihi], [OkunmaTarihi], [CLoginId], [Postinguser], [Silindi], [FirmaSilindi], [Cevaplasin], [OtomatikCevap], [parametreler], [CreationDate], [LastModifyDate]) SELECT [MesajHareketID], [MesajID], [ALoginID], [RefNumber], [Clientjobrefno], [GonderimTarihi], [OkunmaTarihi], [CLoginId], [Postinguser], [Silindi], [FirmaSilindi], [Cevaplasin], [OtomatikCevap], [parametreler], [CreationDate], [LastModifyDate] FROM MesajHareketDB WITH(NOLOCK) OPTION(MAXDOP 12) SET IDENTITY_INSERT MesajHareketDB_PART OFF GO USE [AtlantisDB] GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO PRINT 'DATA ATILDI' GO -- Index olustur CREATE CLUSTERED INDEX [IX_MesajHareketDB_PART_ALoginID] ON [dbo].[MesajHareketDB_PART](ALoginID ASC) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON,ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF,MAXDOP=12, FILLFACTOR =90) ON [pscheme_MesajHareketDB_PART](ALoginID);
USE [AtlantisDB] GO GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO PRINT 'CLUSTERED PARTITON INDEX OLUSTURULDU' GO /****** Object: Index [PK_MesajHareketDBN] Script Date: 1/3/2020 1:34:49 PM ******/ ALTER TABLE [dbo].[MesajHareketDB_PART] ADD CONSTRAINT [PK_MesajHareket_PARTDBN] PRIMARY KEY NONCLUSTERED ( [MesajHareketID] ASC )WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, MAXDOP=12,FILLFACTOR = 90) ON [INDEX_CT] GO GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO CREATE NONCLUSTERED INDEX [IX_MesajHareketDB_PART_ALoginID_NonClustered] ON [dbo].[MesajHareketDB_PART](ALoginID ASC, MesajHareketID ASC, Postinguser ASC, MesajID ASC, Clientjobrefno ASC, GonderimTarihi ASC, Silindi ASC) INCLUDE (RefNumber, OkunmaTarihi) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, MAXDOP=12,FILLFACTOR =90) ON [INDEX_CT]; GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO CREATE NONCLUSTERED INDEX [IX_MesajHareketDB_PART_CreationDate] ON [dbo].[MesajHareketDB_PART](CreationDate ASC) INCLUDE (MesajHareketID, OkunmaTarihi, LastModifyDate) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, MAXDOP=12,FILLFACTOR =90) ON [INDEX_CT]; GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO CREATE NONCLUSTERED INDEX [IX_MesajHareketDB_PART_GonderimTarihi] ON [dbo].[MesajHareketDB_PART](GonderimTarihi ASC) INCLUDE (MesajHareketID, LastModifyDate) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, MAXDOP=12,FILLFACTOR =90) ON [INDEX_CT]; GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO CREATE NONCLUSTERED INDEX [IX_MesajHareketDB_PART_LastModifyDate] ON [dbo].[MesajHareketDB_PART](LastModifyDate ASC) INCLUDE (MesajHareketID, OkunmaTarihi, CreationDate) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, MAXDOP=12,FILLFACTOR =90) ON [INDEX_CT]; GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO CREATE NONCLUSTERED INDEX [IX_MesajHareketDB_PART_MesajHareketID_CT] ON [dbo].[MesajHareketDB_PART](MesajHareketID ASC, GonderimTarihi ASC) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, MAXDOP=12,FILLFACTOR =90) ON [INDEX_CT]; GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO CREATE NONCLUSTERED INDEX [IX_MesajHareketDB_PART_PostingUser] ON [dbo].[MesajHareketDB_PART](Postinguser ASC) INCLUDE (MesajHareketID) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, MAXDOP=12,FILLFACTOR =90) ON [INDEX_CT]; GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO CREATE NONCLUSTERED INDEX [IX_MesajHareketDB_PART_RefNum_AOD] ON [dbo].[MesajHareketDB_PART](RefNumber ASC) INCLUDE (CLoginId, CreationDate) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, MAXDOP=12,FILLFACTOR =90) ON [INDEX_CT]; GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO CREATE NONCLUSTERED INDEX [IX_MesajHareketDB_PART_Silindi_AOD] ON [dbo].[MesajHareketDB_PART](Silindi ASC, OkunmaTarihi ASC) INCLUDE (GonderimTarihi) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, MAXDOP=12,FILLFACTOR =90) ON [INDEX_CT]; GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO CREATE NONCLUSTERED INDEX [KIX_MesajHareketDB_PART_Clientjobrefno_Postinguser_IN_AOD] ON [dbo].[MesajHareketDB_PART](Clientjobrefno ASC, Postinguser ASC) INCLUDE (ALoginID) WITH (DATA_COMPRESSION = PAGE,PAD_INDEX = OFF, ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, MAXDOP=12,FILLFACTOR =90) ON [INDEX_CT]; GO DBCC SHRINKFILE (N'AtlantisDB_V2_log' , 0, TRUNCATEONLY) GO PRINT 'DIGER INDEXLER OLUSTURULDU' GO USE [AtlantisDB] GO EXEC sp_rename 'dbo.MesajHareketDB', 'MesajHareketDB_HEDE'; GO -- sonra bizim hazirladigimiz tabloyu, orjinal tablo adina donusturuyoruz USE [AtlantisDB] GO EXEC sp_rename 'dbo.MesajHareketDB_PART', 'MesajHareketDB'; GO -- bosa cikaralin eski orjinal tablo ya silinir ya da bir sure tutulmak uzere tekrar adi degisitirilir. USE [AtlantisDB] GO EXEC sp_rename 'dbo.MesajHareketDB_HEDE', 'MesajHareketDB_20200106sil'; GO PRINT 'TABLO YENIDEN ADLANDIRILDI'