Click to Rate and Give Feedback
Tips
Each mailbox has an Exchange alias and display name associated with it. You can change the Exchange alias in four steps. ...

Read more!

Auditing in Exchange Server offers many options for tracking important information. We show you all of them and how to configure the policy you want in seven simple steps. ...

Read more!

When a user deletes a message in Microsoft Office Outlook 2007, it is placed in the Deleted Items folder, where it remains until the user deletes it manually or allows Outlook to clear out the Deleted Items. Default retention settings are configured for each mailbox database in the organization. ...

Read more!

Before you can back up a Server Core computer, you must install the Windows Server Backup feature. This can be done in two ways, both of which we detail here. ...

Read more!

With Windows 7, you can easily protect the data stored on removeable drives. See how BitLocker To Go allows you to keep USB drives more secure. ...

Read more!

Related Articles

Far too often, people who are not trained database administrators somehow end up responsible for a database. They lack the proper training and knowledge to maintain their database, and problems begin to develop. Here’s a primer for all those involuntary DBAs who need a crash course in database maintenance best practices.

Paul S. Randal

TechNet Magazine August 2008

...

Read more!

In this installment, Paul Randal answers questions about backing up and restoring, looks at the differences between log shipping and database mirroring, and explains why the Repair function should only be used as a last resort.

Paul S. Randal

TechNet Magazine October 2008

...

Read more!

Saleem Hakani and Dan Carollo

TechNet Magazine February 2008

...

Read more!

The new version of SQL Server offers a host of new features and enhancements that promise to improve performance, increase security, and make life better for database administrators. Here’s an overview of the key changes and what you can expect from SQL Server 2008.

Randy Dyess

TechNet Magazine April 2008

...

Read more!

SQL Server 2008 introduces two new features that allow you to track changes more easily and efficiently. Paul Randal examines the new Change Tracking and Change Data Capture features and discusses the implications these features will have for database administrators.

Paul S. Randal

TechNet Magazine November 2008

...

Read more!

Also by this Author

It's time to start acting on your Green IT initiatives.

Matthew Graven

TechNet Magazine Earth Day 2009 2009

...

Read more!

Popular Articles

Drivers fail, files get corrupted, disks crash--there are numerous uncontrollable reasons why Windows might fail. But all is not lost. Wes Miller explores the kinds of things that can go wrong in a Windows system, and explains how you can troubleshoot them to get your system working again.

Wes Miller

TechNet Magazine January 2009

...

Read more!

See how the free Microsoft USB Flash Drive Manager can help you easily copy, delete, and back up files from a flash drive, as well as perform other useful tasks.

Lance Whitney

TechNet Magazine January 2009

...

Read more!

The upcoming release of Microsoft Identity Lifecycle Manager “2” offers many new features and enhancements. Explore the new portal experience and find out how you can cut costs with self-service tools, increase security compliance with business process modeling, and reduce development time with simplified development tools.

Aung Oo

TechNet Magazine January 2009

...

Read more!

SQL Server 2008 includes a new “eventing” mechanism called SQL Server Extended Events that enables some sophisticated troubleshooting. Get an overview of Extended Events and find out how you can use this new functionality for monitoring and troubleshooting.

Paul S. Randal

TechNet Magazine January 2009

...

Read more!

Aaron Margosis

TechNet Magazine August 2006

...

Read more!

Our Blog

NAP monitors the health of specified computers when they attempt to connect to a network and includes a number of mechanisms to enforce health requirements. In this article, Geek of All Trades Greg Shields gives readers an overview of these enforcement mechanisms and, as an example, takes a closer look at setting ...

Read more!

Use Windows PowerShell to Manage Virtual Machines Here are a few examples of how you can use Windows PowerShell scripts to manage virtual machines running on a Server Core installation. Note that these scripts are presented as samples and may need to be customized to work in your environment.

Create a New ...

Read more!

Disabling an Unused Part of Group Policy Objects One way to disable a policy is to disable an unused part of the GPO. By disabling part of a policy that isn’t used, the application of GPOs and security will be faster.

Administer Windows Server 2008 Server Core from the Command Prompt ...

Read more!

In the August 2008 issue of TechNet Magazine, Paul Randal wrote an article Top Tips for Effective Database Maintenance.  It was geared toward "involuntary  DBAs" (IT pros who inadvertently wind up responsible for a SQL Server instance).  The article had a great response from our readers so Paul has written another ...

Read more!

Microsoft Forefront is designed to deliver an integrated security solution that makes it much easier to deploy and manage security across an organization’s IT infrastructure. In this, our annual security issue, we feature two articles that describe how Forefront Security protects instant messaging and e-mail.

Protect ...

Read more!

SQL Q&A Grow Databases, Use IFilters, and Connect Remotely
Edited by Matthew Graven


Tip: Clear Cache
Ever wonder why a stored procedure might work well in the test environment but work poorly when deployed on the production SQL Server? This may be a cache-related issue. Before you deploy stored procedures to your production environment, test the procedures in the test environment after having cleared cached query plans so that you know how your stored procedure will perform in a "cold" cache environment. Here are a couple handy things to keep in your bag of tricks.
To clear up the procedure cache on a SQL Server:
DBCC FREEPROCCACHE
Go
Query to list all cached plans:
Select * from sys.dm_exec_cached_plans
Go

