SQL Server Management Studio is the central tool for
managing SQL Server, and you will need to be very familiar with it for
the exam. Fortunately, most of the exam objectives require the use of
this tool so you will get plenty of practice with it . For this section we’re going to be focused on the Server Properties that can be changed through the Management Studio interface and by using the sp_configure command in a query window.
sp_configure
provides far more configuration options than the Management Studio
interface, and you will need to be familiar with it for the exam.
Because of this, we’re going to focus on sp_configure and its options,
highlighting where a particular option is also available in Management
Studio.
To run sp_configure simply type it into a query window and click execute. In Figure 1 you can see the results of executing sp_configure on an instance with default values. To access the Server Properties in Management Studio, right-click on a r egistered server in the Object Explorer window and select Properties.
Advanced Options
As you can see in Figure 1,
when you run sp_configure you’ll get a list of 16 options. One of the
first things you’ll typically do as a DBA is to expand that list to
show all of the configuration options. You do this by enabling show advanced options using the following command:
sp_configure 'show advanced options', 1
go
reconfigure
This
is the format for changing all of the options; you pass the option name
in single quotes followed by a comma and then the value you want to
change it to. When you change a configuration option, typically only
the config_value changes, and then you need to run reconfigure to tell SQL Server to reload all the values. After this is executed you’ll see the new values in both the config_value and run_value
columns in the sp_configure output, indicating that SQL Server is using
the new values. There are some settings, however, that require SQL
Server to be restarted..
When you run sp_configure
again you’ll see an extended list of 68 options. This is a persisted
instance-wide change, so all administrators will now see the advanced
options.
We’ll now
take a look at some of the most commonly changed options and
requirements, highlighting where the change can also be made in
Management Studio.
AWE
On a 32-bit system SQL Server is limited to using 2GB of memory. To use more than 2GB of memory you need to enable the Address Windowing Extensions (AWE)
option in SQL Server. AWE allows a 32-bit application, built to support
it, to access as much memory as the underlying operating system.
Windows Server 2008 Enterprise supports as much as 64GB of RAM. AWE has
two valid values, 0 or 1.
To enable AWE to run:
This setting is only visible after enabling show advanced options.
It requires you to restart SQL Server before it takes effect and can
also be configured in SQL Server Management Studio. You should always
set max server memory when using AWE to prevent SQL Server taking too much RAM from Windows.
Setting the Maximum and Minimum Memory for SQL Server
By
default, SQL Server will grow its memory usage to take advantage of as
much memory on the server as possible. This can very often leave only
100 to 200 MB of memory free on a server, causing problems when Windows
requires more memory for something and SQL Server is too slow to give
some back.
Max Server Memory (MB)
Max server memory (MB) controls the maximum size of the buffer pool,
which is the pool of memory that SQL Server uses for most of its
requirements. Setting the maximum server memory is strongly recommended
if you are using AWE or if you’re running a 64-bit version of SQL
Server. To set max server memory (MB) to 6 GB run:
sp_configure 'max server memory (MB)', 6144
go
reconfigure
This setting is only visible with sp_configure after enabling show advanced options, but you can also change this setting in SQL Server Management Studio on the Memory page.
Min Server Memory (MB)
Min
server memory works hand in hand with max server memory but isn’t as
important to as many scenarios. It provides a minimum value that SQL
Server will attempt not to go under once it has reached that value.
For
example, you set min server memory to 2GB. When SQL Server first starts
it takes the minimum amount of memory required for it to start and then
grows its memory usage as it needs to. Once it has grown to be more
than 2GB, SQL Server will attempt to keep the buffer pool above that
value. This setting is most useful when running multiple instances on a
single server or if there are other memory-intensive applications
running on the server. To set min server memory (MB) to 2GB run:
sp_configure 'min server memory (MB)', 2048
go
reconfigure
You can also change this setting in SQL Server Management Studio on the Memory page.
32-bit
(or x86 as it’s sometimes known) systems have a limitation of 4 GB of
virtual address space, so if you have more than 4 GB of RAM in a server
without AWE enabled, then SQL Server won’t be able use the extra
memory. 64-bit (or x64 as the most common platform is known) has a
limitation of 8TB of virtual address space, so you get access to more
RAM without having to switch on AWE.
The
Standard and Enterprise Editions of SQL Server both support as much RAM
as the Windows version that they run on, and they come with licenses to
run either the x86 or x64 version of SQL Server at no additional cost.
|
Maximum Degree of Parallelism
If
SQL Server determines that a query that has been executed is expensive
enough in terms of resource consumption, it may try to break down the
work into several units and execute them on separate CPUs. This is
called parallelism
and is a very intensive operation, where SQL Server assumes that this
query is important enough to run as quickly as possible at the expense
of additional CPU usage.
By
default SQL Server will use up to all of the available CPUs on a server
for a parallel operation. This can cause problems with all the CPUs
running at 100 percent for a period and slowing down other operations.
The max degree of parallelism
option allows you to control how many CPUs can be used for parallel
operations. A common best practice is to set this value to half the
number of CPU cores on your server. For example, if you have four
dual-core CPUs, you will see eight cores in Windows, so you should set max degree of parallelism
to 4. You will not be tested on what the formula should be to calculate
the optimal value, but you may be tested on what it does.
To set max degree of parallelism to 4 run:
sp_configure 'max degree of parallelism', 4
go
reconfigure
The max degree of parallelism is also known as MAXDOP and can be specified at the query level using the MAXDOP keyword, as well as the server level.
The default value of 0 means use all available processors. You can also change this setting in SQL Server Management Studio on the Advanced page.
Security Certifications
SQL
Server 2008 can be easily configured to support requirements to meet
certain compliance standards. You should be aware of these and how to
enable them for the exam.
C2 Auditing
This is a standard developed by the U.S. government that determines how system usage is audited. It is enabled by running:
sp_configure 'c2 audit mode', 1
go
reconfigure
This
will start a SQL Trace that runs continually and stores the output in a
trace file in the default data directory. Because of the stringent
requirements set out by the C2 standard, if SQL Server can’t write that
trace file (if you run out of disk space for example) it will stop the
SQL Server Service, in other words, nothing happens unless it’s audited.
You can also enable this setting in SQL Server Management Studio on the Security page.
Common Criteria Compliance
This
a security standard developed in Europe and adopted worldwide that
supersedes the C2 standard. There are several levels of Evaluation
Assurance Levels (EAL) within the Common Criteria and SQL Server 2008
is certified to level EAL4+, which is the most widely adopted.
It is enabled by running:
sp_configure 'common criteria compliance enabled', 1
go
Common
Criteria Compliance requires a SQL Server Service restart to take
effect, and it can also be enabled in SQL Server Management Studio on
the Security page. To be fully EAL4+ compliant, you need to download and run a script from Microsoft.
New Features
You’ll notice a couple of new configuration options if you’re upgrading your skills from SQL Server 2005.
Backup Compression Default
SQL
Server 2008 has a new feature that enables compressed backups to be
taken, which saves time and storage requirements. It is an Enterprise
Edition-only feature that is switched off by default. When you take a
SQL Server backup it will not be compressed unless you specifically
asked it to be. You can control this default behavior by configuring
the backup compression default option with sp_configure. It is enabled by running:
sp_configure 'backup compression default', 1
go
reconfigure
The backup compression default cannot be controlled through the SQL Server Management Studio interface.