Home > Articles > Data > SQL Server

SQL Server Reference Guide

Hosted by

Toggle Open Guide Table of ContentsGuide Contents

Close Table of ContentsGuide Contents

Close Table of Contents

The DBA's Toolbox, Part 2

Last updated Mar 28, 2003.

In the last installment of this two-part series, I mentioned that there are often more things to learn about SQL Server Management than you can take in at one time. A simple method to help cut the information down to size is to categorize it all into concepts, processes and tools. You can attack the knowledge from any or all of those angles.

I also mentioned that I’ve covered the general concepts for some of the features and components in SQL Server in a series of tutorials called Microsoft SQL Server Features. I pointed out a DBA checklist that I created to help with some process, and I mentioned longer tutorials and articles on the native SQL Server Tools for SQL Server 2000 here and SQL Server 2005 here. In this installment, I’ll close out the discussion of the tools, and just so you don’t have to flip back and forth between the two articles I’ll duplicate the chart information in this tutorial as well.

Once again, I’ll try and stick with the tools that ship with SQL Server. Every once in a while, though, I run into a tool that just does such a good job that I’ll mention it, although I won’t be able to go into as much process with those tools. You’ll just have to rely on their documentation for that.

And I need to add another word or two about those charts before we dive in. The steps I show you here are guides—they may not suite your needs in every situation. For instance, having Analysis Services or Reporting Services installed on your system might dictate different steps than I show here. The best approach is to have a test system that you can play around with until you’re comfortable, and then create your own checklists and processes that fit your situation perfectly. I show you how to create your own testing lab here.

Let’s pick up where we left off in the last installment, with the checklist as it stands now.

Installing and Configuring the SQL Server Platform

Task

Tool

Process/Reference

Install SQL Server

Installation CD

Run SETUP.EXE.

Books Online Installation Reference

Multiple Installations of SQL Server

Installation CD and Unattended Installation File

Run SETUP.EXE with command line switches.

Command-line Switches Reference

Multiple Installations of SQL Server

Microsoft SMS

Develop installation packages, select targets, set schedule.

Now called "System Center Configuration Manager"

Multiple Installations of SQL Server

Windows Server

You can use Windows Policies to push out software based on policy conditions.

Designing and Implementing Databases

Task

Tool

Process/Reference

Run Transact-SQL (T-SQL) Statements

SQL Server Query Analyzer (2K)

Open Query Analyzer tool, connect to a database.

InformIT overview of QA

Run Transact-SQL (T-SQL) Statements

SQL Server Management Studio (2K5)

Open SSMS, open a Query Window.

InformIT overview of SSMS

Run Transact-SQL (T-SQL) Statements

TOAD (Quest Software)

Connect to a database engine, open query.

TOAD evaluation at InformIT.com

Create Database Design Graphically

SQL Server Enterprise Manager (2K)

Connect to a server.

Right-click database folder. Select "Create New Database" from the menu that appears.

Create a database with any options you want.

Open the database, right-click the "Database Diagrams" folder, and select "Create New Diagram" from the menu. (you’ll be asked about creating some objects. Let it do that).

Bypass the "Add Tables" request.

Right-click in the screen to create tables and relationships.

InformIT overview of EM

Create Database Design Graphically

SQL Server Management Studio (2K5)

Connect to a server.

Right-click database folder. Select "Create New Database" from the menu that appears.

Create a database with any options you want.

Open the database, right-click the "Database Diagrams" folder, and select "Create New Diagram" from the menu. (you’ll be asked about creating some objects. Let it do that)

Bypass the "Add Tables" request.

Right-click in the screen to create tables and relationships.

InformIT overview of SSMS

Create Database Design Graphically

Visual Studio Enterprise Edition

See this reference for more information.

Create Database Design Graphically

Erwin

See this reference for more information.

Create Database Design Graphically

Visual Studio Team Edition for Database Professionals (a.k.a. "Data Dude")

See this reference for more information.

Configuring Security and Access

