sql-server – 如何对现有的非分区表进行分区

我有一个包含数据的现有表:
dbo.Test (col1,col2,col3....) ON [PRIMARY]

我需要将此表更改为像这样分区:

dbo.Test(col1,col3....) ON Ps_Date(Col2)

如何在不丢弃和重新创建表的情况下实现这一目标?

解决方法

要对表进行分区,可以按照以下简要步骤操作:

>首先创建一个partition functionpartition scheme
>之后,您可以对表进行分区.
>如果您的表具有聚簇索引,则需要删除并在右侧分区上重新创建它,或者您可以使用DROP_EXISTING子句重新创建聚簇索引.
>如果您的表没有聚簇索引,那么您可以使用分区方案在右侧分区上创建一个.
>此外,Enterprise Edition可以灵活地使用CREATE INDEX语句的ONLINE = ON选项,以最大限度地减少应用程序的停机时间.请注意,使用ONLINE选项重建索引时,您将看到性能下降.

自动分区,您也可以在codeplex上使用SQL Server Partition Management utilitySQL Server Partitioned Table Framework.

一些好的资源:

> Create Partitioned Tables and Indexes
> SQL Server Table Partitioning: Resources
> Partitioning Tips
> SQL SERVER – 2005 – Database Table Partitioning Tutorial – How to Horizontal Partition Database Table

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...