Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 sql server issue

Author  Topic 

kumarich1
Yak Posting Veteran

99 Posts

Posted - 2009-02-20 : 14:30:57
Hi,

This week every other day we had server issue. Around 8 am we are having problems with sql server.I can connect to sql server but When I try to open activity monitor or Job activity monitor it won't open. I get error saying "do not have permission to open activity monitor , time out." I do have permission, since I am sysadmin on the server.I checked event viewer found nothing unusual,checked sql logs found nothing, we have a lot of free space on drives, tempdb is also good it is not full, CPU was around 1%, No blocks on the server. Microstrategy reports run on this server.At this time reports won't run.I guess it is some how related to some bad queries. When I restarted the services , services did not restart and I got error " could not start the sql server (MSSQLSERVER) service on the local computer. Error 1053 the service did not respond to the start or control request in a timely fashion." . Since I don't have much time to do my research, I had toreboot whole server, then everything comes to normal, Microstrategy will start working normally, all reports will start running.

Did I miss anything in trouble shooting this.Please advise, what else I should check when I have same issue.

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-20 : 14:33:28
quote:

No blocks on the server.


How did you determine this? This very much sounds like a blocking or a ton of locks issue.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

kumarich1
Yak Posting Veteran

99 Posts

Posted - 2009-02-20 : 14:59:49
quote:
Originally posted by tkizer

quote:

No blocks on the server.


How did you determine this? This very much sounds like a blocking or a ton of locks issue.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



My mistake I should not have said that there were no blocks.
I ran sp_wh02,to check sessions , since I cannot open activity monitor.I agree with you that there are a bunch of bad scripts which are creating blocks, but how can I track these scripts.I tried to kill some sessions but still those sessions did not go away. So I had to reboot the server. In future how should I tackle this problem,and how can I find problematic scripts.

Thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-20 : 15:33:04
Killing the spids causes them to go into a rollback. You will not see them go away until that rollback is complete. Restarting the server while spids are rolling back causes the database to go into crash recovery. This is often faster than waiting for the rollback to happen without the restart though.

You can use a script like this to give you details about the blocking:

SELECT
GETDATE() AS block_date,
es.session_id AS request_session_id,
SUBSTRING(qt.text,qr.statement_start_offset/2 + 1,
(CASE WHEN qr.statement_end_offset = -1
THEN len(convert(nvarchar(max), qt.text)) * 2
ELSE qr.statement_end_offset END -qr.statement_start_offset)/2
) AS request_query_text,
( SELECT query_plan
FROM sys.dm_exec_requests er
CROSS APPLY sys.dm_exec_query_plan(er.plan_handle)
WHERE er.session_id = es.session_id
) AS request_query_plan,
qr.blocking_session_id,
( SELECT text
FROM sys.dm_exec_connections AS p
CROSS APPLY sys.dm_exec_sql_text(p.most_recent_sql_handle)
WHERE p.session_id = qr.blocking_session_id
) AS blocking_query_text,
( SELECT query_plan
FROM sys.dm_exec_requests er
CROSS APPLY sys.dm_exec_query_plan(er.plan_handle)
WHERE er.session_id = qr.blocking_session_id
) AS blocking_query_plan,
DB_NAME(qr.database_id) AS database_name,
es.last_request_start_time,
es.last_request_end_time,
qr.wait_type,
qr.wait_time,
qr.wait_resource,
qr.open_transaction_count,
qr.transaction_id,
qtran.transaction_begin_time,
CASE qtran.transaction_type
WHEN 1 THEN 'Read/Write'
WHEN 2 THEN 'Read-only'
WHEN 3 THEN 'System'
WHEN 4 THEN 'Distributed'
END AS transaction_type,
qr.cpu_time,
qr.total_elapsed_time,
qr.reads,
qr.writes,
qr.logical_reads
FROM sys.dm_exec_sessions es
LEFT OUTER JOIN sys.dm_exec_requests qr ON es.session_id = qr.session_id
CROSS APPLY sys.dm_exec_sql_text(qr.sql_handle) AS qt
LEFT OUTER JOIN sys.dm_tran_active_transactions qtran ON qr.transaction_id = qtran.transaction_id
WHERE es.is_user_process = 1


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-20 : 17:29:20
Or even standard reports for Blocking/CPU/IO/Memory.
Go to Top of Page
   

- Advertisement -