3.SQLOS

Поділитися
Вставка
  • Опубліковано 26 вер 2024
  • Let us quickly learn what is SQLOS and how it works in SQL Server.
    📚 ►Previous recommended sessions:
    1. • 1. Multitasking, multi...
    2. • 2. Why SQLOS created? ...
    📚 ►Full course on Troubleshooting CPU Spike in SQL Server: • Crash course on CPU ut...
    🧑‍💼►Follow me on LinkedIn - / bobirmirzo-arslanov-54...
    Watch all my playlists here:
    🚀►Full course on Troubleshooting sessions: • Troubleshooting
    🚀►Full course on Encrypting connections to SQL Server- • Full course on Encrypt...
    🚀 ►SQL Server replication session: • SQL Server replication
    🚀 ►SQL Server Always On Availability Group: • SQL Server Always On A...
    🚀 ► SQL Server internals: • SQL Internals
    🚀 ► Course in On-memory OLTP: • Course on In-Memory OLTP
    Queries used:
    ===============
    SELECT
    scheduler_id,
    cpu_id,
    status,
    is_online,
    current_tasks_count,
    runnable_tasks_count,
    current_workers_count,
    pending_disk_io_count
    FROM sys.dm_os_schedulers
    SELECT
    r.session_id,
    t.task_address,
    task_state,
    start_time,
    --status as request_status,
    database_id,
    blocking_session_id,
    wait_type,
    wait_time,
    wait_resource,
    cpu_time,
    total_elapsed_time,
    r.scheduler_id,
    reads as number_of_reads,
    writes as number_of_writes,
    logical_reads as number_of_logical_reads,
    SUBSTRING (REPLACE (REPLACE (SUBSTRING (ST.text, (r.statement_start_offset/2) + 1,
    ((CASE statement_end_offset
    WHEN -1
    THEN DATALENGTH(ST.text)
    ELSE r.statement_end_offset
    END - r.statement_start_offset)/2) + 1) , CHAR(10), ' '), CHAR(13), ' '),
    1, 512) AS statement_text
    FROM sys.dm_exec_requests r
    LEFT JOIN sys.dm_os_tasks t ON t.session_id = r.session_id AND t.task_address = t.task_address
    CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) AS ST
    ===============

КОМЕНТАРІ • 2