SQL Server 2017 Compatibility Levels
With SQL Server 2017, there was a new compatibility level introduced, level 140 the new SQL Server 2017 Compatibility Level. SQL Server can run in a… Read More »SQL Server 2017 Compatibility Levels
With SQL Server 2017, there was a new compatibility level introduced, level 140 the new SQL Server 2017 Compatibility Level. SQL Server can run in a… Read More »SQL Server 2017 Compatibility Levels
From time to time I get asked about checkDB, and there are many solutions out there, but I have one that I generally use that is very simple and does the job.
The script below created a stored procedure in the DBHealthHistory database that can be used to check as many databases as you can get through in a specific time interval. Here it is set to 5 minutes, but that usually gets extended for large databases. If you set the job to daily, and the job doesn’t get through checking all the databases today, it will pick up where it left off and check the rest tomorrow.
Depending on the number and size of your databases you may want to run this more than once a day, or for a longer period than the 5 minutes.
Note: the 5 minute limitation is checked before starting the next check, so if you have a database that takes hours to check, that will kick off in the 5 minute interval and run until completion.
With SQL Server 2016, there was a new compatibility level introduced, level 130 the new SQL Server 2016 Compatibility Level. SQL Server can run in a… Read More »SQL Server 2016 Compatibility Level
CREATE PROCEDURE #MyProcedureName
Yes, you can create temporary stored procedures by prefixing the name of the sproc with a #. The temporary stored procedure is sort of a “leave no trace” stored procedure that is only good for your session. If you use double ## you will get a global temporary stored procedure.
For instance:
One way to improve performance on SQL Server is with IFI or Instant File Initialization.
Normally files are zeroed out on a database growth during an AUTOGROW, RESTORE, CREATE DATABASE or ALTER DATABASE. This is done by SQL Server when the file grows, it runs through that file and writes zeroes to the entire new allocation in the file. The zeroing process can take a great deal of time, the Instant file initialization process skips this zeroing, and just allocates the file. This works since SQL Server will just write each 8k page to disk as they are used, thus overwriting the uninitialized file.
Running some tests on a local virtual machine running SQL Server 2012 (similar results tested on SQL Server 2014 and SQL Server 2016), here is what I found.
For IFI to work, the user account that SQL Server is running as needs the “Perform volume maintenance tasks” policy to be enabled.Read More »Instant File Initialization (IFI)
Who owns that database? A quick check of the owner of most databases will likely reveal that the databases are either owned by sa, or… Read More »Database Owner? What user owns your database?
Back in 2012 when I was writing my Common Table Expressions book, I came up with the following CTE in a function to split a… Read More »CTE to Split a String in a function SplitString
The check for Cost Threshold for Parallelism check has be added to the Database Health Monitor – Quick Scan Report. The Cost Threshold For Parallelism setting in… Read More »SQL Server – Cost Threshold For Parallelism
The check for MAX DEGREE OF PARALLELISM has be added to the Database Health Monitor – Quick Scan Report. The max degree of parallelism setting… Read More »SQL Server MAX DEGREE OF PARALLELISM
Today I released another beta release of SchemaDrift. Part of this release was some redesign of the main screen, as shown here. I had some great… Read More »Beta release 1.2 of SchemaDrift – the database schema comparison tool