Q I have a database that has heavy traffic during the day and I don't want to use autogrow because this could potentially cause timeouts if SQL Server®, decides to do this during peak hours. I would like to implement a periodic job to expand the database file by a specific percentage of the space used. How can I do this?
A File growth is an intensive disk I/O operation and if SQL Server has to wait for a data or log file to expand, you could certainly see this harm performance and response times. The default growth increment is 1MB for data files and 10 percent for log files, which can be insufficient growth increments for busy systems. Additionally, relying on autogrow can lead to disk fragmentation because the data or log files are not contiguous on disk—this means response times may be longer than necessary, as data is physically scattered on the disk.
The key to good performance is proactively allocating sufficient file space for data and log files up front. This often requires some trend analysis and growth forecast and will result in better performance because the files will be contiguous on disk and avoid the I/O cost required by autogrow during peak periods. Autogrow should generally stay enabled since a completely full data or log file will prevent access to the database altogether. But keep in mind that autogrow should be considered a safety net rather than a feature for managing databases.
Scheduling regular database file expansions should be avoided since this can also lead to noncontiguous files on disk and, in turn, reduced performance. Proactive monitoring can be achieved by regularly executing a script to determine the percent of free space for each database (executed by a SQL Agent job) and then taking an action (such as sending an e-mail alert via Database Mail). The code in the figure offers a sample script showing how to gather the percent of free space for the current database.
Once an alert has been generated, you can script one-time file growth with the ALTER DATABASE command, and you can use a SQL Agent job to schedule this action to take place outside of peak hours. Try to grow the file to a size that will be sufficient for the foreseeable future to avoid future small incremental file expansions. It's also a good idea to ensure autoshrink isn't enabled on any database—this could needlessly create database shrink or grow cycles.
—Justin Langford
Determining Free Space in a Database
-- Script to gather size, free space and 
-- calculate % free space for current 
-- USER database
DECLARE @size DEC(15,2)
DECLARE @free DEC(15,2)
DECLARE @result DEC(15,2)

SELECT @size = SUM(size)*1.0/128
FROM sys.database_files

SELECT @free = 
(SUM(unallocated_extent_page_count)*1.0/128)
FROM sys.dm_db_file_space_usage

PRINT 'DB Size ' + CONVERT(VARCHAR(15), @size)
PRINT 'Free Space ' + 
CONVERT(VARCHAR(15), @free)

SELECT @result = (@free/@size)*100

PRINT '% Free Space ' + 
CONVERT(VARCHAR(15), @result)


Q My company stores different formats of files within our database using varbinary and image columns. I've heard that SQL Server has integrated functionality that will let me search these different file formats. How can I configure SQL Server to do this?
A This functionality is built into the full-text indexing service. The service provides the flexibility to use IFilter interfaces, making it possible to develop and load filters that can extract useful information from proprietary data. These IFilters are also used for other products, such as Microsoft® Office SharePoint® Server, to gather information about crawled files.
An IFilter is either provided by the creator of the file format or by third-party vendors. SQL Server already contains some IFilters that are loaded when the FulltextService (FTS) is installed—these include filters for HTML and DOC files. However, more IFilters can be added as required. For example, filters for Adobe PDF can be found on the Adobe Web site, and a new filter pack for 2007 Office system extensions was published at the end of 2007. Note that you must know which version of the IFilter is needed. For instance, an IFilter intended for 32-bit systems won't work with 64-bit installations of SQL Server.
After you run the installation package on the client, the IFilter will typically be registered in the ecosystem of the OS. With the bits registered in the OS, you need to perform a few steps to make FTS able to load the Filters. After starting your query execution tool, issue the following commands:
  • sp_fulltext_service 'load_os_resources',1. (This statement will enable FTS to load the registered bits for processing, including components like wordbreakers and stemmers.)
  • sp_fulltext_service 'verify_signature',0. (This will bypass SQL Server to check whether the used filters are signed, as many vendors do not sign their filters according to the standard.)
  • Restart the SQL Server instance and the instance of FTS.
  • Create your full-text index on the columns having the binary column as the content for the IFilter to crawl and the extension column (meaning the column with the extension type, such as DOCX) for SQL Server to choose the filter to which filter to redirect the content to.
More information can be found at go.microsoft.com/?linkid=7912971.
—Jens Suessmeyer

Q I am unable to connect to a remote SQL server. Do I need to configure the firewall on my client or server machine?
A Remote connections to SQL Server 2005 can fail for many reasons, but firewall configuration is one of the most common problems. The SQL Protocols blog (blogs.msdn.com/sql_protocols) is a great resource for information on making a SQL connection.
The default installation of SQL Server 2005 does not allow remote connections. From the machine running SQL, on the Start menu, select Microsoft SQL Server 2005 | Configuration Tools | SQL Server Surface Area Configuration. Here, go to Surface Area Configuration for Services and Connections, select Remote Connections, and select the "Using both TCP/IP and named pipes" radio button. You must then restart SQL for the change to take effect.
By default, SQL Server uses port 1433. To verify the port is open, use the following telnet command, replacing <ipaddress> with the actual IP address of the machine running SQL Server:
telnet <ipaddress> 1433
If you get a connection failed response, open the Windows® Firewall, go to the Exceptions tab, select Add Port, and add TCP port 1433. Telnet should now succeed. (Note that Telnet is not installed by default on Windows Vista®.)
—Rick Anderson
Thanks to the following SQL Server experts for contributing to this column:
Justin Langford works for Coeo Ltd., a Systems Integrator and Microsoft Certified Partner based in England. Jens Suessmeyer is a database consultant at Microsoft located in Germany. Rick Anderson works in Developer User Education at Microsoft. Saleem Hakani is a Senior Database Engineer and SQL Server Community Lead at Microsoft.

© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited.
Page view tracker