filmov
tv
SQL server Performance || SQL Server Execution Plan || Query Execution Plan || SQL Server Blocking
Показать описание
SQL server Performance || SQL Server Execution Plan || Query Execution Plan || SQL Server Blocking
QUERY:-
SELECT SPID,ER.percent_complete,
/* This piece of code has been taken from article. Nice code to get time criteria's
*/
CAST(((DATEDIFF(s,start_time,GetDate()))/3600) as varchar) + ' hour(s), '
+ CAST((DATEDIFF(s,start_time,GetDate())%3600)/60 as varchar) + 'min, '
+ CAST((DATEDIFF(s,start_time,GetDate())%60) as varchar) + ' sec' as running_time,
CAST((estimated_completion_time/3600000) as varchar) + ' hour(s), '
+ CAST((estimated_completion_time %3600000)/60000 as varchar) + 'min, '
+ CAST((estimated_completion_time %60000)/1000 as varchar) + ' sec' as est_time_to_go,
DATEADD(second,estimated_completion_time/1000, getdate()) as est_completion_time,
/* End of Article Code */
ER.command,ER.blocking_session_id, SP.DBID,LASTWAITTYPE,
DB_NAME(SP.DBID) AS DBNAME,
((CASE ER.statement_end_offset
ELSE ER.statement_end_offset
END - ER.statement_start_offset)/2) + 1) AS QueryText, DEQP.QUERY_PLAN,
TEXT,CPU,HOSTNAME,LOGIN_TIME,LOGINAME,
SP.status,PROGRAM_NAME,NT_DOMAIN, NT_USERNAME
FROM SYSPROCESSES SP
CROSS APPLY SYS.DM_EXEC_QUERY_PLAN(er.PLAN_HANDLE) DEQP
ORDER BY running_time DESC
----------------------END------------------
SQL, SQL DATABASE, SQL BACKUP, RESTORE, RECOVERY, USERS, LOGINS, AGENT, SQL JOBS, SQL ARCHITECTURE, SQL INSTANCE, SQL UPGRADE, SQL PATCHING, SQL PERFORMANCE, SQL MANITINEMANC, SQL SLOWNESS, SQL HARDWARE, SQL LIFE CYCLE, SQL DR, SQL MIRRORING, SQL REPLICATION SQL ALWAYS ON, SQL LOGSHIPING, SQL CLUSTERING, SQL INSTALLATION, SQL MIGRATION, SQL TO AZURE,CLOUDE,AZURE,AMAZON,GOOGLE, SQL TO AWS,AWS,SQL MIGRATION TO CLOUDE,AZURE FUNDAMENTAL, AZURE CERTIFICATION, AZURE ARCHITECTURE, SQL ON LINUX, SQL LINIX INSTALLATION, SQL PERFORMANCE QUERY, SQL BLOCKING,SQL DEADLOCK,SQL DATABASE CRASHED, SQL DATABASE DOWN,SQL SERVICES , SQL SERVICES STOP, SQL INSTALLATION FAILED, SQL UPGRADE FAILED,
#sqlserver #sqlserverdba #techandart
QUERY:-
SELECT SPID,ER.percent_complete,
/* This piece of code has been taken from article. Nice code to get time criteria's
*/
CAST(((DATEDIFF(s,start_time,GetDate()))/3600) as varchar) + ' hour(s), '
+ CAST((DATEDIFF(s,start_time,GetDate())%3600)/60 as varchar) + 'min, '
+ CAST((DATEDIFF(s,start_time,GetDate())%60) as varchar) + ' sec' as running_time,
CAST((estimated_completion_time/3600000) as varchar) + ' hour(s), '
+ CAST((estimated_completion_time %3600000)/60000 as varchar) + 'min, '
+ CAST((estimated_completion_time %60000)/1000 as varchar) + ' sec' as est_time_to_go,
DATEADD(second,estimated_completion_time/1000, getdate()) as est_completion_time,
/* End of Article Code */
ER.command,ER.blocking_session_id, SP.DBID,LASTWAITTYPE,
DB_NAME(SP.DBID) AS DBNAME,
((CASE ER.statement_end_offset
ELSE ER.statement_end_offset
END - ER.statement_start_offset)/2) + 1) AS QueryText, DEQP.QUERY_PLAN,
TEXT,CPU,HOSTNAME,LOGIN_TIME,LOGINAME,
SP.status,PROGRAM_NAME,NT_DOMAIN, NT_USERNAME
FROM SYSPROCESSES SP
CROSS APPLY SYS.DM_EXEC_QUERY_PLAN(er.PLAN_HANDLE) DEQP
ORDER BY running_time DESC
----------------------END------------------
SQL, SQL DATABASE, SQL BACKUP, RESTORE, RECOVERY, USERS, LOGINS, AGENT, SQL JOBS, SQL ARCHITECTURE, SQL INSTANCE, SQL UPGRADE, SQL PATCHING, SQL PERFORMANCE, SQL MANITINEMANC, SQL SLOWNESS, SQL HARDWARE, SQL LIFE CYCLE, SQL DR, SQL MIRRORING, SQL REPLICATION SQL ALWAYS ON, SQL LOGSHIPING, SQL CLUSTERING, SQL INSTALLATION, SQL MIGRATION, SQL TO AZURE,CLOUDE,AZURE,AMAZON,GOOGLE, SQL TO AWS,AWS,SQL MIGRATION TO CLOUDE,AZURE FUNDAMENTAL, AZURE CERTIFICATION, AZURE ARCHITECTURE, SQL ON LINUX, SQL LINIX INSTALLATION, SQL PERFORMANCE QUERY, SQL BLOCKING,SQL DEADLOCK,SQL DATABASE CRASHED, SQL DATABASE DOWN,SQL SERVICES , SQL SERVICES STOP, SQL INSTALLATION FAILED, SQL UPGRADE FAILED,
#sqlserver #sqlserverdba #techandart
Комментарии