由于僵尸状态对象导致SQL Server临时表失败

时间:2016-05-03 13:49:55

标签: sql-server sas

我正在尝试(隐式)使用以下代码在SQL Server 2014(12.0.4100.1)中创建临时表:

proc sql;
create table UNDEAD."##_28DaysLater"n as 
  select * from UNDEAD.inv_overrides;

UNDEAD是一个OLEDB libref,代码在SAS 9.3_M2(Windows)上运行。我得到的错误如下:

  

错误:游标扩展获取错误:IRowset :: GetNextRows失败。 :The   对象处于僵尸状态。对象可能会进入僵尸          在调用ITransaction :: Commit或ITransaction :: Abort时,或者在创建存储对象时尚未创建状态          释放。

完整的日志(带有sastrace)如下所示,在新的企业指南(5.1)中执行。

这里实际发生了什么?在SAS或SQL服务器端,是否可以通过配置来防止此错误?

15         LIBNAME UNDEAD OLEDB
16           PROPERTIES=('Integrated Security'=SSPI 'Persist Security Info'=True 'initial catalog'=BDS)
17           DATASOURCE='Kernkraft400' PROVIDER=SQLNCLI11.1 SCHEMA=dbo connection=shared;
NOTE: Libref UNDEAD was successfully assigned as follows: 
      Engine:        OLEDB 
      Physical Name: SQLNCLI11.1
18         OPTIONS SASTRACE=',,,d' SASTRACELOC=SASLOG NOSTSUFFIX;


19         proc sql;
20         create table UNDEAD."##_28DaysLater"n as
21           select * from UNDEAD.inv_overrides;

OLEDB_13: Prepared: on connection 3
SELECT * FROM "dbo"."inv_overrides"

OLEDB: AUTOCOMMIT turned ON for connection id 4
OLEDB:  *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-* on connection 4
OLEDB: AUTOCOMMIT turned OFF for connection id 4
OLEDB: AUTOCOMMIT turned ON for connection id 4
OLEDB:  *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-* on connection 4
NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.

OLEDB_14: Executed: on connection 3
SELECT * FROM "dbo"."inv_overrides"

OLEDB: AUTOCOMMIT turned ON for connection id 3
OLEDB:  *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-* on connection 3

OLEDB_15: Executed: on connection 3
CREATE TABLE "dbo"."##_28DaysLater" ("TECH_FROM_DTTM" datetime2(3),"MSF_BK" varchar(400),"COLUMN_NM" varchar(32),"OVERRIDE_VALUE" 
varchar(1000),"APPLY_IND" varchar(3),"TECH_TO_DTTM" datetime2(3))

OLEDB: AUTOCOMMIT turned OFF for connection id 3
OLEDB:  *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-* on connection 3

OLEDB_16: Prepared: on connection 3
INSERT INTO "dbo"."##_28DaysLater" ("TECH_FROM_DTTM","MSF_BK","COLUMN_NM","OVERRIDE_VALUE","APPLY_IND","TECH_TO_DTTM")  VALUES ( ? 
, ? , ? , ? , ? , ? )


OLEDB_17: Executed: on connection 3
INSERT INTO "dbo"."##_28DaysLater" ("TECH_FROM_DTTM","MSF_BK","COLUMN_NM","OVERRIDE_VALUE","APPLY_IND","TECH_TO_DTTM")  VALUES ( ? 
, ? , ? , ? , ? , ? )

ERROR: Cursor extended fetch error: IRowset::GetNextRows failed. : The object is in a zombie state. An object may enter a zombie 
       state when either ITransaction::Commit or ITransaction::Abort is called, or when a storage object was created and not yet 
       released.
OLEDB:  Performing ROLLBACK on connection 3
OLEDB:  *-*-*-*-*-*-* ROLLBACK *-*-*-*-*-*-*
OLEDB:  *-*-*-*-*-*-* ROLLBACK *-*-*-*-*-*-* on connection 3
NOTE:  SUCCESSFUL INSERT of 1 ROWS
WARNING: File deletion failed for UNDEAD.'##_28DaysLater'n.DATA.

1 个答案:

答案 0 :(得分:0)

在SQL Server端存在严重问题,我通过SASWORK重新生成了表,日志不再呻吟:

data; 
  set UNDEAD.inv_overrides;
run;
proc sql;
create table UNDEAD."##_28DaysLater"n as 
  select * from &syslast;
  

注意:表格UNDEAD。' ## _ 28DaysLater' n创建,有4行和6   列。