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:

Sysadmin can run any scripts on SQL Server. What if S/he runs scripts with bad results. Can you detect it? Yes, Just Alter your Audit specification: ALTER SERVER AUDIT [Audit-xxxxxx] WHERE ([object_name]=’sysadmin’)

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:

Running DBCC CHECKDB and get out of TEMPDB errors although having enough disk space. CHKDSK commands also cannot find any bad sector but I cannot perform SELECT some of my tables and I cannot perform BACKUP. So you […]

Categories:

In theory, DATABASE_OBJECT_CHANGE_GROUP would be enough to capture “Alter Table” and “Alter Procedures”. But in practice you’ll see that sql cannot capture these actions. So you must add SCHEMA_OBJECT_CHANGE_GROUP, too. Actually, the DATABASE_OBJECT_CHANGE_GROUP is auditing the ALTER permission […]

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