Some Notes, Some Scripts

These are the noted taken for searching solutions and some scripts to identify the problem

Categories:

SELECT parent_node_id ,COUNT(*) as [Schedulers] ,SUM(current_tasks_count) as [Current] ,SUM(runnable_tasks_count) as [Runnable] FROM sys.dm_os_schedulers WHERE status = ‘VISIBLE ONLINE’ GROUP BY parent_node_id;

Categories:

There are four different types of checkpoints: Internal checkpointsInternal checkpoints occur during some SQL Server operations, such as starting database backup or creating a database snapshot.Manual checkpointsManual checkpoint occur manually, as the name indicates, when users trigger them […]

Categories:

This configuration option controls how SQL Server caches execution plans of ad-hoc (nonparameterized)queries. When it is disabled (by default), SQL Server caches full execution plans of those statements, which may significantly increase plan cache memory usage. As the […]

Categories:

If the server has 8 or fewer CPU cores, create the same number of data files.If the server has more than 8 CPU cores, use either 8 data files or 1/4 of the number of cores, whichever is […]

Categories:

Make Sure that all TEMPDB data files have the same initial size and auto-growth parameters specified in megabytes (MB) rather than percentage.

Categories:

Let's assume that you have created separate datafile for non-clustered indexes but you want to check them weather you had created in the right datafile

Categories:

SELECT NAME,NAME ‘password’FROM sys.sql_loginsWHERE Pwdcompare(NAME, password_hash) = 1UNIONSELECT NAME,‘Blank’ AS ‘password’FROM sys.sql_loginsWHERE Pwdcompare(‘ ‘, password_hash) = 1UNIONSELECT NAME,‘password123’ AS ‘password’FROM sys.sql_loginsWHERE Pwdcompare(‘password123’, password_hash) = 1

Categories:

This query helps you identify your tables and calculate size/rowcount ratio easily: USE [DatabaseName] -- replace your GO SELECT s.Name AS SchemaName,t.Name AS TableName,p.rows AS RowCounts, CAST(ROUND((SUM(a.used_pages) / 128.00), 2) AS NUMERIC(36, 2)) AS Used_MB, CAST(ROUND((SUM(a.total_pages) – SUM(a.used_pages)) […]

Categories:

Assume that all we know why we are using IDENTITY column in a table. It you are inserting any row and getting error: “Server: Msg 8101, Level 16, State 1, Line 2An explicit value for the identity column […]

Categories:

SQL Server için tanımlanan memory alanı ne kadar yeterli sorusuna en iyi cevabı verecek olan sorgudur. PLE özetle, cache üzerinde bir verinin ne kadar süre kaldığını gösterir. Eğer bu süre uzun ise sorun yok. Ama kısa ise bu […]