This chapter covers the following topics: • Requirements for SQL Server 2008 • Pre-upgrade tasks • The Upgrade Advisor tool • SQL Server 2008 installation SQL Server Requirements The min
Trang 1SQL Server Installation and
Configuration
Those of us who have spent many years in product development might come to the conclusion
that one of the least glamorous jobs is to design and code the installation and configuration of
a product This task is often contracted out to consultants, so companies can keep their most
tal-ented developers happy working on the complex logic within the product Alternatively, a company
can have great in-house people do the job, but not hire enough staff or not fund that part of the
project well enough to build a high-quality setup experience The latter seems to be the case with
previous versions of SQL Server
Microsoft has now realized that the first impression of the product is the setup and configura-tion experience Microsoft has definitely invested in this experience in SQL Server 2008, and it shows
The experience of installation and configuration of SQL Server 2008 can be summarized in a single
word: pleasant Not only is the user interface clean, but there are also extra wizards that help you set
up and configure the more complicated features like clustering In general, you will find SQL Server
2008 easy to install, thanks to all the hard work that the setup team did in completely redesigning
the experience for SQL Server 2008 If any Microsoft managers are reading this, please give the
members of the team a few hundred dollars bonus on their next review
This chapter covers the following topics:
• Requirements for SQL Server 2008
• Pre-upgrade tasks
• The Upgrade Advisor tool
• SQL Server 2008 installation
SQL Server Requirements
The minimum RAM required to run SQL Server is 512MB, with 1GB recommended if you are
plan-ning to use SQL Server to handle larger workloads
For disk space, you neeed 290MB Disk space is cheap Even if you are installing SQL Server on
a desktop machine, you probably have at least a few gigabytes free If you are concerned that you
don’t have 290MB free to install just the database engine, you probably have some other problems
to deal with first The exact space requirements depend on what you install SQL Server Books Online
does a great job at enumerating specifically what each components takes as far as disk space is
con-cerned, in an article appropriately titled “Hardware and Software Requirements for Installing SQL
Server 2008.” (SQL Server Books Online is available online from http://msdn.microsoft.com.)
9
C H A P T E R 2
Trang 2SQL Server 2008 works on almost all flavors of Windows: XP, Vista, Windows Server 2003, and Windows Server 2008 But do watch out for the service pack requirements As an example, the February Community Technology Preview (CTP) release requires Service Pack 2 if you are running SQL Server on Windows Server 2003 If your organization takes a while to move to service packs, you may want to factor this into your deployment schedule
Upgrading to SQL Server 2008
Setup supports a direct upgrade from SQL Server 2000 and 2005 Those of you still on SQL 7.0 will need to upgrade to SQL Server 2000 or 2005 first before upgrading to SQL Server 2008 Since the product development cycle was shorter than that of SQL Server 2005, the changes and issues involved with upgrading from SQL Server 2005 to SQL Server 2008 are minimal compared with the move from SQL Server 2000 to SQL Server 2008
You can upgrade to SQL Server in two ways:
• Direct in-place upgrade: SQL Server setup does the heavy lifting of updating the necessary
binary files and upgrades all the attached databases to the new version’s format
• Side-by-side upgrade: This is sometimes referred to as a migration It essentially installs
a fresh SQL Server 2008 instance alongside the instance that is to be upgraded This process
is mostly manual, since the idea is for the database administrator (DBA) to copy over the databases and configuration information to the new server Once this information is copied and attached, the DBA can verify that the applications work correctly
The in-place upgrade is the more automated of the two options, but might not be the best option for some organizations An in-place upgrade takes down the server for a duration of time, and without previous testing, who knows what will happen after the upgrade is complete? The posi-tive aspect of the in-place upgrade is that when the upgrade is completed, the instance name of the new SQL Server is the same as it was pre-upgrade, so existing applications do not need to change any connection string information With a side-by-side upgrade, the new installation uses a new instance name, so applications might need to have their connection string information changed to point to the new instance
To help you with the upgrade, Microsoft released a free tool called Upgrade Advisor, which essentially scans your existing SQL Server instance and gives you a report on any potential issues you will have after the upgrade But before we talk about using Upgrade Advisor, we need to discuss planning the upgrade If you were going to simply upgrade your production servers without a plan, then you may want to consider freshening up your resumé A plan is critical to the success of an upgrade
Planning the Upgrade
A smooth upgrade requires a good plan Before you upgrade, you need to prepare your environment The pre-upgrade tasks include the following:
• Ensure the server hardware that will host SQL Server 2008 will be sufficient The server
hard-ware should meet the minimum hardhard-ware requirements, such as the amount of available RAM and disk space The operating system on the server hardware should also contain the latest service pack or the minimum service pack required by SQL Server 2008
• Inventory the applications that will use the upgraded server This list will be used to validate
that your upgrade was successful After upgrade, run through the list and verify that all the applications work correctly, if possible
Trang 3• Take note of the cross-edition upgrade matrix Some upgrade scenarios, like upgrading from
SQL Server 2005 Enterprise Edition to SQL Server 2008 Standard Edition, are not supported with an in-place upgrade SQL Server Books Online describes various upgrade scenarios in
an article titled “Version and Edition Upgrades.”
• Take performance benchmarks In some situtations, upgrading may actually decrease query
performance This is usually observed when upgrading from SQL Server 2000, since the query processor internal to the database engine was rewritten in SQL Server 2005 This rewrite causes a different query plan to be created from the queries that you issue The good news is that most of the time, your queries will run better out of the box in SQL Server 2008 In the rare case that you find your queries running worse, it’s possible to save query plans so there will be no surprises after you upgrade This feature is described in more detail in Chapter 5
• Use the Upgrade Advisor tool Upgrade Advisor is a free, stand-alone application that connects
to a SQL Server instance and performs an analysis to determine if any issues need to be addressed before upgrading It also will analyze script and trace files Results of this tool should be carefully reviewed and addressed before proceeding with the upgrade The Upgrade Advisor tool is discussed in the next section
• Fix or work around backward-compatability issues The Upgrade Advisor tool will note
any backward-compatibility issues In most cases, when a feature or behavior is changed, Microsoft announces a deprecation of that feature or functionality This deprecation will last for three releases; in the fourth release, the feature or functionality will be removed from the product In some rare cases, Microsoft needs to modify or remove a feature without going through the formal deprecation procedure Thus, if you used this feature and then upgraded, it’s possible that your application would not work as you expected It is important to address these backward-compatibility issues before upgrading your SQL Server instance
• Create a back-out plan If you have done your homework, the upgrade experience should go
seamlessly In the event of something going wrong during the upgrade, you may need to revert back to your original system configuration This may involve more steps than just canceling the setup wizard For this reason, it is good to have a formal back-out plan
• Understand upgrade or migration for each component within SQL Server When performing
an upgrade of a database, most people tend to think about just the relational data If all you are using SQL Server for is to store relational data, then either using the setup wizard to per-form an in-place upgrade or migrating the data using a backup/restore or a detach/attach technique might be sufficient However, if you use other technologies, you may need to be aware of other issues
The last item is particularly important, because different components may have different upgrade paths For example, if you’re using Analysis Services, with an in-place upgrade, you can use
the setup wizard just as you would with upgrading the database engine To perform a migration,
you can use the Migration Wizard tool available from the server node context menu off of an
analy-sis server connection in SQL Server Management Studio If you have Analyanaly-sis Services projects
written using Business Intelligence Development Studio (BIDS), you can simply import into BIDS in
SQL Server 2008
With another component within the SQL Server product, Reporting Services, the migration process is slightly different Again, if you choose to perform an in-place upgrade, the setup wizard
will perform most of the heavy lifting If you choose to migrate, there is a list of things to do SQL
Server Books Online describes the migration of Reporting Services very well in an article entitled
“How to: Migrate a Reporting Services Installation.”
As you can see, it is imperative to consider all the components that you are using within the SQL Server product
Trang 4■ Note For a definitive list of migration steps, refer to the appropriate “How to: Migrate ” Books Online topics Note that at the time of this writing, not all migration topics were defined for each component
Using Upgrade Advisor
The Upgrade Advisor (UA) tool is available on the SQL Server 2008 installation disks, in the Servers\Redist\Upgrade Advisorfolder It will also be available as a free download from http://microsoft.com/downloads
Here, we’ll walk through an example of running UA against a SQL Server 2005 instance
1. Launch UA You will be presented with the welcome screen, as shown in Figure 2-1
Figure 2-1. Upgrade Advisor welcome screen
Trang 52. Click the Launch Upgrade Advisor Analysis Wizard link You will see the familiar welcome screen, and then the SQL Server Components page, as shown in Figure 2-2
Figure 2-2. Choosing SQL Server components
3. Type the name of a server and click Detect The wizard will determine the components that are installed on that instance In this example, we are checking a SQL Server 2005 instance
We enter the server name, DBSERVER Since all we are interested in testing is the SQL Server database engine, we check SQL Server and click Next to continue
4. Next, you see the Connection Parameters page, as shown in Figure 2-3 Specify the instance name (PROD in this example) and the credentials used to connect to this server instance (Windows Authentication in this example) Click Next to continue
Trang 6Figure 2-3. Specifying connection parameters
5. The next wizard page is where you select which databases to analyze, provide a separate trace file, and pass a path to SQL batch files, as shown in Figure 2-4 UA can analyze all of these items Click Next to continue
Figure 2-4. Choosing SQL Server parameters
Trang 76. The next page shows a summary of the options you selected Click Next, and UA goes to work, churning through all the stored procedures, metadata, and objects within the data-bases you selected
7. When the analysis is complete, UA will display the results In our simple example, when the SQL Server 2005 instance was scanned, the wizard presented the warning shown in Figure 2-5
Figure 2-5. Completed UA analysis
8. Click Launch Report You will see a list of issues that UA found, as in the example in Figure 2-6
Each item has an Issue Resolved check box Checking this box will remove the item from the list This way, it’s really easy to keep track of which issues are already resolved and which ones remain to be addressed
Trang 8Figure 2-6. Report generated by UA
UA creates a directory under the My Documents folder to store its reporting information UA allows you to analyze multiple servers For each server analyzed, a subfolder is created To view reports, click the Launch Upgrade Advisor Report Viewer link from the main UA screen (Figure 2-1)
■ Note Each time you run UA against the same server, it overwrites the information saved from a prior run of UA
You’ll notice in this example that the number of issues upgrading SQL Server 2005 to SQL Server 2008 was fairly minimal If you are upgrading from SQL Server 2000, expect the list to be a bit longer
Trang 9Performing the Upgrade
Now that you have decided on what type of upgrade you will perform and have gone through all the
items in the pre-upgrade tasks list, it is time to perform the actual upgrade
Before you go ahead and run the setup wizard, or start migrating data from your original SQL Server instance, it is important to make sure your environment is ready for the upgrade The first
task is to check the database consistency for those databases being upgraded This is as simple as
issuing a DBCC CHECKDB command against each of the databases for the instance you are upgrading
After you’ve checked your databases for consistency, take a backup of all the databases in your SQL Server instance When the backups are complete, verify the backups as well to ensure their own
consistency At this point, you are ready to start the upgrade or migration process
In this section, we will walk through a basic installation of SQL Server 2008 Although there is
a nice HTML user interface that can be brought up when you insert the SQL Server media, we chose
to run the setup program directly from the Servers folder on the SQL Server installation disk
The first thing the setup program does is to detect whether you have NET Framework 3.5 installed If you do not, it installs that version of the NET Framework Next, you are presented with
the infamous license agreement to which you must agree in order to proceed Then setup will copy
some support files Once this is complete, the real installation begins
You will see the SQL Server Installation Center screen, as shown in Figure 2-7 From here, you can create a new installation, upgrade an existing SQL Server instance, and create or change an
existing clustering configuration
Figure 2-7. SQL Server Installation Center screen
Clustering support in setup is of great value If you are running SQL Server 2008 on Windows Server 2008, you are already gaining a huge number of features, including support for up to 16 nodes
and an ease on restrictions like the requirement that nodes be on the same subnet This means that
Geoclusters are now a viable option for SQL Server deployments A Geocluster is a clustering
config-uration where the active and passive servers are physically separated by large geographical distances
Trang 10These types of clustering configurations required special considerations during deployment Windows Server 2008 implemented features that makes Geoclustering easier The increased support for clusters doesn’t end with what Windows Server 2008 provides to SQL Server 2008 The SQL Server Installation Center offers access to a few wizards to make it really easy for administrators to set up and maintain a clustered configuration
In this example, we are installing a new instance of SQL Server 2008 on a server that already has SQL Server 2005 installed This is what is known as a side-by-side configuration When we choose New Installation from the SQL Server Installation Center screen, the New Installation Wizard starts This wizard will immedately perform a system configuration check, as shown in Figure 2-8
Figure 2-8. System Configuration Check step for a new installation
If you fail the system configuration check, you won’t be able to continue installation unless you address the issue SQL Server is fairly strict on the requirements for service packs For example, if you are using Windows Server 2003, you must have at least Service Pack 2 installed
Once you have passed the checks, you are ready to select which components to install, as shown
in Figure 2-9 The setup program allows for a variety of configurations You can use it to install just the client tools, SQL Server Books Online, or every feature, as shown in Figure 2-9 Once you have made your selections, the wizard will dynamically add steps as needed
In our example, we are installing SQL Server 2008 side-by-side with SQL Server 2005 You can see the existing SQL Server instance that is already installed on this server, as shown in Figure 2-10 From this page, you can set the instance name, ID, and root directory for the new SQL Server 2008 instance