http://www.microsoft.com/learning/en/us/certification/cert-sql-server.aspx
Tag Archives: http://sqldbpool.com/
Troubleshooting CPU bottleneck
sys.dm_os_schedulers is a useful DMV to find out the CPU pressure. It returns one row per scheduler in SQL Server where each scheduler is mapped to an individual processor.
We can use this DMV to monitor the condition of a scheduler or to identify runaway tasks. It will help us to identify if there is any CPU bottleneck in the SQL Server machine.
We have to check for “runnable_tasks_count” column value which indicates the count of workers that have tasks assigned to them that are just waiting for their share of time on the scheduler (logical CPU). The value of runnable_tasks_count should be as low as possible.
Permission
Requires VIEW SERVER STATE permission on the server
SELECT scheduler_id,
status,
cpu_id,
is_online,
current_tasks_count,
runnable_tasks_count,
current_workers_count,
active_workers_count,
work_queue_count,
pending_disk_io_count,
load_factor
FROM sys.dm_os_schedulers
GO
If you find the the avg(runnable_tasks_count) greater then 0 that means system is waiting for CPU time. If Pending_disk_io_count is greater then 0, that means system is bound by IO you need to get disks to perform better.
Clear/Remove SQL Server Services from Services.msc
Problem:-
One of my friend was installing cluster SQL Server, installation was stopped in the middle of something and he was not able to remove the SQL Server from add/remove programs or SQL Server setup. He has deleted the registry, folder manually but still he can see the SQL Server Services in Services.msc. He called me for the issue, I have provided him the below solution and it will work.
Solution:
1) Go to command prompt and use SC command to delete service
sc delete sqlserveragent
sc delete mssqlserver
2) You have to also delete the services registry entry using regedit
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services
How to take database out of emergency mode?
In SQL Server 2000
sp_configure ‘allow’ ,1
GO
Reconfigure with override
GO
Update sysdatabases set status = status&(~32768) where name = ‘SQLDBPool’
GO
sp_configure ‘allow’, 0
GO
Reconfigure with override
go
IN SQL Server 2005/2008
ALTER DATABASE sqldbpool
SET online
How to open database in Emergency Mode?
In SQL Server 2000
sp_configure ‘allow’ ,1
GO
Reconfigure with override
GO
Update sysdatabases set status = 32768 where name = ‘SQLDBPool’
GO
sp_configure ‘allow’, 0
GO
Reconfigure with override
go
IN SQL Server 2005/2008
ALTER DATABASE sqldbpool
SET emergency