当我将内存优化表与将表传递给内联表值函数的存储过程一起使用时,出现错误:
消息 596,级别 21,状态 1,第 0 行
无法继续执行,因为会话处于终止状态。
消息 0,级别 20,状态 0,第 0 行
当前命令发生严重错误。结果,如果有的话,应该被丢弃。
我正在使用 SQL Server 2016 开发人员版:
Microsoft SQL Server 2016 (SP1-CU3) (KB4019916) - 13.0.4435.0 (X64)
2017 年 4 月 27 日 17:36:12
版权所有 (c)
Windows 10 Pro 6.3(内部版本 14393:)上的 Microsoft Corporation Developer Edition(64 位) (管理程序)
我可以像这样重新创建错误:
CREATE TYPE [dbo].[Name] AS TABLE
( [Name] VARCHAR(500) NOT NULL PRIMARY KEY NONCLUSTERED )
WITH (MEMORY_OPTIMIZED = ON)
GO
CREATE TABLE Table1
( ID INT IDENTITY(1,1) PRIMARY KEY NOT NULL
, [Data] nvarchar(max) not null
)
INSERT INTO Table1 ([Data])
VALUES (N'blah1'), (N'blah2'), (N'blah3'), (N'blah4')
GO
CREATE OR ALTER FUNCTION dbo.Test
( @table dbo.[Name] READONLY
) RETURNS TABLE AS RETURN
SELECT *
FROM Table1 t
JOIN @table t2
ON t2.[Name] = t.[Data]
GO
CREATE OR ALTER PROCEDURE dbo.Test2
@table dbo.[Name] READONLY
AS
SELECT *
FROM dbo.Test(@table)
GO
DECLARE @memTable dbo.[Name]
INSERT INTO @memTable ([Name])
VALUES ('blah1'), ('blah3')
EXEC dbo.Test2 @memTable
有时会发生这种情况,有时不会。我有其他类似的程序,通常它们工作正常。
我把这个转储放在我的ERRORLOG
(为简洁起见缩短):
2017-07-17 13:14:36.14 spid56 *** 堆栈转储被发送到
C:\Program Files\Microsoft SQL
Server\MSSQL13.MSSQLSERVER\MSSQL\LOG\SQLDump0058.txt 2017-07-17
13:14:36.14 spid56 SqlDumpExceptionHandler:进程 56 生成
致命异常 c0000005 EXCEPTION_ACCESS_VIOLATION。SQL Server 正在
终止此进程。2017-07-17 13:14:36.14 spid56 * *************************************** ********************************************* 2017-07-17 13:14: 36.14 spid56 * 2017-07-17 13:14:36.14 spid56
* 开始堆栈转储:2017-07-17 13:14:36.14 spid56 * 07/17/17 13:14:36 spid 56 2017-07-17 13: 14:36.14 spid56 * 2017-07-17
13:14:36.14 spid56 * 2017-07-17 13:14:36.14 spid56 *
异常地址= 00007FF9DBE76564模块(sqllang+0000000000000C6564) 2017-07-17
13:14:36.14 spid56 *异常代码= c0000005 exception_access_access_violation_violation_violation_violation_violation 2017-07-07-07-17 13:14.14:36.14 spid00 000 00 000 00 000 00 000 00 006年000 00 006年000 00 006年000
00 006年000 006 13:14:36.14 spid56 * 输入缓冲区 292 字节 - 2017-07-17 13:14:36.14 spid56 * DECLARE @memTable dbo.[Name] INSERT INTO @memTable ([Nam 2017-07-17 13:14:36.14 spid56 * e]) 值 ('blah1'), ('blah3') EXEC dbo.Test2 @memTable 2017-07-17 13:14:36.14 spid56 * 2017-07-17 13:14:36.14 spid56
* 2017-07-17 13:14:36.14 spid56 * 2017-07-17 13:14:36.14 spid56 * MODULE BASE END SIZE 2017-07-17 13:14:36.14 spid56 * sqlservr
00007FF6C6F30000 00007FF6C6F97FFF 00068000 2017-07-17 13:14:36.14
spid56 * ntdll 00007FF9FE880000 00007FF9FEA50FFF 001d1000 2017-07-17 13:14:36.14 spid56 * KERNEL32 00007FF9FC7E0000 00007FF9FC88BFFF ...
00019000 2017-07-17 13:14:36.14 spid56 * xtp_v_8_907150277_184387255245303_1 00007FF9E7590000 00007FF9E75A8FFF
00019000 2017-07- 17 13:14:36.14 spid56 * dbghelp
0000000077350000 00000000774E5FFF 00196000 2017-07-17 13:14:36.14
spid56 * 2017-07-17 13:14:36.14 spid56 * P1Home:
FFFFFFFFFFFFFFFE: 2017-07-17 13:14:36.14 spid56 * P2Home:
0000000000000000: 2017-07-17 13:14:36.14Home spid:5080 *
P300A 00007FF9DD881A70 000001CF0CAA8A70 0000000000000000 000001CF31FE5C08 000001CF33A76040 000001CF125481A0
2017-07-17 13:14:36.14 spid56 * P4Home: 0000000000000040:
2017-07-17 13:14:36.14 spid56 * P5Home: 000001CF3FD16080: 00007FF9DB1D8C10 000001CF406CB248 000001CF3FD16CD8 0000000000000003
000001CF40080550 000001CF40080048 2017-07-17 13 :14:36.14 spid56
* P6Home: 00007FF9DB0585C9: EE850FC085ED3345 20356E05F7000382 0E850F0010000000 0268858B48000383 890274C085480000 249C8D4CC68B4818
2017-07-17 13:14:36.14 spid56 * ContextFlags: 000000000010005F:
2017-07-17 13:14:36.14 spid56 * MxCsr: 0000000000001FA8:
...
2017-07- 17 13:14:36.14 spid56 * Rcx: 0000000000000000:
2017-07-17 13:14:36.14 spid56 * Rdx: 0000000000000000:
2017-07-17 13:14:36.14 spid56 * Rbx: 0000007EF8A7AB80: 00007FF9DD881A70 000001CF0CAA8A70 0000000000000000 000001CF31FE5C08
000001CF33A76040 000001CF125481A0 2017-07-17 13:14:36.14 spid56
* Rsp: 0000007EF8A7A570: 000001CF1E6CC370 000001CF35D1D450 000001CF35D1D500 000001CF33A76040 00007FF9DB0BCB10 0000000000000000
2017-07-17 13:14:36.14 spid56 * Rbp: 000001CF35D1D450: 00007FF9DD80C7B0 000001CF00000001 000001CF35D1D500 0000000000000004
000001CF35D1D478 0000000000000000 2017-07-17 13:14:36.14 spid56
* Rsi: 000001CF35D1D500: 00007FF9DD82C638 0000000000000001 000001CF0A59A060 0000000000000006 0000000000000000 000001CF35D1D5C0
2017-07-17 13:14:36.14 spid56 * Rdi: 00007FF9DD86FF28: 00007FF9DC8968A0 00007FF9DC47C240 00007FF9DC47C250 00007FF9DC47C260
00007FF9DC62A170 00007FF9DD3D1D40 2017-07-17 13:14:36.14 spid56
* R8: 0000000000000001: 2017-07-17 13:14:36.14 spid56 * R9: 0000000000000038: 2017-07-17 13:14:36.14 spid56 *
R10: 000001CF33A76040: 00007FF9DB1D8718 000001CF00000001 0000000000002000 000001CF0000006E 000001CF0B9E0100 000001CF00000000
2017-07-17 13: 14:36.14 spid56 * R11: 0000007EF8A7A520: 0000000000000000 00007FF9DBE75499 000001CF33A50260 0000000000000000
000001CF33A50260 000001CF0CA8B480 2017-07-17 13:14:36.14 spid56
* R12: 000001CF20580E30: 00007FF9DD80C7B0 0000000000000001 000001CF20580EE0 0000000000000002 000001CF20580E58 000001CF0CA83910
2017-07-17 13:14:36.14 spid56 * R13 : 000001CF0CA8B480: 00007FF9DD827FA8 000001CF00000001 000001CF0A59A060 000001CF00000008
0000000000000000 000001CF0A59A060 2017-07-17 13:14:36.14 spid56
* R14: 0000000000000000: 2017-07-17 13:14:36.14 spid56 * R15: 000001CF35D1D5C0: 00007FF9DD86F068 000001CF0A59A060 000001CF00000000 0000000000000000 000001CF0CA82490 0000000000000000
2017-07-17 13:14:36.14 SPID56*RIP:00007FF9DBE76564:8B486850FF018B48 896052FFC88B4810 8B49000000D02484 718B48B480000010101088F 85F85F88840FF6840FFF68548BBENTYENDY
44C.74C.748BFE
****************************************************** *** 2017-07-17 13:14:36.14 spid56 * ---------------------------------- ------------------------------------------ 2017-07-17 13 :14:36.14 spid56 * 短堆栈转储 2017-07-17
13:14:36.14 SPID56 00007FF9DBE76564
...
2017-07-17 13:14:36.16 SPID56 00007FF9FE8E70D1
模块(NTDLL+00000000000000000670D1)2017-07-07-17 13:14: 14.16 spid56 spid 56 spid for 56 spid for 56 spid for 56 spid for 56 sigal for sign for 56 act sigal for sign
for for for for 17
13:14:36.87 spid56 外部转储进程返回代码 0x20000001。
外部转储过程未返回任何错误。2017-07-17 13:14:36.87
服务器错误:17310,严重性:20,状态:1。2017-07-17
13:14:36.87 服务器来自 SPID 56 会话的用户请求
生成了致命异常。SQL Server 正在终止此会话。 使用日志目录
中生成的转储联系产品支持服务。
这是一个错误:连接错误提交
一种解决方法是不将内存优化表传递到存储过程中。你可以在那之后使用它。
在 SQL Server 2017 CU1 中已修复:
修复:当存储过程将内存优化表传递给 SQL Server 2017 中的内联表值函数时出错