Skip to Content

 Microsoft SQL Server

Useful Microsoft SQL Scripts

Below is a collection of Microsoft SQL Server Scripts   Find Orphaned User Accounts: select    dp.name [user_name]    ,dp.type_desc [user_type]    ,isnull(sp.name,'Orhphaned!') [login_name]  ... Read More

How many CPU’s does SQL see

HOW MANY CPU's ARE ONLINE FOR SQL: select scheduler_id, cpu_id, status, is_onlinefrom sys .dm_os_schedulerswhere status = 'VISIBLE ONLINE'   HOW MANY CPU's DOES SQL SEE: select cpu_count from sys. dm_os_sys_info Read More

Database Memory Utilization (DB_Memory_utilization.sql)

Used to determine the amount of memory be used by all DataBases   SELECT DB_NAME(database_id) AS [Database Name], COUNT(*) * 8/1024.0 AS [Cached Size (MB)] FROM sys.dm_os_buffer_descriptors --WHERE database_id > 4 -- system databases -... Read More

Top 5 Waiting Tasks by Percent

Use below script to determine the Top 5 waiting tasks and sorted by percent of use in the top 5     WITH [Waits] AS         Â... Read More