Task

Tool

Process/Reference

Create Database Roles

Transact-SQL Commands

Open a query tool, use the CREATE ROLE command.

CREATE ROLE Reference

Create Database Roles

Enterprise Manager (2K)

Open EM, connect to a server.

Navigate to and open a database.

Right-click Roles, Select New Database Role from the menu.

Follow the prompts.

More about Roles here.

Create Database Roles

SQL Server Management Studio (2K5)

Open SSMS, connect to a database

Open a database

Right-click the Security/Roles/Database Roles node, select New Database Role from the menu.

Follow the prompts

More about Roles here.

Grant Rights to Roles

Transact-SQL Commands

Open a query tool, use the GRANT command.

GRANT Reference

Grant Rights to Roles

Enterprise Manager (2K)

Open EM, connect to a server.

Navigate to and open a database.

Right-click an object (such as a table), Select Properties from the menu.

Click the Permissions button.

Select the permissions you want from the list that shows, assign them to the proper Role.

Follow the prompts.

More about Permissions here.

Grant Rights to Roles

SQL Server Management Studio (2K5)

Open SSMS, connect to a server.

Navigate to and open a database.

Right-click an object (such as a table), Select Properties from the menu.

Click the Permissions object.

Click the Add Button.

Select the permissions you want from the list that shows, assign them to the proper Role.

Follow the prompts.

More about Permissions here.

Create Server Logins

Transact-SQL Commands

Open a query tool, use the CREATE LOGIN command.

CREATE LOGIN Reference

Create Server Logins

Enterprise Manager (2K)

Open EM, connect to a server.

Open the Security node.

Right-click the Logins object, select New Login from the menu that appears.

Follow the prompts.

More about Server Logins here.

Create Server Logins

SQL Server Management Studio (2K5)

Open SSMS, connect to a server.

Open the Security node.

Right-click the Logins object, select New Login from the menu that appears.

Follow the prompts.

More about Server Logins here.

Create Database Users

Transact-SQL Commands

Open a query tool, use the CREATE LOGIN command.

CREATE USER reference.

Create Database Users

Enterprise Manager (2K)

Open EM, connect to a server.

Navigate to and open a database.

Right-click Users, Select New Database User from the menu.

Follow the prompts.

More about Database Users here.

Create Database Users

SQL Server Management Studio (2K5)

Open SSMS, connect to a database

Open a database

Right-click the Security/Users node, select New User from the menu.

Follow the prompts

More about Database Users here.

Add Users to Roles

Transact-SQL Commands

Open a query tool, use the CREATE LOGIN command.

ALTER GROUP reference.

Add Users to Roles

Enterprise Manager (2K)

Open EM, connect to a server.

Navigate to and open a database.

Right-click a Role, Select Properties from the menu.

Click the Add button.

Follow the prompts.

More about Roles here.

Add Users to Roles

SQL Server Management Studio (2K5)

Open SSMS, connect to a database

Open a database

Right-click the Security/Roles/Database Roles node, select Properties from the menu.

Click the Add button.

Follow the prompts

More about Roles here.

That’s the last of the previous list, so let’s continue now with the rest of the tasks you need to work with.

Maintenance

The server is now installed and configured. You have designed and created a database, and you’re secured the objects in it to the proper roles and tied Server Logins and Database Users to those roles. The applications are written, and your system is up and running.

Now it’s time to ensure that the system is properly maintained. You should start out with a good disaster recovery plan, which I’ve explained here. The reason that’s a good place to start is that it forces you to plan out what the desired outcomes of your system are after a major meltdown—something you hopefully won’t have to face a lot. Determining that state will tell you what to protect.

Along with protection, you need to optimize. Although I’ll cover optimization in a moment, there are some steps you need to take as part of general maintenance. I’ll cover those below.

