top of page

Learn SQL Server

This page contains instructions and tips on Microsoft SQL Server. If you need help with a specific setting or topic reach out by clicking below regarding consulting hours.  I can quickly help you correct bugs, and optimize your system making and that pesky index script work as expected.

Anchor 2

Check, Indexes Backups,Parallelism, Statistics

Check, Indexes Backups,Parallelism, Statistics

Failed Job Alerts, Database Alerts 19-25, SA Log On

IFI, DAC, Compression

SQL Server Blog Posts

Instant File Initialization (IFI)

SQL Server Instant File Initialization (IFI) is a feature that allows SQL Server to allocate space in data files more quickly by skipping the zeroing-out process. Instead of writing zeroes to all the pages of the file, IFI allows SQL Server to mark the new pages as "available" without actually writing any data. This results in much faster file growth operations and can improve the performance of database operations that require the creation or extension of data files.

To enable Instant File Initialization in SQL Server, you need to grant the "Perform Volume Maintenance Tasks" privilege to the account used by the SQL Server service. Here are the steps to set up Instant File Initialization using T-SQL:

Open SQL Server Management Studio and connect to your SQL Server instance.

Open a new query window and execute the following T-SQL command:

USE [master];

Replace [SQLServerServiceAccount] with the name of the account used by the SQL Server service. This account must have administrative privileges on the server.

Restart the SQL Server service to apply the changes.

After enabling IFI, you can monitor its usage by checking the SQL Server error log for messages containing the phrase "Using 'Instant File Initialization'." If you don't see this message, make sure that the account used by the SQL Server service has the "Perform Volume Maintenance Tasks" privilege and that the SQL Server service has been restarted.


Remote Dedicated Administrator Connection (DAC)

Remote Dedicated Administrator Connection (DAC) is a feature of SQL Server that allows a database administrator to connect to a SQL Server instance when the server is unresponsive, or there is high CPU or memory utilization. Remote DAC is also used when a regular connection to the SQL Server instance is not possible or in case of emergencies.

Remote DAC establishes a dedicated connection to the SQL Server instance by using a separate TCP/IP port, which allows the administrator to access the system tables and troubleshoot issues, even if the server is experiencing heavy resource utilization. Remote DAC is a powerful tool, but it should be used with caution, as an administrator can modify or delete critical system objects, which can cause severe damage to the SQL Server instance.

Here's an example of T-SQL code to enable Remote DAC for a SQL Server instance:

USE [master]

-- Enable Remote DAC
EXEC sp_configure 'remote admin connections', 1

This T-SQL code enables Remote DAC by setting the "remote admin connections" configuration option to 1 using the sp_configure system stored procedure. The RECONFIGURE WITH OVERRIDE statement then saves the configuration changes.

Note that this T-SQL code alone is not sufficient to enable Remote DAC. Remote DAC requires that the SQL Server instance be started with the "-f" parameter, as explained in my previous answer. Therefore, after running the above T-SQL code, you must restart the SQL Server instance with the -f parameter for Remote DAC to function properly.

Once the SQL Server instance has been restarted with the -f; parameter, you can connect to the instance using Remote DAC by using the following syntax:


Replace ServerName with the name of the SQL Server instance that you want to connect to.

Note that Remote DAC is not enabled by default, and enabling it requires a SQL Server restart. Therefore, you should use it judiciously and only when necessary.


Backup Compression

You can enable backup compression in SQL Server by using the BACKUP DATABASE statement with the COMPRESSION option set to ON. Here is an example of T-SQL code to enable backup compression:

TO DISK = 'D:\Backup\DatabaseName.bak'

This code performs a full backup of the database "DatabaseName" to the disk location "D:\Backup\DatabaseName.bak". The COMPRESSION option is set to ON to enable backup compression, which reduces the backup size and improves backup performance. The STATS option is set to 10 to display progress information during the backup process.

Note that backup compression can increase CPU usage during the backup operation, so you should test your backup strategy thoroughly to ensure that the backup and restore operations complete within your desired time frame. Also, keep in mind that backup compression is not available in all editions of SQL Server. It is available in Enterprise, Standard, and Web editions, but not in Express or LocalDB.

Anchor 1
bottom of page