filegroup server sql 修改_修改分区方案 - SQL Server | Microsoft Docs

将以下示例复制并粘贴到查询窗口中,然后单击“执行” 。Copy and paste the following example into the query window and click Execute.

USE AdventureWorks2012;

GO

-- add five new filegroups to the AdventureWorks2012 database

ALTER DATABASE AdventureWorks2012

ADD FILEGROUP test1fg;

GO

ALTER DATABASE AdventureWorks2012

ADD FILEGROUP test2fg;

GO

ALTER DATABASE AdventureWorks2012

ADD FILEGROUP test3fg;

GO

ALTER DATABASE AdventureWorks2012

ADD FILEGROUP test4fg;

GO

ALTER DATABASE AdventureWorks2012

ADD FILEGROUP test5fg;

GO

-- if the "myRangePF1" partition function and the "myRangePS1" partition scheme exist,

-- drop them from the AdventureWorks2012 database

IF EXISTS (SELECT * FROM sys.partition_functions

WHERE name = 'myRangePF1')

DROP PARTITION FUNCTION myRangePF1;

GO

IF EXISTS (SELECT * FROM sys.partition_schemes

WHERE name = 'myRangePS1')

DROP PARTITION SCHEME myRangePS1;

GO

-- create the new partition function "myRangePF1" with four partition groups

CREATE PARTITION FUNCTION myRangePF1 (int)

AS RANGE LEFT FOR VALUES ( 1, 100, 1000 );

GO

-- create the new partition scheme "myRangePS1"that will use

-- the "myRangePF1" partition function with five file groups.

-- The last filegroup, "test5fg," will be kept empty but marked

-- as the next used filegroup in the partition scheme.

CREATE PARTITION SCHEME myRangePS1

AS PARTITION myRangePF1

TO (test1fg, test2fg, test3fg, test4fg, test5fg);

GO

--Split "myRangePS1" between boundary_values 100 and 1000

--to create two partitions between boundary_values 100 and 500

--and between boundary_values 500 and 1000.

ALTER PARTITION FUNCTION myRangePF1 ()

SPLIT RANGE (500);

GO

-- Allow the "myRangePS1" partition scheme to use the filegroup "test5fg"

-- for the partition with boundary_values of 100 and 500

ALTER PARTITION SCHEME myRangePS1

NEXT USED test5fg;

GO

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值