The final two checklists are a bit different. Maintenance and Performance Tuning are two things that aren’t quite as simple as following a few steps, so I’m going to copy the checklist I have in this tutorial and put it here for the maintenance part. The reason is that the maintenance section can become quite complex, and for most of these things you shouldn’t just follow a simple set of instructions. Don’t worry, however, this checklist still points out the tools to use and has links to more information. I’m going to add some information here so that you have a full set of links to understand how each of these tasks can be accomplished. Note that for the most part, Enterprise Manager and Query Analyzer are the tools you use with SQL Server 2000, and SQL Server Management Studio has everything you need for SQL Server 2005. In the links I provide, both are referenced, and the scripts for each are also part of the link.

Remember, the checklist there and here cover only the basics; your setup will most certainly be different. But this is a good way to exercise your maintenance plan to see what mix of graphical, command or scripting you like to work in.

Task

Tools, Processes and Reference

Check Backups

Check the backups using the logs.

Check Event Logs

Check the System, Application and Security areas in the Windows Event logs.

Check SQL Server Logs

Check the log files in SQL Server.

Check Drive Space

Check that the drives that store database logs, data files and operational files have sufficient space.

Check jobs history

Check the job history to ensure that it ran correctly.

Check Agent Logs

Check the agent logs on your system.

Perform database backups

Create a plan that executes an automated backup for all of your databases, including the system databases.

Update Indexes and Statistics

Develop a good re-indexing strategy. Use DBCC commands or the referenced graphical tools to check and tune the indexes.

Archive Backups

Determine when the data is no longer needed locally and send tapes or other media off-site for storage. This is a physical process so there isn’t tool involved here (other than your brain) so use the link provided to learn what you need to do.

Data Archival

If you have data that loses its immediate value, create a "rollup" strategy to aggregate the data to save space. Once again, many tools or processes are useful here, such as Data Transformation Services (2000) or Integration Services (2005) are great places to start. The link will point to more articles on those tools.

Update Change Management Scripts

Script your database objects into a change control management system. I use PowerShell, but you can also use Database Management Objects (DMO) or even right-click on object and script it from there.

Install and configure SQL Mail or Database Mail

Install and configure SQL or Database Mail. The same installation tools from above can be used here.

Automate Maintenance and Logging

Use the SQL Server Agent to process all maintenance and logging tasks possible. You can find more information on SQL Server Agent in the link provided.

Review Security Access Points

Check the server for network access. You can do this using various tools, check the link provided.

Test Restore Operations

Restore the database backups to a test server. The link shows you how.

Check indexes

Create a report on indexes to find which are useful. Various DBCC commands and graphical tools are available to help you do that in the link provided.

Monitoring and Performance Tuning

Monitoring and Performance Tuning go hand-in-hand. You have to know which part of the system is the bottleneck before you can choose a tool to fix it, so you’ll want to check this series of tutorials to learn how to do that.

As I mentioned earlier, you’ll find many of the same tasks for improving your performance on your system in maintenance as here. I’ll duplicate some of those in case you’re using this chart for reference.

Once again, this chart differs from the ones I created in the last article. The reason is that the steps are quite involved, and would make the checklist too bulky to easily read. This format allows you to see the tasks in a list, but use the hyperlinks in the text to get to more information.

Task

Tool

Process/Reference

Check indexes

DBCC Commands

Graphical tools in EM, QA and SSMS

Third-party tools

Create a report on indexes to find which are useful. Various DBCC commands and graphical tools are available to help you do that in the link provided.

Check overall performance of the system

Index Tuning Wizard (2000)

Database Tuning Advisor (2005)

Check this series of articles for more in-depth information on these tools and processes you should follow to monitor and tune your system.

Find performance issues and determine steps to correct them

Spotlight on SQL Server

I have to mention this tool because I have found it so useful. You can read my review and the steps to check your system here.

InformIT Articles and Sample Chapters

If you’re really in a hurry and need an even shorter checklist, I’ve got one of those here.

Online Resources

Since this is such a general list, it may be useful to point out Microsoft’s site on SQL Server—at least the technical one. There’s another here that deals with the marketing side.