简体   繁体   English

无法删除或截断 sql 服务器表

[英]Unable to drop or truncate sql server table

We are using azure data flows and we are trying to load the data in one particular table in sql server.我们正在使用 azure 数据流,我们正在尝试将数据加载到 sql 服务器的一个特定表中。 however our data flow keeps running for hours for smaller set of data.但是,对于较小的数据集,我们的数据流会持续运行数小时。 when we tried to truncate or drop the table, our request times out.当我们尝试截断或删除表时,我们的请求超时。

how can we force drop and recreate the table.我们如何强制删除并重新创建表。

What I checked We don't have any foreign constraints that may avoid the drop我检查的我们没有任何可以避免下降的外国约束

Getting this error when i tried to truncate当我尝试截断时出现此错误

Failed to execute query.无法执行查询。 Error: A severe error occurred on the current command.错误:当前命令发生严重错误。 The results, if any, should be discarded.结果,如果有的话,应该丢弃。

I also ran this query and found this我也运行了这个查询,发现了这个

Query -询问 -

 SELECT  session_id
     ,blocking_session_id
     ,wait_time
     ,wait_type
     ,last_wait_type
     ,wait_resource
     ,transaction_isolation_level
     ,lock_timeout
    FROM sys.dm_exec_requests
    WHERE blocking_session_id <> 0

在此处输入图像描述

Is this causing the issue这是否导致问题

How can I fix this issue我该如何解决这个问题

i found this after running我在跑步后发现了这个

exec sp_who 88执行 sp_who 88

在此处输入图像描述

What can i do on it我能在上面做什么

find out more about blocking session 88, run exec sp_who 88 , seems like this is the session that is blocking, find out more about blocking stuff, if you are allowed to add a proc to the database, go get and install sp_whoisactive which gives you more information find out more about blocking session 88, run exec sp_who 88 , seems like this is the session that is blocking, find out more about blocking stuff, if you are allowed to add a proc to the database, go get and install sp_whoisactive which gives you更多信息

then you can run: dbcc inputnuffer(88) to find out which main proc or process is executing that select query.然后您可以运行: dbcc inputnuffer(88)以找出哪个主 proc 或进程正在执行该 select 查询。 if this is safe to kill that process, you can kill that session by如果可以安全地终止该进程,则可以通过以下方式终止 session

kill 88杀死 88

before killing that session make sure that session id is still running the same process在杀死 session 之前确保 session id 仍在运行相同的进程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM