Click to Rate and Give Feedback
Tips
With a core server installation, you have a minimal UI that includes a limited desktop environment for local console management of the server. Here is an overview of key commands and utilities you’ll use for managing server core installations while logged on locally. ...

Read more!

You can run Check Disk from the command line or within other utilities. At a command prompt, you can test the integrity of the E drive by typing these commands. ...

Read more!

Think part of your database is missing or corrupted? Find out how you can perform a partial restore to recover the missing or corrupted data. ...

Read more!

When a mailbox is stored on the server, you can grant access to individual folders in the mailbox. Granting access in this way means that users can perform tasks only for which you’ve granted permission. ...

Read more!

Do you know what tools you'll need to use to prepare and deploy Windows Vista to systems throughout your environment? Here's an overview of the tools you'll need, and the ones you can forget about. ...

Read more!

Related Articles

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!

Should you enable Backup Compression? How can you avoid dropped application connections during a failover? Paul Randal answers these questions and more in the latest installment of SQL Q&A.

Paul S. Randal

TechNet Magazine February 2009

...

Read more!

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!

SQL Server 2008 offers more powerful relational data warehousing capabilities. Take a close look at key performancerelated data warehousing features and find out how you can use all this new technology to optimize query performance.

S. Agarwal, T. Grabs, and J. Hammer

TechNet Magazine April 2008

...

Read more!

Find out how to grow databases programmatically, learn how to use IFilters, and explore firewall settings that support remote SQL Server connections.

Edited by Matthew Graven

TechNet Magazine April 2008

...

Read more!

Also by this Author

Database failure can be detrimental, causing loss of data and loss of productivity. Fortunately, SQL Server 2005 SP1 introduced a database mirroring feature that can prevent such a disaster. Here's what you need to know to create a hot standby database that you can switch to in case your production server ever goes offline.

Saleem Hakani

TechNet Magazine March 2007

...

Read more!

Popular Articles

Raymond Chen looks at the skewed relationship bugs have to errors, and explains why it's important that programmers suffer as well as give results.

Raymond Chen

TechNet Magazine October 2008

...

Read more!

Raymond Chen explains why it is often the developers who have their acts together who end up checking in the final bug fixes to products.

Raymond Chen

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!

Virtualization brings significant changes to disaster recovery. Here’s an introduction to how the Microsoft virtualization platform factors into your disaster recovery plan, as well as a deeper look into backup and restore options and considerations for Windows Server 2008 Hyper-V.

Adam Fazio

TechNet Magazine October 2008

...

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 Non-Clustered Indexes and Retaining Permissions
Saleem Hakani and Dan Carollo



Non-Clustered Indexes and Their Uses
Q What are non-clustered indexes, and what are the pros and cons of using them?
A A non-clustered index is similar to the type of index typically found at the back of a book. All the information contained within the book is represented in the index by topic, and there are pointers in the form of page numbers that direct you where to find the information perhaps in several areas of the book. Furthermore, the data in a book index is not listed in the same order as it appears in the text of the book. It is the same with non-clustered indexes. If you have a clustered index on a table, you can specify what the order of items will be. Otherwise, there is no way to be certain what the order will be.
In addition, non-clustered indexes have two limitations: only 16 columns can be included in the index and the maximum size of the index key cannot exceed 900 bytes. So what does that mean? Let's see what happens if you want to index the following columns in the Movie table from the sample MovieList database: MovieTitle NVarchar(50), DirectorName NVarchar(50), ShortStory NVarchar(400).
Assume you issue the following statement to create the table:
Use MovieList;
CREATE INDEX Movie_IDX ON Movie(MovieTitle, DirectorName, ShortStory); 
This will spawn the following error message: "Warning! The maximum key length is 900 bytes. The index 'Movie_IDX' has maximum length of 1000 bytes." For some combination of large values, the insert/update operation will fail. You will receive the above message because "nvarchar" datatype consumes 2 bytes for each character; an index that contains the previous three columns would exceed the 900 byte size limit.
With the release of SQL Server® 2005, you now have the opportunity to overcome this problem by adding the columns to the INCLUDE clause. This is a very useful feature if you want to overcome both size and column limitations. You can do this by executing the following statement:
CREATE INDEX Movie_IDX ON Movie(MovieTitle, DirectorName) INCLUDE (ShortStory);
It's important to note that when you use the INCLUDE clause during index creation, the database engine does not consider non-key columns when calculating the number of index key columns or index key size.
To find more helpful information on non-clustered indexes, visit "Non-clustered Indexes" at msdn2.microsoft.com/aa174537 and "Using Non-clustered Indexes" at msdn2.microsoft.com/aa933130. For tips on optimizing indexes, see sql-server-performance.com/optimizing_ indexes.asp.

Preserving Permissions Data
Q How can I avoid losing permissions when a subscription is reinitialized? I have experienced the problem several times that when a snapshot is reinitialized, it loses all the granted permissions.
A By default, all the objects in the subscription database are dropped and recreated whenever a subscription is reinitialized. But there are two ways you can handle this scenario.
First, you can reapply all the permissions after the reinitialization. When you set up the permissions manually, you should script out all the object/statement-level permissions and store them separately so you can use them immediately after you reinitialize the subscription.
Second, you can configure your subscription so that it does not drop any objects whenever you reinitialize the subscription. To do so you can use SP_CHANGEARTICLE system stored procedure to configure the value of PRE_CREATION_CMD for the parameter @PROPERTY and a value of NONE, DELETE or TRUNCATE for the parameter @Value.
Also, in the Article Properties dialog box in the destination object section, select a value of "Keep existing object unchanged, delete data. If article has a row filter, delete only what matches the filter. Truncate all data in the existing object." Make sure to try this in your test environment, and if you need further help, check the latest version of SQL Server Books Online for up-to-date information.

Saleem Hakani is a Senior Database Engineer, Senior Problem Engineer, and Worldwide Microsoft SQL Server Community Lead with 14 years of experience in database systems. He leads the external SQL Server Community Web site sqlcommunity.com and can be reached at Saleem@sqlcommunity.com.
Dan Carollo is an Operations Engineer and SQL Server DBA who works with the Windows Anti-Malware Research and Response team at Microsoft. He has an MCT in SQL Server.
© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited.
Page view tracker