码迷,mamicode.com
首页 > 其他好文 > 详细

不能创建Memory Optimized Table

时间:2016-06-20 20:24:54      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:

 为DBTest增加了一个Memory Table FileGroup,但是在创建Memory Optimized Table时,出现error

Cannot create memory optimized tables in a database that does not have an online and non-empty MEMORY_OPTIMIZED_DATA filegroup.

USE [master]
GO
ALTER DATABASE [DBTest] 
ADD FILEGROUP [MemoryTableGroup] 
CONTAINS MEMORY_OPTIMIZED_DATA; 
GO

USE [DBTest]
GO

--Drop table if it already exists.
IF OBJECT_ID(dbo.MemoryTable_test,U) IS NOT NULL
    DROP TABLE dbo.MemoryTable_test
GO

CREATE TABLE dbo.MemoryTable_test
(
    ID int not null , 
    name varchar(11) not null,
    age int not null,
    constraint PK__MemoryTable_Test 
        primary key nonclustered hash(ID) with (bucket_count=1024)
) 
WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA )
GO

 

查看MemoryTableGroup,其FileStream files的数量是0,需要为该FileGroup 添加File。

技术分享

 

为MemoryTableGroup 添加一个File,Memory Table创建成功。

ALTER DATABASE [DBTest] 
ADD FILE (name=DBTest_file1, filename=D:\MSSQLServerData\MSSQL12.MSSQLSERVER\MSSQL\DATA\DBTest_file1) 
TO FILEGROUP [MemoryTableGroup] 
GO

 

参考doc:

The Memory Optimized Filegroup

Cannot create memory optimized tables in a database on SQL Server 2014

 

不能创建Memory Optimized Table

标签:

原文地址:http://www.cnblogs.com/ljhdo/p/5601535.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!