Tag: Script
-
Find Uptime / Last Boot Up Time Commands
There are numerous ways to find how long a machine has been powered on for, and below I will list a few of them: CMD Powershell
-
SQL Server Memory Usage – Buffer
What is the SQL Server Buffer Pool? I am purposely keeping this post short because I simply want to offer up my script to show the current amount buffered. My version is very similar to that found on the main sys.dm_os_buffer_descriptors page, but I prefer MiB rather than pages. This next script will break down the buffer…
-
SQL Server Max Row Size 8060 Part 2
In my previous post on row maximum length I showed that the largest row size that could be stored on page was 8053 byte. So to recap a table with 2 fixed length columns CHAR(8000) & CHAR(53) the internal storage would look as below, with an unused space of 34 bytes. Page Header 96 bytes…
-
Page Life Expectancy
Page Life Expectancy Page Life Expectancy is often quoted as being a key metric to watch out for memory pressure within SQL Server. If you search you will often see 300 listed as a low water mark to indicate that you may have a problem, indeed several vendor applications raise warnings at this threshold. The standard definition…
-
SQL Servers Virtual Columns and Row Cracking
In order to access row structures there are several functions within SQL Server that are beneficial. I have listed these below with the descriptions taken from the actual functions. sys.fn_GetRowsetIdFromrowdump — Cracks the output of %%rowdump%% virtual column and returns the rowset id sys.fn_rowdumpCracker — Cracks the output of %%rowdump%% virtual column sys.fn_physlocFormatter — Formats the…
-
SQL Server Max Row Size 8060
When asked the size of the largest row that could be placed on to a single SQL Server data page the answer that most give is 8060 bytes. If you try to create a fixed length table with columns that total this length however it throws an error. Please create a database to run this test and…
-
Capturing Deadlocks
So, deadlocks. “A deadlock occurs when two or more tasks permanently block each other by each task having a lock on a resource which the other tasks are trying to lock.” http://msdn.microsoft.com/en-us/library/ms178104.aspx How to capture deadlocks? How many ways can you capture a deadlock? Lots! Luckily I do not see a lot of deadlocks in…
-
SQL Server Profiler Trace
A Trace can easily be used to monitor what is happening within SQL Server, just start SQL Server Profiler via the Tools Menu in SSMS or via a shortcut. Once started it is a relatively easy process: 1. Connect to the SQL Server you wish to run the trace on. 2. Either use the default…