我正在尝试对一个大表(160Gb)进行分区。它包含过去 70 天内IIS logs
生成的数据。分区方案和函数将表拆分为相关日期。
每个文件组中有一个文件,每个文件中有 1 天的数据。
表上当前没有聚集索引,在创建日志和从数据中提取的 ASP 会话 ID 前后有 2 个非聚集索引。
我遇到的问题是,当我尝试将此表分配为分区时,我的磁盘空间不足。
有没有办法批处理这个过程?
USE [Diagnostic_MB]
GO
BEGIN TRANSACTION
CREATE CLUSTERED INDEX [ClusteredIndex_on_Scheme70Day_634883295513235207] ON [dbo].[IISLog]
(
[SentUTCDateTime]
)WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [Scheme70Day]([SentUTCDateTime])
DROP INDEX [ClusteredIndex_on_Scheme70Day_634883295513235207] ON [dbo].[IISLog] WITH ( ONLINE = OFF )
CREATE NONCLUSTERED INDEX [ASPSession] ON [dbo].[IISLog]
(
[ASPSessionID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = ON, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [Scheme70Day]([SentUTCDateTime])
CREATE NONCLUSTERED INDEX [IX_Time] ON [dbo].[IISLog]
(
[SentUTCDateTime] ASC
)
INCLUDE ( [csHost],
[scStatus],
[timeTaken]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = ON, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [Scheme70Day]([SentUTCDateTime])
COMMIT TRANSACTION
这是最终占用我所有磁盘空间的代码。理想情况下,我希望能够将数据移出主文件组,而不是创建副本。这不是一个需要一直运行的数据库,所以offline solutions are also welcome...