top of page

Search
Check if your SQL Server is under Memory Pressure
-- SQL Server Process Address space info --(shows whether locked pages is enabled, among other things) SELECT physical_memory_in_use_kb/1...

Kunal Ranpura
Jul 30, 20191 min read
Â
Â
Â
Find SQL Server Memory total and Available including Page File Size
-- Good basic information about memory amounts and state SELECT total_physical_memory_kb/1024000 Total_Physical_MM_GB,...

Kunal Ranpura
Jul 30, 20191 min read
Â
Â
Â
SQL Server CPU Utilization History for last 256 Mins
-- Get CPU Utilization History for last 256 minutes (in one minute intervals) -- This version works with SQL Server 2008 and SQL Server...

Kunal Ranpura
Jul 30, 20191 min read
Â
Â
Â
Get Average Task Counts for SQL Server
-- Get Average Task Counts (run multiple times) SELECT AVG(current_tasks_count) AS [Avg Task Count], AVG(runnable_tasks_count) AS [Avg...

Kunal Ranpura
Jul 30, 20191 min read
Â
Â
Â
Find number of session for each SQL Server Login Connected
-- Get logins that are connected and how many sessions they have SELECT login_name, COUNT(session_id) AS [session_count] FROM...

Kunal Ranpura
Jul 30, 20191 min read
Â
Â
Â
Signal Waits in SQL Server
-- Signal Waits for instance SELECT CAST(100.0 * SUM(signal_wait_time_ms) / SUM (wait_time_ms) AS NUMERIC(20,2)) AS [%signal (cpu)...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
SQL Server Wait Types Explained
-- Common Significant Wait types with BOL explanations -- *** Network Related Waits *** -- ASYNC_NETWORK_IO Occurs on network writes...

Kunal Ranpura
Jul 29, 20192 min read
Â
Â
Â
SQL Server Get total buffer usage by database for current instance
-- Get total buffer usage by database for current instance SELECT DB_NAME(database_id) AS [Database Name], COUNT(*) * 8/1024.0 AS [Cached...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Get CPU utilization by database SQL Server
-- Get CPU utilization by database WITH DB_CPU_Stats AS (SELECT DatabaseID, DB_Name(DatabaseID) AS [DatabaseName], SUM(total_worker_time)...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Recovery model, log reuse wait, log file size, log usage Fsize and compatibility level for all DB
-- Recovery model, log reuse wait description, log file size, log usage size -- and compatibility level for all databases on instance...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Volume info for all databases on the current instance SQL Server
-- Volume info for all databases on the current instance (SQL Server 2008 R2 SP1 or greater) SELECT DB_NAME(f.database_id) AS...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Find SQL Server Database Data and Log File Size in GB
SELECT DB_NAME([database_id])AS [Database Name], [file_id], name, physical_name, type_desc, state_desc, CONVERT( bigint, size/128000.0)...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Find Configuration value for your SQL Instance
-- Get configuration values for instance SELECT name, value, value_in_use, [description] FROM sys.configurations ORDER BY name OPTION...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
How to Get SQL Server processor description from Windows Registry
-- Get processor description from Windows Registry EXEC xp_instance_regread 'HKEY_LOCAL_MACHINE', 'HARDWARE\DESCRIPTION\System\CentralPro...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Find Hardware Manufacturer for your SQL Server
-- Get System Manufacturer and model number from -- SQL Server Error log. This query might take a few seconds -- if you have not recycled...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Script to find SQL Server Hardware Details
SELECT cpu_count AS [Logical CPU Count], hyperthread_ratio AS [Hyperthread Ratio], cpu_count/hyperthread_ratio AS [Physical CPU Count],...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
SQL Script to find SQL Service Information
-- SQL Server Services information (SQL Server 2008 R2 SP1 or greater) SELECT servicename, startup_type_desc, status_desc,...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Find OS version from SQL Server
-- Windows information (SQL Server 2008 R2 SP1 or greater) SELECT windows_release, windows_service_pack_level, windows_sku,...

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Find SQL Server Version
-- SQL and OS Version information for current instance SELECT @@VERSION AS [SQL Server and OS Version Info];

Kunal Ranpura
Jul 29, 20191 min read
Â
Â
Â
Script to restore multiple database backups
The following script will generate output script with restore command to restore all log backup located at L:\Log_Backup\DB_Name\ exec...

Kunal Ranpura
Jul 29, 20192 min read
Â
Â
Â
bottom of page





