Query to get top 30 high CPU quriesSELECT TOP 30 DB_NAME(st.dbid) AS 'Database Name', SERVERPROPERTY('ServerName') AS 'Server Name', s.session_id AS 'Sessi...
https://blogs.msdn.microsoft.com/docast/2017/07/30/sql-high-cpu-troubleshooting-checklist/Email::: Microsoft findingsBelow queries were used on siebeldb database high CPU issue to findout which ...
https://www.datavail.com/blog/how-to-stripe-your-backups-into-multiple-files/-- Stripe the full backup files for the selected databases with date and timestamp appended to the backup files-- *********...
To shrink all log files in server at one shot create table #dbfiles ( sysname , Name sysname , sysname , nvarchar(1024) , Allocated int , Used int , Available int ) exec sp_msfo...
USE masterGOIF OBJECT_ID ('sp_hexadecimal') IS NOT NULL DROP PROCEDURE sp_hexadecimalGOCREATE PROCEDURE sp_hexadecimal @binvalue varbinary(256), @hexvalue v...
USE masterGOIF OBJECT_ID ('sp_hexadecimal') IS NOT NULL DROP PROCEDURE sp_hexadecimalGOCREATE PROCEDURE sp_hexadecimal @binvalue varbinary(256), @hexv...
SELECT @@ServerName AS , @@SERVICENAME AS Instance,GETDATE() AS TimeOfQuery,loginname AS ,createdate AS , updatedate AS , accdate AS , CASE WHEN sysadmin = 1 THEN 'Login is a member o...
Percentage queryuse master;SELECT r.session_id,r.command,CONVERT(NUMERIC(6,2),r.percent_complete) AS ,CONVERT(VARCHAR(20),DATEADD(ms,r.estimated_completion_time,GetDate()),20) AS , CON...
To copy all users and their permissions for a databaseSELECT 'IF NOT EXISTS (SELECT 1 FROM sys.database_principals WHERE name = ' + QuoteName(dp.name, char(39)) + ') CREATE USER ' + Qu...
SELECT , s.database_id,COUNT(l.database_id) AS 'VLF Count',SUM(vlf_size_mb) AS 'VLF Size (MB)',SUM(CAST(vlf_active AS INT)) AS 'Active VLF',SUM(vlf_active*vlf_size_mb) AS 'Active VLF Size (MB)',...