Sql 超时时间已过。。在我的问题中
我有一个链接许多表的查询。因此,当执行存储过程时,它会Sql 超时时间已过。。在我的问题中,sql,sql-server,sql-server-2008,Sql,Sql Server,Sql Server 2008,我有一个链接许多表的查询。因此,当执行存储过程时,它会 Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 我能为此做些什么。。我可以增加SQL server的超时时间吗。我正在使用SQL2008。您能帮我解决这个问题吗?..超时从不在sql server中,而是始终在调用它们的客户端中。因此,如果无法优化查询(可能是
Timeout expired.
The timeout period elapsed prior to completion of the operation or the server is not responding.
我能为此做些什么。。我可以增加SQL server的超时时间吗。我正在使用SQL2008。您能帮我解决这个问题吗?..超时从不在sql server中,而是始终在调用它们的客户端中。因此,如果无法优化查询(可能是这种情况),请更改用于发出查询的应用程序中的超时。超时从不在sql server中,而是始终在调用它们的客户端中。因此,如果无法优化查询(可能是这种情况),请更改用于发出查询的应用程序中的超时。使用SQL Server Management Studio 配置远程查询超时选项的步骤
使用SQL Server Management Studio 配置远程查询超时选项的步骤
当一个事务持有数据资源上的锁,而另一个事务请求同一资源上的不兼容锁时,请求被阻止,请求者进入等待状态。默认情况下,被阻止的请求将一直等待,直到阻止程序释放干扰锁。 要获取锁信息,包括当前授予会话的锁和会话正在等待的锁,请查询动态管理视图(DMV)sys.dm_tran_locks,如下所示:
SELECT -- use * to explore other available attributes
request_session_id AS spid,
resource_type AS restype,
resource_database_id AS dbid,
DB_NAME(resource_database_id) AS dbname,
resource_description AS res,
resource_associated_entity_id AS resid,
request_mode AS mode,
request_status AS status
FROM sys.dm_tran_locks;
在查询的输出中,您将获得等待共享/独占锁的spid
。您可以通过观察具有相同res
和resid
值的行来获取相关的spid
。
为了进一步获得更多信息,您可以执行以下代码,以获取有关阻塞链中涉及的进程的连接、会话和阻塞信息
-- Connection info:
SELECT -- use * to explore
session_id AS spid,
connect_time,
last_read,
last_write,
most_recent_sql_handle
FROM sys.dm_exec_connections
WHERE session_id IN(--spid found in above query);
-- Session info
SELECT -- use * to explore
session_id AS spid,
login_time,
host_name,
program_name,
login_name,
nt_user_name,
last_request_start_time,
last_request_end_time
FROM sys.dm_exec_sessions
WHERE session_id IN(--spid found in above query);
-- Blocking
SELECT -- use * to explore
session_id AS spid,
blocking_session_id,
command,
sql_handle,
database_id,
wait_type,
wait_time,
wait_resource
FROM sys.dm_exec_requests
WHERE blocking_session_id > 0;
--SQL text of the connections involved in the blocking chain:
SELECT session_id, text
FROM sys.dm_exec_connections
CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) AS ST
WHERE session_id IN(--spid found in above query);
一旦涉及到spid,您可以使用
KILL
命令杀死spid,或者使用以下命令在存储过程中设置锁定超时:set lock\u timeout代码>当一个事务持有数据资源上的锁,而另一个事务请求同一资源上的不兼容锁时,请求被阻止,请求者进入等待状态。默认情况下,被阻止的请求将一直等待,直到阻止程序释放干扰锁。
要获取锁信息,包括当前授予会话的锁和会话正在等待的锁,请查询动态管理视图(DMV)sys.dm_tran_locks,如下所示:
SELECT -- use * to explore other available attributes
request_session_id AS spid,
resource_type AS restype,
resource_database_id AS dbid,
DB_NAME(resource_database_id) AS dbname,
resource_description AS res,
resource_associated_entity_id AS resid,
request_mode AS mode,
request_status AS status
FROM sys.dm_tran_locks;
在查询的输出中,您将获得等待共享/独占锁的spid
。您可以通过观察具有相同res
和resid
值的行来获取相关的spid
。
为了进一步获得更多信息,您可以执行以下代码,以获取有关阻塞链中涉及的进程的连接、会话和阻塞信息
-- Connection info:
SELECT -- use * to explore
session_id AS spid,
connect_time,
last_read,
last_write,
most_recent_sql_handle
FROM sys.dm_exec_connections
WHERE session_id IN(--spid found in above query);
-- Session info
SELECT -- use * to explore
session_id AS spid,
login_time,
host_name,
program_name,
login_name,
nt_user_name,
last_request_start_time,
last_request_end_time
FROM sys.dm_exec_sessions
WHERE session_id IN(--spid found in above query);
-- Blocking
SELECT -- use * to explore
session_id AS spid,
blocking_session_id,
command,
sql_handle,
database_id,
wait_type,
wait_time,
wait_resource
FROM sys.dm_exec_requests
WHERE blocking_session_id > 0;
--SQL text of the connections involved in the blocking chain:
SELECT session_id, text
FROM sys.dm_exec_connections
CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) AS ST
WHERE session_id IN(--spid found in above query);
一旦涉及到spid,您可以使用KILL
命令杀死spid,或者使用以下命令在存储过程中设置锁定超时:set lock\u timeout代码>给我你的查询…给我你的查询。。。