top of page
Search
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...
255 views0 comments
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...
12 views0 comments
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...
12 views0 comments
Kunal Ranpura
Jul 29, 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)...
45 views0 comments
Kunal Ranpura
Jul 29, 20192 min read
SQL Server Wait Types Explained
-- Common Significant Wait types with BOL explanations -- *** Network Related Waits *** -- ASYNC_NETWORK_IO Occurs on network writes...
12 views0 comments
Kunal Ranpura
Jul 29, 20191 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...
20 views0 comments
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)...
22 views0 comments
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...
5 views0 comments
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...
2 views0 comments
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)...
63 views2 comments
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...
10 views0 comments
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...
7 views0 comments
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...
143 views0 comments
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],...
10 views0 comments
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,...
4 views0 comments
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,...
9 views0 comments
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];
4 views0 comments
Kunal Ranpura
Jul 29, 20192 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...
24 views0 comments
Kunal Ranpura
Jul 29, 20191 min read
SQL Server CPU MAXDOP Setting
Maxdop - 1, means no parallelism Maxdop - 0 (Default), Means SQL Server can aggressively use all the available processor to execute the...
12 views0 comments
Kunal Ranpura
Jul 29, 20191 min read
Change DB_Owner to SA
/* The Code */ --If you want to get a list of current owners who aren't sa SELECT suser_sname(owner_sid) as DBOwner, Name as DBName FROM...
4 views0 comments
bottom of page