标签:
为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
标签:
原文地址:http://www.cnblogs.com/ljhdo/p/5601535.html